diff --git a/index.html b/index.html index 8df2884..2dfc880 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ - KBTD + Kanban TODO
-

KBTD

-

Kanban TODO - Markdown based task management

+

Kanban TODO

+

Markdown based task management

To get started, open a Markdown file containing your tasks.

+

Install

+

Permission Required

-

KBTD needs permission to view and edit your file.

+

Kanban TODO needs permission to view and edit your file.

@@ -426,6 +443,9 @@
+

Install

+ @@ -461,6 +481,8 @@ currentDropTarget: null }; + let launcherScriptBlob = null; + // --- IndexedDB Helper --- const dbPromise = new Promise((resolve, reject) => { 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 = `kbtd # <- right click and save as +chmod 755 kbtd`; + landingInstructions.style.display = 'block'; + + sectionInstructions.innerHTML = `kbtd # <- 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 --- function parseMarkdown(text) { @@ -1293,6 +1354,8 @@ // --- Initialization & Polling --- async function init() { + loadLauncherScript(); + const params = new URLSearchParams(window.location.search); state.filePath = params.get('file'); diff --git a/kbtd b/kbtd index 9c43f15..e24d247 100755 --- a/kbtd +++ b/kbtd @@ -1,7 +1,6 @@ #!/bin/bash -# KBTD Launcher -# See SPEC.md for details +# kanban-todo launcher set -e