Files
exercise_builder/README.md
T
ryan c18510b3c3 Import the exercise builder
The drag-and-drop workspace for building BI122G exercise sheets, served
by the Workshop at /projects/exercise-builder. Plain HTML, CSS and ES
modules; no build step. It runs entirely in the browser — work in
progress lives in localStorage and finished sheets leave as downloads,
so nothing is written on the server.

This directory is canonical. It began as a deployment target for
deploy_builder.sh syncing from the BI122G course folder, and that
arrangement has ended; see the README.

Includes the sheet's light/dark switch: the stylesheet already carried
both themes and followed the reader's system setting, so this adds the
control that overrides it — a corner toggle built by sheet.js, applied
before first paint by a head script the exporter writes, and hidden in
print. The builder's toolbar previews the same attribute on the canvas.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ed5kU3HfZq9dfj7EYj5J2v
2026-08-11 19:59:59 +02:00

2.5 KiB

Exercise Builder — hosted copy

The drag-and-drop workspace for building BI122G exercise sheets, served by the Workshop at:

/projects/exercise-builder          landing page
/projects/exercise-builder/app      the builder itself

Open to everyone; no sign-in.

What is here

app/        the builder — plain HTML, CSS, and ES modules. No build step.

app/ is the whole application. It runs entirely in the browser: work in progress lives in the visitor's localStorage, and finished sheets and project files leave as downloads. Nothing is written on the server, and there is no endpoint that could write anything. That is what makes it safe to host without a login.

Note this differs from the local development setup in the course folder, where edit_server.py accepts POST /__save and writes sheets straight to disk. That server is not deployed here, and must not be — reachable without a login it would be a write primitive for anyone who could load the page.

How it is served

workshop/src/routes/projects/exercise-builder/app/[...file]/+server.ts reads this directory at request time. Consequences worth knowing:

  • Updating the builder does not need a site rebuild. Sync new files here and a reload picks them up (responses are no-cache with an mtime-based ETag). A rebuild is only needed when the landing page or the route itself changes.
  • Only recognised asset extensions are reachable, and paths are contained to this directory — so nothing outside app/ can be requested.
  • .js is served as text/javascript, without which browsers refuse ES modules outright.
  • The route injects <base href="/projects/exercise-builder/app/"> into the served HTML, so the builder's relative URLs resolve whether or not the visitor typed a trailing slash.

Override the location with EXERCISE_BUILDER_ROOT in the workshop .env if it ever moves.

Updating

Edit the files here. There is no build step and no sync — a reload picks the change up, for the reasons above.

Source of truth

This directory. The builder was developed in the BI122G course folder on the workstation (/Muspelheim/Employment/HiS/Teaching/BI122G) and pushed here by deploy_builder.sh. That arrangement has ended and this installation is now canonical: do not run deploy_builder.sh again, as it would overwrite this directory with the older course-folder copy.

The course folder still holds test.mjs, a Node test harness that was never deployed here — it needs linkedom and is no use in a browser.