Expand description
geop open [DIR]: the web editor in a browser, its kernel this process
and its workspace the folder DIR.
The page is the web app as vite build --mode open builds it
(web/src/backend.local.ts), embedded in the executable with the
feature frontend. It talks to this process over HTTP on 127.0.0.1:
GET /ws?token=…: a WebSocket to the editor’sSession. Each text message is one command of the JSON protocolgeop servespeaks on its stdin, and is answered, in order, by one message: the update.GET /api/files: the folder’s program and data files, by their paths relative to it, with the one to edit first, if one was named.PUT /api/file?path=…writes a file,DELETEremoves one.POST /api/raisebrings the window showing the page to the front: only ingeop app, where it is how a secondgeop appof the same folder hands over to the first (seeapp.rs).- Anything else is a file of the page itself.
What can reach 127.0.0.1 is more than the user: every page the browser
has open can send requests to it, and a page of a name that resolves to
127.0.0.1 (DNS rebinding) can even read the answers. So every request
must name this server as its Host, a request from a page must come
from this server’s own origin, and the WebSocket and the file API take
a token that is made afresh each run and given only in the URL printed
(see Access). The file API reads and writes only files under DIR,
of the kinds the explorer shows, never through a link out of it (see
[Folder]).
The editor is one, for every WebSocket: a thread owns it and answers
the commands the connections send it (SessionHandle). That is the
session another front end would attach to — an MCP client driving what
the page shows (geop mcp --attach, not yet written) would be another
sender of commands to it.
Structs§
- Access
- Who this server answers: requests naming it as their host, from its own pages, and — for the editor and the files — knowing the token.
- Claims
- What a request says of where it comes from.
- Open
Args - Server 🔒
- What every request is answered with.
- Serving
- The editor of a folder, served on 127.0.0.1: bound, and answering
once
Serving::runis. - Session
Handle - The editor’s session, answering the commands sent to it in the order they come, from whichever sender. Cloned for every connection.
Enums§
- Route
- How a request is let in.
Functions§
- answer 🔒
- folder_
of - The folder
pathnames — or the one a programpathis in — with the program to edit first, if one was named. - header 🔒
- json 🔒
- media_
type - What the page’s file
pathis, for itsContent-Type. - open
- open_
browser - Open the default browser at
url. - page_
file 🔒 - The file of the page at
path, if the page was built in. - page_
missing - Why this
geopcannot serve the editor’s page, if it cannot: it was built without it. - percent_
decoded textwith every%XXand+decoded, if it is UTF-8 then.- query_
value - The value of
keyin the queryquery(a=1&b=2), percent-decoded. - same 🔒
- Whether
aandbare equal, in a time that does not tell how much of them is. - socket 🔒
- Answer the commands of one WebSocket until it closes.
- text 🔒