@mutmutco/installer-gate 0.1.1 → 0.1.2
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/dist/index.js +19 -0
- package/dist/types.d.ts +5 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -377,6 +377,11 @@ function createGateHandler(config) {
|
|
|
377
377
|
await refresh(req, res);
|
|
378
378
|
return;
|
|
379
379
|
}
|
|
380
|
+
if (pathname === "/release/version") {
|
|
381
|
+
requireMethod(method, "GET");
|
|
382
|
+
await releaseVersion(res);
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
380
385
|
if (pathname === "/release/manifest") {
|
|
381
386
|
requireMethod(method, "GET");
|
|
382
387
|
await releaseManifest(req, res);
|
|
@@ -492,6 +497,20 @@ function createGateHandler(config) {
|
|
|
492
497
|
}
|
|
493
498
|
return identity;
|
|
494
499
|
}
|
|
500
|
+
async function releaseVersion(res) {
|
|
501
|
+
const read = config.release.currentVersion;
|
|
502
|
+
if (!read) {
|
|
503
|
+
sendJson(res, 404, { error: "not_found" });
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
let version;
|
|
507
|
+
try {
|
|
508
|
+
version = await read();
|
|
509
|
+
} catch {
|
|
510
|
+
throw new GateHttpError(500, "internal_error");
|
|
511
|
+
}
|
|
512
|
+
sendJson(res, 200, { version });
|
|
513
|
+
}
|
|
495
514
|
async function releaseManifest(req, res) {
|
|
496
515
|
if (await authenticate(req, res) === null) return;
|
|
497
516
|
let input;
|
package/dist/types.d.ts
CHANGED
|
@@ -36,6 +36,11 @@ export interface ReleaseConfig {
|
|
|
36
36
|
sign: (canonicalBytes: Buffer) => Buffer;
|
|
37
37
|
/** Reads one release file by manifest-relative path. Throws when absent. */
|
|
38
38
|
readFile: (path: string) => Promise<Buffer>;
|
|
39
|
+
/** #6864: the current release version ALONE, read straight from the pointer — no file hashing.
|
|
40
|
+
* Backs the unauthenticated `GET /release/version` probe, so it must stay cheap: `manifest()`
|
|
41
|
+
* re-hashes every payload file on each call and must never sit behind a public route. Optional:
|
|
42
|
+
* a store that does not provide it simply has no version probe (the route answers 404). */
|
|
43
|
+
currentVersion?: () => Promise<string>;
|
|
39
44
|
}
|
|
40
45
|
interface GateConfigBase {
|
|
41
46
|
allowlist: AllowlistConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mutmutco/installer-gate",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Installer gate server library — GitHub device flow, allowlists, and signed release manifests. Mounted by a product's own server.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|