Download launcher script.
This commit is contained in:
parent
7f97085d10
commit
3e509fdf40
2 changed files with 69 additions and 7 deletions
73
index.html
73
index.html
|
|
@ -3,7 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>KBTD</title>
|
<title>Kanban TODO</title>
|
||||||
<style>
|
<style>
|
||||||
:root {
|
:root {
|
||||||
--fg: #ffe;
|
--fg: #ffe;
|
||||||
|
|
@ -82,7 +82,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 { font-size: 2em; }
|
h1 { font-size: 2em; }
|
||||||
h2 { font-size: 1.5em; }
|
h2 { font-size: 1.5em; margin-bottom: 0.5em; }
|
||||||
h3 { font-size: 1.17em; }
|
h3 { font-size: 1.17em; }
|
||||||
h1, h2, h3 { margin-top: 0; }
|
h1, h2, h3 { margin-top: 0; }
|
||||||
|
|
||||||
|
|
@ -397,23 +397,40 @@
|
||||||
p {
|
p {
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
background: transparent;
|
||||||
|
border: .1rem solid var(--shade);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
padding: 1em;
|
||||||
|
margin: 0.5em 0 1em 0;
|
||||||
|
overflow-x: auto;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre a {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<!-- Landing Screen -->
|
<!-- Landing Screen -->
|
||||||
<div id="landing-screen" class="screen center-content">
|
<div id="landing-screen" class="screen center-content">
|
||||||
<h1>KBTD</h1>
|
<h1>Kanban TODO</h1>
|
||||||
<p>Kanban TODO - Markdown based task management</p>
|
<p>Markdown based task management</p>
|
||||||
<p>To get started, open a Markdown file containing your tasks.</p>
|
<p>To get started, open a Markdown file containing your tasks.</p>
|
||||||
<button id="open-file-btn">Open TODO.md</button>
|
<button id="open-file-btn">Open TODO.md</button>
|
||||||
|
<h2>Install</h2>
|
||||||
|
<pre id="launcher-instructions-landing" style="display:none">kbtd # <- right click and save as
|
||||||
|
chmod 755 kbtd</pre>
|
||||||
<div id="landing-error" class="error" style="display:none"></div>
|
<div id="landing-error" class="error" style="display:none"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Permission Screen -->
|
<!-- Permission Screen -->
|
||||||
<div id="permission-screen" class="screen center-content">
|
<div id="permission-screen" class="screen center-content">
|
||||||
<h1>Permission Required</h1>
|
<h1>Permission Required</h1>
|
||||||
<p>KBTD needs permission to view and edit your file.</p>
|
<p>Kanban TODO needs permission to view and edit your file.</p>
|
||||||
<button id="grant-permission-btn">Grant Access</button>
|
<button id="grant-permission-btn">Grant Access</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -426,6 +443,9 @@
|
||||||
<button id="create-project-btn">Create</button>
|
<button id="create-project-btn">Create</button>
|
||||||
</div>
|
</div>
|
||||||
<button id="change-file-btn" style="margin-top: 1em">Change File</button>
|
<button id="change-file-btn" style="margin-top: 1em">Change File</button>
|
||||||
|
<h2>Install</h2>
|
||||||
|
<pre id="launcher-instructions-section" style="display:none">kbtd # <- right click and save as
|
||||||
|
chmod 755 kbtd</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Board Screen -->
|
<!-- Board Screen -->
|
||||||
|
|
@ -461,6 +481,8 @@
|
||||||
currentDropTarget: null
|
currentDropTarget: null
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let launcherScriptBlob = null;
|
||||||
|
|
||||||
// --- IndexedDB Helper ---
|
// --- IndexedDB Helper ---
|
||||||
const dbPromise = new Promise((resolve, reject) => {
|
const dbPromise = new Promise((resolve, reject) => {
|
||||||
const request = indexedDB.open(DB_NAME, DB_VERSION);
|
const request = indexedDB.open(DB_NAME, DB_VERSION);
|
||||||
|
|
@ -496,6 +518,45 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- Launcher Script Loading ---
|
||||||
|
async function loadLauncherScript() {
|
||||||
|
try {
|
||||||
|
console.log('Loading launcher script...');
|
||||||
|
const response = await fetch('kbtd');
|
||||||
|
if (!response.ok) {
|
||||||
|
console.error('Failed to load launcher script:', response.status);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let scriptContent = await response.text();
|
||||||
|
console.log('Launcher script loaded, modifying URL...');
|
||||||
|
|
||||||
|
const currentUrl = window.location.href.split('?')[0];
|
||||||
|
scriptContent = scriptContent.replace(
|
||||||
|
/BASE_URL="\$\{KBTD_URL:-http:\/\/localhost:8000\}"/,
|
||||||
|
`BASE_URL="\${KBTD_URL:-${currentUrl}}"`
|
||||||
|
);
|
||||||
|
|
||||||
|
launcherScriptBlob = new Blob([scriptContent], { type: 'application/x-sh' });
|
||||||
|
const blobUrl = URL.createObjectURL(launcherScriptBlob);
|
||||||
|
|
||||||
|
const landingInstructions = document.getElementById('launcher-instructions-landing');
|
||||||
|
const sectionInstructions = document.getElementById('launcher-instructions-section');
|
||||||
|
|
||||||
|
landingInstructions.innerHTML = `<a href="${blobUrl}" download="kbtd">kbtd</a> # <- right click and save as
|
||||||
|
chmod 755 kbtd`;
|
||||||
|
landingInstructions.style.display = 'block';
|
||||||
|
|
||||||
|
sectionInstructions.innerHTML = `<a href="${blobUrl}" download="kbtd">kbtd</a> # <- right click and save as
|
||||||
|
chmod 755 kbtd`;
|
||||||
|
sectionInstructions.style.display = 'block';
|
||||||
|
|
||||||
|
console.log('Launcher script ready for download');
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error loading launcher script:', err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// --- Markdown Parsing ---
|
// --- Markdown Parsing ---
|
||||||
|
|
||||||
function parseMarkdown(text) {
|
function parseMarkdown(text) {
|
||||||
|
|
@ -1293,6 +1354,8 @@
|
||||||
// --- Initialization & Polling ---
|
// --- Initialization & Polling ---
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
|
loadLauncherScript();
|
||||||
|
|
||||||
const params = new URLSearchParams(window.location.search);
|
const params = new URLSearchParams(window.location.search);
|
||||||
state.filePath = params.get('file');
|
state.filePath = params.get('file');
|
||||||
|
|
||||||
|
|
|
||||||
3
kbtd
3
kbtd
|
|
@ -1,7 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# KBTD Launcher
|
# kanban-todo launcher
|
||||||
# See SPEC.md for details
|
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue