mirror of
https://github.com/narrrl/narl-workspace.git
synced 2026-11-04 00:47:01 +01:00
A `!` now means force or everything and nothing else (`:w!`, `:search!`, `:export!`, `:logout!`). A command that did a second thing behind its bang takes a word for it instead: `:space new|name|rm`, `:list name|rm`, `:task [add]|edit`, `:upload seal`, `:import zip [/]`. `:card` while reading a document makes a card about it, so `:card!` is gone. Merged: `:export` downloads what has focus, a file as it is or a document as markdown (`:download` folded in); `:share [off|new]` replaces `:unshare` and `:link`, and the list's `s` and `y` give way to it and the info sheet; `:noh` replaces `:clear`; `:vault [unlock|lock|passwd]` replaces `:unlock`, `:lock` and `:passwd`; Esc in the list puts down what `m` picked up before it closes the document, replacing `:unmark`. The old spellings run as their new lines for one release through a table in commands.ts; help and Tab leave them out, and the wiki lists them. A settings sheet (`,` or `:settings`) holds the options, the vault, the backup, the signed-in browsers, ssh keys and capture tokens. Each row runs the command a line would. Bare `:set`, `:vault`, `:backup`, `:sessions`, `:sshkey` and `:token` open it at their part. `?` shows the keys and commands to start with, flagged in the keymap and the command table; a second `?` (or `:help all`) shows all of them, and a filter always searches all of them. Help rows are keyed by key and description, as two contexts can share a label.
94 lines
4.3 KiB
Markdown
94 lines
4.3 KiB
Markdown
# Not losing things
|
|
|
|
The workspace is meant to be the one place things are kept, so it tries hard
|
|
not to lose any of them. This page covers what protects your work, and how to
|
|
get it back.
|
|
|
|
## Saving
|
|
|
|
Each change is written to the browser's storage as it is typed and to the
|
|
server a couple of seconds later. A dropped network, an expired session or a
|
|
crashed tab does not lose a draft, and a save from elsewhere is not overwritten
|
|
without asking. See [Writing](Writing.md#saving).
|
|
|
|
## History
|
|
|
|
A save keeps the text it replaces. `gh` or `:history` lists the open document's
|
|
earlier versions, the newest first.
|
|
|
|

|
|
|
|
The version under the cursor is shown as a diff against the text as it is now:
|
|
`-` is what bringing it back would take out, `+` what it would put back. `Enter`
|
|
brings it back, and the text it replaces becomes a version of its own, so a
|
|
restore can be undone the same way.
|
|
|
|
- Autosave writes every few seconds, so an ordinary save keeps a version at
|
|
most every ten minutes.
|
|
- `:w!`, a save over the SFTP mount, a link rewritten by a rename, and a
|
|
restore always keep one, because each of them may undo something.
|
|
- A rename alone keeps nothing.
|
|
- The daily sweep forgets versions older than `WORKSPACE_REVISION_DAYS`
|
|
(90 by default), but always keeps the newest 20 of each document.
|
|
- An upload is kept as long as a version still embeds it. A file that has been
|
|
sealed since is gone from the old version, because sealing deletes the
|
|
plaintext on purpose.
|
|
|
|
## The trash
|
|
|
|
A delete is not final. `x`, `dd`, `:delete`, `:space rm` and an `rm` over the
|
|
mount put what they delete in the trash, with everything inside it.
|
|
|
|
- `u` puts the last delete back where it was: the same folder, the same name,
|
|
unless a new one took the name meanwhile.
|
|
- `:trash` lists everything in it, the last deleted first. `j`/`k` walk it,
|
|
`Enter` or `r` restores, `x` deletes one for good, and `:trash purge`
|
|
empties it. Each of these asks first.
|
|
- Something whose folder has gone since comes back to the root of its space.
|
|
Something whose space is in the trash too waits until the space is restored.
|
|
- After `WORKSPACE_TRASH_DAYS` (30 by default) the daily sweep deletes it for
|
|
good, files and all.
|
|
|
|
While it is in the trash, a node is out of sight: not in the tree, the search,
|
|
the agenda, the mails, the SFTP mount, the export or the readable view on
|
|
Proton Drive. A card whose notes are in the trash finds them again after a
|
|
restore, and a shared document answers like an unknown link until it is
|
|
restored, with the same link its readers already have.
|
|
|
|
## Export
|
|
|
|
- `:export` downloads the open document as markdown.
|
|
- `:export!` downloads the whole workspace as a zip.
|
|
|
|
The zip needs nothing from this application to be read: the tree as real
|
|
directories, one markdown file per document, every file where it sits, every
|
|
embedded upload in `media/`, all under their real names, with relative links
|
|
between them. What plain files have no place for (when each entry was written,
|
|
names as they were typed, which space is the diary, the boards with their cards
|
|
and rules) goes into one `.workspace.json` beside them.
|
|
|
|
`:export!` refuses while the vault is shut, because the archive has to hold the
|
|
sealed files opened.
|
|
|
|
## Import
|
|
|
|
- `:import` picks a folder and uploads it into the one you are in. Directories
|
|
become folders, `.md` and `.markdown` files become documents (named by their
|
|
first heading), and anything else becomes a file.
|
|
- `:import zip` does the same with a zip.
|
|
- `:import zip /` pours an `:export!` back in at the root. Each directory becomes a
|
|
space again, or goes into the space already there by that name, and with
|
|
`.workspace.json` the dates, names, boards and cards come back as they were.
|
|
|
|
Links between imported files are rewritten as they land: a link to a markdown
|
|
file becomes the document's address, a link to an image its upload. Anything
|
|
pointing outside the upload is left as it was. Absolute paths, `..` and
|
|
anything else a zip might smuggle in are refused.
|
|
|
|
## Backups
|
|
|
|
The data directory, `WORKSPACE_DATA_DIR`, is the whole backup: `diary.db`
|
|
and `uploads/`. Before a new build changes the database it copies it to
|
|
`diary.db.pre-<version>` next to it. The server can also mirror itself to
|
|
Proton Drive, end-to-end encrypted; see [Backup and mail](Backup-and-Mail.md).
|