Sharing: the default server is a build-time setting

FIGCRAFT_DEFAULT_SERVER, set when compiling, names another server or, set to nothing, ships a
build with no default: online sharing then stays off until the user enters a server in
Preferences. Normal builds and the release workflow are unchanged.
This commit is contained in:
bflatastic authored and BFlat committed 2026-10-13 03:01:34 +07:00
1 parent 511213e820
commit 794b83a0db
5 files changed
+33 -4

No files matched your search

+2 -1
View File
@@ -269,7 +269,8 @@ share or join a file. Live sessions are a **preview**. Before you share anything
know what sharing does:
- **Share ▸ Online uploads the file to a server.** By default that is the public server at
`collab.craftapps.dev`; you can set another one, or your own, in Preferences. The file stays on
`collab.craftapps.dev`; you can set another one, or your own, in Preferences (and a build can
ship without it: [`docs/releasing.md`](docs/releasing.md#the-default-server)). The file stays on
the server after you stop sharing, until you remove it (Share ▸ Advanced ▸ Remove from server…)
or nobody has opened it for 30 days, when a public server deletes it.
- **It is not end-to-end encrypted.** The connection to the server is encrypted (TLS), but the
+8 -1
View File
@@ -61,7 +61,14 @@ use crate::{DocState, EngineError, Result, Session, TextEdit, ViewState, bad, sp
/// The server files are shared through online unless Preferences name another: the only place
/// its address is written.
pub const DEFAULT_SERVER: &str = "wss://collab.craftapps.dev/";
///
/// A build can ship another one, or none: set `FIGCRAFT_DEFAULT_SERVER` when compiling to a
/// server's address (`wss://host/`), or to nothing (`FIGCRAFT_DEFAULT_SERVER=`) for a build whose
/// online sharing stays off until the user enters a server in Preferences.
pub const DEFAULT_SERVER: &str = match option_env!("FIGCRAFT_DEFAULT_SERVER") {
Some(server) => server,
None => "wss://collab.craftapps.dev/",
};
/// Most selected ids one presence update carries (the rest aren't shown to others).
pub const MAX_SELECTION: usize = 10_000;
+5 -1
View File
@@ -164,7 +164,11 @@ fn on_the_server_unshared(s: &mut Session, script: &Arc<Mutex<Script>>) {
fn the_built_in_server_is_the_default_and_can_be_changed_or_turned_off() {
let (mut s, _) = session();
assert_eq!(s.prefs.publish_server, DEFAULT_SERVER);
assert!(DEFAULT_SERVER.starts_with("wss://") && DEFAULT_SERVER.ends_with('/'), "TLS, and an address the preference itself accepts");
// A build may ship without one (`FIGCRAFT_DEFAULT_SERVER=`); any it ships is TLS.
assert!(
DEFAULT_SERVER.is_empty() || (DEFAULT_SERVER.starts_with("wss://") && DEFAULT_SERVER.ends_with('/')),
"TLS, and an address the preference itself accepts"
);
assert_eq!(ex(&mut s, "pref.publishServer", json!({"url": DEFAULT_SERVER}))["url"], DEFAULT_SERVER);
// Another server; back to the built-in one; off.
assert_eq!(ex(&mut s, "pref.publishServer", json!({"url": "wss://share.example/"}))["url"], "wss://share.example/");
+16
View File
@@ -52,6 +52,22 @@ Windows and draft-release jobs declare `environment: release`; off the `release`
environment refuses them (0 steps) and no release is created. The `version` input is applied with
`xtask version set` before building, so the binaries report it too.
## The default server
Share ▸ Online uses the server in Preferences, which starts as the public one built into the app
(`figcraft_engine::live::DEFAULT_SERVER`). Distributions that would rather not ship that default
set `FIGCRAFT_DEFAULT_SERVER` when building: to their own server's address (`wss://host/`), or to
nothing for a build with no default, where online sharing stays off until the user enters a
server (sharing on the local network works either way):
```sh
FIGCRAFT_DEFAULT_SERVER= cargo build --release -p figcraft # no default server
FIGCRAFT_DEFAULT_SERVER=wss://design.example.org/ cargo build --release -p figcraft
```
The release workflow leaves it unset. The public server's terms are in
[`online-sharing-terms.md`](online-sharing-terms.md).
## What gets built
| Platform | Artifacts | Built on |
+2 -1
View File
@@ -728,7 +728,8 @@ sudo systemctl start figcraft-server
the server; on the server they are stored unencrypted, so the operator and anyone who can read
the data directory can read every file. Tell the people who publish to your server so (the
README's [Privacy and online sharing](../README.md#privacy-and-online-sharing) says it for the
default public server, whose terms are [online-sharing-terms.md](online-sharing-terms.md): a
default public server, which a build can replace or leave out with `FIGCRAFT_DEFAULT_SERVER`
([releasing](releasing.md#the-default-server)), and whose terms are [online-sharing-terms.md](online-sharing-terms.md): a
starting point for your own), and set `operator_contact` and `terms_url` on a public one.
- **Access** is a share link (128-bit random token) per file and access level, an owner token
(128-bit) per file published without the key, or the server key (128-bit) for managing files.