toilscript 0.1.54 → 0.1.55
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/cli.js +3 -3
- package/dist/cli.js.map +1 -1
- package/dist/importmap.json +2 -2
- package/dist/toilscript.js +6 -3
- package/dist/toilscript.js.map +2 -2
- package/dist/web.js +3 -3
- package/package.json +1 -1
- package/std/assembly/toildb.ts +2 -2
- package/std/assembly/toilscript.d.ts +1 -1
package/dist/importmap.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"imports": {
|
|
3
|
-
"toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.
|
|
4
|
-
"toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.
|
|
3
|
+
"toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.55/dist/toilscript.js",
|
|
4
|
+
"toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.55/dist/cli.js",
|
|
5
5
|
"binaryen": "https://cdn.jsdelivr.net/npm/binaryen@130.0.0-nightly.20260609/index.js",
|
|
6
6
|
"long": "https://cdn.jsdelivr.net/npm/long@5.3.2/index.js"
|
|
7
7
|
}
|
package/dist/toilscript.js
CHANGED
|
@@ -487,7 +487,8 @@ declare interface __Record`),n.push(e.id.toString()),n.push(`<TOmittable> {
|
|
|
487
487
|
`}return e+=` };
|
|
488
488
|
`,e+=`}
|
|
489
489
|
`,e}function uR(r){let i=`// ---- @user session client (reads the readable companion cookie) ----
|
|
490
|
-
`;return i+=`const __TOIL_USER_COOKIE = "__Secure-toil_user";
|
|
490
|
+
`;return i+=`const __TOIL_USER_COOKIE = "__Secure-toil_user"; // HTTPS (prod)
|
|
491
|
+
`,i+=`const __TOIL_USER_COOKIE_HTTP = "toil_user"; // plain HTTP (dev): no __Secure- prefix
|
|
491
492
|
|
|
492
493
|
`,i+=`function __toilReadCookie(name: string): string | null {
|
|
493
494
|
`,i+=` if (typeof document === "undefined" || !document.cookie) return null;
|
|
@@ -511,10 +512,12 @@ declare interface __Record`),n.push(e.id.toString()),n.push(`<TOmittable> {
|
|
|
511
512
|
`,i+=`}
|
|
512
513
|
|
|
513
514
|
`,i+=`/**
|
|
514
|
-
`,i+=" * The signed-in user, decoded from the readable `
|
|
515
|
+
`,i+=" * The signed-in user, decoded from the readable `toil_user` companion cookie the\n",i+=" * server set at login (prefixed `__Secure-toil_user` over HTTPS), or `null`. Reads\n",i+=" * both names so a dev (http) session resolves. Auto-typed to your `@user` class\n",i+=" * (`"+r+"`) with no type argument. DISPLAY-ONLY: the server re-verifies\n",i+=" * the HttpOnly signed session on every `@auth` request; never trust this for\n",i+=` * authorization (a client can forge it, fooling only its own UI).
|
|
515
516
|
`,i+=` */
|
|
516
517
|
`,i+="export function getUser(): "+r+` | null {
|
|
517
|
-
`,i+=`
|
|
518
|
+
`,i+=` // Prefixed name (HTTPS/prod) first, then the bare name (plain HTTP/dev). A
|
|
519
|
+
`,i+=` // __Secure- cookie is never sent over http, so this resolves correctly on both.
|
|
520
|
+
`,i+=` const raw = __toilReadCookie(__TOIL_USER_COOKIE) ?? __toilReadCookie(__TOIL_USER_COOKIE_HTTP);
|
|
518
521
|
`,i+=` if (raw === null) return null;
|
|
519
522
|
`,i+=` const bytes = __toilB64UrlDecode(raw);
|
|
520
523
|
`,i+=` if (bytes === null) return null;
|