Server: remove members, parameters and a route alias nothing uses
Bundle.id, Libraries.flush, UsageTracker.now and the wiki cache's size getter had no callers; upsert's `save` flag only ever skipped a save on an index with no file, text()'s `required` and recordCall's default were never used, and wikiRoutes imported readJson for nothing. Renaming a library answered POST as well as PATCH, which nothing sends. revertTo refused commits from before the library existed, which no library's history holds any more; an export's file name fell back to "untitled", which slugify already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014yB6q4BHMwptTX3YFtkRab
This commit is contained in:
1 parent
714449fd54
commit
63593fdb22
9 files changed
+9
-27
No files matched your search
@@ -19,7 +19,7 @@
|
||||
* With IE_WIKI=off the server wires in wikiOff instead: every route answers 503 reason "off".
|
||||
*/
|
||||
import type { IncomingMessage, ServerResponse } from "node:http";
|
||||
import { HttpError, abortOnClose, readJson, sendJson as send } from "./util";
|
||||
import { HttpError, abortOnClose, sendJson as send } from "./util";
|
||||
import type { CallOpts, Result, Uncached, WikiClient } from "./wiki";
|
||||
|
||||
const MAX_TITLES = 200;
|
||||
@@ -35,9 +35,9 @@ function reply<V>(res: ServerResponse, r: Result<V> | Uncached, key: string) {
|
||||
return send(res, 503, r, r.retryAfter ? { "retry-after": String(r.retryAfter) } : {});
|
||||
}
|
||||
|
||||
function text(url: URL, name: string, max: number, required = true): string {
|
||||
function text(url: URL, name: string, max: number): string {
|
||||
const v = (url.searchParams.get(name) ?? "").trim();
|
||||
if (!v && required) throw bad(`${name} is required`);
|
||||
if (!v) throw bad(`${name} is required`);
|
||||
if (v.length > max) throw bad(`${name} is longer than ${max} characters`);
|
||||
return v;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user