stilo serve
stilo serve [folder] [--host HOST] [--port PORT] [--web WEB]
Serves a folder of Texl documents, and the web editor that edits them, over HTTP.
stilo serve ~/reports
Stilo: serving /home/ada/reports at http://127.0.0.1:8010/ (press Ctrl+C here to stop)
Open the address in your browser to see the folder in the editor. Press Ctrl+C in the terminal to stop the server; it says Stilo: stopped. Goodbye!
Arguments and options
| Argument | Default | Meaning |
|---|---|---|
folder | the current folder | The folder of the documents. It is the root of the server: everything under it can be read, its .texl files can be written, and its files and folders can be created, uploaded, moved and deleted. |
--host HOST | 127.0.0.1 | The address to listen on. The default accepts connections from your own computer only. |
--port PORT | 8010 | The port to listen on. Choose another one if a program already uses it. |
--web WEB | the one installed with Stilo | The built web editor. Change it only to serve another build of it. |
Addresses
Every document has one address: its path in the folder. With the server
above, ~/reports/projects/beam.texl is at:
http://127.0.0.1:8010/projects/beam.texl
- In a browser, the address of a document opens it in the editor.
- For a Texl import, the same address gives the file itself. This is how
one document imports another:
texl.import("../library/steel.texl")inprojects/beam.texlreadslibrary/steel.texlfrom the server.
The editor's navigation pane shows the whole folder. Add ?root= to an
address to show only a part of it:
http://127.0.0.1:8010/projects/beam.texl?root=projects
What is served
- Every file is listed in the navigation pane. Only
.texlfiles are documents, which the editor opens and saves. Other files (images, PDFs, data) can be uploaded, renamed, moved and deleted, and read by an import, a link or an image in a document. - A packed package (
.texlz) is shown as a folder that cannot be changed: its documents open read-only, and imports reach into it. The file itself can be uploaded, renamed, moved, deleted and downloaded. - Files and folders that Stilo has no permission to change on your computer are read-only too: the navigation pane shows them with a lock.
- For an import, the address of a folder or a packed package leads to its
index.texl. Add?downloadto the address of a file to download it. - Every other file has its own address, and comes as itself, with its real type. A file of an unknown type downloads. HTML, XML and SVG files opened by their address cannot run scripts, so a file in the folder cannot change your documents.
- Hidden files and folders (names starting with
.) are never served. This includes.trash, where deleted files go. - Names starting with
_are reserved at the top of the folder (the server uses/_apiand/_app): files and folders with such names there are not served. - Symbolic links that lead out of the folder are not followed.
Programmers who want to talk to the server from their own programs find its protocol in the Stilo repository.
Serving to other computers
The server has no accounts and no passwords: anybody who can reach it can
read, change, move and delete every document in the folder. --host 0.0.0.0 makes it
reachable from your network; do that only on a network you trust, or put
the server behind your own access control (a VPN, or a proxy that asks for
a password).
stilo serve ~/reports --host 0.0.0.0 --port 8080