nandi/frqpublic Fork 0
8c38fb8bbe192d09a2f585404b1a38d8f309d0ae
Commits
Clone
git clone https://git.rickub.com/nandi/frq.git
git clone ssh://git@rickub.com/nandi/frq.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

README.md · 55 lines · 2.4 KBmarkdown Blame HistoryRaw
A third target, and the seam that was already waiting for it f54ca45 nandi 2d ago1# `flutter-web`
2
3 modal run .modal/flutter-web/container.py
4 just modal flutter-web
5
6Defined by `container.toml`; see `../spec.md` for the keys.
7Built on the published `arch-nix` image.
8
9`flutter-dev` with the Linux target swapped for the web one: the same
10`clojure -M:cljd compile` over the same `flutter/src` and `common/`,
11then dart2js instead of CMake and Ninja. Same incremental shape --
12the working tree and Flutter's caches live on the `devshell` volume,
13under `frq-flutter-web/` so the desktop container's directory beside
14it is untouched.
15
16Runs as a Sandbox on a real VM (kernel 6.x, not gVisor). The command
17is the sandbox's own process, so it dies when the command exits.
18
19To look at what it built, ask for the serve action -- `[network]
20ports` tunnels 8080 out, and the URL is printed once the sandbox is
21scheduled:
22
23 modal run .modal/flutter-web/container.py \
24 --command 'cd /devshell/frq-flutter-web && nix develop /app#flutter-web --command just -f /devshell/frq-flutter-web/justfile flutter-web serve'
25
26That blocks until you Ctrl-C it, and it bills until you do.
27
28## It compiles; it does not start
29
30dart2js links the whole app -- `main.dart.js` is 3.6MB and has
31`frq`, `irc`, `atproto` and `handshake` all through it, so the
32`dart:io` imports under `flutter/src` are not the wall they look
33like. What stops it is the first line of `main`:
34`getApplicationDocumentsDirectory` is a platform channel, path_provider
35ships no web implementation, and the channel with no handler behind it
36throws `MissingPluginException`. `main` awaits that before installing
37`frq.io.dart`, so no widget is ever built and the page stays white.
38
39That is the seam doing its job rather than a build problem. The fix is
40a `frq.io.web` behind `frq.io` -- the browser's answer for a private
41file is IndexedDB or localStorage, not a directory -- and `main`
42choosing it the way `flutter/src/frq/main.cljd` chooses the Dart one
43now. `frq.net.web` is the next one after it, for the same reason: a
44browser has no raw socket, so the IRC connection wants a WebSocket.
45
46## Serving it
47
48`serve.py` is the other half: a Function that mounts the same volume
49and hands out `flutter/build/web`, so a rebuild in the Sandbox is
50picked up by the next cold start with nothing redeployed.
51
52 modal deploy .modal/flutter-web/serve.py
53
54`[network] ports` tunnels 8080 out of the Sandbox as well, for the
55case where you want the build and the server to be one process.