claude-code-kanban 4.21.0 → 4.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/file-url.js +38 -0
- package/package.json +1 -1
- package/public/app.js +991 -137
- package/public/style.css +470 -94
- package/server.js +202 -85
package/lib/file-url.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Some tools hand out a `file://` URL where a path is expected — Explorer's
|
|
4
|
+
// "copy as path" on a network share, a PDF viewer's location bar, a chat client
|
|
5
|
+
// that linkifies attachments. Windows apps also emit the non-standard backslash
|
|
6
|
+
// spelling `file:\\\C:\dir\a.md`. Both are normalized to a plain OS path so the
|
|
7
|
+
// user does not have to hand-edit what their clipboard produced.
|
|
8
|
+
|
|
9
|
+
const { fileURLToPath } = require('url');
|
|
10
|
+
|
|
11
|
+
// Matches any number of leading slashes before a drive letter, so it re-spells both
|
|
12
|
+
// the well-formed `file:///C:/dir` and `file://C:/dir`, where the parser reads C: as
|
|
13
|
+
// a host and rejects the URL outright. Anything else — POSIX paths, UNC shares — is
|
|
14
|
+
// left for the parser.
|
|
15
|
+
const DRIVE_URL = /^file:\/*([a-zA-Z]:.*)$/;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Convert a `file://` URL to an OS path. Any other string is returned unchanged,
|
|
19
|
+
* as is a URL too malformed to parse — the caller reports "not found" on the
|
|
20
|
+
* literal text, which is more useful than a parser error.
|
|
21
|
+
* @param {string} value
|
|
22
|
+
*/
|
|
23
|
+
function fileUrlToPath(value) {
|
|
24
|
+
if (typeof value !== 'string' || !/^file:/i.test(value)) return value;
|
|
25
|
+
// Backslashes are not legal in a URL, so this cannot corrupt a well-formed one.
|
|
26
|
+
let url = value.replace(/\\/g, '/');
|
|
27
|
+
// A scheme with no path body: POSIX Node resolves it to "/" rather than throwing.
|
|
28
|
+
if (/^file:\/*$/i.test(url)) return value;
|
|
29
|
+
const drive = DRIVE_URL.exec(url);
|
|
30
|
+
if (drive) url = `file:///${drive[1]}`;
|
|
31
|
+
try {
|
|
32
|
+
return fileURLToPath(url);
|
|
33
|
+
} catch {
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
module.exports = { fileUrlToPath };
|