{"draft":null,"from":35,"to":318,"files":[{"path":"client/src/core.ts","added":36,"removed":10,"diff":"--- a/client/src/core.ts\n+++ b/client/src/core.ts\n@@ -24,9 +24,9 @@\n export const LOCK_FILE = \"lock\";\n /**\n  * A lock not renewed for this long was left behind, even if its process id\n- * now belongs to another process (AVCS - Git Lessons). A holder renews it\n+ * now belongs to another process. A holder renews it\n  * every 20 seconds, so a long record or sync is never taken over while it\n- * writes (AVCS - Security); a lock whose process is gone is taken over by\n+ * writes; a lock whose process is gone is taken over by\n  * the next command at once.\n  */\n export const LOCK_STALE_MS = 2 * 60_000;\n@@ -48,7 +48,7 @@\n \t}\n }\n \n-/** The Windows short names of the ALWAYS_SKIPPED folders: on NTFS, CLAUDE~1 is .claude (AVCS - Git Lessons). */\n+/** The Windows short names of the ALWAYS_SKIPPED folders: on NTFS, CLAUDE~1 is .claude. */\n const SKIPPED_SHORT = /^(git|abso|avcs|claude|node_m)~[0-9]+$/i;\n \n /**\n@@ -69,7 +69,7 @@\n }\n \n /**\n- * The key a path part is compared with ALWAYS_SKIPPED by (AVCS - Security):\n+ * The key a path part is compared with ALWAYS_SKIPPED by:\n  * pathKey, after taking out what HFS+ leaves out. It folds .avc\\u017F (long s) to .avcs and\n  * .g\\u0131t (dotless i) to .git, as a case-insensitive disk may.\n  */\n@@ -107,6 +107,22 @@\n }\n \n /**\n+ * A server's base: its origin and any path, without a trailing slash (https://x.example/issues), or undefined\n+ * for anything else, a query, a fragment or a user name included. Plain string work, as serverOrigin.\n+ */\n+export function serverBase(s: string): string | undefined {\n+\tconst m = /^(https?):\\/\\/([^/?#\\\\]+)((?:\\/[^?#\\\\]*)?)$/i.exec(s.trim());\n+\tif (!m || m[2]!.includes(\"@\")) return undefined;\n+\treturn `${m[1]!.toLowerCase()}://${m[2]!.toLowerCase()}${m[3]!.replace(/\\/+$/, \"\")}`;\n+}\n+\n+/** The origin of a server given with or without a path (serverBase), or undefined. */\n+export function baseOrigin(s: string): string | undefined {\n+\tconst base = serverBase(s);\n+\treturn base === undefined ? undefined : serverOrigin(base.replace(/^(https?:\\/\\/[^/]+).*$/i, \"$1\"));\n+}\n+\n+/**\n  * This machine's servers, from ~/.abso/servers.json:\n  * {\"servers\": {\"<server>\": {\"issues\": \"<its Issues Worker>\"}}}. Each server\n  * named there, and each Issues Worker it names, may receive the token, and a\n@@ -130,10 +146,10 @@\n \t\t\t\tif (o === undefined) continue;\n \t\t\t\ttrusted.push(o);\n \t\t\t\tconst i = (about as { issues?: unknown } | null)?.issues;\n-\t\t\t\tconst io = typeof i === \"string\" ? serverOrigin(i) : undefined;\n+\t\t\t\tconst io = typeof i === \"string\" ? serverBase(i) : undefined;\n \t\t\t\tif (io !== undefined) {\n \t\t\t\t\tissues[o] = io;\n-\t\t\t\t\ttrusted.push(io);\n+\t\t\t\t\ttrusted.push(baseOrigin(io)!);\n \t\t\t\t}\n \t\t\t}\n \t} catch {}\n@@ -146,14 +162,24 @@\n }\n \n /**\n- * The Issues Worker beside an avcs server (#54): this machine's servers.json\n- * first, then abso's own. ABSO_ISSUES_SERVER overrides both (issues.ts).\n+ * The Issues Worker beside an avcs server: this machine's servers.json\n+ * first, then abso's own, else the server's own /issues, where the open\n+ * server keeps them. ABSO_ISSUES_SERVER overrides all three (issues.ts).\n  */\n export function issuesServerFor(server: string, machine?: MachineServers): string | undefined {\n \tconst o = serverOrigin(server);\n-\treturn o === undefined ? undefined : (machine?.issues[o] ?? ISSUES_SERVERS[o]);\n+\treturn o === undefined ? undefined : (machine?.issues[o] ?? ISSUES_SERVERS[o] ?? `${o}/issues`);\n }\n \n+/**\n+ * Whether the token may go to an Issues Worker: as to its origin (tokenGoesTo), since it may sit at a path on\n+ * its server, as the open server's do at <server>/issues. A query, a fragment or a user name is refused.\n+ */\n+export function tokenGoesToIssues(server: string, trusted?: string): boolean {\n+\tconst o = baseOrigin(server);\n+\treturn o !== undefined && tokenGoesTo(o, trusted);\n+}\n+\n /** Whether the token may go to `server`: TOKEN_SERVERS, `trusted` (trustedList), or this machine. Plain string work: the mod has no URL. */\n export function tokenGoesTo(server: string, trusted?: string): boolean {\n \tconst origin = serverOrigin;\n@@ -161,7 +187,7 @@\n \tif (o === undefined) return false;\n \tconst host = o.replace(/^https?:\\/\\//, \"\").replace(/:\\d+$/, \"\");\n \tif (host === \"localhost\" || host === \"127.0.0.1\" || host === \"[::1]\") return true;\n-\t// Off this machine only https: a token over plain http goes in clear text (Security, 608).\n+\t// Off this machine only https: a token over plain http goes in clear text.\n \tif (!o.startsWith(\"https://\")) return false;\n \treturn [...TOKEN_SERVERS, ...(trusted ?? \"\").split(\",\")].some((t) => t.trim() !== \"\" && origin(t) === o);\n }"}],"unmatched":[]}