@axium/office 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -5
- package/dist/common.d.ts +1 -0
- package/dist/common.js +2 -0
- package/dist/server/documentserver.js +6 -1
- package/locales/en.json +1 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -21,17 +21,23 @@ services:
|
|
|
21
21
|
restart: unless-stopped
|
|
22
22
|
ports:
|
|
23
23
|
- 127.0.0.1:8080:80
|
|
24
|
+
- '[::1]:8080:80'
|
|
24
25
|
environment:
|
|
25
26
|
JWT_SECRET: ${OFFICE_SECRET} # the plugin's `secret`
|
|
26
27
|
volumes:
|
|
27
|
-
- ./documentserver/data:/var/www/euro-office/Data
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
- ./fonts:/usr/share/fonts/truetype/custom:ro
|
|
28
|
+
- ./documentserver/data:/var/www/euro-office/Data:z
|
|
29
|
+
- logs:/var/log/euro-office/documentserver
|
|
30
|
+
- cache:/var/lib/euro-office/documentserver
|
|
31
|
+
- database:/var/lib/postgresql
|
|
32
|
+
- ./fonts:/usr/share/fonts/truetype/custom:ro,z
|
|
32
33
|
# Only if `internal_url` points at this host rather than Axium's public origin
|
|
33
34
|
# extra_hosts:
|
|
34
35
|
# - host.docker.internal:host-gateway
|
|
36
|
+
|
|
37
|
+
volumes:
|
|
38
|
+
logs:
|
|
39
|
+
cache:
|
|
40
|
+
database:
|
|
35
41
|
```
|
|
36
42
|
|
|
37
43
|
- **Secret:** `JWT_SECRET` must equal the plugin's `secret`. Generate one with `openssl rand -hex 32`.
|
|
@@ -40,6 +46,9 @@ services:
|
|
|
40
46
|
- `cache` holds the files of open sessions.
|
|
41
47
|
- `database` holds the session state that lets editing survive a restart.
|
|
42
48
|
- `logs` is for troubleshooting.
|
|
49
|
+
- `logs`, `cache` and `database` must be named volumes. Docker fills a named volume with the directories the image has at that path (the Postgres cluster, each service's log directory, the converter's working directories), while an empty bind mount hides them and the server exits at startup.
|
|
50
|
+
- `:z` relabels bind mounts for SELinux. Without it, hosts that enforce SELinux deny the container's writes and it exits at startup.
|
|
51
|
+
- **Ports:** `localhost` may resolve to `::1` first, e.g. in `cloudflared`, so the port is published on both loopback addresses.
|
|
43
52
|
- **Fonts:** fonts in `/usr/share/fonts/truetype/custom` are indexed when the container starts. Documents whose fonts are missing are laid out with substitutes, so lines and pages break differently; e.g. Palatino Linotype is not included. Add the fonts your documents use (licensed copies, or metric-compatible ones such as TeX Gyre Pagella or URW P052 for Palatino).
|
|
44
53
|
- **Autosave:** the image saves open documents with changes every 5 minutes, not only when the last editor closes or someone presses Save.
|
|
45
54
|
|
|
@@ -48,4 +57,5 @@ services:
|
|
|
48
57
|
- **Cloudflare Tunnel:** route a hostname such as `documents.example.com` to `http://localhost:8080` and set `server_url` to `https://documents.example.com`. TLS ends at Cloudflare, and the container serves plain HTTP. The tunnel forwards `X-Forwarded-Proto: https` and the public `Host`, which the server uses for the absolute URLs it generates, so no setting is needed.
|
|
49
58
|
- **Other reverse proxies** must forward `Host` (or `X-Forwarded-Host`) and `X-Forwarded-Proto`. To serve the server under a path, the proxy strips the path and sends it as `X-Forwarded-Prefix`, and `server_url` includes it. A hostname of its own is simpler.
|
|
50
59
|
- **TLS in the container:** mount a certificate and key, set `SSL_CERTIFICATE_PATH` and `SSL_KEY_PATH` to their paths, and publish port 443, e.g. `8443:443` for the default `server_url`.
|
|
60
|
+
- **`server_internal_url`:** where Axium downloads saved documents from the document server; it defaults to `server_url`. Set it to a local address, e.g. `http://localhost:8080`, when requests from Axium to `server_url` would be blocked or slowed, as Cloudflare's bot protection does.
|
|
51
61
|
- **`internal_url`:** the container can reach Axium through its public origin, the default, which goes through the tunnel and needs no host mapping. Or it can use a local address, e.g. `https://host.docker.internal` with the `extra_hosts` entry above. That address needs a certificate the server trusts, or set `USE_UNAUTHORIZED_STORAGE=true`. Local Axium addresses also need `ALLOW_PRIVATE_IP_ADDRESS=true`.
|
package/dist/common.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export declare function formatOf(item: {
|
|
|
27
27
|
export declare const Config: z.ZodObject<{
|
|
28
28
|
server_url: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
|
|
29
29
|
internal_url: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
|
|
30
|
+
server_internal_url: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
|
|
30
31
|
secret: z.ZodString;
|
|
31
32
|
}, z.core.$strip>;
|
|
32
33
|
export interface Config extends z.infer<typeof Config> {
|
package/dist/common.js
CHANGED
|
@@ -34,6 +34,8 @@ export const Config = z
|
|
|
34
34
|
server_url: z.url().nullish(),
|
|
35
35
|
/** Where the document server reaches Axium */
|
|
36
36
|
internal_url: z.url().nullish(),
|
|
37
|
+
/** Where Axium reaches the document server */
|
|
38
|
+
server_internal_url: z.url().nullish(),
|
|
37
39
|
/** The document server's JWT secret */
|
|
38
40
|
secret: z.string().register(locales.zod, { secret: true }),
|
|
39
41
|
})
|
|
@@ -26,6 +26,11 @@ function serverURL() {
|
|
|
26
26
|
const { protocol, hostname } = new URL(serverConfig.origin);
|
|
27
27
|
return new URL(`${protocol}//${hostname}:8443`);
|
|
28
28
|
}
|
|
29
|
+
/** Where Axium reaches the document server, which defaults to where browsers reach it */
|
|
30
|
+
function serverInternalURL() {
|
|
31
|
+
const { server_internal_url } = getConfig('@axium/office');
|
|
32
|
+
return server_internal_url ? new URL(server_internal_url) : serverURL();
|
|
33
|
+
}
|
|
29
34
|
/** Where the document server reaches Axium */
|
|
30
35
|
function internalURL() {
|
|
31
36
|
return getConfig('@axium/office').internal_url ?? serverConfig.origin;
|
|
@@ -127,7 +132,7 @@ addRoute({
|
|
|
127
132
|
/** The document server only offers saved documents from itself, so this refuses to download from anywhere else */
|
|
128
133
|
async function save(itemId, location) {
|
|
129
134
|
const url = new URL(location);
|
|
130
|
-
const server =
|
|
135
|
+
const server = serverInternalURL();
|
|
131
136
|
url.protocol = server.protocol;
|
|
132
137
|
url.host = server.host;
|
|
133
138
|
const response = await fetch(url);
|
package/locales/en.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axium/office",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"author": "James Prevett <axium@jamespre.dev>",
|
|
5
5
|
"description": "Office documents for Axium, edited with Euro-Office or OnlyOffice",
|
|
6
6
|
"funding": {
|
|
@@ -64,8 +64,9 @@
|
|
|
64
64
|
"config": {
|
|
65
65
|
"server_url": null,
|
|
66
66
|
"internal_url": null,
|
|
67
|
+
"server_internal_url": null,
|
|
67
68
|
"secret": ""
|
|
68
69
|
},
|
|
69
|
-
"update_checks":
|
|
70
|
+
"update_checks": true
|
|
70
71
|
}
|
|
71
72
|
}
|