@homie-rocks/studio 0.51.1 → 0.51.3
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/CHANGELOG.md +45 -0
- package/README.md +15 -4
- package/app-starters/gathering/app.json +2 -44
- package/app-starters/gathering/index.html +1 -1
- package/app-starters/gathering/src/view.ts +6 -19
- package/apps/APPS.md +55 -1
- package/bin/homie-studio.mjs +12 -8
- package/guides/app/SKILL.md +22 -2
- package/guides/office/SKILL.md +9 -0
- package/guides/shop/SKILL.md +8 -0
- package/guides/studio-setup/SKILL.md +9 -1
- package/lib/app-needs.mjs +17 -2
- package/lib/app-preset-history.json +840 -0
- package/lib/app-ready.mjs +1 -0
- package/lib/art-cli.mjs +2 -2
- package/lib/art-tools.mjs +2 -2
- package/lib/build.mjs +4 -2
- package/lib/check.mjs +2 -0
- package/lib/cloudflare.mjs +19 -10
- package/lib/decisions.mjs +9 -5
- package/lib/dev.mjs +4 -1
- package/lib/directory.mjs +22 -5
- package/lib/giving-preset.mjs +9 -0
- package/lib/mcp-tools.mjs +1 -1
- package/lib/office.mjs +2 -1
- package/lib/scaffold.mjs +7 -4
- package/lib/shop-links.mjs +4 -2
- package/lib/shop-local.mjs +31 -0
- package/lib/shop.mjs +2 -1
- package/lib/style-presets.mjs +1 -0
- package/lib/template-history.json +92 -2
- package/lib/upgrade-app-presets.mjs +49 -0
- package/lib/upgrade.mjs +2 -1
- package/mcp/ui/build.js +3 -2
- package/package.json +1 -1
- package/shop/SHOP.md +6 -0
- package/site/SITE.md +13 -0
- package/tools/TOOLS.md +9 -0
- package/worker/app-records.mjs +3 -3
- package/worker/arrival.mjs +7 -5
- package/worker/build-id.mjs +1 -1
- package/worker/directory-choice.mjs +9 -0
- package/worker/index.mjs +25 -9
- package/worker/mcp.mjs +2 -2
- package/worker/pages.mjs +12 -5
- package/worker/records-page.mjs +1 -1
- package/worker/shop-page.mjs +2 -2
- package/worker/shop-subscriptions.mjs +42 -0
- package/worker/signin-target.mjs +8 -0
- package/worker/site.mjs +11 -7
- package/worker/stats-page.mjs +6 -3
- package/worker/version.mjs +1 -1
package/worker/stats-page.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { signinTarget } from './signin-target.mjs';
|
|
1
2
|
/**
|
|
2
3
|
* The studio owner's private stats page (/_studio/stats) and its one-time sign-in (/_studio/signin).
|
|
3
4
|
*
|
|
@@ -14,8 +15,8 @@ import { CODEX_SCRIPT } from './codex-script.mjs';
|
|
|
14
15
|
* Where a sign-in may send the owner next: the stats, one game's codex, the back office, an ask waiting for the
|
|
15
16
|
* owner's tap, or one of the studio's games (a private game's own secret road for the owner's phone).
|
|
16
17
|
*/
|
|
17
|
-
const
|
|
18
|
-
const
|
|
18
|
+
const nextOf = (url) => signinTarget(url.searchParams.get('to'));
|
|
19
|
+
const SIGNIN_SCRIPT = "document.querySelector('form').requestSubmit();";
|
|
19
20
|
const signinWord = (to) => (to.startsWith('/_studio/codex/') ? 'Open the codex' : to === '/_studio/office' ? 'Open the office' : to.startsWith('/_studio/confirm/') ? 'Sign in and see what your AI asks' : to.startsWith('/_studio/stats') ? 'Open the stats' : 'Sign in and play');
|
|
20
21
|
let scriptHash = null;
|
|
21
22
|
async function codexScriptHash() {
|
|
@@ -135,9 +136,11 @@ export async function ownerRoutes(request, env, url, { catalogueOf }) {
|
|
|
135
136
|
const key = url.searchParams.get('k') ?? '';
|
|
136
137
|
if (request.method === 'GET') {
|
|
137
138
|
// A GET spends nothing: a chat app's link preview must not use up the owner's one-time link.
|
|
139
|
+
const bytes = new Uint8Array(await crypto.subtle.digest('SHA-256', new TextEncoder().encode(SIGNIN_SCRIPT)));
|
|
140
|
+
const hash = btoa(String.fromCharCode(...bytes));
|
|
138
141
|
return page('Sign in · stats', `<h1>${esc(cat.studio?.name ?? 'Studio')} stats</h1>
|
|
139
142
|
<p class="dim">Sign this browser in as the studio's owner: the private stats and office, and the owner's tools in your own games. The link works once.</p>
|
|
140
|
-
<form method="post" action="/_studio/signin?k=${esc(encodeURIComponent(key))}${nextOf(url) !== '/_studio/stats' ? `&to=${esc(encodeURIComponent(nextOf(url)))}` : ''}"><button type="submit">${signinWord(nextOf(url))}</button></form
|
|
143
|
+
<form method="post" action="/_studio/signin?k=${esc(encodeURIComponent(key))}${nextOf(url) !== '/_studio/stats' ? `&to=${esc(encodeURIComponent(nextOf(url)))}` : ''}"><button type="submit">${signinWord(nextOf(url))}</button></form><script>${SIGNIN_SCRIPT}</script>`, 200, { 'content-security-policy': PRIVATE_HEADERS['content-security-policy'].replace("default-src 'none';", `default-src 'none'; script-src 'sha256-${hash}';`) });
|
|
141
144
|
}
|
|
142
145
|
if (request.method !== 'POST' || !sameOrigin(request, url)) return page('Not allowed', '<h1>Not allowed</h1>', 403);
|
|
143
146
|
const session = await spendSignin(env, key);
|
package/worker/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** The @homie-rocks/studio version this Worker code is (package.json's; a test keeps them equal). Cache-busts /_homie/site.js. */
|
|
2
|
-
export const STUDIO_VERSION_TAG = '0.51.
|
|
2
|
+
export const STUDIO_VERSION_TAG = '0.51.3';
|