Public: anyone can read this; the crew can change it.
The in-place form list shrinks: the first twelve entries of test/in-place-offenders.json submit in place and leave the list #18530
Merged 2h 23m ago, live in production
scout/forge:scout/18523-the-in-place-form-list-shrinks-the-first → main 0 commits fork
57 files
changed +443
−148
- docs/design/size-budget/board.json
- docs/design/size-budget/changelog.json
- docs/design/size-budget/claim.json
- docs/design/size-budget/explore.json
- docs/design/size-budget/feed.json
- docs/design/size-budget/fleet.json
- docs/design/size-budget/forges-new.json
- docs/design/size-budget/home.json
- docs/design/size-budget/maintenance.json
- docs/design/size-budget/map.json
- docs/design/size-budget/owner-name-next.json
- docs/design/size-budget/owner-name-pulls-number.json
- docs/design/size-budget/owner-name-space.json
- docs/design/size-budget/owner-name.json
- docs/design/size-budget/pricing.json
- docs/design/size-budget/system.json
- docs/design/size-budget/talk.json
- docs/design/size-budget/templates.json
- src/http/games_routes.ts
- src/http/lazy_lists.ts
- src/http/marks/settings.json
- src/http/routes/operations.ts
- src/http/routes/repo_settings.ts
- src/http/settings_routes.ts
- src/web/blocked.ts
- src/web/chrome.ts
- src/web/client.ts
- src/web/fleet-act.ts
- src/web/flow_button.ts
- src/web/games_machine.ts
- src/web/in_place.ts
- src/web/layout.ts
- src/web/origin_connection.ts
- src/web/own_token.ts
- src/web/pages/fleet-ops.ts
- src/web/pages/fleet.ts
- src/web/pages/origin-reach.ts
- src/web/pages/origins.ts
- src/web/pages/settings.ts
- src/web/pages/site.ts
- src/web/pages/talk.ts
- src/web/studio/ask_admin.ts
- src/web/studio/crew.ts
- src/web/studio/run.ts
- test/cookie-flags.test.ts
- test/cookie-floor.test.ts
- test/description-clamp.test.ts
- test/design-audit.test.ts
- test/game-machine.test.ts
- test/in-place-fragments.test.ts
- test/in-place-offenders.json
- test/no-polling.test.ts
- test/origins-page-shape.test.ts
- test/own-token.test.ts
- test/pages-budget.test.ts
- test/security-floor-routes.test.ts
- test/server-timing-sweep.test.ts
docs/design/size-budget/board.json +1 −1
docs/design/size-budget/changelog.json +1 −1
docs/design/size-budget/claim.json +1 −1
docs/design/size-budget/explore.json +1 −1
docs/design/size-budget/feed.json +1 −1
docs/design/size-budget/fleet.json +1 −1
docs/design/size-budget/forges-new.json +1 −1
docs/design/size-budget/home.json +1 −1
docs/design/size-budget/maintenance.json +1 −1
docs/design/size-budget/map.json +1 −1
docs/design/size-budget/owner-name-next.json +1 −1
docs/design/size-budget/owner-name-pulls-number.json +1 −1
docs/design/size-budget/owner-name-space.json +1 −1
docs/design/size-budget/owner-name.json +1 −1
docs/design/size-budget/pricing.json +1 −1
docs/design/size-budget/system.json +1 −1
docs/design/size-budget/talk.json +1 −1
docs/design/size-budget/templates.json +1 −1
src/http/games_routes.ts +2 −1
| @@ -34,7 +34,7 @@ import { gameSparkView } from "../web/pages/games_spark_view.ts"; | ||
| 34 | 34 | import { gameSparkLink, gameSparkOpen, gameSparkPost, gameSparkRead } from "../web/pages/games_spark.ts"; |
| 35 | 35 | import { gameConfigCommit, gameConfigPage, gameConfigPreview } from "../web/pages/games_config.ts"; |
| 36 | 36 | import { gameDoorOptions, gameDoorSubmit } from "../web/pages/games_door.ts"; |
| 37 | import { gameCycleSubmit, gameLiveStream } from "../web/games_machine.ts"; | |
| 37 | import { gameCycleFragment, gameCycleSubmit, gameLiveStream } from "../web/games_machine.ts"; | |
| 38 | 38 | import { publicOrigin } from "../core/public_origin.ts"; |
| 39 | 39 | import type { Ctx, Handler } from "./context.ts"; |
| 40 | 40 | import { InvalidJson } from "./json_body.ts"; |
| @@ -200,6 +200,7 @@ export function gamesRoutes(router: Router<Handler>): void { | ||
| 200 | 200 | router.add("GET", "/games/:box/@shell/stream", gameShellStream); |
| 201 | 201 | router.add("GET", "/games/:box/@live", gameLiveStream); |
| 202 | 202 | router.add("POST", "/games/:box/@cycle", gameCycleSubmit); |
| 203 | router.add("GET", "/games/:box/@cycle", gameCycleFragment); | |
| 203 | 204 | router.add("POST", "/games/:box/@spark", gameSparkLink); |
| 204 | 205 | router.add("GET", "/games/:box/@spark/:key", gameSparkOpen); |
| 205 | 206 | router.add("GET", "/games/:box/spark/:key", gameSparkView); |
src/http/lazy_lists.ts +5
| @@ -234,6 +234,7 @@ export const SETTINGS_ROUTES = [ | ||
| 234 | 234 | ["POST", "/settings/origins/token"], |
| 235 | 235 | ["POST", "/settings/origins/oauth"], |
| 236 | 236 | ["POST", "/settings/origins/reach"], |
| 237 | ["GET", "/settings/origins/reach"], | |
| 237 | 238 | ["POST", "/settings/origins/reach/dismiss"], |
| 238 | 239 | ["POST", "/settings/origins/apps"], |
| 239 | 240 | ["POST", "/settings/origins/trusted-hosts"], |
| @@ -250,6 +251,7 @@ export const SETTINGS_ROUTES = [ | ||
| 250 | 251 | ["POST", "/settings/origins/:id/check"], |
| 251 | 252 | ["POST", "/settings/origins/:id/delete"], |
| 252 | 253 | ["POST", "/settings/origins/:id/token"], |
| 254 | ["GET", "/settings/origins/:id/connection"], | |
| 253 | 255 | ["GET", "/settings/keys"], |
| 254 | 256 | ["POST", "/settings/keys"], |
| 255 | 257 | ["POST", "/settings/keys/:id/delete"], |
| @@ -676,6 +678,7 @@ export const OPERATIONS_ROUTES = [ | ||
| 676 | 678 | ["GET", "/games/:box/@shell/stream"], |
| 677 | 679 | ["GET", "/games/:box/@live"], |
| 678 | 680 | ["POST", "/games/:box/@cycle"], |
| 681 | ["GET", "/games/:box/@cycle"], | |
| 679 | 682 | ["POST", "/games/:box/@spark"], |
| 680 | 683 | ["GET", "/games/:box/@spark/:key"], |
| 681 | 684 | ["GET", "/games/:box/spark/:key"], |
| @@ -722,6 +725,7 @@ export const OPERATIONS_ROUTES = [ | ||
| 722 | 725 | ["GET", "/resilience/nightly/:job"], |
| 723 | 726 | ["GET", "/fleet"], |
| 724 | 727 | ["POST", "/fleet"], |
| 728 | ["GET", "/fleet/result"], | |
| 725 | 729 | ["GET", "/fleet/ops/:id"], |
| 726 | 730 | ["POST", "/fleet/ops/:id/undo"], |
| 727 | 731 | ["GET", "/forks/flows"], |
| @@ -1104,6 +1108,7 @@ export const REPO_SETTINGS_ROUTES = [ | ||
| 1104 | 1108 | ["POST", "/:owner/:name/wallet"], |
| 1105 | 1109 | ["GET", "/:owner/:name/settings/crew"], |
| 1106 | 1110 | ["GET", "/:owner/:name/settings/crew/seat/:role"], |
| 1111 | ["GET", "/:owner/:name/settings/crew/line"], | |
| 1107 | 1112 | ["POST", "/:owner/:name/settings/crew"], |
| 1108 | 1113 | ["POST", "/:owner/:name/settings/crew/subscriptions"], |
| 1109 | 1114 | ["POST", "/:owner/:name/settings/crew/:username/remove"], |
src/http/marks/settings.json +1
src/http/routes/operations.ts +2 −1
| @@ -13,7 +13,7 @@ import { brokerStart } from "../../spawn/origin_broker.ts"; | ||
| 13 | 13 | import { clientCloudAttach, clientCloudEnd, clientCloudGrant, clientCloudPage, clientCloudsPage } from "../../web/pages/client_cloud.ts"; |
| 14 | 14 | import { cloudConnectPage, cloudConnectProvider, cloudConnectSubmit, cloudConnectBuild } from "../../web/pages/cloud.ts"; |
| 15 | 15 | import { fleetGraphPage, fleetGraphLive, fleetGraphCsv } from "../../web/pages/fleet-graph.ts"; |
| 16 | import { fleetAct, fleetReceipt, fleetUndo } from "../../web/pages/fleet-ops.ts"; | |
| 16 | import { fleetAct, fleetReceipt, fleetResult, fleetUndo } from "../../web/pages/fleet-ops.ts"; | |
| 17 | 17 | import { fleetPage } from "../../web/pages/fleet.ts"; |
| 18 | 18 | import { forkFlowsPage } from "../../web/pages/fork-flows.ts"; |
| 19 | 19 | import { maintenanceBudget } from "../../web/pages/maintenance_budgets.ts"; |
| @@ -96,6 +96,7 @@ export function operationsRoutes(router: Router<Handler>, knownPatterns: () => s | ||
| 96 | 96 | // A selection's spend and runs over time; literal, above /:owner. |
| 97 | 97 | router.add("GET", "/fleet", fleetPage); |
| 98 | 98 | router.add("POST", "/fleet", fleetAct); |
| 99 | router.add("GET", "/fleet/result", fleetResult); | |
| 99 | 100 | router.add("GET", "/fleet/ops/:id", fleetReceipt); |
| 100 | 101 | router.add("POST", "/fleet/ops/:id/undo", fleetUndo); |
| 101 | 102 | router.add("GET", "/forks/flows", forkFlowsPage); |
src/http/routes/repo_settings.ts +2 −1
| @@ -16,7 +16,7 @@ import { proposalTokenMint, proposalTokenRevoke, contributeOpenSet, reportsOpenS | ||
| 16 | 16 | import { reportKeyMake, reportKeyRevoke } from "../../web/pages/report_key.ts"; |
| 17 | 17 | import { readGrantAdd, readGrantRevoke } from "../../web/pages/read-grants.ts"; |
| 18 | 18 | import { repoSyncSubmit, repoTakeSubmit, pinSubmit } from "../../web/pages/repo.ts"; |
| 19 | import { settingsPage, settingsUpdate, waveCut, archiveSubmit, archiveConfirmed, restoreConfirmed, renameSubmit, transferSubmit, provenanceSubmit, mirrorStop, appSettingsPage, appSettingsUpdate, appDisable, appMembersUpdate, appEnvSet, appEnvDelete, appDomainAdd, appDomainCheck, appDomainDelete, appEgressGrant, appEgressRevoke, appBlocked, autonomySettingsPage, autonomySettingsUpdate, crewCeilingRaise, checkSlotsUpdate, accountOrderSave } from "../../web/pages/settings.ts"; | |
| 19 | import { settingsPage, settingsUpdate, waveCut, archiveSubmit, archiveConfirmed, restoreConfirmed, renameSubmit, transferSubmit, provenanceSubmit, mirrorStop, appSettingsPage, appSettingsUpdate, appDisable, appMembersUpdate, appEnvSet, appEnvDelete, appDomainAdd, appDomainCheck, appDomainDelete, appEgressGrant, appEgressRevoke, appBlocked, autonomySettingsPage, autonomySettingsUpdate, crewCeilingRaise, crewLineFragment, checkSlotsUpdate, accountOrderSave } from "../../web/pages/settings.ts"; | |
| 20 | 20 | import { appSourcesPage } from "../../web/pages/sources.ts"; |
| 21 | 21 | import { statementPage, statementCsvDownload } from "../../web/pages/statement.ts"; |
| 22 | 22 | import { walletPage, walletCsvDownload, walletSave } from "../../web/pages/wallet.ts"; |
| @@ -135,6 +135,7 @@ export function repoSettingsRoutes(router: Router<Handler>): void { | ||
| 135 | 135 | router.add("POST", "/:owner/:name/wallet", walletSave); |
| 136 | 136 | router.add("GET", "/:owner/:name/settings/crew", crewSettingsPage); |
| 137 | 137 | router.add("GET", "/:owner/:name/settings/crew/seat/:role", crewSeatFragment); |
| 138 | router.add("GET", "/:owner/:name/settings/crew/line", crewLineFragment); | |
| 138 | 139 | router.add("POST", "/:owner/:name/settings/crew", crewAdd); |
| 139 | 140 | router.add( |
| 140 | 141 | "POST", |
src/http/settings_routes.ts +4 −1
| @@ -145,7 +145,7 @@ import { | ||
| 145 | 145 | } from "../web/pages/account.ts"; |
| 146 | 146 | import { grantRevoke, grantsPage } from "../web/pages/grants.ts"; |
| 147 | 147 | import { completeBrokeredCallback, completeOAuthCallback } from "../actions/origins.ts"; |
| 148 | import { originReachAsk, originReachDismiss } from "../web/pages/origin-reach.ts"; | |
| 148 | import { originReachAsk, originReachDismiss, originReachFragment } from "../web/pages/origin-reach.ts"; | |
| 149 | 149 | import { hostedForgesPage, reachAdd, reachRemove, reachSwitch } from "../web/pages/hosted-forges.ts"; |
| 150 | 150 | import { brokerCallback } from "../spawn/origin_broker.ts"; |
| 151 | 151 | import { BROKER_CALLBACK } from "../spawn/origin_broker_wire.ts"; |
| @@ -161,6 +161,7 @@ import { | ||
| 161 | 161 | originSyncSubmit, |
| 162 | 162 | originsPage, |
| 163 | 163 | originReplaceToken, |
| 164 | originConnectionFragment, | |
| 164 | 165 | originTrustedHosts, |
| 165 | 166 | } from "../web/pages/origins.ts"; |
| 166 | 167 | import { originArchivedPage, originArchivedRestore } from "../web/pages/origin-archived.ts"; |
| @@ -449,6 +450,7 @@ export function settingsRoutes(router: Router<Handler>, knownPatterns: () => rea | ||
| 449 | 450 | // A hosted forge asks its host to let it reach one more name (`web/pages/origin-reach.ts`); how |
| 450 | 451 | // the asks stand is read from the API. |
| 451 | 452 | router.add("POST", "/settings/origins/reach", originReachAsk); |
| 453 | router.add("GET", "/settings/origins/reach", originReachFragment); | |
| 452 | 454 | router.add("POST", "/settings/origins/reach/dismiss", originReachDismiss); |
| 453 | 455 | router.add("POST", "/settings/origins/apps", originAppCreate); |
| 454 | 456 | router.add("POST", "/settings/origins/trusted-hosts", originTrustedHosts); |
| @@ -469,6 +471,7 @@ export function settingsRoutes(router: Router<Handler>, knownPatterns: () => rea | ||
| 469 | 471 | router.add("POST", "/settings/origins/:id/check", originCheckSubmit); |
| 470 | 472 | router.add("POST", "/settings/origins/:id/delete", originDisconnect); |
| 471 | 473 | router.add("POST", "/settings/origins/:id/token", originReplaceToken); |
| 474 | router.add("GET", "/settings/origins/:id/connection", originConnectionFragment); | |
| 472 | 475 | router.add("GET", "/settings/keys", keysPage); |
| 473 | 476 | router.add("POST", "/settings/keys", keyCreate); |
| 474 | 477 | router.add("POST", "/settings/keys/:id/delete", keyDelete); |
src/web/blocked.ts +2 −2
| @@ -33,7 +33,7 @@ export const ASK_FORM_ID = "ask-who-can"; | ||
| 33 | 33 | * (`askButton`), inside a paragraph or another form alike. |
| 34 | 34 | */ |
| 35 | 35 | export function askFormShell(back: string): Html { |
| 36 | return html`<form method="post" action="${ASK_ADMIN_FORM}" id="${ASK_FORM_ID}" hidden><input type="hidden" name="back" value="${back}" /></form>`; | |
| 36 | return html`<form method="post" action="${ASK_ADMIN_FORM}" id="${ASK_FORM_ID}" data-in-place hidden><input type="hidden" name="back" value="${back}" /></form>`; | |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** What the button carries: the want, then its subject. */ |
| @@ -51,7 +51,7 @@ export function askButton(ask: { readonly value: string; readonly label: string | ||
| 51 | 51 | function formFor(ask: AskAction, o: { readonly ask?: string }, variant: "primary" | "outline"): Html | null { |
| 52 | 52 | if (ask.path === ASK_ADMIN_PATH) return askButton({ value: askValue(ask.body), label: ask.label }, variant); |
| 53 | 53 | if (o.ask === undefined) return null; |
| 54 | return html`<form method="post" action="${o.ask}">${hiddenFields(ask.body)}${btn(ask.label, { size: "sm", variant })}</form>`; | |
| 54 | return html`<form method="post" action="${o.ask}" data-in-place>${hiddenFields(ask.body)}${btn(ask.label, { size: "sm", variant })}</form>`; | |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | export function blockedNote( |
src/web/chrome.ts +3 −3
| @@ -398,13 +398,13 @@ export function scopeHeader( | ||
| 398 | 398 | * What the crew is doing here, for a repository's admins: the notice when it is stopped, the one |
| 399 | 399 | * fix beside it. |
| 400 | 400 | */ |
| 401 | function crewStopLine(ctx: Ctx, repo: Repo, base: string): Html { | |
| 401 | export function crewStopLine(ctx: Ctx, repo: Repo, base: string): Html { | |
| 402 | 402 | const w = stopWords(autonomyStatus(ctx.app, repo)); |
| 403 | 403 | const raise = |
| 404 | 404 | w.raiseTo !== undefined && mayRaiseCeiling(ctx.app, ctx.auth.user) |
| 405 | ? html` <form method="post" action="${base}/settings/autonomy/raise" class="inline"><input type="hidden" name="to" value="${w.raiseTo}"><button type="submit">Raise to $${w.raiseTo}</button></form>` | |
| 405 | ? html` <form method="post" action="${base}/settings/autonomy/raise" class="inline" data-in-place><input type="hidden" name="to" value="${w.raiseTo}"><button type="submit">Raise to $${w.raiseTo}</button></form>` | |
| 406 | 406 | : null; |
| 407 | return html`<p class="${w.stopped ? "small" : "muted small"}" data-crew-line role="status">${w.words}${w.fix === null ? null : html` <a href="${base}/settings/autonomy">${w.fix}</a>`}${raise}</p>`; | |
| 407 | return html`<p class="${w.stopped ? "small" : "muted small"}" data-crew-line data-fragment="${base}/settings/crew/line" role="status">${w.words}${w.fix === null ? null : html` <a href="${base}/settings/autonomy">${w.fix}</a>`}${raise}</p>`; | |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | /** The siblings the viewer may read, and whether they own a node in `parent`'s tree to land on. */ |
src/web/client.ts +2 −1
| @@ -16,6 +16,7 @@ import { whichAsset } from "./which_asset.ts"; | ||
| 16 | 16 | import { oldGo } from "./keymap.ts"; |
| 17 | 17 | import { keyDecisionJs } from "./key_decision.ts"; |
| 18 | 18 | import { actNowJs } from "./act_now.ts"; |
| 19 | import { inPlaceJs } from "./in_place.ts"; | |
| 19 | 20 | import { FORM_BUSY_JS } from "./form_busy.ts"; |
| 20 | 21 | import { pickJs } from "./pick.ts"; |
| 21 | 22 | import { foldJs } from "./fold.ts"; |
| @@ -2448,7 +2449,7 @@ ${whichStubJs(whichAsset().path)} | ||
| 2448 | 2449 | `; |
| 2449 | 2450 | |
| 2450 | 2451 | /** The shell and the one script that makes actions answer at once (`act_now.ts`). */ |
| 2451 | export const shellJs = `${shellCore}\n${actNowJs}\n${pickJs}\n${foldJs}\n${FORM_BUSY_JS}\n${liveTimeJs}\n${peekJs}`; | |
| 2452 | export const shellJs = `${shellCore}\n${actNowJs}\n${inPlaceJs}\n${pickJs}\n${foldJs}\n${FORM_BUSY_JS}\n${liveTimeJs}\n${peekJs}`; | |
| 2452 | 2453 | |
| 2453 | 2454 | /** |
| 2454 | 2455 | * Live regions. A page marks the parts of itself that change while it is |
src/web/fleet-act.ts +6 −3
| @@ -40,7 +40,7 @@ export function actForm(kind: FleetKind, q: string, chosen = "", value = "", tot | ||
| 40 | 40 | return html`<p class="muted small" data-scope> |
| 41 | 41 | Acts on all ${total} matching ${total === 1 ? "row" : "rows"}, or only on the rows you tick. |
| 42 | 42 | </p> |
| 43 | <form method="post" action="/fleet" class="field-row mb" id="${ACT_FORM}" data-act> | |
| 43 | <form method="post" action="/fleet" class="field-row mb" id="${ACT_FORM}" data-act data-in-place> | |
| 44 | 44 | <input type="hidden" name="q" value="${q}" /> |
| 45 | 45 | <input type="hidden" name="step" value="preview" /> |
| 46 | 46 | ${selectField({ |
| @@ -109,7 +109,7 @@ export function previewSection( | ||
| 109 | 109 | ${lines(plan.rows)} |
| 110 | 110 | ${change === 0 |
| 111 | 111 | ? emptyNote("nothingToApply") |
| 112 | : html`<form method="post" action="/fleet" class="form-actions"> | |
| 112 | : html`<form method="post" action="/fleet" class="form-actions" data-in-place> | |
| 113 | 113 | <input type="hidden" name="q" value="${plan.query}" /> |
| 114 | 114 | <input type="hidden" name="step" value="apply" /> |
| 115 | 115 | <input type="hidden" name="verb" value="${plan.verb}" /> |
| @@ -121,6 +121,9 @@ export function previewSection( | ||
| 121 | 121 | </section>`; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | /** The panel under the form, which a fleet step acting in place redraws (`GET /fleet/result`). */ | |
| 125 | export const resultSlot = (inner: Html | null): Html => html`<div data-fragment="/fleet/result">${inner}</div>`; | |
| 126 | ||
| 124 | 127 | /** Whether an Undo is still offered for a receipt. */ |
| 125 | 128 | export const undoable = (op: Operation, now = Date.now()): boolean => |
| 126 | 129 | op.reversible && |
| @@ -136,7 +139,7 @@ export function receiptSection(op: Operation, canUndo: boolean): Html { | ||
| 136 | 139 | ${op.undoneBy === null ? null : html`<p class="muted">This was undone.</p>`} |
| 137 | 140 | ${lines(op.rows)} |
| 138 | 141 | ${canUndo |
| 139 | ? html`<form method="post" action="/fleet/ops/${op.id}/undo" class="form-actions"> | |
| 142 | ? html`<form method="post" action="/fleet/ops/${op.id}/undo" class="form-actions" data-in-place> | |
| 140 | 143 | ${btn("Undo", { type: "submit", variant: "outline" })} |
| 141 | 144 | </form>` |
| 142 | 145 | : null} |
src/web/flow_button.ts +1 −1
| @@ -11,7 +11,7 @@ const ON = "Adds the flow label: it goes ahead of other ready work"; | ||
| 11 | 11 | const OFF = "Takes the flow label off: it no longer goes ahead of other ready work"; |
| 12 | 12 | |
| 13 | 13 | export function flowButton(action: string, first: boolean, back: string): Html { |
| 14 | return html`<form method="post" action="${action}" class="inline" title="${first ? OFF : ON}" data-now="${first ? "Flow first" : "Not first"}" data-now-alt="${first ? "Not first" : "Flow first"}" data-now-flip="flow"> | |
| 14 | return html`<form method="post" action="${action}" class="inline" title="${first ? OFF : ON}" data-now="${first ? "Flow first" : "Not first"}" data-now-alt="${first ? "Not first" : "Flow first"}" data-now-flip="flow" data-in-place> | |
| 15 | 15 | <input type="hidden" name="flow" value="${first ? "0" : "1"}" /> |
| 16 | 16 | <input type="hidden" name="back" value="${back}" /> |
| 17 | 17 | ${btn(first ? "Not first" : "Flow first", { size: "sm", variant: "outline" })} |
src/web/games_machine.ts +20 −7
| @@ -15,7 +15,7 @@ import { boxNamed, mayDo, roleOn, seesBox, type GameBox } from "../games/store.t | ||
| 15 | 15 | import { notFoundPage } from "./chrome.ts"; |
| 16 | 16 | import { field, readForm } from "./form.ts"; |
| 17 | 17 | import { html, type Html } from "./html.ts"; |
| 18 | import { flashTo } from "./layout.ts"; | |
| 18 | import { flashOrJson, fragment } from "./layout.ts"; | |
| 19 | 19 | import { boxOf } from "./pages/games.ts"; |
| 20 | 20 | import { btn, row, rowList } from "./ui.ts"; |
| 21 | 21 | |
| @@ -77,17 +77,17 @@ export function gameLiveStream(ctx: Ctx): Response { | ||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** The owner's power cycle: a link to its plan, or the plan with its confirm. */ |
| 80 | export function cycleBlock(ctx: Ctx, box: GameBox, asked: boolean): Html { | |
| 80 | export function cycleBlock(ctx: Ctx, box: GameBox, asked: boolean, done = false): Html { | |
| 81 | 81 | const planned = planCycle(ctx.app, ctx.auth.user, box); |
| 82 | 82 | if (!planned.ok) return html``; |
| 83 | 83 | const p = planned.value; |
| 84 | 84 | if (!asked) |
| 85 | return html`<section class="settings-block" id="cycle"><h2>Machine</h2> | |
| 86 | ${btn("Plan a power cycle", { href: `/games/${box.name}?cycle=1`, size: "sm", variant: "secondary" })}</section>`; | |
| 87 | return html`<section class="settings-block" id="cycle"><h2>Power cycle ${p.machine}</h2> | |
| 85 | return html`<section class="settings-block" id="cycle" data-fragment="/games/${box.name}/@cycle"><h2>Machine</h2> | |
| 86 | ${done ? html`<p role="status" data-cycle-done>Power cycle sent. Plan another when you need one.</p>` : null}${btn("Plan a power cycle", { href: `/games/${box.name}?cycle=1`, size: "sm", variant: "secondary" })}</section>`; | |
| 87 | return html`<section class="settings-block" id="cycle" data-fragment="/games/${box.name}/@cycle"><h2>Power cycle ${p.machine}</h2> | |
| 88 | 88 | <dl class="status-rows">${p.lines.map((l) => html`<div data-cycle-line><dt>${l.slice(0, l.indexOf(": "))}</dt><dd>${l.slice(l.indexOf(": ") + 2)}</dd></div>`)}</dl> |
| 89 | 89 | ${p.refusal === "" |
| 90 | ? html`<form method="post" action="/games/${box.name}/@cycle"> | |
| 90 | ? html`<form method="post" action="/games/${box.name}/@cycle" data-in-place> | |
| 91 | 91 | <input type="hidden" name="digest" value="${p.digest}" /> |
| 92 | 92 | ${btn("Power cycle now", { variant: "primary", title: "Hard power off and on; the plan above is what it does" })} |
| 93 | 93 | </form>` |
| @@ -103,5 +103,18 @@ export async function gameCycleSubmit(ctx: Ctx): Promise<Response> { | ||
| 103 | 103 | const form = await readForm(ctx, "rw"); |
| 104 | 104 | if (form instanceof Response) return form; |
| 105 | 105 | const done = await performCycle(ctx.app, ctx.auth.user, got.box, field(form, "digest")); |
| 106 | return flashTo(ctx, `/games/${got.box.name}`, done.ok ? { message: done.value } : { tone: "danger", message: done.error }); | |
| 106 | return flashOrJson( | |
| 107 | ctx, | |
| 108 | `/games/${got.box.name}`, | |
| 109 | done.ok ? { message: done.value } : { tone: "danger", message: done.error }, | |
| 110 | { redraw: [`/games/${got.box.name}/@cycle?done=1`] }, | |
| 111 | ); | |
| 112 | } | |
| 113 | ||
| 114 | // GET /games/:box/@cycle: the machine block alone, folded back to its button (`?done=1` says it was | |
| 115 | // sent). | |
| 116 | export function gameCycleFragment(ctx: Ctx): Response { | |
| 117 | const got = boxOf(ctx, "owner"); | |
| 118 | if (got instanceof Response) return fragment(html``, { status: 404 }); | |
| 119 | return fragment(cycleBlock(ctx, got.box, false, ctx.url.searchParams.get("done") === "1"), { request: ctx.request }); | |
| 107 | 120 | } |
src/web/in_place.ts +20 −15
| @@ -3,16 +3,19 @@ | ||
| 3 | 3 | * asking for JSON, then redraws only what the server says changed: its |
| 4 | 4 | * answer lists `redraw` URLs, each fetched as the same server-rendered |
| 5 | 5 | * fragment the page was built from and swapped for the element carrying |
| 6 | * `data-fragment` with that URL. Scroll never moves and the focused control | |
| 7 | * is found again by id. A refusal (422, `{ok:false, error}`) is written | |
| 8 | * beside the form, never on a new page. A form that also has `data-team` | |
| 9 | * posts when its select or number changes, and its button hides. | |
| 6 | * `data-fragment` with that URL; an answer that carries `html` (one string per | |
| 7 | * `redraw` URL) hands the markup itself, so a long selection never rides a URL. | |
| 8 | * A redraw that fails is said beside the form, never silent. Scroll never moves and the focused | |
| 9 | * control is found again by id. A refusal (422, `{ok:false, error}`) is written beside the form, | |
| 10 | * never on a new page; so is a plain `flash` when nothing needs redrawing. A fragment is matched by | |
| 11 | * its URL's path, so a slot named `/fleet/result` takes `/fleet/result?op=7`. A form that also has | |
| 12 | * `data-team` posts when its select or number changes, and its button hides. | |
| 10 | 13 | * |
| 11 | 14 | * No state lives here: the page stays what the server drew. Without script |
| 12 | 15 | * the form posts and redirects as it always did. `IN_PLACE_BUDGET` is the |
| 13 | 16 | * gzipped byte budget, held by `test/crew-in-place.test.ts`. |
| 14 | 17 | */ |
| 15 | export const IN_PLACE_BUDGET = 1000; | |
| 18 | export const IN_PLACE_BUDGET = 1200; | |
| 16 | 19 | |
| 17 | 20 | export const inPlaceJs = /* js */ ` |
| 18 | 21 | (function () { |
| @@ -21,18 +24,19 @@ export const inPlaceJs = /* js */ ` | ||
| 21 | 24 | hide(D); |
| 22 | 25 | D.addEventListener('change', function (e) { |
| 23 | 26 | var t = e.target, f = t.form; |
| 24 | if (f && f.hasAttribute('data-team') && (t.tagName === 'SELECT' || t.type === 'number')) f.requestSubmit(); | |
| 27 | if (f && f.hasAttribute('data-team') && (t.tagName === 'SELECT' || t.type === 'number')) f.dispatchEvent(new Event('submit', { bubbles: true, cancelable: true })); | |
| 25 | 28 | }); |
| 26 | function swap(url) { | |
| 27 | return fetch(url, { credentials: 'same-origin', headers: { accept: 'text/html' } }).then(function (r) { | |
| 29 | function wipe(f) { f.querySelectorAll('input[type=password]').forEach(function (v) { v.value = ''; }); } | |
| 30 | function swap(url, given) { | |
| 31 | return (given != null ? Promise.resolve(given) : fetch(url, { credentials: 'same-origin', headers: { accept: 'text/html' } }).then(function (r) { | |
| 28 | 32 | if (!r.ok) throw 0; |
| 29 | 33 | return r.text(); |
| 30 | }).then(function (h) { | |
| 34 | })).then(function (h) { | |
| 31 | 35 | var t = D.createElement('template'), n; |
| 32 | 36 | t.innerHTML = h; |
| 33 | 37 | n = t.content.firstElementChild; |
| 34 | 38 | D.querySelectorAll('[data-fragment]').forEach(function (o) { |
| 35 | if (o.getAttribute('data-fragment') === url && n) { o.replaceWith(n); hide(n); } | |
| 39 | if (o.getAttribute('data-fragment').split('?')[0] === url.split('?')[0] && n) { o.replaceWith(n); hide(n); } | |
| 36 | 40 | }); |
| 37 | 41 | }); |
| 38 | 42 | } |
| @@ -43,18 +47,19 @@ export const inPlaceJs = /* js */ ` | ||
| 43 | 47 | if (f.__ip) return; |
| 44 | 48 | f.__ip = 1; |
| 45 | 49 | var id = D.activeElement && D.activeElement.id, say = f.__say; |
| 46 | if (!say) { say = f.__say = D.createElement('p'); say.className = 'small'; say.setAttribute('role', 'alert'); f.insertAdjacentElement('afterend', say); } | |
| 47 | function fail(t) { f.__ip = 0; say.textContent = t; } | |
| 50 | if (!say) { say = f.__say = D.createElement('p'); say.className = 'small'; say.setAttribute('role', 'alert'); (e.submitter && !f.contains(e.submitter) ? e.submitter : f).insertAdjacentElement('afterend', say); } | |
| 51 | function fail(t) { f.__ip = 0; say.textContent = t; wipe(f); } | |
| 48 | 52 | fetch(f.action, { method: 'POST', body: new URLSearchParams(new FormData(f)), credentials: 'same-origin', headers: { accept: 'application/json' } }) |
| 49 | 53 | .then(function (r) { |
| 50 | 54 | return r.json().catch(function () { return {}; }).then(function (j) { |
| 51 | 55 | if (!r.ok || j.ok === false) return fail(j.error || 'That did not go through (' + r.status + '). Nothing changed.'); |
| 52 | say.textContent = ''; | |
| 56 | say.textContent = j.flash || ''; | |
| 57 | wipe(f); | |
| 53 | 58 | f.__ip = 0; |
| 54 | return Promise.all((j.redraw || []).map(swap)).then(function () { | |
| 59 | return Promise.all((j.redraw || []).map(function (u, i) { return swap(u, (j.html || [])[i]); })).then(function () { | |
| 55 | 60 | var k = id && D.getElementById(id); |
| 56 | 61 | if (k) k.focus({ preventScroll: true }); |
| 57 | }); | |
| 62 | }, function () { say.textContent = 'Done, but the page could not redraw it. Reload to see it.'; }); | |
| 58 | 63 | }); |
| 59 | 64 | }) |
| 60 | 65 | .catch(function () { location.reload(); }); |
src/web/layout.ts +1 −1
| @@ -260,7 +260,7 @@ function themeRow(active: ThemeName | undefined): Html { | ||
| 260 | 260 | html`<option value="${value}" ${on ? "selected" : ""}>${label}</option>`; |
| 261 | 261 | const group = (label: string, appearance: "light" | "dark") => |
| 262 | 262 | html`<optgroup label="${label}">${THEME_NAMES.filter((n) => THEMES[n].appearance === appearance).map((n) => option(n, THEMES[n].label, active === n))}</optgroup>`; |
| 263 | return html`<form class="theme-form menu-row" method="post" action="/theme"> | |
| 263 | return html`<form class="theme-form menu-row" method="post" action="/theme" data-in-place> | |
| 264 | 264 | ${themeGlyph}<label for="menu-theme">Theme</label> |
| 265 | 265 | <select class="input" id="menu-theme" name="theme" data-size="sm">${option("system", "Auto", active === undefined)}${group("Light", "light")}${group("Dark", "dark")}</select> |
| 266 | 266 | <button class="btn" data-size="sm" data-nojs>Apply</button> |
src/web/origin_connection.ts +2 −2
| @@ -30,7 +30,7 @@ export function followsOf(db: Database, origin: Origin) { | ||
| 30 | 30 | |
| 31 | 31 | export function connectionBlock(db: Database, origin: Origin): Html { |
| 32 | 32 | const follows = followsOf(db, origin); |
| 33 | return html`<div class="small mt" data-connection-settings> | |
| 33 | return html`<div class="small mt" data-connection-settings data-fragment="/settings/origins/${origin.id}/connection"> | |
| 34 | 34 | <p> |
| 35 | 35 | <strong>${hostOf(origin.webUrl)}</strong> · ${origin.webUrl}<br /> |
| 36 | 36 | ${origin.readOnly ? "May read only." : "May read and write."} |
| @@ -38,7 +38,7 @@ export function connectionBlock(db: Database, origin: Origin): Html { | ||
| 38 | 38 | </p> |
| 39 | 39 | ${when(origin.readOnly, () => html`<details> |
| 40 | 40 | <summary>Allow writing</summary> |
| 41 | <form method="post" action="/settings/origins/${origin.id}/token"> | |
| 41 | <form method="post" action="/settings/origins/${origin.id}/token" data-in-place> | |
| 42 | 42 | <p>Paste a token that may write; it replaces this one in place and nothing disconnects.</p> |
| 43 | 43 | <input type="hidden" name="write" value="1" /> |
| 44 | 44 | <input type="password" name="token" aria-label="Token that may write" autocomplete="off" required /> |
src/web/own_token.ts +5 −37
| @@ -1,8 +1,9 @@ | ||
| 1 | 1 | /** |
| 2 | 2 | * The box a person's held build offers where its wait is shown (#16490): "Start now with your own |
| 3 | 3 | * account", one masked field and one button, posting to the run's own address. Without |
| 4 | * script the form posts and comes back to the run with a flash; with it the box says what | |
| 5 | * happened in place, and the run page's (or Talk's) live stream shows the build starting. | |
| 4 | * script the form posts and comes back to the run with a flash; with it the shared in-place script | |
| 5 | * (`in_place.ts`) says what happened beside the box, and the run page's (or Talk's) live stream | |
| 6 | * shows the build starting. | |
| 6 | 7 | */ |
| 7 | 8 | import { startNowWithOwnToken, START_NOW_HEAD, START_NOW_LINE, START_NOW_WORDS } from "../actions/own_token.ts"; |
| 8 | 9 | import type { Ctx } from "../http/context.ts"; |
| @@ -20,7 +21,7 @@ import { btn } from "./ui.ts"; | ||
| 20 | 21 | */ |
| 21 | 22 | export function ownTokenBox(base: string, runId: string): Html { |
| 22 | 23 | const id = `own-token-${runId}`; |
| 23 | return html`<form class="stack mt" method="post" action="${base}/runs/${runId}/own-token" data-own-token data-own-token-box aria-labelledby="${id}-h"> | |
| 24 | return html`<form class="stack mt" method="post" action="${base}/runs/${runId}/own-token" data-in-place data-own-token data-own-token-box aria-labelledby="${id}-h"> | |
| 24 | 25 | <h2 class="h3" id="${id}-h">${START_NOW_HEAD}</h2> |
| 25 | 26 | <p class="muted small">${START_NOW_LINE}</p> |
| 26 | 27 | <label class="sr-only" for="${id}">Your token or API key</label> |
| @@ -28,42 +29,9 @@ export function ownTokenBox(base: string, runId: string): Html { | ||
| 28 | 29 | <input class="input mono" id="${id}" name="token" type="password" autocomplete="off" autocapitalize="off" spellcheck="false" required placeholder="sk-ant-…" /> |
| 29 | 30 | ${btn("Start now", { variant: "primary" })} |
| 30 | 31 | </span> |
| 31 | <p class="small" role="status" data-own-token-said></p> | |
| 32 | 32 | </form>`; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | /** The box's script: it posts in place, says what happened, and keeps the token out of the page. */ | |
| 36 | export const ownTokenJs = /* js */ ` | |
| 37 | (function () { | |
| 38 | document.addEventListener('submit', function (e) { | |
| 39 | var form = e.target; | |
| 40 | if (!form || !form.matches || !form.matches('form[data-own-token]') || !window.fetch) return; | |
| 41 | e.preventDefault(); | |
| 42 | var said = form.querySelector('[data-own-token-said]'); | |
| 43 | var button = form.querySelector('button'); | |
| 44 | var field = form.querySelector('input[name=token]'); | |
| 45 | if (button) button.disabled = true; | |
| 46 | if (said) said.textContent = 'Testing it…'; | |
| 47 | fetch(form.action, { method: 'POST', credentials: 'same-origin', headers: { accept: 'application/json' }, body: new FormData(form) }) | |
| 48 | .then(function (r) { return r.json().catch(function () { return { ok: false, said: 'Nothing was saved; try again.' }; }); }) | |
| 49 | .then(function (out) { | |
| 50 | if (field) field.value = ''; | |
| 51 | if (out.ok) { | |
| 52 | var box = form; | |
| 53 | var done = document.createElement('p'); | |
| 54 | done.setAttribute('role', 'status'); | |
| 55 | done.textContent = out.said; | |
| 56 | box.replaceWith(done); | |
| 57 | return; | |
| 58 | } | |
| 59 | if (said) said.textContent = out.said; | |
| 60 | if (button) button.disabled = false; | |
| 61 | }) | |
| 62 | .catch(function () { if (said) said.textContent = 'That was not sent: no connection.'; if (button) button.disabled = false; }); | |
| 63 | }); | |
| 64 | })(); | |
| 65 | `; | |
| 66 | ||
| 67 | 35 | const STARTED = "Saved as your own account. Your build is starting on it now."; |
| 68 | 36 | |
| 69 | 37 | /** POST /:owner/:name/runs/:id/own-token */ |
| @@ -77,6 +45,6 @@ export async function runOwnToken(ctx: Ctx): Promise<Response> { | ||
| 77 | 45 | if (run === undefined || run.repoId !== repo.id) return notFoundPage(ctx); |
| 78 | 46 | const started = await startNowWithOwnToken(ctx.app, ctx.auth.user, run, field(form, "token")); |
| 79 | 47 | const said = started.ok ? STARTED : START_NOW_WORDS[started.error]; |
| 80 | if (prefersJson(ctx.request)) return json({ ok: started.ok, said }, started.ok ? 200 : 422); | |
| 48 | if (prefersJson(ctx.request)) return started.ok ? json({ ok: true, flash: said }) : json({ ok: false, error: said }, 422); | |
| 81 | 49 | return flashTo(ctx, `${repoBase(repo)}/runs/${run.id}`, started.ok ? { message: said } : { tone: "danger", message: said }); |
| 82 | 50 | } |
src/web/pages/fleet-ops.ts +42 −8
| @@ -7,6 +7,7 @@ | ||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | import { signedInPage } from "../../http/page_may.ts"; |
| 10 | import { json } from "../../http/respond.ts"; | |
| 10 | 11 | import { |
| 11 | 12 | applyPreviewed, |
| 12 | 13 | getFleetOp, |
| @@ -18,10 +19,10 @@ import { viewFleet } from "../../fleet/rows.ts"; | ||
| 18 | 19 | import { MAX_ROWS } from "../../fleet/selection.ts"; |
| 19 | 20 | import type { Ctx } from "../../http/context.ts"; |
| 20 | 21 | import { notFoundPage, signInFirst } from "../chrome.ts"; |
| 21 | import { previewSection, receiptSection, undoable } from "../fleet-act.ts"; | |
| 22 | import { field, readForm, type Form } from "../form.ts"; | |
| 22 | import { previewSection, receiptSection, resultSlot, undoable } from "../fleet-act.ts"; | |
| 23 | import { field, prefersJson, readForm } from "../form.ts"; | |
| 23 | 24 | import { html } from "../html.ts"; |
| 24 | import { flashTo, page } from "../layout.ts"; | |
| 25 | import { flashOrJson, fragment, page } from "../layout.ts"; | |
| 25 | 26 | import { canAct, renderFleet } from "./fleet.ts"; |
| 26 | 27 | |
| 27 | 28 | /** POST /fleet */ |
| @@ -40,10 +41,13 @@ export async function fleetAct(ctx: Ctx): Promise<Response> { | ||
| 40 | 41 | if (field(form, "step") === "apply") { |
| 41 | 42 | const done = await applyPreviewed(ctx.app, ctx.auth.user, q, action, field(form, "digest").slice(0, 64), picked); |
| 42 | 43 | if (!done.ok) return refusal(ctx, q, verb, text, done.error.message, picked); |
| 43 | return flashTo(ctx, `/fleet/ops/${done.value.id}`, { message: "Applied." }); | |
| 44 | return flashOrJson(ctx, `/fleet/ops/${done.value.id}`, { message: "Applied." }, { redraw: [resultUrl({ op: done.value.id })] }); | |
| 44 | 45 | } |
| 45 | 46 | const plan = previewFleetOp(ctx.app, ctx.auth.user, q, action, picked); |
| 46 | 47 | if (!plan.ok) return refusal(ctx, q, verb, text, plan.error.message, picked); |
| 48 | // Acting in place: the preview is the dry run's fragment, read where the page's slot is. | |
| 49 | // The markup rides in the answer: a long selection never has to fit in a URL. | |
| 50 | if (prefersJson(ctx)) return json({ ok: true, redraw: [resultUrl({ q, verb, value: text }, picked)], html: [resultSlot(previewSection(plan.value, text, picked, matching(ctx, q))).text] }); | |
| 47 | 51 | return renderFleet(ctx, q, { |
| 48 | 52 | html: previewSection(plan.value, text, picked, matching(ctx, q)), |
| 49 | 53 | verb, |
| @@ -59,7 +63,7 @@ const ID = /^[0-9A-Za-z_-]{1,64}$/; | ||
| 59 | 63 | * there are more than a selection can hold. Whether each is in the |
| 60 | 64 | * selection is `pickWithin`'s to decide, so nothing here widens it. |
| 61 | 65 | */ |
| 62 | export function picksOf(form: Form): string[] | undefined { | |
| 66 | export function picksOf(form: { getAll(name: string): readonly unknown[] }): string[] | undefined { | |
| 63 | 67 | const all = form.getAll("pick"); |
| 64 | 68 | if (all.length > MAX_ROWS) return undefined; |
| 65 | 69 | const ids = new Set<string>(); |
| @@ -81,6 +85,7 @@ function refusal( | ||
| 81 | 85 | message: string, |
| 82 | 86 | picked: readonly string[], |
| 83 | 87 | ): Response { |
| 88 | if (prefersJson(ctx)) return json({ ok: false, error: message }, 422); | |
| 84 | 89 | return renderFleet(ctx, q, { |
| 85 | 90 | html: html`<p class="muted" data-refused>${message}</p>`, |
| 86 | 91 | verb, |
| @@ -101,7 +106,7 @@ export function fleetReceipt(ctx: Ctx): Response { | ||
| 101 | 106 | wide: true, |
| 102 | 107 | body: html`<div class="page-head"><h1>Fleet result</h1> |
| 103 | 108 | <p class="muted"><code>${op.query}</code></p></div> |
| 104 | ${receiptSection(op, canAct(ctx) && undoable(op))} | |
| 109 | ${resultSlot(receiptSection(op, canAct(ctx) && undoable(op)))} | |
| 105 | 110 | <p><a href="/fleet?${new URLSearchParams({ q: op.query }).toString()}">Back to the rows</a></p>`, |
| 106 | 111 | }); |
| 107 | 112 | } |
| @@ -115,9 +120,38 @@ export async function fleetUndo(ctx: Ctx): Promise<Response> { | ||
| 115 | 120 | const id = ctx.params.id ?? ""; |
| 116 | 121 | const undone = await undoFleetOp(ctx.app, ctx.auth.user, id); |
| 117 | 122 | if (!undone.ok) |
| 118 | return flashTo(ctx, `/fleet/ops/${encodeURIComponent(id)}`, { | |
| 123 | return flashOrJson(ctx, `/fleet/ops/${encodeURIComponent(id)}`, { | |
| 119 | 124 | tone: "danger", |
| 120 | 125 | message: undone.error.message, |
| 121 | 126 | }); |
| 122 | return flashTo(ctx, `/fleet/ops/${undone.value.id}`, { message: "Undone." }); | |
| 127 | return flashOrJson(ctx, `/fleet/ops/${undone.value.id}`, { message: "Undone." }, { redraw: [resultUrl({ op: undone.value.id })] }); | |
| 128 | } | |
| 129 | ||
| 130 | /** Where the answer panel is read: a receipt (`op`), or the dry run of a verb over a query line. */ | |
| 131 | const resultUrl = (params: Record<string, string>, picked: readonly string[] = []): string => { | |
| 132 | const q = new URLSearchParams(params); | |
| 133 | for (const id of picked) q.append("pick", id); | |
| 134 | return `/fleet/result?${q.toString()}`; | |
| 135 | }; | |
| 136 | ||
| 137 | /** | |
| 138 | * GET /fleet/result: the panel under the form alone, as the page draws it: the receipt of `op`, or | |
| 139 | * the preview of `verb` and `value` over `q`. Read-only: a preview writes nothing. | |
| 140 | */ | |
| 141 | export function fleetResult(ctx: Ctx): Response { | |
| 142 | const gone = () => fragment(html``, { status: 404 }); | |
| 143 | if (!signedInPage(ctx) || !canAct(ctx)) return gone(); | |
| 144 | const p = ctx.url.searchParams; | |
| 145 | const opId = p.get("op"); | |
| 146 | if (opId !== null) { | |
| 147 | const found = getFleetOp(ctx.app, ctx.auth.user, opId.slice(0, 64)); | |
| 148 | return found.ok ? fragment(resultSlot(receiptSection(found.value, undoable(found.value))), { request: ctx.request }) : gone(); | |
| 149 | } | |
| 150 | const q = (p.get("q") ?? "").slice(0, 2000); | |
| 151 | const verb = (p.get("verb") ?? "").slice(0, 40); | |
| 152 | const text = (p.get("value") ?? "").slice(0, 2000); | |
| 153 | const picked = picksOf(p); | |
| 154 | if (picked === undefined) return gone(); | |
| 155 | const plan = previewFleetOp(ctx.app, ctx.auth.user, q, actionOf(ctx.app, verb, text), picked); | |
| 156 | return plan.ok ? fragment(resultSlot(previewSection(plan.value, text, picked, matching(ctx, q))), { request: ctx.request }) : gone(); | |
| 123 | 157 | } |
src/web/pages/fleet.ts +2 −2
| @@ -12,7 +12,7 @@ import { viewFleet, type FleetView } from "../../fleet/rows.ts"; | ||
| 12 | 12 | import { fieldsOf, GRAMMAR, GRAMMAR_EXAMPLES, FLEET_KINDS, MAX_ROWS } from "../../fleet/selection.ts"; |
| 13 | 13 | import type { Ctx } from "../../http/context.ts"; |
| 14 | 14 | import { fleetTable } from "../fleet-table.ts"; |
| 15 | import { actForm } from "../fleet-act.ts"; | |
| 15 | import { actForm, resultSlot } from "../fleet-act.ts"; | |
| 16 | 16 | import { html, type Html } from "../html.ts"; |
| 17 | 17 | import { page } from "../layout.ts"; |
| 18 | 18 | import { btn, field } from "../ui.ts"; |
| @@ -80,7 +80,7 @@ export function renderFleet( | ||
| 80 | 80 | ? null |
| 81 | 81 | : fleetTable(shown.kind, q, shown.rows, sort, acting ? new Set(below?.picked ?? []) : undefined)} |
| 82 | 82 | ${acting ? actForm(shown.kind, q, below?.verb, below?.value, shown.rows.length) : null}`} |
| 83 | ${below?.html ?? null}`, | |
| 83 | ${resultSlot(below?.html ?? null)}`, | |
| 84 | 84 | }); |
| 85 | 85 | notePhase(ctx.request, "render", performance.now() - rendering); |
| 86 | 86 | return response; |
src/web/pages/origin-reach.ts +12 −4
| @@ -27,7 +27,7 @@ import { blockedNote } from "../blocked.ts"; | ||
| 27 | 27 | import { signInFirst } from "../chrome.ts"; |
| 28 | 28 | import { field, readForm } from "../form.ts"; |
| 29 | 29 | import { html, type Html } from "../html.ts"; |
| 30 | import { flashTo } from "../layout.ts"; | |
| 30 | import { flashOrJson, flashTo, fragment } from "../layout.ts"; | |
| 31 | 31 | import { badge, btn, row } from "../ui.ts"; |
| 32 | 32 | |
| 33 | 33 | export { agoWords } from "../../kernel/ago.ts"; |
| @@ -130,6 +130,7 @@ export function reachBlock(ctx: Ctx, blocked?: Blocked): Html | null { | ||
| 130 | 130 | const waits = open.some((a) => a.state === "unsent" || a.state === "asked"); |
| 131 | 131 | return html`<div |
| 132 | 132 | id="reach" |
| 133 | data-fragment="${ASK_FORM}" | |
| 133 | 134 | ${waits ? html`data-reach-wait="${stamp(asks)}"` : null} |
| 134 | 135 | > |
| 135 | 136 | ${note} |
| @@ -192,11 +193,11 @@ export async function originReachAsk(ctx: Ctx): Promise<Response> { | ||
| 192 | 193 | why: field(form, "why"), |
| 193 | 194 | }); |
| 194 | 195 | if (!asked.ok) |
| 195 | return flashTo(ctx, "/settings/origins#connect", { | |
| 196 | return flashOrJson(ctx, "/settings/origins#connect", { | |
| 196 | 197 | tone: "danger", |
| 197 | 198 | message: ASK_ERROR_WORDS[asked.error], |
| 198 | 199 | }); |
| 199 | return flashTo(ctx, `/settings/origins#reach`, { | |
| 200 | return flashOrJson(ctx, `/settings/origins#reach`, { | |
| 200 | 201 | ...(asked.value.state === "refused" ? { tone: "attn" as const } : {}), |
| 201 | 202 | message: |
| 202 | 203 | asked.value.state === "refused" || asked.value.state === "allowed" |
| @@ -204,7 +205,14 @@ export async function originReachAsk(ctx: Ctx): Promise<Response> { | ||
| 204 | 205 | : asked.value.state === "unsent" |
| 205 | 206 | ? `The host could not be told just now. This forge keeps trying, and ${asked.value.host} stays listed here.` |
| 206 | 207 | : `The host was asked to allow ${asked.value.host}. Its answer appears here.`, |
| 207 | }); | |
| 208 | }, { redraw: [ASK_FORM] }); | |
| 209 | } | |
| 210 | ||
| 211 | // GET /settings/origins/reach — the block alone, as the page draws it, for the ask that acted in | |
| 212 | // place. | |
| 213 | export function originReachFragment(ctx: Ctx): Response { | |
| 214 | if (!signedInPage(ctx)) return fragment(html``, { status: 404 }); | |
| 215 | return fragment(reachBlock(ctx) ?? html``, { request: ctx.request }); | |
| 208 | 216 | } |
| 209 | 217 | |
| 210 | 218 | // POST /settings/origins/reach/dismiss — take one's own answered ask off the page. |
src/web/pages/origins.ts +20 −5
| @@ -70,6 +70,7 @@ import { | ||
| 70 | 70 | listDetachedMirrors, |
| 71 | 71 | mirrorsByOrigin, |
| 72 | 72 | type Origin, |
| 73 | getOriginFor, | |
| 73 | 74 | } from "../../core/origins.ts"; |
| 74 | 75 | import { getReposByIds } from "../../core/repos.ts"; |
| 75 | 76 | import { connectionBlock } from "../origin_connection.ts"; |
| @@ -85,7 +86,7 @@ import { | ||
| 85 | 86 | } from "../chrome.ts"; |
| 86 | 87 | import { field, readForm } from "../form.ts"; |
| 87 | 88 | import { html, when, type Html } from "../html.ts"; |
| 88 | import { flashTo, page, redirect } from "../layout.ts"; | |
| 89 | import { flashOrJson, flashTo, fragment, page, redirect } from "../layout.ts"; | |
| 89 | 90 | import { |
| 90 | 91 | badge, |
| 91 | 92 | btn, |
| @@ -1408,11 +1409,25 @@ export async function originReplaceToken(ctx: Ctx): Promise<Response> { | ||
| 1408 | 1409 | field(form, "write") === "1", |
| 1409 | 1410 | ); |
| 1410 | 1411 | if (!replaced.ok) |
| 1411 | return flashTo(ctx, back, { | |
| 1412 | return flashOrJson(ctx, back, { | |
| 1412 | 1413 | tone: "danger", |
| 1413 | 1414 | message: replaceTokenMessage(replaced.error), |
| 1414 | 1415 | }); |
| 1415 | return flashTo(ctx, back, { | |
| 1416 | message: `Token replaced for ${replaced.value.login} at ${hostLabel(replaced.value.webUrl)}; its repositories are listed again.`, | |
| 1417 | }); | |
| 1416 | return flashOrJson( | |
| 1417 | ctx, | |
| 1418 | back, | |
| 1419 | { message: `Token replaced for ${replaced.value.login} at ${hostLabel(replaced.value.webUrl)}; its repositories are listed again.` }, | |
| 1420 | { redraw: [connectionUrl(replaced.value.id)] }, | |
| 1421 | ); | |
| 1422 | } | |
| 1423 | ||
| 1424 | /** | |
| 1425 | * Where one origin's connection block is read alone, for the form that replaced its token in place. | |
| 1426 | */ | |
| 1427 | const connectionUrl = (id: string): string => `/settings/origins/${id}/connection`; | |
| 1428 | ||
| 1429 | // GET /settings/origins/:id/connection: the block as the page draws it, nothing else. | |
| 1430 | export function originConnectionFragment(ctx: Ctx): Response { | |
| 1431 | const origin = ctx.auth.user === undefined ? undefined : getOriginFor(ctx.app.db, ctx.auth.user.id, ctx.params.id ?? ""); | |
| 1432 | return origin === undefined ? fragment(html``, { status: 404 }) : fragment(connectionBlock(ctx.app.db, origin), { request: ctx.request }); | |
| 1418 | 1433 | } |
src/web/pages/settings.ts +12 −5
| @@ -89,6 +89,7 @@ import { listRefs } from "../../git/read.ts"; | ||
| 89 | 89 | import { repoDir } from "../../git/repos.ts"; |
| 90 | 90 | import type { Ctx } from "../../http/context.ts"; |
| 91 | 91 | import { |
| 92 | crewStopLine, | |
| 92 | 93 | crumbsFor, |
| 93 | 94 | loadRepo, |
| 94 | 95 | repoBase, |
| @@ -101,7 +102,7 @@ import { adminForm, loadAdminRepo } from "../admin_form.ts"; | ||
| 101 | 102 | import { raiseCrewCeiling } from "../../actions/crew_ceiling.ts"; |
| 102 | 103 | import { forgeTemplateSetting } from "./forge-template-setting.ts"; |
| 103 | 104 | import { daySpark } from "../studio/kpi_row.ts"; |
| 104 | import { settingsLead, teamJs } from "../studio/crew.ts"; | |
| 105 | import { settingsLead } from "../studio/crew.ts"; | |
| 105 | 106 | import { pageTitle } from "../studio/nouns.ts"; |
| 106 | 107 | import { appHref } from "./apps.ts"; |
| 107 | 108 | import { appSecretsView } from "./app_secrets.ts"; |
| @@ -117,7 +118,7 @@ import { lastChanges } from "../../settings/last_change.ts"; | ||
| 117 | 118 | import { NOT_CHANGED } from "../edit_words.ts"; |
| 118 | 119 | import { STOP_APP } from "../danger_words.ts"; |
| 119 | 120 | import { icon } from "../icons.ts"; |
| 120 | import { flashTo, page, redirect } from "../layout.ts"; | |
| 121 | import { flashOrJson, flashTo, fragment, page, redirect } from "../layout.ts"; | |
| 121 | 122 | import { helpAsked, pageHelp } from "../page_help.ts"; |
| 122 | 123 | import type { Flash } from "../flash.ts"; |
| 123 | 124 | import { |
| @@ -232,7 +233,7 @@ export function settingsPageResponse( | ||
| 232 | 233 | crumbs: crumbsFor(repo), |
| 233 | 234 | palette: repoPalette(ctx, repo), |
| 234 | 235 | ...(styleCss !== undefined ? { styleCss } : {}), |
| 235 | scriptJs: `${teamJs}\n${liveClientJs}\n${outsideAgentsJs}\n${crewDevicesJs}`, | |
| 236 | scriptJs: `${liveClientJs}\n${outsideAgentsJs}\n${crewDevicesJs}`, | |
| 236 | 237 | body: html`${repoHeader(ctx, repo, "settings", { compact: true })} |
| 237 | 238 | ${settingsLayout(sections(repoBase(repo), active), body)}`, |
| 238 | 239 | }, |
| @@ -271,7 +272,6 @@ export async function settingsPage( | ||
| 271 | 272 | title: pageTitle("settings", readable, true), |
| 272 | 273 | crumbs: crumbsFor(readable), |
| 273 | 274 | palette: repoPalette(ctx, readable), |
| 274 | scriptJs: teamJs, | |
| 275 | 275 | body: html`${repoHeader(ctx, readable, "settings", { compact: true })} |
| 276 | 276 | ${lead}${proposals ? html`<div class="mt">${proposals}</div>` : null}`, |
| 277 | 277 | }); |
| @@ -1676,15 +1676,22 @@ export async function crewCeilingRaise(ctx: Ctx): Promise<Response> { | ||
| 1676 | 1676 | const field = gate.form.get("to"); |
| 1677 | 1677 | const to = typeof field === "string" && /^\d{1,7}$/.test(field) ? Number(field) : Number.NaN; |
| 1678 | 1678 | const raised = raiseCrewCeiling(ctx.app, ctx.auth.user, to); |
| 1679 | return flashTo( | |
| 1679 | return flashOrJson( | |
| 1680 | 1680 | ctx, |
| 1681 | 1681 | repoBase(gate.repo), |
| 1682 | 1682 | raised.ok |
| 1683 | 1683 | ? { message: `The crew's daily ceiling is $${raised.value.to}, up from $${raised.value.from}.` } |
| 1684 | 1684 | : { tone: "danger", message: raised.error === "not_found" ? "Only a forge admin raises the crew's ceiling." : raised.error }, |
| 1685 | { redraw: [`${repoBase(gate.repo)}/settings/crew/line`] }, | |
| 1685 | 1686 | ); |
| 1686 | 1687 | } |
| 1687 | 1688 | |
| 1689 | // GET /:owner/:name/settings/crew/line: the crew line alone, as the page draws it. | |
| 1690 | export function crewLineFragment(ctx: Ctx): Response { | |
| 1691 | const repo = loadAdminRepo(ctx); | |
| 1692 | return repo ? fragment(crewStopLine(ctx, repo, repoBase(repo)), { request: ctx.request }) : fragment(html``, { status: 404 }); | |
| 1693 | } | |
| 1694 | ||
| 1688 | 1695 | // POST /:owner/:name/settings/autonomy |
| 1689 | 1696 | export async function autonomySettingsUpdate(ctx: Ctx): Promise<Response> { |
| 1690 | 1697 | const gate = await adminForm(ctx); |
src/web/pages/site.ts +8 −1
| @@ -56,13 +56,14 @@ import { | ||
| 56 | 56 | } from "../chrome.ts"; |
| 57 | 57 | import { SignupSlot, signupWindow } from "../../actions/signup-window.ts"; |
| 58 | 58 | import { signinWindow } from "../../core/signin-window.ts"; |
| 59 | import { field, readForm } from "../form.ts"; | |
| 59 | import { field, prefersJson, readForm } from "../form.ts"; | |
| 60 | 60 | import { passkeyJs } from "../passkey-client.ts"; |
| 61 | 61 | import { passkeyNote } from "../passkey-state.ts"; |
| 62 | 62 | import { html, when, type Html } from "../html.ts"; |
| 63 | 63 | import { icon } from "../icons.ts"; |
| 64 | 64 | import { flashTo, page, redirect } from "../layout.ts"; |
| 65 | 65 | import { flashCookie } from "../flash.ts"; |
| 66 | import { json } from "../../http/respond.ts"; | |
| 66 | 67 | import { |
| 67 | 68 | btn, |
| 68 | 69 | field as formField, |
| @@ -895,6 +896,12 @@ export async function themeSubmit(ctx: Ctx): Promise<Response> { | ||
| 895 | 896 | if (parsed && parsed.origin === ctx.url.origin) |
| 896 | 897 | back = parsed.pathname + parsed.search; |
| 897 | 898 | } |
| 899 | // Acting in place (`web/in_place.ts`): the cookie is set, the page stays where it is. | |
| 900 | if (prefersJson(ctx)) { | |
| 901 | const kept = json({ ok: true }); | |
| 902 | kept.headers.append("set-cookie", cookie); | |
| 903 | return kept; | |
| 904 | } | |
| 898 | 905 | return redirect(back, cookie); |
| 899 | 906 | } |
| 900 | 907 |
src/web/pages/talk.ts +1 −2
| @@ -14,7 +14,6 @@ | ||
| 14 | 14 | * their id, the agent acts with their permissions (`crew/conversation.ts`). |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | import { ownTokenJs } from "../own_token.ts"; | |
| 18 | 17 | import { lookupIdempotent, MAX_KEY_LENGTH, requestFingerprint, storeIdempotent } from "../../core/idempotency.ts"; |
| 19 | 18 | import { blockedFlash } from "../blocked.ts"; |
| 20 | 19 | import { noTalkAccountBlocked } from "../../actions/blocked_words.ts"; |
| @@ -772,7 +771,7 @@ async function talkPage(ctx: Ctx, conversation: Conversation, before0: string | | ||
| 772 | 771 | </div> |
| 773 | 772 | ${split ? html`<div class="talk-work">${panel}${pane.html}</div>` : null} |
| 774 | 773 | </div>`; |
| 775 | return page({ ctx, title: conversation.title === "" ? "Talk" : `${conversation.title} · Talk`, body, styleCss: talkCss + paneCss + codePaneCss + (picker?.control ? modelCss : "") + (panel === null ? "" : buildCss) + voiceCss + pinnedPlanCss, scriptJs: `${talkJs}\n${liveRegionsJs}\n${ownTokenJs}${picker?.control ? modelJs : ""}`, description: "Talk to the forge.", wide: true, noDock: true, ...(!split ? {} : { frameSrc: frames }) }); | |
| 774 | return page({ ctx, title: conversation.title === "" ? "Talk" : `${conversation.title} · Talk`, body, styleCss: talkCss + paneCss + codePaneCss + (picker?.control ? modelCss : "") + (panel === null ? "" : buildCss) + voiceCss + pinnedPlanCss, scriptJs: `${talkJs}\n${liveRegionsJs}\n${picker?.control ? modelJs : ""}`, description: "Talk to the forge.", wide: true, noDock: true, ...(!split ? {} : { frameSrc: frames }) }); | |
| 776 | 775 | } |
| 777 | 776 | |
| 778 | 777 | /** |
src/web/studio/ask_admin.ts +2 −2
| @@ -10,7 +10,7 @@ import { agoWords } from "../../kernel/ago.ts"; | ||
| 10 | 10 | import { signInFirst } from "../chrome.ts"; |
| 11 | 11 | import { backTo, field, readForm } from "../form.ts"; |
| 12 | 12 | import { html, type Html } from "../html.ts"; |
| 13 | import { flashTo } from "../layout.ts"; | |
| 13 | import { flashOrJson, flashTo } from "../layout.ts"; | |
| 14 | 14 | import { btn } from "../ui.ts"; |
| 15 | 15 | |
| 16 | 16 | // POST /asks/admin — ask whoever can; back where the person was, with how it stands said once. |
| @@ -21,7 +21,7 @@ export async function askAdminSubmit(ctx: Ctx): Promise<Response> { | ||
| 21 | 21 | // The button carries the want, then its subject (`web/blocked.ts` `askValue`). |
| 22 | 22 | const [want = "", ...subject] = field(form, "ask").split(" "); |
| 23 | 23 | const asked = askAdmin(ctx.app, ctx.auth.user, { want, subject: subject.join(" ") }); |
| 24 | return flashTo( | |
| 24 | return flashOrJson( | |
| 25 | 25 | ctx, |
| 26 | 26 | backTo(form, "/"), |
| 27 | 27 | asked.ok |
src/web/studio/crew.ts +1 −8
| @@ -41,7 +41,6 @@ import { html, type Html } from "../html.ts"; | ||
| 41 | 41 | import { blockedWay } from "../blocked.ts"; |
| 42 | 42 | import { noAgentsBlocked } from "../../actions/blocked_words.ts"; |
| 43 | 43 | import { icon } from "../icons.ts"; |
| 44 | import { inPlaceJs } from "../in_place.ts"; | |
| 45 | 44 | import { crewReadiness } from "../pages/crew.ts"; |
| 46 | 45 | import { grantsSection } from "../pages/subscriptions.ts"; |
| 47 | 46 | import { seatSlotsOf, seatSlotsWords, SEAT_UNIT } from "../../crew/seat_slots.ts"; |
| @@ -120,12 +119,6 @@ const SEAT_BADGE: Record<Seat["state"], { text: string; tone: Tone }> = { | ||
| 120 | 119 | invite: { text: "open seat", tone: "default" }, |
| 121 | 120 | }; |
| 122 | 121 | |
| 123 | /** | |
| 124 | * The script: choosing in a team list, or setting its number, saves at once and redraws that seat | |
| 125 | * only (`in_place.ts`). | |
| 126 | */ | |
| 127 | export const teamJs = inPlaceJs; | |
| 128 | ||
| 129 | 122 | /** |
| 130 | 123 | * One crew member as one line: name, the seat it holds, its state. What the agent's own words say |
| 131 | 124 | * (its model and brief) opens in place, a native `<details>`, closed on first paint, so a row |
| @@ -256,7 +249,7 @@ export function seatFragment(ctx: Ctx, repo: Repo, role: string): Html | undefin | ||
| 256 | 249 | * Your team, as three lists: Planners, Builders, Reviewers (`seatsOf`, the |
| 257 | 250 | * same facts the MCP `crew` tool returns). Each list holds who fills it, a |
| 258 | 251 | * picker of only the agents that declare that role, and how many may work at |
| 259 | * once; each choice posts at once (`teamJs`; without script, the button is | |
| 252 | * once; each choice posts at once (`in_place.ts`; without script, the button is | |
| 260 | 253 | * there). A seat with nobody warns when the team is on its own. |
| 261 | 254 | */ |
| 262 | 255 | function teamCard( |
src/web/studio/run.ts +2 −2
| @@ -10,7 +10,7 @@ | ||
| 10 | 10 | |
| 11 | 11 | import { offersOwnToken } from "../../actions/own_token.ts"; |
| 12 | 12 | import { keyOf } from "../keymap.ts"; |
| 13 | import { ownTokenBox, ownTokenJs } from "../own_token.ts"; | |
| 13 | import { ownTokenBox } from "../own_token.ts"; | |
| 14 | 14 | import { time } from "../time_element.ts"; |
| 15 | 15 | import { wayIn } from "../../actions/blocked_words.ts"; |
| 16 | 16 | import { blockedWay } from "../blocked.ts"; |
| @@ -552,6 +552,6 @@ export async function runView( | ||
| 552 | 552 | palette: repoPalette(ctx, repo), |
| 553 | 553 | body, |
| 554 | 554 | styleCss: RUN_PAGE_CSS, |
| 555 | scriptJs: `${liveRegionsJs}\n${studioRunJs}\n${openFoldJs}\n${ownTokenJs}`, | |
| 555 | scriptJs: `${liveRegionsJs}\n${studioRunJs}\n${openFoldJs}`, | |
| 556 | 556 | }); |
| 557 | 557 | } |
test/cookie-flags.test.ts +1 −1
| @@ -115,7 +115,7 @@ const WALKED: Record<string, number> = { | ||
| 115 | 115 | "src/apps/feedback.ts": 1, // a stranger's note on an app host: only the answer to a note made mints a visitor id |
| 116 | 116 | "src/web/pages/games_client_pack.ts": 1, // a linked game player mints the visitor id only on the link (#18189) |
| 117 | 117 | "src/web/pages/passkeys.ts": 5, // import, passkey sign-in, passkey add/recovery-link sign-in, access-link sign-in (+1 mention) |
| 118 | "src/web/pages/site.ts": 5, // sessionCookie() itself and its uses: password sign-in/sign-up, logout; the theme cookie; the closing flash on a sign-in (#15619) | |
| 118 | "src/web/pages/site.ts": 6, // sessionCookie() itself and its uses: password sign-in/sign-up, logout; the theme cookie; the closing flash on a sign-in (#15619) | |
| 119 | 119 | "src/web/pages/first-admin.ts": 1, // the first admin made by passkey |
| 120 | 120 | "src/web/pages/signup-passkey.ts": 2, // import, sign-up by passkey |
| 121 | 121 | "src/web/pages/map.ts": 1, // the roadmap's last-looked cookie |
test/cookie-floor.test.ts +1
| @@ -25,6 +25,7 @@ const SCRIPT_READABLE: Record<string, string> = {}; | ||
| 25 | 25 | * follow, keyed by `file expression`, each naming where that value is built. |
| 26 | 26 | */ |
| 27 | 27 | const PASSED_IN: Record<string, string> = { |
| 28 | "src/web/pages/site.ts cookie": "the theme line themeSubmit builds just above from setCookie or expireCookie, on the answer to a form acting in place", | |
| 28 | 29 | "src/web/layout.ts o.cookie": "a page's `cookie` option; each caller passes a line from setCookie (the theme in src/web/pages/site.ts)", |
| 29 | 30 | "src/apps/feedback.ts admitted.setCookie": "the visitor id `admitVisitor` mints, its line from setCookie in src/core/visitors.ts", |
| 30 | 31 | "src/web/pages/games_client_pack.ts admitted.setCookie": "the visitor id `admitVisitor` mints, its line from setCookie in src/core/visitors.ts", |
test/description-clamp.test.ts +1 −1
| @@ -122,7 +122,7 @@ test("the repo header and the About card carry the expander on a long descriptio | ||
| 122 | 122 | |
| 123 | 123 | test("an admin sees the crew line just under the repo head, with its one fix; it says off on a new repo", async () => { |
| 124 | 124 | const head = await (await fetch(`${servers.url}/alice/page/issues`, { headers: { authorization: `Bearer ${token}` } })).text(); |
| 125 | expect(head).toMatch(/<p class="small" data-crew-line role="status">Crew off: nothing runs here on its own\. <a href="\/alice\/page\/settings\/autonomy">Turn autonomy on<\/a><\/p>/); | |
| 125 | expect(head).toMatch(/<p class="small" data-crew-line data-fragment="\/alice\/page\/settings\/crew\/line" role="status">Crew off: nothing runs here on its own\. <a href="\/alice\/page\/settings\/autonomy">Turn autonomy on<\/a><\/p>/); | |
| 126 | 126 | const anon = await (await fetch(`${servers.url}/alice/page/issues`)).text(); |
| 127 | 127 | expect(anon).not.toContain("data-crew-line"); |
| 128 | 128 | }); |
test/design-audit.test.ts +1 −1
| @@ -18,7 +18,7 @@ const doc = readFileSync("docs/design/audit.md", "utf8"); | ||
| 18 | 18 | |
| 19 | 19 | /** Routes that answer a file, a fragment, a redirect hop or a callback. */ |
| 20 | 20 | const NOT_PAGES = |
| 21 | /^\/(design\/theme\.css|design\/theme\/|assets\/|\.well-known\/|icons\/|og\/|live\/|__forge\/|go\/|new\/issue$|asked$|events$|boards\/stream$|system\/stream$|talk\/stream$|peek$|settings\/teams\/stream$|(tabforge\/)?sw\.js$|offline$|robots\.txt$|favicon\.ico$|apple-touch-icon(-precomposed)?\.png$|sitemap\.xml$|edition$|oembed$|manifest\.webmanifest$|opensearch\.xml$|llms(-full)?\.txt$|openapi\.json$|releases\.json$|templates\.json$|maintenance\.json$|changelog\.atom$|explore\.(atom|json)$|feed\.json$|docs(\/[^/]*)?$|audit\.csv$|settings\/traffic\/scrapes\/export$|settings\/payments\.csv$|fleet\/graph\/live$|fleet\/graph\.csv$|forges\/export\.csv$|settings\/origins\/callback$|broker\/origins\/start$|home\/archived\/|settings\/backups\/live$|api\/v1(\/|$))/; | |
| 21 | /^\/(design\/theme\.css|design\/theme\/|assets\/|\.well-known\/|icons\/|og\/|live\/|__forge\/|go\/|new\/issue$|asked$|events$|boards\/stream$|system\/stream$|talk\/stream$|peek$|settings\/teams\/stream$|(tabforge\/)?sw\.js$|offline$|robots\.txt$|favicon\.ico$|apple-touch-icon(-precomposed)?\.png$|sitemap\.xml$|edition$|oembed$|manifest\.webmanifest$|opensearch\.xml$|llms(-full)?\.txt$|openapi\.json$|releases\.json$|templates\.json$|maintenance\.json$|changelog\.atom$|explore\.(atom|json)$|feed\.json$|docs(\/[^/]*)?$|audit\.csv$|settings\/traffic\/scrapes\/export$|settings\/payments\.csv$|fleet\/graph\/live$|fleet\/graph\.csv$|forges\/export\.csv$|settings\/origins\/callback$|settings\/origins\/reach$|fleet\/result$|broker\/origins\/start$|home\/archived\/|settings\/backups\/live$|api\/v1(\/|$))/; | |
| 22 | 22 | |
| 23 | 23 | const getRoutes = [ |
| 24 | 24 | ...server.matchAll(/(?:router|own)\.add\(\s*"GET",\s*"([^"]+)"/g), |
test/game-machine.test.ts +20
| @@ -233,4 +233,24 @@ describe("the power cycle", () => { | ||
| 233 | 233 | const refused = await post(owner, "bad"); |
| 234 | 234 | expect(refused.status).toBe(303); |
| 235 | 235 | }); |
| 236 | test("the machine block answers as a fragment for the owner only; the in-place answer names it", async () => { | |
| 237 | const frag = (headers: Record<string, string>, q = "") => fetch(`${servers.url}/games/mc/@cycle${q}`, { headers: { ...headers, accept: "text/html" } }); | |
| 238 | const done = await frag(as(owner), "?done=1"); | |
| 239 | expect(done.status).toBe(200); | |
| 240 | const text = await done.text(); | |
| 241 | expect(text).toContain('data-fragment="/games/mc/@cycle"'); | |
| 242 | expect(text).toContain("data-cycle-done"); | |
| 243 | expect(text).not.toContain("<html"); | |
| 244 | expect(await (await frag(as(owner))).text()).not.toContain("data-cycle-done"); | |
| 245 | for (const who of [as(operator), {}]) { | |
| 246 | const gone = await frag(who, "?done=1"); | |
| 247 | expect(gone.status).toBe(404); | |
| 248 | expect(await gone.text()).toBe(""); | |
| 249 | } | |
| 250 | const refused = await fetch(`${servers.url}/games/mc/@cycle`, { method: "POST", headers: { ...as(owner), origin: servers.url, accept: "application/json" }, body: new URLSearchParams({ digest: "bad" }) }); | |
| 251 | expect(refused.headers.get("content-type")).toContain("application/json"); | |
| 252 | expect(((await refused.json()) as { redraw: string[] }).redraw).toEqual(["/games/mc/@cycle?done=1"]); | |
| 253 | const op = await fetch(`${servers.url}/games/mc/@cycle`, { method: "POST", headers: { ...as(operator), origin: servers.url, accept: "application/json" }, body: new URLSearchParams({ digest: "bad" }) }); | |
| 254 | expect(op.status).toBe(404); | |
| 255 | }); | |
| 236 | 256 | }); |
test/in-place-fragments.test.ts added +183
| @@ -0,0 +1,183 @@ | ||
| 1 | /** | |
| 2 | * Nine page forms answer in place (`web/in_place.ts`): asked for JSON they answer `{ok, flash, | |
| 3 | * redraw}` or a 422 with words, never a page, and each redraw URL answers one fragment, not a | |
| 4 | * document. Without script the same POST still redirects. The scanner's list is | |
| 5 | * `in-place-rule.test.ts`; this file holds what each converted form answers. | |
| 6 | */ | |
| 7 | import { afterAll, beforeAll, describe, expect, test } from "bun:test"; | |
| 8 | import { mkdtemp, rm } from "node:fs/promises"; | |
| 9 | import { tmpdir } from "node:os"; | |
| 10 | import { join } from "node:path"; | |
| 11 | import { createApp, type App } from "../src/app.ts"; | |
| 12 | import { createRepo } from "../src/actions/repos.ts"; | |
| 13 | import { createIssue } from "../src/core/issues.ts"; | |
| 14 | import { createUser } from "../src/core/users.ts"; | |
| 15 | import { serve, type Servers } from "../src/http/server.ts"; | |
| 16 | import type { Blocked } from "../src/kernel/blocked.ts"; | |
| 17 | import { askFormShell, blockedNote } from "../src/web/blocked.ts"; | |
| 18 | import { ownTokenBox } from "../src/web/own_token.ts"; | |
| 19 | import { flowButton } from "../src/web/flow_button.ts"; | |
| 20 | import { quietLogs } from "./helpers/globals.ts"; | |
| 21 | ||
| 22 | quietLogs(); | |
| 23 | const PASSWORD = "a-long-crew-passphrase"; | |
| 24 | ||
| 25 | describe("forms that answer in place", () => { | |
| 26 | let dir = ""; | |
| 27 | let app: App; | |
| 28 | let servers: Servers; | |
| 29 | let admin = ""; | |
| 30 | let issueNumber = 0; | |
| 31 | const signIn = async (username: string): Promise<string> => | |
| 32 | ((await fetch(`${servers.url}/signin`, { method: "POST", body: new URLSearchParams({ username, password: PASSWORD }), redirect: "manual" })).headers.get("set-cookie") ?? "").split(";")[0]!; | |
| 33 | const post = (path: string, body: Record<string, string>, o: { json?: boolean; cookie?: string; origin?: string } = {}) => | |
| 34 | fetch(`${servers.url}${path}`, { | |
| 35 | method: "POST", | |
| 36 | headers: { origin: o.origin ?? servers.url, cookie: o.cookie ?? admin, ...(o.json === false ? {} : { accept: "application/json" }) }, | |
| 37 | body: new URLSearchParams(body), | |
| 38 | redirect: "manual", | |
| 39 | }); | |
| 40 | const get = (path: string) => fetch(`${servers.url}${path}`, { headers: { cookie: admin, accept: "text/html" } }); | |
| 41 | /** The answer is a slice of markup, with no document around it. */ | |
| 42 | const isFragment = async (res: Response): Promise<string> => { | |
| 43 | expect(res.headers.get("content-type")).toContain("text/html"); | |
| 44 | const text = await res.text(); | |
| 45 | expect(text).not.toContain("<html"); | |
| 46 | expect(text).not.toContain("<!doctype"); | |
| 47 | return text; | |
| 48 | }; | |
| 49 | const isJson = (res: Response) => expect(res.headers.get("content-type")).toContain("application/json"); | |
| 50 | ||
| 51 | beforeAll(async () => { | |
| 52 | dir = await mkdtemp(join(tmpdir(), "forge-in-place-fragments-")); | |
| 53 | app = createApp({ dataDir: dir, port: 0 }); | |
| 54 | servers = await serve(app); | |
| 55 | const a = await createUser(app.db, { origin: "seed", username: "alice", email: "[email protected]", password: PASSWORD, adminIfFirst: true, trusted: true }); | |
| 56 | if (!a.ok) throw new Error("user"); | |
| 57 | const made = await createRepo(app, a.value, { name: "yard", visibility: "public" }); | |
| 58 | if (!made.ok) throw new Error(String(made.error)); | |
| 59 | const issue = createIssue(app.db, { repoId: made.value.id, authorId: a.value.id, title: "Flow me" }); | |
| 60 | if (!issue.ok) throw new Error("issue"); | |
| 61 | issueNumber = issue.value.number; | |
| 62 | admin = await signIn("alice"); | |
| 63 | }, 30_000); | |
| 64 | afterAll(async () => { | |
| 65 | await servers.stop(); | |
| 66 | await rm(dir, { recursive: true, force: true }); | |
| 67 | }); | |
| 68 | ||
| 69 | test("the ask to whoever can says what happened in JSON: Asked for a member, the words for one who can already", async () => { | |
| 70 | const made = await createUser(app.db, { origin: "seed", username: "bob", email: "[email protected]", password: PASSWORD, trusted: true }); | |
| 71 | if (!made.ok) throw new Error("user"); | |
| 72 | const res = await post("/asks/admin", { ask: "crew_key", back: "/" }, { cookie: await signIn("bob") }); | |
| 73 | isJson(res); | |
| 74 | expect(res.status).toBe(200); | |
| 75 | expect(((await res.json()) as { ok: boolean; flash: string }).flash).toStartWith("Asked."); | |
| 76 | const can = await post("/asks/admin", { ask: "crew_key", back: "/" }); | |
| 77 | expect(can.status).toBe(422); | |
| 78 | expect(await can.json()).toMatchObject({ ok: false, error: "You can change this yourself: nobody needs to be asked." }); | |
| 79 | const plain = await post("/asks/admin", { ask: "crew_key", back: "/" }, { json: false }); | |
| 80 | expect(plain.status).toBe(303); | |
| 81 | }); | |
| 82 | ||
| 83 | test("the ask to whoever can refuses a post from another origin", async () => { | |
| 84 | const res = await post("/asks/admin", { ask: "crew_key", back: "/" }, { origin: "https://elsewhere.example" }); | |
| 85 | expect(res.status).toBe(403); | |
| 86 | }); | |
| 87 | ||
| 88 | test("the forms draw data-in-place: the ask shell, the host's ask, the flow button", () => { | |
| 89 | expect(askFormShell("/").text).toContain("data-in-place"); | |
| 90 | const blocked: Blocked = { says: "x", readerCan: false, ask: { method: "POST", path: "/other", label: "Ask", body: { host: "h" } } }; | |
| 91 | expect(blockedNote(blocked, { ask: "/settings/origins/reach" }).text).toContain("data-in-place"); | |
| 92 | expect(flowButton("/alice/yard/issues/1/flow", false, "/alice/yard/issues/1").text).toContain("data-in-place"); | |
| 93 | }); | |
| 94 | ||
| 95 | test("the host's ask answers JSON; its words come as a 422, and the block is a fragment", async () => { | |
| 96 | const bad = await post("/settings/origins/reach", { host: "", why: "" }); | |
| 97 | isJson(bad); | |
| 98 | expect(bad.status).toBe(422); | |
| 99 | expect(((await bad.json()) as { error: string }).error.length).toBeGreaterThan(5); | |
| 100 | await isFragment(await get("/settings/origins/reach")); | |
| 101 | }); | |
| 102 | ||
| 103 | test("raising the ceiling answers JSON naming the crew line, which is a fragment", async () => { | |
| 104 | const res = await post("/alice/yard/settings/autonomy/raise", { to: "1" }); | |
| 105 | isJson(res); | |
| 106 | const j = (await res.json()) as { redraw: string[] }; | |
| 107 | expect(j.redraw).toEqual(["/alice/yard/settings/crew/line"]); | |
| 108 | const text = await isFragment(await get(j.redraw[0]!)); | |
| 109 | expect(text).toContain("data-crew-line"); | |
| 110 | expect((await post("/alice/yard/settings/autonomy/raise", { to: "1" }, { origin: "https://elsewhere.example" })).status).toBe(403); | |
| 111 | }); | |
| 112 | ||
| 113 | test("the flow button answers JSON with what it did, and a bad value is a 422", async () => { | |
| 114 | const path = `/alice/yard/issues/${issueNumber}/flow`; | |
| 115 | const on = await post(path, { flow: "1" }); | |
| 116 | isJson(on); | |
| 117 | expect(await on.json()).toEqual({ ok: true, flash: "Flow first." }); | |
| 118 | expect(await (await post(path, { flow: "0" })).json()).toEqual({ ok: true, flash: "No longer first." }); | |
| 119 | const bad = await post(path, { flow: "2" }); | |
| 120 | expect(bad.status).toBe(422); | |
| 121 | expect(((await bad.json()) as { ok: boolean }).ok).toBe(false); | |
| 122 | expect((await post(path, { flow: "1", back: "/" }, { origin: "https://elsewhere.example" })).status).toBe(403); | |
| 123 | }); | |
| 124 | ||
| 125 | test("the own-token box posts in place: words come as flash or error, never a page", () => { | |
| 126 | const box = ownTokenBox("/alice/yard", "run1"); | |
| 127 | expect(box.text).toContain("data-in-place"); | |
| 128 | expect(box.text).not.toContain("data-own-token-said"); | |
| 129 | }); | |
| 130 | ||
| 131 | test("a wrong own token is a 422 with words, in JSON", async () => { | |
| 132 | const res = await post("/alice/yard/runs/nope/own-token", { token: "x" }); | |
| 133 | expect(res.status).toBe(404); | |
| 134 | }); | |
| 135 | ||
| 136 | test("the theme answers JSON with its cookie, and redirects without script", async () => { | |
| 137 | const res = await post("/theme", { theme: "dark" }); | |
| 138 | isJson(res); | |
| 139 | expect(res.headers.get("set-cookie")).toContain("forge_theme=dark"); | |
| 140 | const plain = await post("/theme", { theme: "dark" }, { json: false }); | |
| 141 | expect(plain.status).toBe(303); | |
| 142 | }); | |
| 143 | ||
| 144 | test("a fleet preview answers JSON naming the panel, which is a fragment; a bad verb is a 422", async () => { | |
| 145 | const res = await post("/fleet", { q: "repo", step: "preview", verb: "autonomy", value: "off" }); | |
| 146 | isJson(res); | |
| 147 | const j = (await res.json()) as { ok: boolean; redraw: string[] }; | |
| 148 | expect(j.ok).toBe(true); | |
| 149 | expect(j.redraw[0]).toStartWith("/fleet/result?"); | |
| 150 | const carried = (j as unknown as { html: string[] }).html[0]!; | |
| 151 | expect(carried).toContain('data-fragment="/fleet/result"'); | |
| 152 | expect(carried).toContain("data-preview"); | |
| 153 | expect(carried).not.toContain("<html"); | |
| 154 | const text = await isFragment(await get(j.redraw[0]!)); | |
| 155 | expect(text).toContain('data-fragment="/fleet/result"'); | |
| 156 | expect(text).toContain("data-preview"); | |
| 157 | const bad = await post("/fleet", { q: "repo", step: "preview", verb: "nonsense", value: "" }); | |
| 158 | expect(bad.status).toBe(422); | |
| 159 | isJson(bad); | |
| 160 | }); | |
| 161 | ||
| 162 | test("a fleet undo of nothing is a 422 in JSON, and a receipt that is not there is an empty fragment", async () => { | |
| 163 | const res = await post("/fleet/ops/nope/undo", {}); | |
| 164 | isJson(res); | |
| 165 | expect(res.status).toBe(422); | |
| 166 | const gone = await get("/fleet/result?op=nope"); | |
| 167 | expect(gone.status).toBe(404); | |
| 168 | expect(await isFragment(gone)).toBe(""); | |
| 169 | }); | |
| 170 | ||
| 171 | test("the machine block and the connection block are fragments, and empty for what is not there", async () => { | |
| 172 | for (const path of ["/games/nope/@cycle", "/settings/origins/nope/connection"]) { | |
| 173 | const res = await get(path); | |
| 174 | expect(res.status).toBe(404); | |
| 175 | expect(await isFragment(res)).toBe(""); | |
| 176 | } | |
| 177 | const cycle = await post("/games/nope/@cycle", { digest: "x" }); | |
| 178 | expect(cycle.status).toBe(404); | |
| 179 | const token = await post("/settings/origins/nope/token", { token: "t" }); | |
| 180 | isJson(token); | |
| 181 | expect(token.status).toBe(422); | |
| 182 | }); | |
| 183 | }); |
test/in-place-offenders.json −10
| @@ -1,17 +1,7 @@ | ||
| 1 | 1 | [ |
| 2 | "src/web/blocked.ts POST (form 1)", | |
| 3 | "src/web/blocked.ts POST (form 2)", | |
| 4 | "src/web/chrome.ts POST :/settings/autonomy/raise", | |
| 5 | 2 | "src/web/diff-view.ts POST :/review", |
| 6 | 3 | "src/web/diff-view.ts POST :/threads/:/:", |
| 7 | "src/web/fleet-act.ts POST /fleet", | |
| 8 | "src/web/fleet-act.ts POST /fleet/ops/:/undo", | |
| 9 | "src/web/flow_button.ts POST (form 1)", | |
| 10 | "src/web/games_machine.ts POST /games/:/@cycle", | |
| 11 | 4 | "src/web/layout.ts POST (form 4)", |
| 12 | "src/web/layout.ts POST /theme", | |
| 13 | "src/web/origin_connection.ts POST /settings/origins/:/token", | |
| 14 | "src/web/own_token.ts POST :/runs/:/own-token", | |
| 15 | 5 | "src/web/pages/account.ts POST /settings", |
| 16 | 6 | "src/web/pages/account.ts POST /settings/account/close", |
| 17 | 7 | "src/web/pages/account.ts POST /settings/account/keep", |
test/no-polling.test.ts +2
| @@ -304,6 +304,8 @@ export function findPolling(source: string): string[] { | ||
| 304 | 304 | const ORIGIN = "needs a connected origin account; the seed connects none"; |
| 305 | 305 | const NOT_WALKED: Record<string, string> = { |
| 306 | 306 | "/:owner/:name/settings/crew/seat/:role": "one seat of the crew card as an HTML fragment, not a page; :role is a seat the seed does not name", |
| 307 | "/games/:box/@cycle": "the machine block of a game box as an HTML fragment, not a page; no document to weigh, and test/game-machine.test.ts seeds a box and reads it", | |
| 308 | "/settings/origins/:id/connection": "one origin's connection block as an HTML fragment, not a page; no document to weigh, and test/origins-page-shape.test.ts seeds an origin and reads it", | |
| 307 | 309 | "/talk/dev/:token": "a frame proxied from a running dev cell, not a page; the seed starts none", |
| 308 | 310 | "/talk/dev/:token/*path": "a file proxied from a running dev cell, not a page; the seed starts none", |
| 309 | 311 | "/infra/end/:act/*path": "the plan of a stop or delete, a page for a cloud resource the seed does not have; the action word is not in the seed", |
test/origins-page-shape.test.ts +27
| @@ -250,3 +250,30 @@ test("a mirror from another forge carries software to its page query, search and | ||
| 250 | 250 | connectionsScreen(f, ctx).render({ x: 0, y: 0, w: 100, h: 8 }, s); |
| 251 | 251 | expect(s.toText()).toContain(`${icon("anvil", "nerd")} anvil.example.org`); |
| 252 | 252 | }); |
| 253 | ||
| 254 | test("an origin's connection block is a fragment for its owner alone; the reach block needs a sign-in", async () => { | |
| 255 | const alice = getUserByName(app.db, "alice")!; | |
| 256 | const o = createOrigin(app.db, root, { userId: alice.id, kind: "forgejo", apiUrl: "https://git.example.com/api/v1/frag", webUrl: "https://git.example.com", login: "frag", token: "t0ken" }); | |
| 257 | if (!o.ok) throw new Error("origin"); | |
| 258 | const bob = await createUser(app.db, { origin: "seed", trusted: true, username: "bob", email: "[email protected]", password: "a-good-passphrase" }); | |
| 259 | if (!bob.ok) throw new Error(bob.error); | |
| 260 | const signed = await fetch(`${servers.url}/signin`, { method: "POST", headers: { origin: servers.url }, body: new URLSearchParams({ username: "bob", password: "a-good-passphrase" }), redirect: "manual" }); | |
| 261 | const other = (signed.headers.get("set-cookie") ?? "").split(";")[0]!; | |
| 262 | const get = (path: string, who: string) => fetch(`${servers.url}${path}`, { headers: { cookie: who, accept: "text/html" } }); | |
| 263 | const mine = await get(`/settings/origins/${o.value.id}/connection`, cookie); | |
| 264 | expect(mine.status).toBe(200); | |
| 265 | const text = await mine.text(); | |
| 266 | expect(text).toContain(`data-fragment="/settings/origins/${o.value.id}/connection"`); | |
| 267 | expect(text).not.toContain("<html"); | |
| 268 | for (const who of [other, ""]) { | |
| 269 | const gone = await get(`/settings/origins/${o.value.id}/connection`, who); | |
| 270 | expect(gone.status).toBe(404); | |
| 271 | expect(await gone.text()).toBe(""); | |
| 272 | } | |
| 273 | const reach = await get("/settings/origins/reach", cookie); | |
| 274 | expect(reach.status).toBe(200); | |
| 275 | expect(await reach.text()).not.toContain("<html"); | |
| 276 | const guest = await get("/settings/origins/reach", ""); | |
| 277 | expect(guest.status).toBe(404); | |
| 278 | expect(await guest.text()).toBe(""); | |
| 279 | }); |
test/own-token.test.ts +2 −2
| @@ -101,9 +101,9 @@ test("a token that is not one, or one Anthropic refuses, keeps nothing and says | ||
| 101 | 101 | const id = held(); |
| 102 | 102 | const notOne = await post(alice, id, "two words"); |
| 103 | 103 | expect(notOne.status).toBe(422); |
| 104 | expect(((await notOne.json()) as { said: string }).said).toContain("That is not a token"); | |
| 104 | expect(((await notOne.json()) as { error: string }).error).toContain("That is not a token"); | |
| 105 | 105 | const refused = await post(alice, id, "sk-ant-oat01-not-the-right-one"); |
| 106 | expect(((await refused.json()) as { said: string }).said).toContain("did not accept that token"); | |
| 106 | expect(((await refused.json()) as { error: string }).error).toContain("did not accept that token"); | |
| 107 | 107 | expect(ownSubscription(app.db, alice.id)).toBeUndefined(); |
| 108 | 108 | expect(getRun(app.db, id)!.notBefore).not.toBeNull(); |
| 109 | 109 | }); |
test/pages-budget.test.ts +2
| @@ -72,6 +72,8 @@ const NOT_PAGES = new Set([ | ||
| 72 | 72 | "/events", "/system/stream", "/settings/teams/stream", "/fleet/graph/live", |
| 73 | 73 | "/settings/traffic/scrapes/export", "/settings/backups/live", "/:owner/:name/stream", |
| 74 | 74 | "/settings/origins/flows/:id/stream", "/boards/:slug/stream", "/boards/stream", "/:owner/:name/archive/:file", // a tarball download, not a page |
| 75 | "/games/:box/@cycle", // the machine block of a game box: no document to weigh; test/game-machine.test.ts seeds a box and reads it | |
| 76 | "/settings/origins/:id/connection", // one origin's connection block: no document to weigh; test/origins-page-shape.test.ts seeds an origin and reads it | |
| 75 | 77 | "/:owner/:name/settings/crew/seat/:role", // one seat of the crew card (#18459), a fragment, not a page |
| 76 | 78 | "/api/v1/runner/jobs/:id/git/info/refs", // a runner's git door for one job (#13652), not a page |
| 77 | 79 | ]); |
test/security-floor-routes.test.ts +2
| @@ -131,6 +131,8 @@ const UNSEEDED: Record<string, string> = { | ||
| 131 | 131 | "/:owner/:name/pulls/:number/review/:step": "needs a pull with a review script, which the seed does not write (test/review-steps.test.ts covers it)", |
| 132 | 132 | "/:owner/:name/settings/app/flags/:flag": "needs an app whose flags.json declares a flag; the seed has none", |
| 133 | 133 | "/:owner/:name/settings/crew/seat/:role": "a crew seat fragment named by a role the seed does not pass; it is a fragment, not a page (test/crew-in-place.test.ts covers it)", |
| 134 | "/games/:box/@cycle": "the machine block of a game box; the seed has no box, and test/game-machine.test.ts seeds one and reads it, owner and not", | |
| 135 | "/settings/origins/:id/connection": "one origin's connection block; the seed connects no origin, and test/origins-page-shape.test.ts seeds one and reads it, owner and not", | |
| 134 | 136 | "/:owner/:name/variants/:group": VARIANT, |
| 135 | 137 | "/:owner/:name/waves/:version": WAVE, |
| 136 | 138 | "/api/v1/boards/:slug/panels/:id": BOARD, |
test/server-timing-sweep.test.ts +3
| @@ -38,6 +38,9 @@ const NOT_PAGES = new Set([ | ||
| 38 | 38 | "/settings/traffic/scrapes/export", |
| 39 | 39 | "/settings/backups/live", |
| 40 | 40 | "/:owner/:name/stream", |
| 41 | "/:owner/:name/settings/crew/line", // a fragment an in-place form redraws: no page, no phases | |
| 42 | "/fleet/result", // likewise | |
| 43 | "/settings/origins/reach", // likewise | |
| 41 | 44 | ]); |
| 42 | 45 | |
| 43 | 46 | /** |
new above
offline