Compare commits
47
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd3e215b4d | ||
|
|
8f53181693 | ||
|
|
9c47609215 | ||
|
|
8d846892d5 | ||
|
|
7eca6452bb | ||
|
|
0d779d1bc1 | ||
|
|
515e6debe4 | ||
|
|
c9c276d9de | ||
|
|
a451a9de0a | ||
|
|
24f25d8143 | ||
|
|
8b6746667b | ||
|
|
20bb8f85a8 | ||
|
|
331017116e | ||
|
|
8a51e77216 | ||
|
|
e0a1ef293e | ||
|
|
39f429a9da | ||
|
|
7a609f4815 | ||
|
|
72727c96c5 | ||
|
|
84dd1616e7 | ||
|
|
75aaa197aa | ||
|
|
555ae6a991 | ||
|
|
07cd51ac1f | ||
|
|
4d9af52c70 | ||
|
|
c6a504c951 | ||
|
|
2093f17fa5 | ||
|
|
e8b41e57e5 | ||
|
|
3e2601b496 | ||
|
|
d9eb0dfc44 | ||
|
|
845e68316d | ||
|
|
9b5d2ed657 | ||
|
|
0143a1a760 | ||
|
|
7fbceb5cdb | ||
|
|
caccbd8f9d | ||
|
|
50c4efc09b | ||
|
|
e935abd0c3 | ||
|
|
f52861ffb8 | ||
|
|
acd7612e7c | ||
|
|
87c6b755b1 | ||
|
|
21cc43a1c3 | ||
|
|
5aeb3c5d50 | ||
|
|
06925e9af8 | ||
|
|
60d2e5d80f | ||
|
|
7bceeb255e | ||
|
|
ba213e1a3b | ||
|
|
21a3b5c59f | ||
|
|
bd794f98a2 | ||
|
|
f8af0b81a9 |
@@ -2,19 +2,6 @@ name: runner nix smoke
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- .gitea/workflows/runner-nix-smoke.yaml
|
||||
- flake.lock
|
||||
- flake.nix
|
||||
- infra/gitea-runners/**
|
||||
- lib/**
|
||||
- legacy/**
|
||||
- nixos/**
|
||||
- package/**
|
||||
- test/**
|
||||
|
||||
jobs:
|
||||
smoke:
|
||||
|
||||
@@ -2,12 +2,6 @@ name: runner ubuntu smoke
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- .gitea/workflows/runner-ubuntu-smoke.yaml
|
||||
- infra/gitea-runners/**
|
||||
|
||||
jobs:
|
||||
smoke:
|
||||
|
||||
@@ -2,8 +2,13 @@
|
||||
|
||||
- [Using the `hectic` Attic Cache](./attic-cache.md)
|
||||
- [Minecraft incident log](./minecraft-incidents.md)
|
||||
- [WorldOfSosal source versions and reset](./world-of-sosal-reset.md)
|
||||
- [Project Zomboid backups](./project-zomboid-backups.md)
|
||||
- [Minecraft backups](./minecraft-backups.md)
|
||||
- [Gitea Kanban CLI](./gitea-kanban-cli.md)
|
||||
- [AFFiNE document typography](./affine-typography.md)
|
||||
- [Native AFFiNE deployment and migration](./affine-native.md)
|
||||
- [ChatGPT subscription connector for AFFiNE](./affine-chatgpt.md)
|
||||
|
||||
## Gitea runner labels
|
||||
|
||||
|
||||
@@ -0,0 +1,276 @@
|
||||
# AFFiNE ChatGPT subscription connector
|
||||
|
||||
`affine-chatgpt` uses the official Sign in with ChatGPT preview flow. It does not
|
||||
use browser cookies, another application's OAuth client, or an API-billing
|
||||
fallback. Account eligibility and usage limits are controlled by OpenAI.
|
||||
|
||||
## Native service
|
||||
|
||||
The reusable NixOS module is `hectic.services.affine-chatgpt`. The hectic-lab
|
||||
host enables it in `nixos/system/hectic-lab/affine-chatgpt.nix`.
|
||||
|
||||
- Unit: `affine-chatgpt.service`, running as `affine-chatgpt`.
|
||||
- Listener: `127.0.0.1:3012`; no public port or Docker dependency.
|
||||
- OAuth state: `/var/lib/affine-chatgpt/session`, mode `0700`.
|
||||
- Credentials and stable gateway key: owner-only files, mode `0600`.
|
||||
- Gateway key: `/var/lib/affine-chatgpt/gateway-key`.
|
||||
|
||||
Do not put credentials or key contents in Nix expressions, the Nix store,
|
||||
environment variables, command arguments, logs, screenshots, or Git. The
|
||||
service receives only the protected key's path. Keep the key stable: AFFiNE
|
||||
stores its value as an encrypted workspace BYOK credential.
|
||||
|
||||
The service is deliberately not started when the OAuth credential file is
|
||||
absent. Provision the state before starting it, using the service account's
|
||||
ownership. Preserve the original private directory/file permissions.
|
||||
|
||||
## Authorize and move a session
|
||||
|
||||
On the computer running the user's regular browser:
|
||||
|
||||
```sh
|
||||
nix run .#affine-chatgpt -- login
|
||||
nix run .#affine-chatgpt -- status
|
||||
nix run .#affine-chatgpt -- models
|
||||
```
|
||||
|
||||
Open the printed OpenAI authorization URL in the normal browser, not a
|
||||
temporary automation browser. Complete login, any passkey challenge, and app
|
||||
consent. The loopback callback is `http://127.0.0.1:1455/auth/callback`; the
|
||||
listener expires after 15 minutes unless `login --timeout` is specified.
|
||||
|
||||
For a self-hosted VM, securely transfer the complete credential record over
|
||||
SSH. Create and persist a distinct VM host ID in `session/host.json`; do not
|
||||
overwrite it with the laptop's host ID. Associate the imported credential's
|
||||
`host_id` with that VM. Use the same issued client registration, not the
|
||||
`dynamic_agent_client` registration entrypoint, for subsequent token exchanges.
|
||||
|
||||
After a successful remote model and inference test, remove the local active
|
||||
credential record. Only the VM should rotate the imported refresh token.
|
||||
Never copy a different application's credential record or session cookies.
|
||||
|
||||
Login and model-list success prove enrollment and catalog access, not working
|
||||
inference. Require a streamed request ending with `response.completed` before
|
||||
claiming that the subscription works.
|
||||
|
||||
## AFFiNE configuration
|
||||
|
||||
Configure these settings through AFFiNE's supported administrator API/UI, not
|
||||
direct SQL or source-embedded secrets:
|
||||
|
||||
```json
|
||||
{
|
||||
"copilot.enabled": true,
|
||||
"copilot.byok.enabled": true,
|
||||
"copilot.byok.allowedProviders": ["openai"],
|
||||
"copilot.byok.allowCustomEndpoint": true,
|
||||
"copilot.byok.allowPrivateEndpoint": true
|
||||
}
|
||||
```
|
||||
|
||||
The native AFFiNE wrapper sets `DEPLOYMENT_TYPE=selfhosted`, required for custom
|
||||
endpoints. The stable AFFiNE `private.key` must be preserved so stored BYOK
|
||||
credentials remain decryptable.
|
||||
|
||||
Add a workspace BYOK provider:
|
||||
|
||||
- Provider: `openai`.
|
||||
- Endpoint kind: `openai_compatible`.
|
||||
- URL: `http://127.0.0.1:3012/v1`.
|
||||
- Dialect: `responses`, not Chat Completions.
|
||||
- Credential: the protected gateway key, not an OpenAI token.
|
||||
- Model: a slug returned by the authorized account's catalog.
|
||||
- Initial capabilities: text input/output and `tool_calling`, no attachments.
|
||||
|
||||
Persistent AFFiNE BYOK is workspace-wide. All authorized workspace members can
|
||||
consume the connected account's limits and send document context/tool results
|
||||
to OpenAI. User consent to shared access does not replace OpenAI's account and
|
||||
subscription terms.
|
||||
|
||||
## Supported transport
|
||||
|
||||
The gateway authenticates requests before reading their bodies. It supports
|
||||
`GET /v1/models` and `POST /v1/responses`, text history, function/custom tools,
|
||||
and function-call results. AFFiNE executes tools; the gateway never executes
|
||||
shell commands or document tools itself.
|
||||
|
||||
Upstream requests always use `store:false` and `stream:true`. Non-streaming
|
||||
AFFiNE probes are assembled from completed SSE output items and the final
|
||||
completion event. An explicitly non-SSE Content-Type is rejected; a missing
|
||||
Content-Type is accepted only through the same strict SSE parser. Failed,
|
||||
incomplete, malformed, or interrupted streams are not reported as successful.
|
||||
|
||||
Image generation, image/file/audio attachments, hosted MCP, Code Interpreter,
|
||||
and persistent Responses conversation IDs are not supported. Do not declare
|
||||
those capabilities in AFFiNE.
|
||||
|
||||
## Verification and development
|
||||
|
||||
```sh
|
||||
nix build .#affine-chatgpt
|
||||
nix build .#checks.x86_64-linux.affine-chatgpt-enrollment
|
||||
nix build .#checks.x86_64-linux.affine-chatgpt-module
|
||||
nix build .#checks.x86_64-linux.affine-model-picker
|
||||
nix build .#affine-chatgpt.pythonEnv --out-link package/affine-chatgpt/.venv
|
||||
pyright --project package/affine-chatgpt/pyrightconfig.json \
|
||||
--pythonpath package/affine-chatgpt/.venv/bin/python3
|
||||
```
|
||||
|
||||
Package checks use fake credentials and local HTTP fixtures only. Real smoke
|
||||
tests should verify unauthenticated `401`, model filtering, text response,
|
||||
function-call output, streamed completion, restart, and token refresh without
|
||||
printing credentials. A successful direct gateway test is not proof that
|
||||
AFFiNE's workspace provider and chat UI have been configured.
|
||||
|
||||
References:
|
||||
|
||||
- <https://developers.openai.com/siwc/token-sharing-open-source>
|
||||
- <https://developers.openai.com/siwc/token-sharing-open-source/self-hosted-vms>
|
||||
- <https://developers.openai.com/siwc/token-sharing-open-source/preview-limitations>
|
||||
|
||||
## hectic-lab deployment
|
||||
|
||||
The native service is active and the shared AFFiNE workspace has an enabled
|
||||
`ChatGPT subscription` BYOK profile pointing at `http://127.0.0.1:3012/v1`.
|
||||
The profile offers these account-catalog models, each with text input/output
|
||||
and tool calling:
|
||||
|
||||
- `gpt-5.6-luna`
|
||||
- `gpt-5.6-terra`
|
||||
- `gpt-5.6-sol`
|
||||
- `gpt-6-luna`
|
||||
- `gpt-6-sol`
|
||||
- `gpt-6-astra`
|
||||
- `gpt-6.1-terra`
|
||||
- `gpt-6.1-sol`
|
||||
|
||||
The existing first/default model remains `gpt-5.6-luna`. All eight models passed
|
||||
AFFiNE's chat and tool-calling probes. A two-turn chat switched from
|
||||
`gpt-5.6-luna` to `gpt-6.1-sol`; the second model recovered a random marker from
|
||||
the first turn, confirming conversation history is retained across the switch.
|
||||
The temporary test conversation was removed through AFFiNE's API. Model changes
|
||||
use the existing workspace profile and do not replace its encrypted credential
|
||||
or require another OAuth login. Reload an already-open client to refresh its
|
||||
model catalog.
|
||||
|
||||
The pinned AFFiNE frontend originally exposed only managed route choices, which
|
||||
are empty on self-hosted servers. `package/affine/byok-model-picker.patch` adds
|
||||
workspace BYOK models to the existing Model menu and forwards the selected
|
||||
profile/model separately from managed route IDs. Auto and managed selections
|
||||
remain supported; retries retain the last request selection in memory.
|
||||
|
||||
BYOK discovery uses the existing owner/admin settings API. Owners and workspace
|
||||
admins can choose these models in the patched selector; ordinary members retain
|
||||
Auto and can use the shared default profile without gaining settings access.
|
||||
No backend permission or Enterprise source code is changed.
|
||||
|
||||
The native module's optional `frontendPackage` mounts matching source-built
|
||||
static assets read-only into the application service. Backend binaries and
|
||||
migration units stay unchanged during this frontend-only rollout. Compatibility
|
||||
checks require matching release and source revision. The host explicitly enables
|
||||
this override; a standalone module with no override keeps its bundled frontend.
|
||||
|
||||
For a frontend-only rollout, build the static artifact and picker check, inspect
|
||||
the host activation plan, then activate the host configuration normally:
|
||||
|
||||
```sh
|
||||
nix build .#affine-frontend-static .#checks.x86_64-linux.affine-model-picker
|
||||
nixos-rebuild switch --flake '.#hectic-lab|x86_64-linux'
|
||||
```
|
||||
|
||||
Only `affine-native.service` should restart for a static-only change. Its
|
||||
migration unit, dedicated PostgreSQL and Redis must keep their existing package
|
||||
and restart triggers. Reload the client with a hard refresh after deployment to
|
||||
discard cached frontend chunks.
|
||||
|
||||
### Verified picker rollout
|
||||
|
||||
The patched selector is deployed in NixOS generation
|
||||
`1mvb1nb5xqhaj8xfskxi00lj39lmbpzl`. It binds frontend static package
|
||||
`hrg3dkcacg5drizifiinjx481k6k33d5` over the unchanged native backend's static
|
||||
directory. The activation restarted only AFFiNE; PostgreSQL, Redis and migration
|
||||
unit process/state timestamps remained unchanged.
|
||||
|
||||
An authenticated headless browser verified all eight menu choices and selected
|
||||
`gpt-6.1-sol`. The real selector returned the expected `profileId` and `modelId`
|
||||
with no managed `routeTargetId`; the trigger displayed the selected model.
|
||||
Open the AI input's Auto/current-model control, then its Model submenu. Use a
|
||||
hard refresh (`Ctrl+F5`) if the old interface is still cached.
|
||||
|
||||
Account OAuth enrollment, remote catalog access, text generation, function
|
||||
calls and streamed tool results were tested. AFFiNE's own provider probes and
|
||||
chat SSE endpoint also passed, including automatic profile routing.
|
||||
|
||||
Only the server now owns the imported rotating session; the local active
|
||||
credential copy was removed after remote verification. Images and attachments
|
||||
remain unsupported and are not advertised by the profile.
|
||||
|
||||
## AFFiNE managed trial counter versus provider limits
|
||||
|
||||
`currentUser.copilot.quota { limit used }` describes AFFiNE's managed AI trial,
|
||||
not the connected ChatGPT account's remaining usage. It must not be presented as
|
||||
an OpenAI allowance or an invoice. BYOK execution is authorized independently
|
||||
from quota-backed managed routes and records usage as `byok_server`.
|
||||
|
||||
The pinned release has a legacy accounting edge case: deleted sessions retain
|
||||
`messageCost`, while the BYOK exemption query joins usage billing units to live
|
||||
message rows. Removing test conversations can therefore leave a misleading
|
||||
managed-trial cost after their BYOK message rows disappear. The observed `8/10`
|
||||
was explained by eight such retained units; the connected provider's request
|
||||
history was tagged BYOK, not AFFiNE-managed usage.
|
||||
|
||||
Do not fix this by resetting usage, promoting a plan, granting unlimited quota,
|
||||
or weakening server enforcement. The raw quota and all provider/quota errors
|
||||
remain unchanged. A self-hosted UI should instead identify AI as self-hosted
|
||||
and explain that provider and server limits may apply, without a managed-trial
|
||||
progress bar, Free badge or AFFiNE upgrade action. Cloud quota presentation
|
||||
continues to use the original managed allowance.
|
||||
|
||||
ChatGPT subscription access is already paid for by the account owner; it is not
|
||||
unlimited. OpenAI still enforces the account's model, usage-window and app-access
|
||||
limits. This connector does not add an API-key billing fallback.
|
||||
|
||||
### Verified self-hosted usage rollout
|
||||
|
||||
On 2026-11-06, frontend static package
|
||||
`3s22k6a5p9731xmlr6x33icilcsfkzv2-affine-frontend-static-0.27.4` was copied to
|
||||
`hectic-lab` and mounted over the unchanged backend's static directory. This
|
||||
was a bounded systemd override, **not** a NixOS generation switch: the active
|
||||
and boot generation remain `6rb81fr95gngs99x1dvjw9vzzd7snkn5`. A whole-host
|
||||
build was interrupted rather than activating unrelated package updates.
|
||||
|
||||
The root-owned persistent drop-in is
|
||||
`/etc/systemd/system.control/affine-native.service.d/99-frontend-static-rollout.conf`.
|
||||
It resets `BindReadOnlyPaths` and supplies only the new static bind. This
|
||||
control directory is used because NixOS's `/etc/systemd/system` points into
|
||||
the immutable store. GC roots `affine-frontend-static-rollout` and
|
||||
`affine-frontend-static-rollback` under `/nix/var/nix/gcroots` retain the new
|
||||
bundle and the previous `hrg3dkcacg5drizifiinjx481k6k33d5` bundle.
|
||||
|
||||
Only `affine-native.service` restarted. The migration unit's active timestamp,
|
||||
PostgreSQL, Redis and ChatGPT gateway process IDs and active timestamps stayed
|
||||
unchanged. The running application's mount namespace was checked against the
|
||||
new package's `index.html`; HTTPS `/info` remained healthy. An authenticated
|
||||
headless browser verified the sidebar and account settings on desktop and a
|
||||
Pixel 5 viewport: neutral self-hosted text, no trial count, progress bar or
|
||||
billing action, in both English and Russian. This stable release serves the
|
||||
responsive web application to mobile browsers; upstream's separate mobile shell
|
||||
is canary-only. The separate
|
||||
mobile component is covered by the source-level rendering check.
|
||||
|
||||
A real BYOK text probe succeeded after deployment. AFFiNE's raw managed quota
|
||||
remained `{ limit: 10, used: 8 }` before and after; no accounting records or
|
||||
provider limits were altered. Existing browser sessions need a hard refresh.
|
||||
|
||||
The drop-in survives reboots and NixOS generation rollbacks, and masks future
|
||||
declarative frontend changes until removed. During the next reviewed NixOS
|
||||
switch containing the desired `frontendPackage`, remove this exact drop-in,
|
||||
run `systemctl daemon-reload`, and restart only `affine-native.service` so the
|
||||
declared bind takes effect. Remove the temporary GC roots only after checking
|
||||
that the active generation retains the desired package and rollback retention
|
||||
is no longer needed. Do not use a broad `systemctl revert` operation.
|
||||
|
||||
To roll back this bounded rollout while the original generation remains active,
|
||||
remove that exact drop-in, daemon-reload and restart `affine-native.service`.
|
||||
Its declared unit still binds the previous `hrg3dkcacg5drizifiinjx481k6k33d5`
|
||||
bundle. Confirm health and the effective bind before removing any GC root.
|
||||
@@ -0,0 +1,288 @@
|
||||
# Native AFFiNE NixOS module
|
||||
|
||||
`hectic.services.affine` runs the source-built AFFiNE backend without Docker.
|
||||
It is opt-in and uses distinct `affine-native` and `affine-native-migrate`
|
||||
units, so enabling or importing the module does not alter an existing
|
||||
`affine.service` or Compose deployment.
|
||||
|
||||
## Building and checking
|
||||
|
||||
The package targets `x86_64-linux` and pins AFFiNE 0.27.4. It builds the server,
|
||||
Rust server-native binding, all three web/admin/mobile web bundles, and matching
|
||||
Prisma 6.8.2 engines from source. Toolchains and dependency caches are fixed
|
||||
inputs. No AFFiNE application binary or OCI image is used.
|
||||
|
||||
The backend license is marked unfree. For local development/testing, explicitly
|
||||
allow evaluation without changing machine-wide Nixpkgs configuration:
|
||||
|
||||
```sh
|
||||
NIXPKGS_ALLOW_UNFREE=1 nix build --impure .#affine --option post-build-hook ''
|
||||
NIXPKGS_ALLOW_UNFREE=1 nix build --impure .#checks.x86_64-linux.affine-runtime --option post-build-hook ''
|
||||
nix build .#checks.x86_64-linux.affine-module-basic --option post-build-hook ''
|
||||
```
|
||||
|
||||
Do not publish server/native artifacts to a shared binary cache without checking
|
||||
their redistribution terms. Allowing unfree evaluation does not grant production
|
||||
or redistribution rights. The runtime check uses a fresh PostgreSQL 16 database,
|
||||
pgvector, a non-superuser application role, and a private Redis instance. It tests
|
||||
both migration passes, server startup, assets, administrator setup, authentication,
|
||||
workspace creation, and disabled public signup.
|
||||
|
||||
## Runtime contract
|
||||
|
||||
The selected package must provide:
|
||||
|
||||
- `bin/affine-server`, the long-running backend;
|
||||
- `bin/affine-migrate`, the full upstream predeploy sequence, including private
|
||||
key setup, Prisma schema migrations, and AFFiNE data migrations.
|
||||
|
||||
Both units run as the static `affine-native` system user. systemd manages
|
||||
`/var/lib/affine-native` with mode `0700`. `HOME` points there, so upstream uses
|
||||
`/var/lib/affine-native/.affine/config` and
|
||||
`/var/lib/affine-native/.affine/storage`.
|
||||
|
||||
The module writes an initial `config.json` only when none exists. It seeds the
|
||||
external URL, server name, loopback listener, port, disabled public/OAuth
|
||||
signup, and disabled copilot. Later admin-panel or manual edits are retained.
|
||||
Use `settings` only to extend or override this initial seed.
|
||||
|
||||
## Isolated local example
|
||||
|
||||
This example deliberately creates a new database, Redis instance, state path,
|
||||
and secret file. Do not point an initial native deployment at a production
|
||||
AFFiNE database.
|
||||
|
||||
```nix
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
nixpkgs.config.allowUnfreePredicate = package:
|
||||
builtins.elem (lib.getName package) [ "affine" "affine-server-native" ];
|
||||
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
package = pkgs.postgresql_16;
|
||||
ensureDatabases = [ "affine-native" ];
|
||||
ensureUsers = [{
|
||||
name = "affine-native";
|
||||
ensureDBOwnership = true;
|
||||
}];
|
||||
extensions = ps: [ ps.pgvector ];
|
||||
};
|
||||
|
||||
services.redis.servers.affine-native = {
|
||||
enable = true;
|
||||
port = 6388;
|
||||
bind = "127.0.0.1";
|
||||
};
|
||||
|
||||
# DATABASE_URL: postgresql://affine-native@localhost/affine-native?host=/run/postgresql
|
||||
sops.secrets.affine-native-database-url = {};
|
||||
sops.templates."affine-native.env" = {
|
||||
owner = "affine-native";
|
||||
group = "affine-native";
|
||||
mode = "0400";
|
||||
content = ''
|
||||
DATABASE_URL=${config.sops.placeholder.affine-native-database-url}
|
||||
'';
|
||||
};
|
||||
|
||||
hectic.services.affine = {
|
||||
enable = true;
|
||||
environmentFile = config.sops.templates."affine-native.env".path;
|
||||
externalUrl = "http://localhost:3011";
|
||||
redisHost = "127.0.0.1";
|
||||
redisPort = 6388;
|
||||
};
|
||||
|
||||
# This example runs both dependencies locally, so order migration after them.
|
||||
systemd.services.affine-native-migrate = {
|
||||
after = [ "postgresql.service" "redis-affine-native.service" ];
|
||||
requires = [ "postgresql.service" "redis-affine-native.service" ];
|
||||
};
|
||||
|
||||
# pgvector is not a trusted extension; provision it as postgres, not the app role.
|
||||
systemd.services.affine-native-database = {
|
||||
requires = [ "postgresql.service" ];
|
||||
after = [ "postgresql.service" ];
|
||||
before = [ "affine-native-migrate.service" ];
|
||||
requiredBy = [ "affine-native-migrate.service" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "postgres";
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
script = ''
|
||||
${pkgs.postgresql_16}/bin/psql --dbname=affine-native --set=ON_ERROR_STOP=1 \
|
||||
--command='CREATE EXTENSION IF NOT EXISTS vector;'
|
||||
'';
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
The module never creates PostgreSQL, pgvector, Redis, reverse-proxy, or
|
||||
firewall configuration. `environmentFile` is required and is passed to systemd
|
||||
at runtime; put `DATABASE_URL`, Redis credentials, and other secrets there,
|
||||
never in Nix module values or the Nix store. Non-secret Redis host and port
|
||||
options map to upstream `REDIS_SERVER_HOST` and `REDIS_SERVER_PORT`.
|
||||
|
||||
Default binding is `127.0.0.1:3011`. Perform initial administration through an
|
||||
SSH tunnel, for example `ssh -L 3011:127.0.0.1:3011 host`, then browse to
|
||||
`http://localhost:3011`. Add a reverse proxy separately only when remote access
|
||||
is intended.
|
||||
|
||||
## Upgrades and rollback
|
||||
|
||||
`affine-native-migrate.service` is required by and ordered before
|
||||
`affine-native.service`. Package or initial-seed changes restart the migration
|
||||
unit before the app, and the package wrapper owns the complete upstream
|
||||
predeploy procedure.
|
||||
|
||||
Database schema and AFFiNE data migrations are not reversed by switching to an
|
||||
older NixOS generation. Back up the dedicated database and state directory
|
||||
before upgrades. Production migration remains a separate, explicit operation.
|
||||
|
||||
AFFiNE backend source has its own license; review it before production use.
|
||||
This module does not grant production authorization or alter upstream license
|
||||
terms.
|
||||
|
||||
## hectic-lab host configuration
|
||||
|
||||
`nixos/system/hectic-lab/affine.nix` stages the reusable native module alongside
|
||||
the original deployment. `hectic.affineDeployment.nativeActive` defaults to
|
||||
`false`: the legacy Docker units and nginx port 3010 remain selected. The old
|
||||
configuration is preserved in `affine-docker.nix` for staging and rollback.
|
||||
Set `nativeActive = true` only after the final frozen-state restore and native
|
||||
verification; this removes the legacy unit declarations and selects nginx port
|
||||
3011. Source declarations alone are not evidence that production has migrated.
|
||||
|
||||
The host configuration intentionally uses isolated dependencies:
|
||||
|
||||
| Component | Unit | Endpoint/state |
|
||||
| --- | --- | --- |
|
||||
| AFFiNE | `affine-native.service` | `127.0.0.1:3011`, `/var/lib/affine-native` |
|
||||
| Migration | `affine-native-migrate.service` | Same user, environment and state |
|
||||
| PostgreSQL 16 | `affine-postgresql.service` | Unix socket `/run/affine-postgresql`, port 5433, `/var/lib/affine-postgresql` |
|
||||
| Redis | `redis-affine.service` | `127.0.0.1:6388` |
|
||||
| ChatGPT connector | `affine-chatgpt.service` | `127.0.0.1:3012`, separate protected state |
|
||||
|
||||
The database cluster does not listen on TCP and does not replace the host's
|
||||
shared `postgresql.service`. It uses peer authentication, a non-superuser role
|
||||
and database named `affine-native`, and pgvector `0.8.7` from the pinned
|
||||
official release. PostgreSQL pre-creates `vector` and `pgcrypto` as its cluster
|
||||
administrator. The cluster locale matches the existing Docker database's
|
||||
`en_US.utf8`; do not silently substitute a different collation.
|
||||
|
||||
Both AFFiNE units are gated by `/var/lib/affine-native/environment`. Create that
|
||||
file only after staging the correct database/config/storage. It must be
|
||||
protected outside Git and the Nix store. Its required connection settings are:
|
||||
|
||||
```text
|
||||
DATABASE_URL=postgresql://affine-native@localhost:5433/affine-native?host=/run/affine-postgresql
|
||||
AFFINE_INDEXER_ENABLED=false
|
||||
```
|
||||
|
||||
The database URL contains no password because the Unix socket uses peer auth.
|
||||
The environment file may also carry secrets; treat the entire file as private.
|
||||
|
||||
## Docker-to-native migration procedure
|
||||
|
||||
1. Build the source package, exact pgvector version, native service units and
|
||||
targeted checks before scheduling an outage. Inspect the activation plan;
|
||||
do not restart the shared PostgreSQL cluster or unrelated Redis instances.
|
||||
2. Inventory the running AFFiNE revision, database extensions/locale, workspace
|
||||
and user counts, config/private key, storage file manifest and nginx route.
|
||||
Never print secret values or document contents.
|
||||
3. Make an owner-only custom-format PostgreSQL backup and config/storage
|
||||
snapshot. Verify `pg_restore --list`, archive readability and checksums.
|
||||
A listed archive is not a tested restore or an offsite backup.
|
||||
4. Start only the dedicated PostgreSQL and Redis units. Restore a rehearsal
|
||||
dump into their isolated database, preserving role ownership. Pre-created
|
||||
extensions avoid giving the application superuser privileges. Use
|
||||
`pg_restore --exit-on-error --no-owner --no-acl --no-comments
|
||||
--role=affine-native`; investigate any error instead of ignoring it.
|
||||
5. Copy the complete Docker config and storage to
|
||||
`/var/lib/affine-native/.affine/{config,storage}`. Preserve `private.key`
|
||||
byte-for-byte. Give the native account ownership and private permissions.
|
||||
Update copied server/listen/port and Redis settings for native paths;
|
||||
preserve authentication, external URL and all encryption material.
|
||||
6. Run migration/startup against the rehearsal database and copied storage
|
||||
only. Never point staging workers at the live Docker database/storage.
|
||||
Verify `/info` reports `selfhosted` and compatibility `0.27.4`, then test
|
||||
authenticated workspaces, representative documents and stored attachments.
|
||||
7. Announce the write freeze. Stop all Docker AFFiNE application/worker writers
|
||||
without deleting its PostgreSQL volume. Take a fresh final dump and final
|
||||
config/storage snapshot after the freeze. Restore that final snapshot into
|
||||
a clean native database; stop staging units before replacing state.
|
||||
8. Start native migration and application units. Verify entity counts,
|
||||
checksums, login, documents, attachments and readiness before switching
|
||||
`hectic.affineDeployment.nativeActive` to `true` and nginx from port 3010 to
|
||||
3011. Inspect the activation plan and test nginx configuration first.
|
||||
9. Confirm the public HTTPS route, WebSockets/live editing and signup policy.
|
||||
Confirm the cutover removed/disabled the old Docker `affine.service` and
|
||||
`affine-frontend.service`. Retain their image/config/data and final snapshot;
|
||||
do not delete old state as part of cutover.
|
||||
10. Configure the [native ChatGPT connector](./affine-chatgpt.md) through AFFiNE's
|
||||
administrator API/UI and verify an actual AFFiNE AI request, not only a
|
||||
direct upstream probe.
|
||||
|
||||
Before native production writes, rollback can return nginx/application to the
|
||||
frozen Docker state. After native writes begin, that state is stale: rollback
|
||||
requires a new consistent export and compatible restore, not a proxy flip to
|
||||
an old database. NixOS generation rollback alone does not restore application
|
||||
data.
|
||||
|
||||
If SSH, package copying, extension build, rehearsal restore or verification is
|
||||
blocked, leave the Docker production route intact. Do not create the runtime
|
||||
environment marker or activate a half-prepared native application.
|
||||
|
||||
## Completed hectic-lab cutover: 2026-10-31
|
||||
|
||||
Production now explicitly sets `hectic.affineDeployment.nativeActive = true`.
|
||||
The activated persistent NixOS generation is:
|
||||
|
||||
```text
|
||||
/nix/store/6vp7qb6id8krb9l5ff1dkdi7nzxifhwd-nixos-system-hectic-lab-26.05.20261006.b253099
|
||||
```
|
||||
|
||||
Final write-frozen backup:
|
||||
|
||||
```text
|
||||
/var/backups/affine/native-cutover-20261031T231824Z
|
||||
```
|
||||
|
||||
The backup directory is `0700`; database/config/storage archives are `0600`.
|
||||
It includes the final database dump, verified archive listings, config and
|
||||
storage snapshots, previous generation references, and matching before/after
|
||||
data fingerprints. Keep it private. It is local recovery material, not an
|
||||
offsite backup.
|
||||
|
||||
Cutover verification matched all rows/fingerprints in `users`, `workspaces`,
|
||||
`workspace_members`, `workspace_pages`, `snapshots`, `updates`, and `blobs`:
|
||||
5 users, 2 workspaces, 5 memberships, 44 pages, 53 snapshots, 0 pending update
|
||||
rows, and 49 blob records. All 98 storage files (19,341,496 bytes) and the
|
||||
original `private.key` were preserved. Rehearsal authenticated document bytes
|
||||
and a 3,049,505-byte attachment matched the Docker source; final HTTPS login,
|
||||
document reads, attachment retrieval and frontend assets passed.
|
||||
|
||||
The final `switch-to-configuration switch` completed successfully. The Docker
|
||||
AFFiNE application/PostgreSQL/Redis containers are gone; their original
|
||||
`/var/lib/affine` state remains retained. The host Docker daemon still serves
|
||||
unrelated applications and was not removed.
|
||||
|
||||
The staging `test` activation encountered a pre-existing D-Bus reload timeout
|
||||
(the journal also records it on 2026-10-10); the bus remained active and was
|
||||
not restarted. The final cutover activation did not reload D-Bus and completed
|
||||
successfully. Shared `postgresql.service` remained active throughout.
|
||||
|
||||
The native [ChatGPT connector](./affine-chatgpt.md) is enabled through the
|
||||
workspace's persistent BYOK profile `ChatGPT subscription`. Text and function
|
||||
probes were verified, and an actual AFFiNE SSE chat returned the expected
|
||||
response with both explicit and automatic provider selection. Two authenticated
|
||||
WebSocket connections joined the workspace and read identical document state
|
||||
without writing documents.
|
||||
|
||||
After restarting both native AFFiNE and the connector, public login, document
|
||||
and attachment reads, two-client WebSocket reads, and an automatic-routed AI
|
||||
chat associated with an existing document passed again. Local validation also
|
||||
passed 61 connector tests, Pyright with its Nix Python environment, and the
|
||||
runtime, typography, native-module, production and connector Nix checks.
|
||||
@@ -0,0 +1,75 @@
|
||||
# AFFiNE document typography
|
||||
|
||||
The frontend source patch in `package/affine/gitea-document-typography.patch`
|
||||
adopts Gitea README typography without replacing BlockSuite's document model.
|
||||
At the default 16px body size, H1-H6 use 32, 24, 20, 16, 14 and 13.6px. Headings
|
||||
use 1.25 line height, 24px/16px section spacing, and H1/H2 dividers. Body text
|
||||
uses 1.5 line height and 16px paragraph spacing; nested lists remain compact.
|
||||
Quotes and inline code retain native AFFiNE colors and formatting.
|
||||
|
||||
The scale and spacing are inspired by Gitea's MIT-licensed
|
||||
[README markup stylesheet](https://github.com/go-gitea/gitea/blob/v1.27.3/web_src/css/markup/content.css).
|
||||
This is an independently authored, scoped BlockSuite patch, not a wholesale
|
||||
copy of that stylesheet; no vendored Gitea source files are changed.
|
||||
|
||||
The patch is limited to page mode. Canvas notes, embedded canvas previews and
|
||||
database block trees retain their existing typography. Below 640px, page text
|
||||
reflows to its viewport instead of following the intrinsic width of a wide
|
||||
table. Tables and databases retain their native horizontal scrollers. The
|
||||
existing sidebar toggle can be used to give the document the full phone width.
|
||||
|
||||
## Build and verify
|
||||
|
||||
```sh
|
||||
nix build .#affine-frontend-static --option post-build-hook ''
|
||||
NIXPKGS_ALLOW_UNFREE=1 nix build --impure .#checks.x86_64-linux.affine-typography --option post-build-hook ''
|
||||
```
|
||||
|
||||
The browser check uses the real source-built frontend with an isolated backend
|
||||
and anonymous, browser-local example documents. It covers light/dark desktop
|
||||
and phone layouts, heading metrics, colored text/highlights, inline code,
|
||||
editing, rich blocks, native canvas sizing and nested selector boundaries.
|
||||
Screenshots and computed-size results are retained in the check output.
|
||||
Fixture writes are restricted to the isolated loopback test server; the harness
|
||||
does not accept a remote URL override.
|
||||
The backend used by that check still requires explicit unfree evaluation.
|
||||
|
||||
## Current hectic-lab rollout
|
||||
|
||||
Since 2026-10-31, hectic-lab runs the source-built backend and patched frontend
|
||||
together through `hectic.services.affine` and `affine-native.service`. Its
|
||||
dedicated PostgreSQL, Redis and ChatGPT connector are native services as well.
|
||||
There is no production AFFiNE container or `affine-frontend.service` mount.
|
||||
See [native deployment and migration](./affine-native.md) for the cutover,
|
||||
verification and backup record. The frontend patch remains part of the same
|
||||
pinned AFFiNE source package; a read-only browser check after migration confirmed
|
||||
the real document's H2 blocks retain the 24px scale.
|
||||
|
||||
## Historical Docker rollout
|
||||
|
||||
The following describes the earlier frontend-only rollout, retained for the
|
||||
staging/rollback configuration. It is not the current production topology.
|
||||
|
||||
`affine-frontend-static` contains regular, copied web assets, including admin
|
||||
and mobile directories and upstream license notices. It does not contain
|
||||
symlinks into store paths that would be unavailable inside a container.
|
||||
|
||||
The existing Docker backend, database, Redis instance, image digests and data
|
||||
paths remain unchanged. A companion `affine-frontend.service` applies a Compose
|
||||
override mounting the source-built assets read-only at `/app/static`. It uses
|
||||
`up --detach --no-deps --force-recreate affine`: only the application container
|
||||
is reconciled. The main `affine.service` keeps its existing start/stop behavior.
|
||||
|
||||
Changing the frontend reloads the companion unit. Stopping/removing that unit
|
||||
recreates the application from the base Compose configuration, restoring the
|
||||
stock frontend. A restart of the parent stack reapplies the frontend afterward.
|
||||
Database credentials and keys remain generated runtime state; no secret values
|
||||
are embedded in the Nix store or repository by this frontend change.
|
||||
Frontend and backend release versions must match; the NixOS configuration
|
||||
asserts this before deployment.
|
||||
|
||||
Take a database/state backup before applying the first rollout, and verify that
|
||||
PostgreSQL, Redis and migration container IDs remain unchanged. No database
|
||||
upgrade or native-backend migration is part of this change. Application startup
|
||||
may perform its usual background work; this is not a claim that the process
|
||||
never writes to its database.
|
||||
@@ -0,0 +1,175 @@
|
||||
# Minecraft backups
|
||||
|
||||
`services.minecraft-backups` adds scheduled S3 archives to the Minecraft module.
|
||||
Neuro enables it for `vanilla`, `createAeronautics`, `wowMineMap`, and Horizon.
|
||||
Enabled nix-minecraft servers are discovered automatically. Horizon is registered
|
||||
explicitly because it runs a separate native engine.
|
||||
|
||||
Each server has a `minecraft-backup-<name>.timer`, scheduled every six hours
|
||||
with up to ten minutes of jitter. S3 retains regular timestamped archives for
|
||||
14 days under `minecraft/neuro/<name>/` in `backup-hectic-lab`.
|
||||
Horizon also keeps its existing native backups.
|
||||
|
||||
Set `services.minecraft-backups.onCalendar` to change the schedule. Its default
|
||||
is `"*-*-* 00/6:00:00"` (00:00, 06:00, 12:00, and 18:00 in the host timezone).
|
||||
S3 retention is configured separately with `services.minecraft-backups.s3.retentionDays`.
|
||||
|
||||
## Snapshot and local storage
|
||||
|
||||
A running server is shut down through its normal systemd stop command while
|
||||
rsync copies its data to a private staging directory. A failed or forced
|
||||
shutdown prevents the snapshot. The server starts again before compression
|
||||
or upload. An already inactive server stays inactive.
|
||||
|
||||
An exit trap and the backup unit's `ExecStopPost` restore a server that the backup
|
||||
stopped if copying fails or the backup is terminated. A `restart-needed` marker
|
||||
persists until starting the server succeeds.
|
||||
|
||||
Staging and pending archives live in `/var/lib/minecraft-backups/<name>/`.
|
||||
Staging remains for the next incremental copy. A completed archive is removed
|
||||
locally only after a successful upload. Failed uploads leave it for the next
|
||||
run, which retries pending archives before taking another snapshot.
|
||||
|
||||
Archives contain server data, including worlds and runtime lists such as
|
||||
whitelists and operators. Regenerated mods, libraries, resources, caches,
|
||||
logs, existing backups, and secret-bearing `server.properties` are excluded.
|
||||
Reapply the matching Nix configuration when restoring.
|
||||
|
||||
S3 cleanup only deletes names matching that server's timestamped archive format.
|
||||
Manual archives and other prefixes are preserved. Cleanup uses the same helper
|
||||
as PZ: individual object deletions and explicit validation of S3 deletion errors.
|
||||
|
||||
## wowMineMap live-backup investigation, 2026-11-16
|
||||
|
||||
Read-only inspection through `ssh neuro` confirmed that wowMineMap is running
|
||||
Minecraft 1.21.1 / NeoForge 21.1.250 with Sable 2.0.5 and Distant Horizons 3.3.3.
|
||||
Its data resides on ext4 at `/dev/nvme0n1p2`; there is no configured snapshot
|
||||
backend for this mount.
|
||||
|
||||
The Java process has seven Distant Horizons SQLite databases open across the
|
||||
dimensions, including their WAL and shared-memory files. The Azeroth main
|
||||
database was about 2.2 GB with a separate nonempty WAL. Copying these files
|
||||
independently is not a database snapshot.
|
||||
|
||||
One component was verified without stopping the game: Python's SQLite Backup
|
||||
API copied `world/data/DistantHorizons.sqlite`, opened with `mode=ro`, into an
|
||||
in-memory database. The copy reported journal mode `wal`, 1286 pages, six tables,
|
||||
and `PRAGMA quick_check` returned `ok`. No backup file was written on neuro.
|
||||
This verifies that database-copy mechanism, not a full-world restore.
|
||||
|
||||
Inspection with `javap` of the deployed Minecraft server and Sable jars found:
|
||||
|
||||
- `MinecraftServer.saveEverything` calls `PlayerList.saveAll` before applying
|
||||
the chunk-saving flags.
|
||||
- `PlayerList.remove(ServerPlayer)` calls `save(player)` during logout without
|
||||
consulting the world's `noSave` flag.
|
||||
- `MinecraftServer.saveAllChunks` also writes the main world metadata using
|
||||
`LevelStorageAccess.saveDataTag` outside the per-level skip-save logic.
|
||||
- Sable's `sable$saveSubLevels` injection runs before `ServerLevel.saveLevelData`,
|
||||
inside the level's skip-save guard. That particular hook is not evidence that
|
||||
Sable ignores `save-off`.
|
||||
|
||||
Consequently, `save-off` plus `save-all flush` does not make the entire server
|
||||
directory immutable while players keep playing. A file copy can combine frozen
|
||||
chunks with later player inventories or world metadata. SQLite snapshots alone
|
||||
do not provide a common checkpoint for those different data stores.
|
||||
|
||||
No live mode with guarantees equivalent to an orderly stopped-server copy has
|
||||
been established for this pack. The stop-based implementation has therefore
|
||||
not been replaced or deployed. A full-world live restore test was not run,
|
||||
because there is not yet a coordinated snapshot mechanism to test.
|
||||
|
||||
The next implementation step would be an in-process NeoForge checkpoint that
|
||||
coordinates world, player, Sable, and SQLite persistence, followed by a restore
|
||||
test on a disposable WorldOfSosal instance. Production was not stopped,
|
||||
restarted, sent save commands, or deployed during this investigation; the
|
||||
six-hour schedule and fourteen-day retention remain unchanged.
|
||||
|
||||
## Credentials and deployment
|
||||
|
||||
Before enabling the timers on neuro, provision a root-owned file with mode 0600:
|
||||
|
||||
```text
|
||||
/var/lib/minecraft-backups/s3-credentials
|
||||
```
|
||||
|
||||
Its contents use the systemd environment-file format:
|
||||
|
||||
```sh
|
||||
AWS_ACCESS_KEY_ID=...
|
||||
AWS_SECRET_ACCESS_KEY=...
|
||||
```
|
||||
|
||||
The key must allow listing the bucket and uploading/deleting objects under
|
||||
`minecraft/neuro/`. Keep the file outside the repository and `/nix/store`.
|
||||
A missing file prevents the backup from starting, before it stops any server.
|
||||
|
||||
The committed configuration does not provision this secret. Apply the neuro
|
||||
configuration after the file exists, then check:
|
||||
|
||||
```sh
|
||||
systemctl list-timers 'minecraft-backup-*'
|
||||
systemctl start minecraft-backup-vanilla.service
|
||||
journalctl -u minecraft-backup-vanilla.service
|
||||
```
|
||||
|
||||
## Restore
|
||||
|
||||
Stop that server's backup timer and game service. Download the chosen
|
||||
`minecraft-<name>-<timestamp>.tar.zst` from its S3 prefix. Preserve the current
|
||||
data directory separately before replacing anything.
|
||||
|
||||
Extract the archive into the server's data directory while the game is stopped.
|
||||
Archives contain paths relative to that directory. Restore file ownership to the
|
||||
game service's user (`minecraft` for Java servers, `horizon` for Horizon),
|
||||
reapply the matching Nix configuration and runtime secrets, then start the game
|
||||
and its backup timer.
|
||||
|
||||
## Isolated wowMineMap restore test
|
||||
|
||||
Neuro declares `wowMineMapRestore` as a separate, manually started Minecraft
|
||||
instance. It reuses the production NeoForge package, pinned WorldOfSosal
|
||||
modpack import, and shared modpack adjustments. It uses an 8 GB heap and reduced
|
||||
view/simulation distances for the test. Its directory is
|
||||
`/srv/minecraft/wowMineMapRestore`; its game socket is `127.0.0.1:25568`.
|
||||
RCON, public firewall access, and scheduled backups of this copy are disabled.
|
||||
It does not use the production source-map importer or reset service.
|
||||
|
||||
After deploying the neuro NixOS configuration normally, start the copy:
|
||||
|
||||
```sh
|
||||
ssh neuro 'systemctl start minecraft-server-wowMineMapRestore.service'
|
||||
ssh neuro 'journalctl -u minecraft-modpack-import-wowMineMapRestore -u minecraft-backup-restore-wowMineMapRestore -u minecraft-server-wowMineMapRestore -n 100 --no-pager'
|
||||
ssh neuro 'tail -n 80 /srv/minecraft/wowMineMapRestore/logs/latest.log'
|
||||
```
|
||||
|
||||
The first start installs the matching modpack, then downloads this exact object:
|
||||
|
||||
```text
|
||||
s3://backup-hectic-lab/minecraft/neuro/wowMineMap/minecraft-wowMineMap-20261117T172531Z.tar.zst
|
||||
```
|
||||
|
||||
The restore uses the existing root-only S3 credentials file. The key needs
|
||||
`GetObject` access in addition to the backup permissions above. It checks the
|
||||
compressed size (9,206,330,929 bytes), zstd integrity, archive paths, and the
|
||||
configured world's `level.dat`. Backup data, including player and mod state,
|
||||
overrides bootstrap configuration; regenerated mods remain installed.
|
||||
It refuses to replace an existing world. A completion marker binds the
|
||||
restored directory to this S3 object, and subsequent starts skip both bootstrap
|
||||
and restoration so that restored configuration is preserved.
|
||||
|
||||
Connect using the matching WorldOfSosal client through an SSH tunnel:
|
||||
|
||||
```sh
|
||||
ssh -N -L 25568:127.0.0.1:25568 neuro
|
||||
```
|
||||
|
||||
Use `localhost:25568` in Minecraft. Confirm startup reaches `Done`, enter the
|
||||
restored Azeroth dimension, and inspect known builds, player inventory, and mod
|
||||
objects. A running systemd unit alone does not prove that the saved world
|
||||
loaded correctly. These real-world checks remain to be performed after deploy.
|
||||
Stop the test when finished:
|
||||
|
||||
```sh
|
||||
ssh neuro 'systemctl stop minecraft-server-wowMineMapRestore.service'
|
||||
```
|
||||
Executable → Regular
+423
-11
@@ -1,11 +1,12 @@
|
||||
# WorldOfSosal: Prism automatic updates
|
||||
|
||||
The published client entry points are:
|
||||
- https://store.bfs.band/minecraft/ (BFS / Element host)
|
||||
- https://store.hectic-lab.com/minecraft/world-of-sosal/ (hectic-lab)
|
||||
The active client entry point is
|
||||
https://store.hectic-lab.com/minecraft/world-of-sosal/.
|
||||
BFS is unavailable as of 2026-11-12. Existing instances using its update URL
|
||||
must switch their pre-launch URL to the active site's `current/pack.toml`, or
|
||||
import the active site's Prism ZIP.
|
||||
|
||||
Each site provides its own Prism ZIP with that site's update URL and matching
|
||||
server address. Both installs use the same Minecraft world and modpack release.
|
||||
The active Prism ZIP includes the matching update URL and server address.
|
||||
|
||||
Players import `WorldOfSosal-Prism.zip` into Prism once and approve its pre-launch
|
||||
command. Before each launch, packwiz-installer reconciles the client with the
|
||||
@@ -19,20 +20,40 @@ Official workflow: https://packwiz.infra.link/tutorials/installing/packwiz-insta
|
||||
|
||||
## Publishing a tested update
|
||||
|
||||
Keep the authoritative `.mrpack` in Storage Box at
|
||||
`minecraft/pack/WorldOfSosal.mrpack`. For a server update, replace that archive,
|
||||
set its new SHA-256 in `nixos/system/neuro/minecraft/world-of-sosal.nix`,
|
||||
Keep authoritative `.mrpack` revisions as separate files in Storage Box.
|
||||
The current source is `minecraft/pack/WorldOfSosal-v13-lootplus-cleanup.mrpack`,
|
||||
SHA-256 `e5895994e95a4df476d7da00b53c39d0372885265acb6cf9b5a9647a015db5f7`.
|
||||
V13 removes Loot Plus and its obsolete configuration, retaining Craftable Loot
|
||||
Chests, Iris, and Bliss. It retains LOW horizontal quality and BLOCK LOD resolution at radius 512,
|
||||
with a 60 FPS preset. Existing profiles retain their own `options.txt`.
|
||||
The GC warning remains hidden in chat.
|
||||
It retains v7's Distant Horizons
|
||||
3.3.3 on client and server and v6's client-only
|
||||
version indicator. The game window and local login chat show the manifest version;
|
||||
the server MOTD shows its activated server configuration. A client-only release
|
||||
can retain the previous MOTD without restarting the server. Downloads from the page use
|
||||
`WorldOfSosal-<version>.mrpack`, while `latest.mrpack` remains a compatibility URL.
|
||||
V5 added five optimizers and Nowheel, with separate client/server Lithium
|
||||
compatibility settings. V4's removal of Dynamic Height and its Sable addon is
|
||||
retained. Minecraft/NeoForge versions are unchanged. For a server update, upload a new
|
||||
revision and set its path and SHA-256 in `nixos/system/neuro/minecraft/world-of-sosal.nix`,
|
||||
and rebuild/switch neuro before publishing the corresponding client export. The server importer and the
|
||||
client export must consume the same archive; publishing only the client can make
|
||||
it incompatible with the running server.
|
||||
|
||||
```sh
|
||||
# Test the client and deploy the matching server release first.
|
||||
python3 script/publish-prism-mirrors.py WorldOfSosal.mrpack
|
||||
python3 script/build-prism-pack.py WorldOfSosal-v13-lootplus-cleanup.mrpack \
|
||||
prism-export --server store.hectic-lab.com:25568
|
||||
python3 script/publish-prism-pack.py prism-export hectic-lab
|
||||
```
|
||||
|
||||
The mirror publisher creates temporary build directories and sets each server
|
||||
address and update URL automatically. The builder downloads a SHA-256-pinned bootstrap from the
|
||||
The publishing SSH alias must support SFTP. The main hectic-lab sshd uses port
|
||||
22223; the experimental daemon on 22222 does not provide the SFTP subsystem.
|
||||
The legacy `publish-prism-mirrors.py` also targets the unavailable BFS host and
|
||||
is not the active publication command.
|
||||
|
||||
The builder downloads a SHA-256-pinned bootstrap from the
|
||||
packwiz project's release, or accepts it via `--bootstrap /path/to/file.jar`.
|
||||
External mods retain their original URLs and SHA-512 checksums. Embedded mods and
|
||||
configuration are hosted with the release. Both required and optional client mods
|
||||
@@ -54,6 +75,397 @@ If Minecraft/NeoForge versions change, update and test both the server pin and
|
||||
client pack. packwiz-installer 0.5.14 understands NeoForge components in Prism's
|
||||
`mmc-pack.json`; a launcher restart/relaunch may be necessary after changing them.
|
||||
|
||||
## Client version information
|
||||
|
||||
Source and build instructions: `script/worldofsosal-client-info/README.md`.
|
||||
The addon version is 1.0.0; it is independent of the pack release.
|
||||
`config/worldofsosal-version.json` is generated from the mrpack's `name`,
|
||||
`versionId`, and Minecraft/NeoForge dependencies. An existing metadata override
|
||||
must match that manifest or the builder rejects the release. When preparing
|
||||
a new source archive, regenerate its client metadata from its updated manifest.
|
||||
|
||||
The title appears before login and remains on connection failures. After each
|
||||
successful multiplayer login, `CLIENT: WorldOfSosal <version> | Minecraft
|
||||
<version> | NeoForge <version>` is added only to that client's chat. Dimension
|
||||
changes do not add another line. The early NeoForge bootstrap window is
|
||||
separate from the Minecraft game window.
|
||||
|
||||
The immutable download name and its checksum are included in publication;
|
||||
previous named archives are retained. The selected release's MOTD is declared
|
||||
in `world-of-sosal.nix` alongside its archive path.
|
||||
|
||||
## Loot Plus cleanup: v13 on 2026-11-16
|
||||
|
||||
V13 removes `Loot Plus V1.1.3-neoforge-1.21.1 (FIXED).jar` from both client
|
||||
and server, its `config/LootPlusConfig.toml`, the six `config/mlb/*.json` files,
|
||||
and `config/lootbundles-common.toml`. Craftable Loot Chests is retained unchanged.
|
||||
Other RPG loot configuration, all remaining mods, Iris/Bliss/DH, client presets,
|
||||
and player options are retained. This release has 143 client JARs, 132 server JARs,
|
||||
and 595 managed client files.
|
||||
|
||||
Source: `minecraft/pack/WorldOfSosal-v13-lootplus-cleanup.mrpack`, 8,728,272 bytes,
|
||||
SHA-256 `e5895994e95a4df476d7da00b53c39d0372885265acb6cf9b5a9647a015db5f7`.
|
||||
Storage Box staging, full final readback, hash comparison, and immutable rename
|
||||
passed. The old sources and named cache versions remain available. The two earlier
|
||||
client-only cleanup candidates were never published.
|
||||
|
||||
Although upstream marked Loot Plus optional, an actual client without it failed
|
||||
to connect to the unchanged server because of unknown `lootboxesplus` registry
|
||||
entries. After removing it from both sides, the real client joined the private
|
||||
Azeroth server and displayed the existing Origins selection interface. Every
|
||||
retained JAR hash, Bliss ZIP, and DH configuration matched v12. Actual fresh and
|
||||
v12-upgrade packwiz runs removed all nine selected files; personal `options.txt`
|
||||
and shader choices in `config/iris.properties` stayed byte-identical. The final
|
||||
client export is byte-identical to that tested candidate.
|
||||
|
||||
The user approved server removal with a backup and ordinary restart. The full
|
||||
stopped-state backup is at
|
||||
`u664722@u664722.your-storagebox.de:minecraft/backups/wowMineMap-before-lootplus-removal-20261116/`.
|
||||
All 6,753 selected world/mod/config/root-JSON/property files passed independent
|
||||
SHA-256 verification on Storage Box. The nine removed files are also retained
|
||||
under `/srv/minecraft/backups/wowMineMap-before-lootplus-removal-20261116/`.
|
||||
All 6,153 world files were byte-identical after offline removal; no map import,
|
||||
reset, player-data edit, or world replacement occurred. No player data file
|
||||
contained the removed mod namespace.
|
||||
|
||||
The first autonomous deployment attempt could not find SSH in systemd's PATH;
|
||||
it made no removals and restarted the original server. Absolute executable paths
|
||||
fixed that cause. The subsequent transaction completed with full backup checking
|
||||
and automatically started the cleaned server. The active 132-JAR server passed
|
||||
RCON health checks; all remaining JAR/config hashes, OP data, and parsed server
|
||||
properties were preserved. Distances remain 32/32, command blocks remain enabled,
|
||||
and `doFireTick` remains false. Both importer InvocationIDs were unchanged.
|
||||
The source pin/cache activation used the same archive and required no additional
|
||||
restart or importer execution.
|
||||
|
||||
The web release is
|
||||
`fcb95a325ca33e7be53ecf550e01b86e97fd1b4a48b215787707bb0547aded69`.
|
||||
The ordinary publisher payload was staged and SHA-256 checked before the restart,
|
||||
then its immutable release and `current` symlink were activated after server health
|
||||
checks. Public HTTPS readback matched all 595 index files and hashes, pack/index
|
||||
metadata, named/latest source archives, Prism ZIP, SHA256SUMS, and page bytes.
|
||||
A real v12 profile updated through the public `current/pack.toml`: all nine files
|
||||
were removed, all 143 retained JAR hashes matched, and personal options, shader
|
||||
selection, and DH configuration were preserved.
|
||||
The legacy runtime MOTD still names v11; its properties generator was
|
||||
deliberately retained. Client version metadata names v13. Existing recipe/function
|
||||
warnings from the retained mods were outside this cleanup.
|
||||
|
||||
The server root had only about 7.7 GiB free for a roughly 15 GiB world, so the
|
||||
full backup used Storage Box directly. The incomplete workstation copy is retained
|
||||
as an additional partial artifact and is not the verified backup. Evidence,
|
||||
scripts, and runtime screenshot: `/tmp/worldofsosal-v13-lootplus-final/`;
|
||||
server reports: `/var/tmp/worldofsosal-v13-lootplus-deploy/`.
|
||||
No project Git commit was created.
|
||||
|
||||
## Bliss: v12 on 2026-11-15
|
||||
|
||||
V12 adds Iris `1.8.14-beta.1+mc1.21.1` for NeoForge and Bliss `2.1.2`.
|
||||
This Iris build matches the existing Sodium `0.8.13`; DH remains `3.3.3`.
|
||||
Both additions are required on clients and marked unsupported on servers.
|
||||
Bliss is referenced by its original Modrinth CDN URL and SHA-512 rather than
|
||||
redistributed inside the archive. Every old archive entry is byte-identical
|
||||
except the manifest and client version metadata.
|
||||
|
||||
After the normal Prism update, open Iris's shader-pack menu and select
|
||||
`Bliss_v2.1.2_(Chocapic13_Shaders_edit).zip`. Shader selection is not forced:
|
||||
the release does not manage `config/iris.properties`, so personal enable/disable
|
||||
choices survive updates. LOW/BLOCK/512 and the fresh-install 60 FPS limit remain.
|
||||
Shaders add rendering cost; the 60 FPS setting is a cap, not a measured result.
|
||||
|
||||
Source: `minecraft/pack/WorldOfSosal-v12-bliss.mrpack`, 8,731,511 bytes,
|
||||
SHA-256 `f82bac94ae3d38076db81458ea04c2b6e1abed49900186073b33d104fdedafc9`.
|
||||
Immutable Storage Box upload, full readback, hash check, and rename passed.
|
||||
The server cache and importer pin use this same source; filtered server files
|
||||
still match all 133 running JARs. The importer was not executed, the main
|
||||
server process and configuration stayed unchanged, and the map was not reset.
|
||||
The live server MOTD therefore still names v11; this does not prevent v12 clients
|
||||
from connecting. The Nix configuration names v12 for a later configuration
|
||||
activation.
|
||||
|
||||
Real packwiz installs passed for a fresh client and a v11 upgrade. SHA-512 and
|
||||
sizes of both additions matched; custom render/simulation/FPS options were
|
||||
preserved byte for byte. An isolated client connected to a private copy of
|
||||
Azeroth with Bliss enabled. Shader pipelines, DH event binding and renderer
|
||||
setup completed, with 2,778 populated DH rows observed and a largest data payload
|
||||
of 62,430 bytes. Spawn and elevated north/south views were inspected, including
|
||||
distant terrain beyond the QA-only native render distance of two chunks.
|
||||
|
||||
QA used llvmpipe/OpenGL 4.5, not a player GPU benchmark. Bliss emitted existing
|
||||
option/block-alias warnings, and Iris logged one nonrepeating opaque/translucent
|
||||
initialization message. No shader compile/pipeline failure or DH binding NPE
|
||||
was reproduced. The initial Xvfb launch lacked GLX; supplying the existing Mesa
|
||||
driver environment fixed the private test display without changing the pack.
|
||||
The 604-file web release is
|
||||
`244ec93f1bc456927bcb9a154c632eccde6d8d9f9bac48a67eb6560bc13fb9a8`.
|
||||
Public HTTPS byte comparisons passed for pack/index metadata, Iris and Bliss
|
||||
download records, presets, named/latest archives, Prism ZIP and the download
|
||||
page. The real installer also accepted the published `current/pack.toml` URL
|
||||
and retained the custom options byte for byte.
|
||||
|
||||
## LOW/BLOCK and 60 FPS preset: v11 on 2026-11-13
|
||||
|
||||
V11 keeps horizontal LOW and radius 512, restores BLOCK resolution, and changes
|
||||
the preset `options.txt` limit from 120 to 60 FPS. Other options, vertical quality,
|
||||
hidden GC chat warning, thread defaults, Java and all JARs remain unchanged.
|
||||
Source: `minecraft/pack/WorldOfSosal-v11-lod512-low60.mrpack`,
|
||||
SHA-256 `0498c7064586c4377db8c6668ccc6c2e6afca19c44463b981d4f560cdf339c99`.
|
||||
Storage Box upload and reverse-download verification passed after replacing a
|
||||
stalled TCP session with a new connection with bounded SSH timeouts.
|
||||
|
||||
Actual installer checks passed for both a clean preset with `maxFps:60` and a
|
||||
v10 update preserving custom `renderDistance:4`, `simulationDistance:2` and
|
||||
`maxFps:144`. Existing profiles keep their own options; users wanting the new
|
||||
cap there must select 60 FPS in video settings. The publisher's preserve policy
|
||||
for `options.txt` remains unchanged.
|
||||
|
||||
A real client accepted LOW/BLOCK/512/60 and automatic eight threads at ratio
|
||||
1.0. The clean preset's render distance 12 exceeded the private QA server's
|
||||
limit 2, causing a gap between native chunks and LODs. Matching the QA-only
|
||||
client distance to 2 removed the gap, with continuous Azeroth terrain visible
|
||||
from both directions. The distributed preset stays at its original distance 12.
|
||||
This was a software OpenGL 4.5 functional check, with no measured player GPU gain.
|
||||
After the server was empty, the stopped backup was created at
|
||||
`/srv/minecraft/backups/wowMineMap-before-lod512-low60-20261113T134243Z`, with
|
||||
sibling `-mods` and `-config` copies. Targeted activation retained the original
|
||||
Java command, using importer `8c552by89dk8zngxcjn9wxlwf9f4dvmm` and pre-start
|
||||
`bmqyiyjbc3wl47m7x9rakg1nraysfags-worldofsosal-v11-start-pre`.
|
||||
The server was ready at 13:46:22 UTC. All 133 server JARs matched the source;
|
||||
existing-only generation, threads 2/0.5 and normal distances 32/32 were retained.
|
||||
No full 512-radius precomputation was started.
|
||||
The 2,063,716 populated Azeroth chunk positions, datapacks and playerdata
|
||||
matched the stopped backup; no heightmap warnings appeared. The retained DH
|
||||
database contained 70,041 rows. The server remained active with zero automatic
|
||||
restarts. No temporary verification force-load tickets were needed.
|
||||
The immutable web release on hectic-lab is
|
||||
`1910d85189aad1667ab03a209ede057acb11b7b0784901c50905bf622a9e7658`.
|
||||
Public HTTPS checks passed for the 602-entry index, DH configuration, 60 FPS
|
||||
preset, metadata, archives and Prism ZIP. Public Minecraft status reports v11.
|
||||
|
||||
## LOD 512 lite: v10 on 2026-11-13
|
||||
|
||||
V10 changes only client `horizontalQuality = "LOW"` and
|
||||
`maxHorizontalResolution = "TWO_BLOCKS"` plus release metadata. Radius 512,
|
||||
vertical quality, hidden GC chat warning, automatic client threads, server
|
||||
settings and all JARs remain unchanged. It aims to reduce LOD rendering work;
|
||||
no performance gain on the player's GPU has been measured.
|
||||
Source: `minecraft/pack/WorldOfSosal-v10-lod512-lite.mrpack`,
|
||||
SHA-256 `8b368b2d690dfbf199f65d554ffeba0b3d2f6a163b1a2abcf132e3bec9628277`.
|
||||
Storage Box upload and reverse-download verification passed.
|
||||
|
||||
The actual v9-to-v10 updater preserved custom options. A real client connected
|
||||
through QuickPlay and rendered Azeroth from two directions with runtime radius
|
||||
512, horizontal LOW, TWO_BLOCKS resolution, vertical MEDIUM and eight automatic
|
||||
threads at ratio 1.0. The populated LOD cache had 1,145 rows and a largest data
|
||||
payload of 63,683 bytes. No DH missing-buffer errors or GC chat warning appeared.
|
||||
QA used llvmpipe/OpenGL 4.5, so this is a functional check rather than a hardware
|
||||
GPU benchmark.
|
||||
|
||||
After players left, the stopped backup was created at
|
||||
`/srv/minecraft/backups/wowMineMap-before-lod512-lite-20261113T125559Z`, with
|
||||
sibling `-mods` and `-config` copies. Targeted activation preserved the original
|
||||
JVM and uses importer `3i6p37b7lwr75jhfhbgladkx7a143b7h` and pre-start
|
||||
`spiv6zdjkk88sj0gd08wzlzzdq3sifhf-worldofsosal-v10-start-pre`.
|
||||
All 133 server JARs matched the source, with existing-only generation, server
|
||||
threads 2/0.5, request limit 4096 and normal distances 32/32. The 2,063,716
|
||||
populated chunk positions and datapacks matched the stopped backup, with no
|
||||
heightmap warnings. The retained LOD database contained 62,775 rows; no full
|
||||
512-radius precomputation was started.
|
||||
The client publication on hectic-lab uses immutable web release
|
||||
`260ffe1fedd8a434364efe23cb03b2be05431a583dd3426cd0746f8380ed686a`.
|
||||
Public HTTPS checks passed for the 602-entry index, lite DH configuration,
|
||||
metadata, archives and Prism ZIP; public Minecraft status reports v10.
|
||||
The native-height comparison passed for 81 chunks and 12,798 block samples,
|
||||
including the spawn anchor, `yPos=-32` and 52-long heightmaps. All 81 temporary
|
||||
verification tickets were removed; the server was active with zero automatic
|
||||
restarts.
|
||||
|
||||
## LOD radius 512: v9 on 2026-11-13
|
||||
|
||||
V9 sets the client LOD radius to 512 chunks and sets
|
||||
`common.logging.warning.showGarbageCollectorWarning = false` in the client
|
||||
override. The GC warning remains enabled in the log; Java, GC, JARs, thread
|
||||
defaults and 32/32 distances remain unchanged.
|
||||
Source: `minecraft/pack/WorldOfSosal-v9-lod512.mrpack`,
|
||||
SHA-256 `485e9e92eae00a7c978fb1f116ef8b63cb79df922965aca8cb05055d3b290b53`.
|
||||
Storage Box upload and reverse-download verification passed.
|
||||
|
||||
A real v8-to-v9 updater preserved custom options. The actual client accepted
|
||||
512, retained eight automatic threads at ratio 1.0, connected and rendered
|
||||
Azeroth LODs from two directions. Its GC warning appeared in the log and was
|
||||
absent from chat. The populated client cache had 265 rows, with a largest data
|
||||
payload of 63,683 bytes. No missing-buffer errors appeared during the session.
|
||||
This does not precompute the whole 512 radius: the existing production cache
|
||||
remains at 256 and farther existing terrain is requested on demand. The QA
|
||||
client queued about one million requests; initial loading can take substantial
|
||||
time.
|
||||
|
||||
After players left, the stopped backup was created at
|
||||
`/srv/minecraft/backups/wowMineMap-before-lod512-20261113T094343Z`, with sibling
|
||||
`-mods` and `-config` copies. Targeted activation kept the original JVM, using
|
||||
importer `zvbj8hhp7n8zlwj49b0jz9lzif82f4g0` and pre-start
|
||||
`q7vs3y5wn2w4b5fbxsh535yfh7xw0g4v-worldofsosal-v9-start-pre`.
|
||||
All 133 server JARs matched the source, with existing-only generation, server
|
||||
threads 2/0.5, request limit 4096 and normal distances 32/32.
|
||||
The 2,063,716 populated chunk positions and the 81-chunk / 12,798-block
|
||||
native-height comparison matched the backup. Datapacks and the spawn anchor
|
||||
were unchanged; heightmap warnings were absent. The retained server LOD database
|
||||
contained 31,062 rows. Existing recipe and class-selection datapack errors were
|
||||
also present in the previous logs and were left unchanged.
|
||||
The client publication on hectic-lab uses immutable web release
|
||||
`2f0dcf6061dc32efb53a27fad6472e7bf60a6a783f44924c323f5f6ed84fb7ae`.
|
||||
That host rejected SFTP; the publication archive was transferred over SSH stdin,
|
||||
then the same atomic activation script was used.
|
||||
Public HTTPS verification passed for the 602-entry index, DH configuration,
|
||||
version metadata, archives and Prism ZIP; public Minecraft status reports v9.
|
||||
All 81 temporary verification tickets were removed. The server remained active
|
||||
with zero automatic restarts.
|
||||
|
||||
The QA wrapper's old `/run/opengl-driver` path disappeared from the workstation.
|
||||
Use the installed Mesa library and DRI paths directly, with private Xvfb and
|
||||
llvmpipe; `glxinfo -B` must confirm OpenGL 4.5 before launching the client.
|
||||
|
||||
## LOD radius 256: v8 on 2026-11-13
|
||||
|
||||
V8 changes only the two DH radius values from 128 to 256 and the release
|
||||
metadata. All JARs, Minecraft/NeoForge versions, generation safety settings,
|
||||
client thread defaults, server thread limit and normal 32/32 distances remain
|
||||
unchanged. A real v7-to-v8 packwiz update preserved custom `options.txt`.
|
||||
The actual client accepted 256, connected, received populated Azeroth LOD data,
|
||||
and rendered terrain from two angles without missing-buffer errors.
|
||||
|
||||
The source archive was uploaded to Storage Box and verified by downloading it.
|
||||
The stopped backup is
|
||||
`/srv/minecraft/backups/wowMineMap-before-lod256-20261113T012021Z`, with sibling
|
||||
`-mods` and `-config` copies. Targeted activation preserves the original JVM and
|
||||
uses importer `c9gm28drindq1dypib4dygdl86m52zmg` and pre-start
|
||||
`fwq9fsavmpzyf5sp96ivjd9vr9kpkvc2-worldofsosal-v8-start-pre`.
|
||||
Existing-only import at block origin `3742,8891`, radius 256 chunks, completed
|
||||
at 01:44:28 UTC on 2026-11-13. The completed cache covers the requested area;
|
||||
it does not mean the entire Azeroth map has been precomputed.
|
||||
Public HTTPS checks passed for the 602-entry index, the DH configuration and
|
||||
metadata, named source archive, latest alias and Prism ZIP. Public Minecraft
|
||||
status reports `WorldOfSosal v8-lod256`. Immutable web release:
|
||||
`9ab159a65647f19b964624bfaed0a8c0584df84a7698a069806a1a6eb7aa5710`.
|
||||
After completion, all 2,063,716 populated Azeroth chunk positions matched the
|
||||
stopped backup. The native-height comparison passed for 81 chunks and 12,798
|
||||
block samples, with `yPos=-32`, 52-long heightmaps and no heightmap warnings.
|
||||
Datapacks and the spawn anchor remained unchanged. The LOD database contained
|
||||
22,109 rows; the server was active with zero automatic restarts. All 81 temporary
|
||||
verification tickets were removed.
|
||||
|
||||
QA copies must take `dimensions/crafting_azeroth/azeroth/region/r.7.17.mca`
|
||||
from the backup. The identically named file under `world/region` belongs to the
|
||||
ordinary overworld. Copying that file does not provide Azeroth terrain.
|
||||
|
||||
## Distant Horizons and verification: v7 on 2026-11-13
|
||||
|
||||
Both sides use `DistantHorizons-3.3.3-1.21.1-fabric-neoforge.jar`.
|
||||
`CHUNKS_ONLY` and `PRE_EXISTING_ONLY` are both required: DH reads the imported
|
||||
Azeroth terrain instead of reconstructing it from the seed. No additional
|
||||
network port is used. Native dimension bounds remain `min_y=-512`, `height=2544`.
|
||||
Server view and simulation distances remain 32; the client LOD radius is 128.
|
||||
|
||||
The shared server configuration limits DH to two threads at a 0.5 runtime ratio.
|
||||
A client override keeps DH's automatic thread budget and 1.0 ratio. Applying
|
||||
the server limit to clients starved the shared network decoding queue during
|
||||
cold loading: completed buffers expired after 30 seconds. A cold-cache A/B
|
||||
test with the client defaults completed 336 payload deliveries in 120 seconds
|
||||
with zero DH errors. A populated distant row matched server data byte-for-byte.
|
||||
The actual client rendered Azeroth from several angles; disabling DH removed
|
||||
the distant geometry. Tests used software rendering, not an FPS benchmark.
|
||||
|
||||
- Real packwiz v6-to-v7 update passed with 602 managed entries and preserved
|
||||
modified `options.txt`. Client/server configuration separation was verified.
|
||||
- All 133 live server JARs matched the archive; original Java/start command
|
||||
remained in place. Server reached `Done`; public status reports v7.
|
||||
- Existing-only LOD import completed at block origin `3742,8891`, radius
|
||||
64 chunks. The database contained 1,440 rows. The remainder of the 128-chunk
|
||||
client radius fills from existing terrain as requested; the whole map has
|
||||
not been precomputed.
|
||||
- Production comparison with the stopped backup passed for 81 chunks and
|
||||
12,798 block samples: `yPos=-32`, 52-long heightmaps, no heightmap warnings.
|
||||
World datapacks and the spawn anchor remained unchanged.
|
||||
- Storage Box upload/readback, public manifest/index checksums, DH metadata,
|
||||
named archive, latest alias, Prism ZIP and desktop/mobile page checks passed.
|
||||
- Immutable web release:
|
||||
`7fe95d9b696d0b601688d8eecef7efd890b3d113d3848234ea0627bfdf7b3a6d`.
|
||||
- Stopped backup: `/srv/minecraft/backups/wowMineMap-before-dh-20261113T001417Z`,
|
||||
with sibling `-mods` and `-config` copies.
|
||||
|
||||
Targeted activation uses importer unit `1kl0ca17k46iiqdm8v8ri2w7lmgl069p` and
|
||||
pre-start file `gm0yv2p7913yw4kh0jwgw7mkgcw1gkxj-worldofsosal-v7-start-pre`.
|
||||
Reconcile the persistent `50-distances.conf` override before a future full
|
||||
system activation. Older source archives and web releases remain available.
|
||||
|
||||
## Verification: v6 on 2026-11-12
|
||||
|
||||
- Java 21 addon build passed against NeoForge 21.1.250, with no extra runtime
|
||||
libraries and no server installation.
|
||||
- The actual game window showed v6 before joining and after whitelist denial;
|
||||
the rejected login added no success message.
|
||||
- Successful multiplayer login showed the full local chat line. Dimension
|
||||
change kept one line; disconnect/reconnect produced exactly one new line.
|
||||
- A real packwiz update from the published 598-entry v5 snapshot to the
|
||||
600-entry v6 snapshot installed the addon and metadata and preserved custom
|
||||
`options.txt`. A mismatched manifest/metadata release was rejected.
|
||||
- Chromium downloaded `WorldOfSosal-v6-version-display.mrpack`; its bytes matched
|
||||
the source archive. Desktop and phone-width page captures were inspected.
|
||||
- Public Minecraft status returned `WorldOfSosal v6-version-display`; live
|
||||
view and simulation distance remained 32, with the previous Java/start command.
|
||||
- Storage Box upload/download comparison passed; older versions remain.
|
||||
|
||||
One additional Quick Play QA startup failed in existing Puffish Skills 0.19.0:
|
||||
`ConcurrentModificationException` in `RewardRegistry.register`, followed by a
|
||||
secondary Sodium configuration error. Normal menu-based startups and joins
|
||||
worked. That startup failure was not repaired by this version-display change;
|
||||
reproduction without the addon has not been established.
|
||||
|
||||
Targeted server activation preserves the current platform: the existing
|
||||
`50-distances.conf` pre-start override now uses the v6 properties template.
|
||||
Reconcile that override on a future full server configuration activation.
|
||||
|
||||
## Verification: v5 on 2026-11-12
|
||||
|
||||
- Published `v5-optimizations` on hectic-lab; immutable web release
|
||||
`b8416b890f24578dbaeabd2b2bede19ca8a1e01f9e2b532b04023188fa407c30`.
|
||||
- Public HTTPS checks passed for the 598-entry index, the index hash,
|
||||
client Lithium settings, archive SHA-256, and Prism's NeoForge 21.1.250 pin.
|
||||
- Real packwiz transition from v4 to v5 passed and preserved modified
|
||||
`options.txt`.
|
||||
- Verified all 132 production server JARs against the same archive; no extra
|
||||
JARs were present. The server started normally with the expected server
|
||||
Lithium settings and the existing spawn datapack.
|
||||
- Compared the production region against its fresh pre-update backup:
|
||||
81 chunks and 12,798 sampled blocks were unchanged, with `yPos=-32`,
|
||||
52-long heightmaps, and no heightmap-size warnings.
|
||||
- The actual client entered an isolated Azeroth server and rendered the spawn
|
||||
from multiple angles. This used software rendering, not an FPS benchmark.
|
||||
- See `world-of-sosal-optimizations.md` for versions, compatibility rules,
|
||||
accepted warnings, and remaining limitations.
|
||||
|
||||
## Verification: v4 on 2026-11-12
|
||||
|
||||
- Published `v4-native-height` on hectic-lab. Source archive SHA-256 is
|
||||
`4a197bc039d6684fa1e652e1242b15d87bd8758de895ea8c4f8455ce6a712df1`;
|
||||
the immutable web release is
|
||||
`1abb0ff1a737f426c8e0cf3cd521875e32e06d9fe4582b8d78ea807ca87f2008`.
|
||||
- Verified all 129 server mod files against the new archive before publication.
|
||||
The running server already had the same mod set, so updating its source pin
|
||||
and cache required no game restart or world changes.
|
||||
- Public HTTPS checks passed for the manifest, index checksum, and Prism ZIP.
|
||||
The ZIP pins Minecraft 1.21.1 and NeoForge 21.1.250.
|
||||
- A real packwiz-installer upgrade from v3 to v4 in an isolated Prism directory
|
||||
removed Dynamic Height and `sable_dynamicheight_compat`, preserved modified
|
||||
`options.txt`, and corrected an intentionally mismatched NeoForge 21.1.249
|
||||
component to 21.1.250. All 121 downloaded client files and 470 overrides matched
|
||||
the new archive, except the intentionally preserved options.
|
||||
- The installer test served byte-identical published release snapshots over
|
||||
loopback HTTP: neuro's HTTPS route stalled on the public index, while public
|
||||
HTTPS checks from the workstation succeeded. A full Minecraft GUI login was
|
||||
not observed in this update.
|
||||
- BFS publication is excluded because that mirror is unavailable.
|
||||
|
||||
## Verification on 2026-09-18
|
||||
|
||||
- Source archive SHA-256:
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
# WorldOfSosal v5 optimization compatibility
|
||||
|
||||
Published on 2026-11-12 for Minecraft 1.21.1 / NeoForge 21.1.250.
|
||||
Sodium 0.8.13, Create 6.0.10, Sable 2.0.5, and all existing mod versions
|
||||
remain unchanged.
|
||||
|
||||
| Component | Version | Side |
|
||||
| --- | --- | --- |
|
||||
| ImmediatelyFast | 1.6.15+1.21.1 | Client |
|
||||
| Entity Culling | 1.11.3 | Client |
|
||||
| Create: Nowheel | 2.1.1+1.21.1neoforge | Client compatibility fix |
|
||||
| FerriteCore | 7.0.3 | Both |
|
||||
| ModernFix | 5.27.27+mc1.21.1 | Both |
|
||||
| Lithium | 0.15.4+mc1.21.1 | Both |
|
||||
|
||||
More Culling is deferred: all 11 stable NeoForge artifacts advertised for
|
||||
1.21.1 through 1.0.11 require Minecraft `[1.21,1.21.1)`, excluding 1.21.1.
|
||||
No JAR metadata was patched or dependency check bypassed. Distant Horizons
|
||||
and spark were not added.
|
||||
|
||||
Nowheel addresses Entity Culling hiding entities on Sable sublevels. The
|
||||
conservative pairing is Entity Culling 1.11.3 with Nowheel 2.1.1, rather than
|
||||
the newly released Entity Culling 1.12.0.
|
||||
|
||||
## Lithium compatibility
|
||||
|
||||
Common `config/lithium.properties` disables:
|
||||
|
||||
```properties
|
||||
# Retained game-event dispatchers, issue 783.
|
||||
mixin.world.game_events.dispatch=false
|
||||
# Iron's Spellbooks multipart shields, issue 723.
|
||||
mixin.entity.collisions.intersection=false
|
||||
```
|
||||
|
||||
Client overrides retain both rules and additionally disable:
|
||||
|
||||
```properties
|
||||
# Create Ponder fake-level collisions, issue 771.
|
||||
mixin.entity.collisions.movement=false
|
||||
# Create Ponder identification raycasts, issue 663.
|
||||
mixin.world.raycast=false
|
||||
```
|
||||
|
||||
Sable automatically disables Lithium's unpushable cramming, chunk access,
|
||||
chunk ticking, and tick scheduler optimizations. Runtime confirmed four
|
||||
automatic rules plus two manual server rules. Existing ModernFix configuration
|
||||
is unchanged.
|
||||
|
||||
Two method-overwrite warnings are accepted overlap: ModernFix wins over Lithium
|
||||
for biome temperature and sorted chunk-ticket removal. Temperature implementations
|
||||
compute the same result; both ticket implementations retain linear compaction.
|
||||
Disabling the skipped Lithium implementations would only remove warnings.
|
||||
No warning suppression was added.
|
||||
|
||||
## Deployment and checks
|
||||
|
||||
Source: `minecraft/pack/WorldOfSosal-v5-optimizations.mrpack`.
|
||||
SHA-256: `d3ec9d8725fbaaaa1e14ced3404a1fb904417ab45b1f632861d8e495e7846211`.
|
||||
Parent v4: `4a197bc039d6684fa1e652e1242b15d87bd8758de895ea8c4f8455ce6a712df1`.
|
||||
All previous archive entries and indexed mods are unchanged; only six JAR
|
||||
entries and the two Lithium configuration files were added.
|
||||
|
||||
All prior Storage Box versions and web releases remain available. Fresh
|
||||
production backups are under
|
||||
`/srv/minecraft/backups/wowMineMap-before-optimizations-20261112T190256Z`,
|
||||
with sibling `-mods` and `-config` copies. The working world was not reset.
|
||||
The existing Azeroth spawn datapack and source-map pin were preserved.
|
||||
|
||||
An isolated server loaded, saved, restarted, and reloaded native Azeroth chunks.
|
||||
Both comparisons passed: 81 chunks, 12,798 control blocks unchanged,
|
||||
`yPos=-32`, 52-long heightmaps, and cobblestone below spawn unchanged.
|
||||
The independent comparison after production deployment passed the same checks
|
||||
against the fresh production backup. All 132 production JAR hashes matched the
|
||||
new archive, with no extra JARs.
|
||||
|
||||
The actual client entered the isolated server, initialized all new mods, and
|
||||
rendered Azeroth from multiple angles. A real packwiz v4-to-v5 transition also
|
||||
passed, preserving modified options and selecting the client Lithium settings.
|
||||
Public HTTPS checks verified the 598-entry index, checksums, source archive,
|
||||
client settings, and Prism loader pin.
|
||||
|
||||
## Existing findings and test limits
|
||||
|
||||
Sodium Dynamic Lights 1.0.10 references older Sodium option/rendering classes
|
||||
and declares a Sodium Options API dependency that conflicts with Reese's
|
||||
current options. Client logs confirm missing old Sodium mixin targets. This
|
||||
pre-existing mod was retained; no incompatible Options API was installed.
|
||||
Full dynamic-lighting functionality is not certified by this update.
|
||||
|
||||
Older production logs already contain the same missing recipe/loot registry
|
||||
entries from Design n' Decor, Artificers, and Craftable Loot Chests.
|
||||
These were not changed as part of the optimization update.
|
||||
|
||||
Client smoke testing used llvmpipe software rendering on OpenGL 4.5. It is not
|
||||
an FPS comparison; Sable's GPU-specific shaders and every moving-ship/passenger
|
||||
scenario were not exhaustively tested.
|
||||
|
||||
## Primary references
|
||||
|
||||
- https://github.com/tr7zw/EntityCulling/issues/299
|
||||
- https://modrinth.com/mod/create-nowheel/version/3NKOvEei
|
||||
- https://raw.githubusercontent.com/FxMorin/MoreCulling/v1.0.11/gradle.properties
|
||||
- https://github.com/FxMorin/MoreCulling/issues/481
|
||||
- https://github.com/CaffeineMC/lithium/issues/783
|
||||
- https://github.com/CaffeineMC/lithium/issues/723
|
||||
- https://github.com/CaffeineMC/lithium/issues/771
|
||||
- https://github.com/CaffeineMC/lithium/issues/663
|
||||
- https://github.com/embeddedt/ModernFix/issues/274
|
||||
- https://github.com/FlashyReese/reeses-sodium-options/issues/170
|
||||
@@ -0,0 +1,194 @@
|
||||
# WorldOfSosal source versions and reset
|
||||
|
||||
The source map is independent of the running world. Keep every source revision
|
||||
as a separate archive in Storage Box under `minecraft/map/versions/`.
|
||||
Never replace an existing version. The original `minecraft/map/wow mine map.rar`
|
||||
remains the parent source.
|
||||
|
||||
Each new version has a UTC timestamp in its filename and a JSON sidecar recording
|
||||
its SHA-256, parent archive and hash, spawn dimension and coordinates, and changes.
|
||||
Upload to a temporary filename, verify the remote SHA-256, then rename to the
|
||||
final version filename. Pin that path and hash in
|
||||
`nixos/system/neuro/minecraft/wow-mine-map.nix`.
|
||||
|
||||
The repository now pins `world-of-sosal-20261114T223938Z-winter-biomes.tar.gz`,
|
||||
SHA-256 `d1afd169b16b7b50a57c47da46245e93285b46b6c833bfd08941d07d0341b208`
|
||||
(6,423,189,189 bytes). Archive and JSON manifest were uploaded separately,
|
||||
fully downloaded again, hash checked, and renamed to immutable Storage Box
|
||||
paths on 2026-11-15 UTC. The manifest SHA-256 is
|
||||
`4fd3caff074c1f2f30f55dd82a94fef6fd6918e06243094c4fd39457408facc0`.
|
||||
|
||||
The winter revision extends existing snowy plains, snowy taiga, and ice spikes
|
||||
through the native height Y=-512..2031. The approved northern snowy `the_end`
|
||||
component becomes snowy plains. Its exact contour contains 218,269 native
|
||||
4x4 columns; existing winter areas contain 1,384,211 columns. Isolated snow
|
||||
and ice decorations outside these masks remain unchanged. Together these
|
||||
cover 1,602,480 columns in 104,637 chunks and 187 Azeroth region files.
|
||||
The approved contour bundle SHA-256 is
|
||||
`d15c85c563553c203fb32034f74421bda6a5b00209220ef4f9e780b5900760bd`.
|
||||
|
||||
The transformation checks all 1,019,177,280 target biome cells and every
|
||||
unselected biome cell in each affected chunk. Original non-biome NBT bytes,
|
||||
chunk membership, region timestamps, and untouched compressed chunk payloads
|
||||
are preserved. Missing sections added within the native height contain only
|
||||
air blocks. An independent verifier also checked every modified region header,
|
||||
every untouched payload, and 512 selected chunks. A private server with the
|
||||
production NeoForge 21.1.250, Java 21, and 133 mod JARs passed 117 biome predicates
|
||||
and 216 original-block predicates at nine control points. Biome expectations
|
||||
use Minecraft's seeded biome sampling, including neighboring quart cells.
|
||||
|
||||
On 2026-11-15 UTC the running world received a biome-only overlay, without a
|
||||
reset or source extraction. Minecraft was stopped before copying the original
|
||||
187 target region files and player/progress metadata to
|
||||
`/srv/minecraft/backups/wowMineMap-before-winter-biomes-20261114T223938Z`.
|
||||
This is a targeted backup, not a full-world snapshot. Separate output MCA files
|
||||
passed the complete biome/non-biome checks and the independent 512-chunk check
|
||||
before atomic replacement. All 3,361 other world files retained their SHA-256,
|
||||
size, ownership, mode, inode, and modification time before server startup,
|
||||
including entities, POI, playerdata, advancements, statistics, and level metadata.
|
||||
The original live `SOURCE_VERSION.txt` remains unchanged; the separate overlay
|
||||
receipt is `/var/tmp/worldofsosal-winter-biomes/live-application.json`.
|
||||
|
||||
The old Azeroth `data/DistantHorizons.sqlite` was moved intact into the backup's
|
||||
`derived-dh/` directory (807,206,912 bytes, SHA-256
|
||||
`d7c5174889f236bbbeca63be68cb7bd56f85cd96d83d5bd3730af7c089598a30`).
|
||||
This derived terrain cache must be regenerated to avoid serving old biome LODs.
|
||||
Other dimensions' caches were preserved. Old source versions and backups remain.
|
||||
|
||||
After startup at 00:23:37 UTC on 2026-11-15, the production server passed all
|
||||
117 biome predicates and 216 block predicates against the pre-change live
|
||||
baseline at nine control points. Both dimensions registered, temporary
|
||||
force-load tickets were removed, and `save-all flush` succeeded. The Azeroth
|
||||
DH database was recreated with the new cache identity. Only `levelKeyPrefix`
|
||||
changed in the DH configuration; all other parsed TOML settings matched.
|
||||
The v11 archive, all 133 mod JARs, JVM launcher and memory flags
|
||||
(`-Xmx24G -Xms2G`), and view/simulation distances 32/32 were verified unchanged.
|
||||
The public Minecraft status endpoint answered with the v11 MOTD.
|
||||
No heightmap warnings appeared. All 304 distinct startup error messages matched
|
||||
the previous 2026-11-13 launch: existing mod compatibility, registry, loot,
|
||||
recipe, and function errors remain outside this biome change.
|
||||
Verification reports reside in `/var/tmp/worldofsosal-winter-biomes/`:
|
||||
`live-patch-report.json`, `live-independent.json`, `live-application.json`,
|
||||
`live-runtime-report.json`, `live-config-application.json`, and
|
||||
`live-final-report.json`. These separate offline byte-preservation evidence
|
||||
from normal game writes after startup.
|
||||
|
||||
The parent is `world-of-sosal-20261113T172314Z-outland.tar.gz`,
|
||||
SHA-256 `bee81bb955099e85ed93ca7c258a9cc48ec1a26590bfe891c869a80ad0094def`
|
||||
(6,579,158,241 bytes). This is a clean source revision, derived from the spawn
|
||||
revision below, without gameplay state. It was activated on neuro on 2026-11-13:
|
||||
the working world was reset through the updated import and reset units.
|
||||
Previous source archives and existing backups were retained.
|
||||
|
||||
Outland is now `crafting_azeroth:outland`. The original source documentation
|
||||
places its spawn at **-51210 100 7**, Shattrath at `-53787 77 1069`, and the
|
||||
Hellfire Dark Portal at `-51153 119 7`. Positive X near `51200 116 0` is a
|
||||
separate rotated Stormwind instance and remains in Azeroth.
|
||||
|
||||
All 147 region files west of X=-25600 were moved into Outland without changing
|
||||
coordinates or MCA bytes: 96,403 chunks, 854,810,624 bytes. All 2,063,716 source
|
||||
chunks remain accounted for. The new dimension reuses the native Azeroth height
|
||||
type (`min_y=-512`, `height=2544`) and an empty flat generator. The Azeroth spawn
|
||||
datapack remains enabled. Updated installation and teleport instructions and
|
||||
`OUTLAND_SEPARATION.json` are included in the archive.
|
||||
|
||||
The server uses Distant Horizons `server.levelKeyPrefix`
|
||||
`world-of-sosal-20261114T223938Z-winter-biomes-`, enforced by the modpack importer's
|
||||
`postStart`. The archive configuration omits this key, so `postStart` inserts it
|
||||
under `[server]` rather than only replacing an existing line. This gives clients
|
||||
a fresh terrain-cache identity for each dimension. Obsolete client terrain
|
||||
caches can be removed if old Azeroth LODs remain visible. No DH database is
|
||||
included in the source archive. Ordinary server restarts preserve the working
|
||||
world; only the explicit reset command imports the source again.
|
||||
|
||||
The isolated 2026-11-13 trial registered both dimensions on NeoForge 21.1.250.
|
||||
All 1,440 sampled block states across seven control chunks matched before and
|
||||
after a server restart, with `yPos=-32` and 52-long heightmaps. Controls include
|
||||
Outland spawn, Hellfire, Shattrath, Azeroth spawn, the retained positive-X
|
||||
instance, and both empty counterpart locations. The v11 client joined, visited
|
||||
Outland and Shattrath, and returned to Azeroth; screenshots confirmed terrain.
|
||||
Existing modpack recipe/function errors remain unrelated to this map revision.
|
||||
|
||||
After activation, the working server registered both dimensions and passed the
|
||||
same seven-chunk, 1,440-block comparison with native height metadata. Temporary
|
||||
force-load tickets were removed after verification. All 133 mod JARs, the v11
|
||||
release, JVM launcher, and view/simulation distances of 32/32 remained unchanged.
|
||||
The public Minecraft status endpoint responded successfully. The final restart
|
||||
with the new DH cache identity began at 21:42:22 UTC on 2026-11-13.
|
||||
|
||||
The server now uses the native `crafting_azeroth_height` datapack
|
||||
(`min_y=-512`, `height=2544`). The modpack importer's `postStart` removes
|
||||
`dynamicheight-0.2.0+neoforge-1.21-1.21.1.jar` and
|
||||
`sable_dynamicheight_compat-1.0.0.jar` after every import.
|
||||
The original pack archive remains unchanged.
|
||||
|
||||
With the previous mod configuration, saved Azeroth height changed from
|
||||
MinY=-512, MaxY=2016 to MinY=-64, MaxY=320 and loaded chunks were rewritten.
|
||||
The native-height trial checks the 81 chunks around `3742 89 8891`, saves them,
|
||||
restarts Minecraft, and compares control blocks and chunk height metadata.
|
||||
The 2026-11-12 trial passed on the main server: 12,798 sampled blocks matched the
|
||||
source both before and after restart, all 81 chunks retained `yPos=-32` and
|
||||
52-long heightmaps, and the cobblestone at `3742 88 8891` remained present.
|
||||
No heightmap-size warnings appeared after restart. Temporary force-load tickets
|
||||
are removed after the trial. This verifies server loading and persistence;
|
||||
client login with the changed mod set is a separate check.
|
||||
|
||||
The parent spawn revision is
|
||||
`world-of-sosal-20261112T093842Z-spawn-3742-89-8891.tar.gz`, with SHA-256
|
||||
`da3f79e5593a5b7485ed371d65341cc1516c78a19a1fba71874ae8c1d90e624c`.
|
||||
Its parent is retained as `versions/world-of-sosal-original-bc80084d.rar`, with
|
||||
SHA-256 `bc80084de10a06b0fc2cb1651c61936b9e2fd2288f3f0fe44c964d83a393aa30`.
|
||||
The spawn revision includes `worldofsosal_spawn`, which initializes each new
|
||||
character once at `3742 89 8891` in Azeroth and sets a personal respawn point.
|
||||
Its source is `nixos/system/neuro/minecraft/world-of-sosal-spawn/`.
|
||||
|
||||
The spawn was re-enabled on 2026-11-12 after switching to native dimension height.
|
||||
The working world was not reset or replaced: only the datapack, world spawn
|
||||
metadata, and yukkop's personal respawn fields were changed. Player position,
|
||||
inventory, and other player data were preserved. A full pre-change world copy is
|
||||
kept at `/srv/minecraft/backups/wowMineMap-before-spawn-20261112T133407Z`.
|
||||
After restart, the saved world spawn and personal respawn fields were verified
|
||||
at `3742 89 8891`, with personal `SpawnDimension=crafting_azeroth:azeroth` and
|
||||
forced respawn enabled. The spawn datapack was enabled in the running server.
|
||||
Across 81 loaded chunks, all 12,798 control blocks matched the pre-change working
|
||||
world; `yPos=-32`, 52-long heightmaps, and the cobblestone below spawn were
|
||||
preserved. There were no heightmap-size warnings. The temporary force-load
|
||||
tickets were removed after verification.
|
||||
|
||||
To discard all gameplay changes and return to the pinned source:
|
||||
|
||||
```sh
|
||||
ssh neuro systemctl start minecraft-world-reset-wowMineMap.service
|
||||
```
|
||||
|
||||
This command deletes the entire working world, including all dimensions,
|
||||
inventories, player positions, advancements, and statistics. It first verifies
|
||||
the cached source archive's SHA-256, stops the game and world importer, deletes
|
||||
`/srv/minecraft/wowMineMap/world`, then starts the server. The existing importer
|
||||
extracts the pinned archive before Minecraft starts.
|
||||
|
||||
Mods, server configuration, operator permissions, and source archives remain.
|
||||
Ordinary server restarts preserve the working world; only the explicit reset
|
||||
command discards it.
|
||||
|
||||
Check completion with:
|
||||
|
||||
```sh
|
||||
ssh neuro systemctl status minecraft-world-reset-wowMineMap.service \
|
||||
minecraft-world-import-wowMineMap.service minecraft-server-wowMineMap.service \
|
||||
--no-pager
|
||||
```
|
||||
|
||||
An inactive reset service with exit status 0 is expected after completion.
|
||||
The cache must already contain the pinned archive. To switch source versions,
|
||||
deploy the changed importer and cache the verified archive before resetting.
|
||||
|
||||
The initial deployment on neuro installs the generated import and reset units
|
||||
under `/etc/systemd/system.control/`, with GC roots
|
||||
`/nix/var/nix/gcroots/worldofsosal-world-{import,reset}-unit`. This avoids an
|
||||
unrelated NixOS upgrade. These persistent units override ordinary NixOS units:
|
||||
replace both links and GC roots when deploying another source revision, or
|
||||
remove the overrides after a full NixOS activation includes the same revision.
|
||||
The modpack importer also has an override under `/etc/systemd/system.control/`,
|
||||
pinned by `/nix/var/nix/gcroots/worldofsosal-modpack-import-unit`. Update or remove
|
||||
that override under the same rules when changing the modpack import configuration.
|
||||
@@ -0,0 +1,129 @@
|
||||
# WorldOfSosal / wowmine
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
A Russian-language Minecraft server landing page at `/wowmine/`. The existing
|
||||
Prism publication at `/minecraft/world-of-sosal/` remains the source of downloads
|
||||
and updates. This page never publishes or changes a client pack or server world.
|
||||
|
||||
Primary action: download the auto-updating Prism instance.
|
||||
Information priorities: the Azeroth/Outland world, how to install, how to connect.
|
||||
Required content: Prism ZIP, server address, Minecraft 1.21.1, NeoForge 21.1.250,
|
||||
Java 21, 8 GiB instance allocation, permission for the pre-launch updater,
|
||||
preserved options.txt, managed configuration updates, relaunch after a loader
|
||||
update, manual mrpack and checksums.
|
||||
Left out: invented player counts, fake live status, reviews, prices, account
|
||||
forms, tracking, external JavaScript, and changes to the existing pack publisher.
|
||||
|
||||
## 2. Direction
|
||||
|
||||
Minecraft's tangible game-menu language: square controls, inset highlights,
|
||||
block geometry, earthy stone surfaces, warm sunlight and a grassy green action.
|
||||
The hero is an original fictional voxel illustration, not a server screenshot.
|
||||
Russo One gives the Cyrillic display a block-built silhouette; Golos Text keeps
|
||||
instructions readable. No official Minecraft logo or character art is used.
|
||||
|
||||
The alternatives were a generic launcher dashboard and a parchment fantasy
|
||||
page. Both obscure the requested Minecraft identity; neither is used.
|
||||
Material exceptions to the general frontend defaults are deliberate: square
|
||||
bevels and small hard shadows evoke Minecraft controls, not SaaS cards.
|
||||
|
||||
## 3. Tokens
|
||||
|
||||
Dark: background `#141a15`, raised `#202921`, inset `#101610`,
|
||||
text `#f4f3e7`, muted `#bec9b8`, line `#394638`.
|
||||
Light: background `#f3f2e8`, raised `#ffffff`, inset `#e7e9dc`,
|
||||
text `#202b21`, muted `#53624c`, line `#c8d1bd`.
|
||||
Shared: grass `#a7d754`, grass hover `#b9e66c`, action ink `#17250d`,
|
||||
dark/hero focus `#e8b86c`, light focus `#47671d`;
|
||||
hero ink `#fffdf0`, hero muted `#e5e9d7`.
|
||||
|
||||
Type: Russo One 400 for display/headings, Golos Text 400/600 for UI/body;
|
||||
system monospace only for the server address and filenames.
|
||||
Display: 36–84px; h2: 32–48px; h3: 24–28px; body: 16–18px; small: 14px.
|
||||
Space: 4, 8, 12, 16, 24, 32, 48, 64, 80, 96px.
|
||||
Container: 1200px maximum, 24px mobile and 48px desktop gutters.
|
||||
Controls: minimum 48px tall, square corners; focus outline 3px with 4px offset.
|
||||
Motion: 140ms ease-out for press/hover feedback; no ambient loops.
|
||||
|
||||
## 4. Layout
|
||||
|
||||
Layout: wowmine page - a world introduction followed by installation and help ->
|
||||
main-with-rail (https://github.com/changeroa/StyleGallery/blob/main/patterns/split-sidebar/main-with-rail.md);
|
||||
scroll owner: document; anti-patterns: no fixed-height scroll panels, no hidden
|
||||
mobile content, no visual reordering that changes keyboard order.
|
||||
|
||||
Layout: installation - sequential setup actions ->
|
||||
step-nav (https://github.com/changeroa/StyleGallery/blob/main/patterns/stacking/step-nav.md);
|
||||
scroll owner: document; anti-patterns: no horizontal step scroller and no
|
||||
same-size feature-card grid.
|
||||
|
||||
The hero uses one scenic image and readable text over a dark scrim in both
|
||||
themes. Below it, theme-aware stone surfaces hold the server address and setup
|
||||
instructions. Desktop has a narrow requirements rail; mobile stacks in DOM
|
||||
order. Footer stays in normal flow. The whole page reflows down to 320px.
|
||||
|
||||
## 5. Components and states
|
||||
|
||||
- Brand: original block mark plus WorldOfSosal, linked to the page start.
|
||||
- Navigation: in-page links, a compact theme control; no account or fake menu.
|
||||
- Primary download: one prominent button, hover/pressed/focus states.
|
||||
- Copy-address row: address always visible; stable-size icon button; polite,
|
||||
reserved feedback for success or clipboard denial. Address remains selectable.
|
||||
- Setup list: three numbered instructions with real destinations and named
|
||||
files; no interaction required to read the instructions.
|
||||
- Requirements list: semantic description list, not performance claims.
|
||||
- FAQ: native details/summary, visible keyboard focus and open-state icon.
|
||||
- Theme: follows system preference; a button toggles the page between light and
|
||||
dark without storing cookies or requiring localStorage.
|
||||
|
||||
## 6. Content and assets
|
||||
|
||||
Verified existing source: `docs/minecraft-prism.md`, the public active page,
|
||||
and `script/build-prism-pack.py`. Stable links stay under
|
||||
`/minecraft/world-of-sosal/`; Prism ZIP is not a plain mrpack import.
|
||||
Fonts are self-hosted Google Fonts releases under OFL, with notices beside them.
|
||||
Hero art is generated specifically for this page; original generation is
|
||||
retained in task evidence, and the shipped asset is a compressed WebP.
|
||||
All other graphics are small SVG interface glyphs and an original favicon.
|
||||
|
||||
## 7. Accessibility and browser surfaces
|
||||
|
||||
Semantic landmarks, one h1, ordered h2/h3 headings, skip link, native FAQ,
|
||||
visible focus, text selection, themed scrollbars, no color-only instructions.
|
||||
Target: WCAG 2.2 AA contrast and reflow; touch controls 44px or larger.
|
||||
Reduced motion disables smooth scrolling and transforms. The static document
|
||||
works without JavaScript: downloads, setup, FAQ, and selectable IP remain usable.
|
||||
Both themes are captured on mobile and desktop; the component state harness is
|
||||
the real page, exercised through browser interactions.
|
||||
|
||||
## 8. Evidence and accepted debt
|
||||
|
||||
Before captures: `/tmp/wowmine-qa/before-{desktop,mobile}.png`.
|
||||
After captures and checks: `/tmp/wowmine-qa/`.
|
||||
Publication is separate from local implementation and must be reported honestly.
|
||||
No visual debt accepted yet.
|
||||
|
||||
Verified locally in Chromium: 1440px and 390px, both themes, installation
|
||||
layout, native FAQ expansion, clipboard success and permission denial,
|
||||
visible keyboard focus, and no horizontal overflow at 320px.
|
||||
Captures: `after-{desktop,mobile}-{light,dark}.png`, `mobile-install.png`,
|
||||
and `reflow-320.png` in the evidence directory.
|
||||
HTTP preview serves the redirect, document, scripts, fonts and image; the three
|
||||
existing public download/checksum URLs return 200.
|
||||
Nix parsing and isolated route evaluation pass. Bun browser bundling and the
|
||||
frontend draft guard pass. Full NixOS deployment was not run.
|
||||
The frontend detect renderer cannot run on installed Bun 1.2.13 because
|
||||
`Bun.WebView` is unavailable; browser checks above were run directly instead.
|
||||
TypeScript and editor language servers are not installed; browser bundling
|
||||
checks JavaScript syntax, not a full TypeScript analysis.
|
||||
|
||||
## 9. Gap ledger
|
||||
|
||||
| ID | Before | Required improvement | Proof |
|
||||
| --- | --- | --- | --- |
|
||||
| G1 | `/wowmine` returns 404 | Add a Nix-owned static route | Route evaluation and HTTP preview |
|
||||
| G2 | Bare browser-default text | Minecraft identity and readable hierarchy | Desktop/mobile screenshots |
|
||||
| G3 | Instructions lack structure | Ordered setup, requirements and FAQ | Browser landmarks and links |
|
||||
| G4 | IP is plain text | Copy action with accessible feedback | Keyboard and clipboard states |
|
||||
| G5 | No responsive/theme system | 320px reflow and both themes | Reflow/contrast probes |
|
||||
Generated
+90
-109
@@ -1,5 +1,25 @@
|
||||
{
|
||||
"nodes": {
|
||||
"affine-rust-overlay": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1792913333,
|
||||
"narHash": "sha256-wjoZGhxH/Yr+OsFRpNyV9DpMGQIdNEjjAOinfzQvadk=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "fad80eb74614f7dc37c1c83df8caae64361eda22",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"aquamarine": {
|
||||
"inputs": {
|
||||
"hyprutils": [
|
||||
@@ -166,13 +186,13 @@
|
||||
"locked": {
|
||||
"lastModified": 1767039857,
|
||||
"narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=",
|
||||
"owner": "edolstra",
|
||||
"owner": "NixOS",
|
||||
"repo": "flake-compat",
|
||||
"rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"owner": "NixOS",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
@@ -222,11 +242,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1749398372,
|
||||
"narHash": "sha256-tYBdgS56eXYaWVW3fsnPQ/nFlgWi/Z2Ymhyu21zVM98=",
|
||||
"lastModified": 1788450739,
|
||||
"narHash": "sha256-glZLQlzIn1fXH6PazR2iUmTo7kzzyYSshrWhLS9TqCU=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "9305fe4e5c2a6fcf5ba6a3ff155720fbe4076569",
|
||||
"rev": "31729ca8cbdb4fa927b34e5f4353e6a83f39e993",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -235,24 +255,6 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems_4"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"git-hooks": {
|
||||
"inputs": {
|
||||
"flake-compat": [
|
||||
@@ -266,11 +268,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1775585728,
|
||||
"narHash": "sha256-8Psjt+TWvE4thRKktJsXfR6PA/fWWsZ04DVaY6PUhr4=",
|
||||
"lastModified": 1778507602,
|
||||
"narHash": "sha256-kTwur1wV+01SdqskVMSo6JMEpg71ps3HpbFY2GsflKs=",
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"rev": "580633fa3fe5fc0379905986543fd7495481913d",
|
||||
"rev": "61ab0e80d9c7ab14c256b5b453d8b3fb0189ba0a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -350,16 +352,16 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1770260404,
|
||||
"narHash": "sha256-3iVX1+7YUIt23hBx1WZsUllhbmP2EnXrV8tCRbLxHc8=",
|
||||
"lastModified": 1790996401,
|
||||
"narHash": "sha256-f+kOxEmOUnQazVAmGg0i8hzwgd1kX/geY+k/Dpheye8=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "0d782ee42c86b196acff08acfbf41bb7d13eed5b",
|
||||
"rev": "db7d5e2332710f5abb088f6b5de927d7f9511b35",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "release-25.11",
|
||||
"ref": "release-26.05",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
@@ -662,34 +664,6 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"ixx": {
|
||||
"inputs": {
|
||||
"flake-utils": [
|
||||
"nixvim",
|
||||
"nuschtosSearch",
|
||||
"flake-utils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"nixvim",
|
||||
"nuschtosSearch",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1748294338,
|
||||
"narHash": "sha256-FVO01jdmUNArzBS7NmaktLdGA5qA3lUMJ4B7a05Iynw=",
|
||||
"owner": "NuschtOS",
|
||||
"repo": "ixx",
|
||||
"rev": "cc5f390f7caf265461d4aab37e98d2292ebbdb85",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NuschtOS",
|
||||
"ref": "v0.0.8",
|
||||
"repo": "ixx",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"mechabellum-replay-analysis": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
@@ -717,16 +691,16 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1772129556,
|
||||
"narHash": "sha256-Utk0zd8STPsUJPyjabhzPc5BpPodLTXrwkpXBHYnpeg=",
|
||||
"lastModified": 1783744694,
|
||||
"narHash": "sha256-2cp6N3rrwnGYLTx9l6N+NI+kwrCWxvJUbj5WJhvB29A=",
|
||||
"owner": "nix-darwin",
|
||||
"repo": "nix-darwin",
|
||||
"rev": "ebec37af18215214173c98cf6356d0aca24a2585",
|
||||
"rev": "c3e90c89649b07d1a96e4b9dd6cd0d6e44b91a74",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-darwin",
|
||||
"ref": "nix-darwin-25.11",
|
||||
"ref": "nix-darwin-26.05",
|
||||
"repo": "nix-darwin",
|
||||
"type": "github"
|
||||
}
|
||||
@@ -848,16 +822,16 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1764075412,
|
||||
"narHash": "sha256-d1+H7z21NsXgk9vL/9LAPUuiKrq9iqFxxqAWNNk1gY0=",
|
||||
"lastModified": 1779650959,
|
||||
"narHash": "sha256-dbO78C+xfY70Rg1YoMNgOSrYV85l1GmaS11auZeF9Sg=",
|
||||
"owner": "simple-nixos-mailserver",
|
||||
"repo": "nixos-mailserver",
|
||||
"rev": "8d35f004eeb47cfcfa5c4e1c8765f5c1bf64b9a0",
|
||||
"rev": "04094b9a1c120eb249e54b77963ae130f5b0d83d",
|
||||
"type": "gitlab"
|
||||
},
|
||||
"original": {
|
||||
"owner": "simple-nixos-mailserver",
|
||||
"ref": "snm-25.11",
|
||||
"ref": "snm-26.05",
|
||||
"repo": "nixos-mailserver",
|
||||
"type": "gitlab"
|
||||
}
|
||||
@@ -933,16 +907,16 @@
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1779796641,
|
||||
"narHash": "sha256-ZsIrKmhp4vbBXoXXmR/tBXA/UCsAQiJL9vsgZEduhVY=",
|
||||
"lastModified": 1791254437,
|
||||
"narHash": "sha256-qMSsgG+9tIdx282dMqGuJAUK3t6F36clM6efd0rXfes=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "25f538306313eae3927264466c70d7001dcea1df",
|
||||
"rev": "b25309931cfda5f0b8805f462a29897eeae50168",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-25.11",
|
||||
"ref": "nixos-26.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
@@ -953,45 +927,44 @@
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"nuschtosSearch": "nuschtosSearch",
|
||||
"systems": "systems_5"
|
||||
"systems": "systems_4"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1769049374,
|
||||
"narHash": "sha256-h0Os2qqNyycDY1FyZgtbn28VF1ySP74/n0f+LDd8j+w=",
|
||||
"lastModified": 1789959143,
|
||||
"narHash": "sha256-9oBHyJtUyunZL+6v0Ub8Y759cXcejQiTHpXtGcx5RLs=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixvim",
|
||||
"rev": "b8f76bf5751835647538ef8784e4e6ee8deb8f95",
|
||||
"rev": "4836e77b1798cd42e2de28593bec4c1788da08f5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "nixos-25.11",
|
||||
"ref": "nixos-26.05",
|
||||
"repo": "nixvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nuschtosSearch": {
|
||||
"piu-piu": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"ixx": "ixx",
|
||||
"nixpkgs": [
|
||||
"nixvim",
|
||||
"nixpkgs"
|
||||
]
|
||||
],
|
||||
"rust-overlay": "rust-overlay_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1749730855,
|
||||
"narHash": "sha256-L3x2nSlFkXkM6tQPLJP3oCBMIsRifhIDPMQQdHO5xWo=",
|
||||
"owner": "NuschtOS",
|
||||
"repo": "search",
|
||||
"rev": "8dfe5879dd009ff4742b668d9c699bc4b9761742",
|
||||
"type": "github"
|
||||
"lastModified": 1794607706,
|
||||
"lfs": true,
|
||||
"narHash": "sha256-uboAhaoXSrasdmnq1/fzag+2CNw7CfPO+KKQxCIRGU4=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "1312bb414d97e04ca0b9ac062fb75c58a0455c00",
|
||||
"revCount": 171,
|
||||
"type": "git",
|
||||
"url": "ssh://gitea@gitea.hectic-lab.com/liquiz/recompile.git"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NuschtOS",
|
||||
"repo": "search",
|
||||
"type": "github"
|
||||
"lfs": true,
|
||||
"type": "git",
|
||||
"url": "ssh://gitea@gitea.hectic-lab.com/liquiz/recompile.git"
|
||||
}
|
||||
},
|
||||
"pre-commit-hooks": {
|
||||
@@ -1019,6 +992,7 @@
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"affine-rust-overlay": "affine-rust-overlay",
|
||||
"deploy-rs": "deploy-rs",
|
||||
"disko": "disko",
|
||||
"hectic-landing": "hectic-landing",
|
||||
@@ -1036,7 +1010,8 @@
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"nixpkgs-gitea": "nixpkgs-gitea",
|
||||
"nixvim": "nixvim",
|
||||
"rust-overlay": "rust-overlay_2",
|
||||
"piu-piu": "piu-piu",
|
||||
"rust-overlay": "rust-overlay_3",
|
||||
"sops-nix": "sops-nix"
|
||||
}
|
||||
},
|
||||
@@ -1062,6 +1037,27 @@
|
||||
}
|
||||
},
|
||||
"rust-overlay_2": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"piu-piu",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1794476126,
|
||||
"narHash": "sha256-KBjfmgZIUqBpjsemRKp4GvrCf8DlNsldkmxphh4X9oo=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "d1e30fd696e1151603aa8adaa8f6b8c604fe3eb0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"rust-overlay_3": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
@@ -1088,11 +1084,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1764483358,
|
||||
"narHash": "sha256-EyyvCzXoHrbL467YSsQBTWWg4sR96MH1sPpKoSOelB4=",
|
||||
"lastModified": 1791103873,
|
||||
"narHash": "sha256-nFxM+pKoZ8LJAEnUXARyCaOAloWgaW9kZQOSjWzKcTE=",
|
||||
"owner": "Mic92",
|
||||
"repo": "sops-nix",
|
||||
"rev": "5aca6ff67264321d47856a2ed183729271107c9c",
|
||||
"rev": "dcd241ba97088c22569d1573286e1b9daad340c0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -1161,21 +1157,6 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_5": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
};
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
|
||||
nixpkgs-gitea.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
@@ -21,6 +21,10 @@
|
||||
nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
affine-rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
deploy-rs = {
|
||||
url = "github:serokell/deploy-rs";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
@@ -30,7 +34,7 @@
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
nixvim = {
|
||||
url = "github:nix-community/nixvim/nixos-25.11";
|
||||
url = "github:nix-community/nixvim/nixos-26.05";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
disko = {
|
||||
@@ -41,11 +45,11 @@
|
||||
url = "github:nix-community/impermanence";
|
||||
};
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager/release-25.11";
|
||||
url = "github:nix-community/home-manager/release-26.05";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
nix-darwin = {
|
||||
url = "github:nix-darwin/nix-darwin/nix-darwin-25.11";
|
||||
url = "github:nix-darwin/nix-darwin/nix-darwin-26.05";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
nixos-wsl = {
|
||||
@@ -64,7 +68,7 @@
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
nixos-mailserver = {
|
||||
url = "gitlab:simple-nixos-mailserver/nixos-mailserver/snm-25.11";
|
||||
url = "gitlab:simple-nixos-mailserver/nixos-mailserver/snm-26.05";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
nix-minecraft.url = "github:Infinidoge/nix-minecraft";
|
||||
@@ -84,6 +88,13 @@
|
||||
url = "git+ssh://git@github.com/LysmiMx/mechabellum-replay-analysis.git";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
piu-piu = {
|
||||
# NOTE(yukkop): private repo - SSH access required.
|
||||
# Set Port 22223 for gitea.hectic-lab.com in ~/.ssh/config.
|
||||
# Keep the port out of the URL for Nix's LFS authentication.
|
||||
url = "git+ssh://gitea@gitea.hectic-lab.com/liquiz/recompile.git?lfs=1";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = {
|
||||
|
||||
@@ -581,9 +581,12 @@ immediate teardown; failed jobs retain pre-destroy diagnostics. A healthy,
|
||||
bootstrapped terminal VM may stay running until the next hourly boundary
|
||||
measured from original VM creation, capped by its original hard TTL.
|
||||
|
||||
Retention first enters a durable retirement state. The controller disables the
|
||||
exact repository runner registration, deletes it, and confirms its absence
|
||||
before clearing repository, label, and runner ownership into generic idle. A
|
||||
Each controller-managed registration is ephemeral: Gitea permits it to accept
|
||||
exactly one task and revokes reuse credentials after assignment. Retention first
|
||||
enters a durable retirement state. The controller disables the exact repository
|
||||
runner registration, waits if a pre-upgrade non-ephemeral registration is still
|
||||
assigned to an in-progress job, then deletes it and confirms its absence before
|
||||
clearing repository, label, and runner ownership into generic idle. A
|
||||
queued job from any allowed repository can atomically claim generic idle only
|
||||
when persisted server type, location, architecture, and image match one of the
|
||||
job label's candidates. The VM then remains unschedulable while Hetzner rebuilds
|
||||
@@ -592,12 +595,32 @@ server identity, current image/profile, and current IP before fetching a fresh
|
||||
destination-repository token and bootstrapping a new runner name. Old runner
|
||||
registration and filesystem are never reused.
|
||||
|
||||
Runner allocation and Gitea task assignment are separate identities. Bootstrap
|
||||
installs and registers with the daemon stopped, resolves the exact repository
|
||||
runner registration, persists its numeric `runner_id`, and only then starts the
|
||||
daemon over the pinned SSH channel. Webhooks and unfiltered paginated polling
|
||||
bind lifecycle by exact repository plus `runner_id`; terminal `runner_name` is
|
||||
not authoritative because Gitea may already have deleted the ephemeral runner
|
||||
row. If a runner consumes a different queued job, controller first persists a
|
||||
`transfer_pending` intent, moves VM lifecycle to the actual job, and restores
|
||||
the allocation-origin job as VM-less deferred work. Reconciliation replays this
|
||||
ordered transfer before TTL, orphan, capacity, or deferred sweeps, and duplicate
|
||||
crash-intermediate records count as one VM.
|
||||
|
||||
Pre-upgrade records without `runner_id` use exact live runner-name lookup once.
|
||||
If registration is authoritatively absent and complete repository job polling
|
||||
proves no job is active, VM moves to durable synthetic cleanup ownership while
|
||||
origin is restored to deferred. Any malformed, ambiguous, repository-mismatched,
|
||||
or unavailable identity data leaves state and VM untouched for later retry.
|
||||
|
||||
For every creation and reuse rebuild, the controller generates a unique SSH
|
||||
host key, injects it through authenticated Hetzner `user_data`, and pins that
|
||||
exact public key before sending a registration token. Shared image host keys
|
||||
and trust-on-first-use are not used. Runner images must process Hetzner
|
||||
cloud-init `write_files` during create and rebuild; verify this image gate before
|
||||
dispatching jobs. If host-key injection fails, bootstrap remains fail-closed.
|
||||
and trust-on-first-use are not used. Runner images must process cloud-init's
|
||||
native `ssh_keys` with `ssh_deletekeys: true` and `ssh_genkeytypes: [ed25519]`
|
||||
during create and rebuild. Before release, verify cloud-init completion and
|
||||
agreement between generated, pinned, and live host-key fingerprints on the
|
||||
target image. If host-key injection fails, bootstrap remains fail-closed.
|
||||
|
||||
Reuse preserves original Hetzner VM creation time, hard TTL, and budget charge;
|
||||
it creates no server and makes no second reservation. Provider or registration
|
||||
|
||||
+3
-1
@@ -58,7 +58,9 @@
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = pkgOverlays;
|
||||
config.allowUnfreePredicate = cudaUnfreePredicate;
|
||||
config.allowUnfreePredicate = pkg:
|
||||
cudaUnfreePredicate pkg
|
||||
|| builtins.elem (nixpkgs.lib.getName pkg) [ "vim-plugin-AnsiEsc" ];
|
||||
};
|
||||
systemOutputs = f {
|
||||
system = system;
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
{pkgs}:
|
||||
pkgs.writeShellScript "s3-retention" ''
|
||||
set -eu
|
||||
|
||||
if [ "$#" -ne 7 ]; then
|
||||
echo "Usage: $0 bucket endpoint region prefix archivePrefix retentionDays workDir" >&2
|
||||
exit 1
|
||||
fi
|
||||
bucket=$1
|
||||
endpoint=$2
|
||||
region=$3
|
||||
prefix=$4
|
||||
archive_prefix=$5
|
||||
retention_days=$6
|
||||
work_dir=$7
|
||||
remote_prefix="''${prefix:+$prefix/}"
|
||||
|
||||
temp_dir="$(${pkgs.coreutils}/bin/mktemp -d "$work_dir/.s3-retention.XXXXXXXXXX")"
|
||||
trap '${pkgs.coreutils}/bin/rm -rf "$temp_dir"' EXIT
|
||||
remote_list="$temp_dir/objects.json"
|
||||
remote_delete_dir="$temp_dir/delete"
|
||||
${pkgs.awscli2}/bin/aws s3api list-objects-v2 \
|
||||
--bucket "$bucket" \
|
||||
--prefix "$remote_prefix" \
|
||||
--endpoint-url "$endpoint" \
|
||||
--region "$region" \
|
||||
--output json > "$remote_list"
|
||||
${pkgs.python3}/bin/python3 - "$remote_list" "$remote_delete_dir" \
|
||||
"$(( $(${pkgs.coreutils}/bin/date +%s) - retention_days * 86400 ))" \
|
||||
"$remote_prefix$archive_prefix" <<'PY'
|
||||
import datetime
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
objects_path, delete_dir, cutoff, key_prefix = sys.argv[1:]
|
||||
cutoff = int(cutoff)
|
||||
archive_pattern = re.compile(
|
||||
re.escape(key_prefix) + r"\d{8}T\d{6}Z\.tar\.zst\Z"
|
||||
)
|
||||
with open(objects_path, encoding="utf-8") as stream:
|
||||
objects = json.load(stream).get("Contents", [])
|
||||
|
||||
old_keys = []
|
||||
for item in objects:
|
||||
key = item.get("Key", "")
|
||||
if not archive_pattern.fullmatch(key):
|
||||
continue
|
||||
modified = datetime.datetime.fromisoformat(
|
||||
item["LastModified"].replace("Z", "+00:00")
|
||||
)
|
||||
if int(modified.timestamp()) < cutoff:
|
||||
old_keys.append(key)
|
||||
|
||||
os.makedirs(delete_dir, exist_ok=True)
|
||||
# The S3 endpoint disconnects when deleting multiple existing archives at once.
|
||||
for number, key in enumerate(old_keys):
|
||||
manifest_path = os.path.join(delete_dir, f"batch-{number:04d}.json")
|
||||
with open(manifest_path, "w", encoding="utf-8") as stream:
|
||||
json.dump({"Objects": [{"Key": key}], "Quiet": True}, stream)
|
||||
PY
|
||||
for remote_manifest in "$remote_delete_dir"/*.json; do
|
||||
[ -f "$remote_manifest" ] || continue
|
||||
${pkgs.awscli2}/bin/aws s3api delete-objects \
|
||||
--bucket "$bucket" \
|
||||
--delete "file://$remote_manifest" \
|
||||
--endpoint-url "$endpoint" \
|
||||
--region "$region" \
|
||||
--query '{Errors: Errors}' \
|
||||
--output json > "$temp_dir/result.json"
|
||||
if ! ${pkgs.jq}/bin/jq -e '(.Errors // []) | length == 0' "$temp_dir/result.json" > /dev/null; then
|
||||
${pkgs.coreutils}/bin/cat "$temp_dir/result.json" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
''
|
||||
@@ -1,9 +1,7 @@
|
||||
{
|
||||
inputs,
|
||||
flake,
|
||||
self,
|
||||
}:
|
||||
{
|
||||
...
|
||||
}: {
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
@@ -15,6 +13,10 @@
|
||||
value = input.${key};
|
||||
}) (builtins.attrNames input));
|
||||
in {
|
||||
imports = [
|
||||
inputs.nixos-mailserver.nixosModules.mailserver
|
||||
];
|
||||
|
||||
options = {
|
||||
services.mailserver.enable = lib.mkEnableOption "Mail server";
|
||||
|
||||
@@ -23,7 +25,7 @@ in {
|
||||
description = "The domain name of the mail server";
|
||||
};
|
||||
|
||||
services.mailserver.loginAccounts = lib.mkOption {
|
||||
services.mailserver.accounts = lib.mkOption {
|
||||
type = lib.types.attrsOf (lib.types.submodule {
|
||||
options = {
|
||||
hashedPassword = lib.mkOption {
|
||||
@@ -51,9 +53,9 @@ in {
|
||||
fqdn = "mail." + cfg.domain;
|
||||
domains = [ cfg.domain ];
|
||||
|
||||
loginAccounts = transformLoginAccounts cfg.domain cfg.loginAccounts;
|
||||
accounts = transformLoginAccounts cfg.domain cfg.accounts;
|
||||
|
||||
certificateScheme = "acme-nginx";
|
||||
x509.useACMEHost = "mail." + cfg.domain;
|
||||
};
|
||||
|
||||
services.postfix.settings.main = {
|
||||
@@ -0,0 +1,180 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.services.minecraft-backups;
|
||||
minecraft = config.services.minecraft-servers;
|
||||
servers = lib.filterAttrs (_: server: server.enable) cfg.servers;
|
||||
prune = import ../../../lib/s3-retention.nix { inherit pkgs; };
|
||||
stateDir = name: "${cfg.stateDir}/${name}";
|
||||
restore = name: server: pkgs.writeShellScript "minecraft-backup-resume-${name}" ''
|
||||
set -eu
|
||||
marker=${lib.escapeShellArg "${stateDir name}/restart-needed"}
|
||||
if [ -e "$marker" ]; then
|
||||
${pkgs.systemd}/bin/systemctl start ${lib.escapeShellArg server.service}
|
||||
${pkgs.coreutils}/bin/rm -f "$marker"
|
||||
fi
|
||||
'';
|
||||
backup = name: server: pkgs.writeShellScript "minecraft-backup-${name}" ''
|
||||
set -eu
|
||||
umask 077
|
||||
state_dir=${lib.escapeShellArg (stateDir name)}
|
||||
archive_dir="$state_dir/archive"
|
||||
staging_dir="$state_dir/staging"
|
||||
${pkgs.coreutils}/bin/install -d -m 0700 "$archive_dir" "$staging_dir"
|
||||
exec 9>"$state_dir/lock"
|
||||
${pkgs.util-linux}/bin/flock 9
|
||||
: "''${AWS_ACCESS_KEY_ID:?AWS_ACCESS_KEY_ID is required}"
|
||||
: "''${AWS_SECRET_ACCESS_KEY:?AWS_SECRET_ACCESS_KEY is required}"
|
||||
upload() {
|
||||
${pkgs.awscli2}/bin/aws s3 cp "$1" \
|
||||
${lib.escapeShellArg "s3://${cfg.s3.bucket}/${cfg.s3.prefix}/${name}/"}"''${1##*/}" \
|
||||
--endpoint-url ${lib.escapeShellArg cfg.s3.endpoint} \
|
||||
--region ${lib.escapeShellArg cfg.s3.region} \
|
||||
--cli-connect-timeout 30 --cli-read-timeout 300 --only-show-errors
|
||||
${pkgs.coreutils}/bin/rm -f "$1"
|
||||
}
|
||||
# Retry a failed upload before creating another local archive.
|
||||
for pending in "$archive_dir"/minecraft-${name}-????????T??????Z.tar.zst; do
|
||||
[ -f "$pending" ] || continue
|
||||
upload "$pending"
|
||||
done
|
||||
${restore name server}
|
||||
trap '${restore name server}' EXIT
|
||||
unit=${lib.escapeShellArg server.service}
|
||||
if ${pkgs.systemd}/bin/systemctl is-active --quiet "$unit"; then
|
||||
${pkgs.coreutils}/bin/touch "$state_dir/restart-needed"
|
||||
${pkgs.systemd}/bin/systemctl stop "$unit"
|
||||
if [ "$(${pkgs.systemd}/bin/systemctl show "$unit" -p Result --value)" != success ]; then
|
||||
echo "Minecraft did not stop cleanly; refusing to copy $unit" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
${pkgs.rsync}/bin/rsync -a --checksum --delete --delete-excluded \
|
||||
${lib.concatMapStringsSep " \\\n " (path: "--exclude=${lib.escapeShellArg "/${path}"}") server.exclude} \
|
||||
${lib.escapeShellArg "${server.directory}/"} "$staging_dir/"
|
||||
${restore name server}
|
||||
trap - EXIT
|
||||
timestamp="$(${pkgs.coreutils}/bin/date -u +%Y%m%dT%H%M%SZ)"
|
||||
archive="$archive_dir/minecraft-${name}-$timestamp.tar.zst"
|
||||
trap '${pkgs.coreutils}/bin/rm -f "$archive.tmp"' EXIT
|
||||
${pkgs.gnutar}/bin/tar \
|
||||
--use-compress-program=${lib.escapeShellArg "${pkgs.zstd}/bin/zstd -T2"} \
|
||||
-C "$staging_dir" -cf "$archive.tmp" .
|
||||
${pkgs.coreutils}/bin/mv "$archive.tmp" "$archive"
|
||||
trap - EXIT
|
||||
upload "$archive"
|
||||
${prune} \
|
||||
${lib.escapeShellArg cfg.s3.bucket} \
|
||||
${lib.escapeShellArg cfg.s3.endpoint} \
|
||||
${lib.escapeShellArg cfg.s3.region} \
|
||||
${lib.escapeShellArg "${cfg.s3.prefix}/${name}"} \
|
||||
${lib.escapeShellArg "minecraft-${name}-"} \
|
||||
${toString cfg.s3.retentionDays} "$state_dir"
|
||||
'';
|
||||
in {
|
||||
options.services.minecraft-backups = {
|
||||
enable = lib.mkEnableOption "scheduled Minecraft archives in S3";
|
||||
onCalendar = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "*-*-* 00/6:00:00";
|
||||
description = "Backup schedule for each server.";
|
||||
};
|
||||
stateDir = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "/var/lib/minecraft-backups";
|
||||
description = "Private staging trees and archives awaiting upload.";
|
||||
};
|
||||
s3 = {
|
||||
bucket = lib.mkOption { type = lib.types.str; };
|
||||
endpoint = lib.mkOption { type = lib.types.str; };
|
||||
region = lib.mkOption { type = lib.types.str; };
|
||||
prefix = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "minecraft/${config.networking.hostName}";
|
||||
};
|
||||
credentialsFile = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Runtime environment file containing AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.";
|
||||
};
|
||||
retentionDays = lib.mkOption {
|
||||
type = lib.types.ints.positive;
|
||||
default = 14;
|
||||
};
|
||||
};
|
||||
servers = lib.mkOption {
|
||||
default = {};
|
||||
description = "Enabled nix-minecraft servers are included automatically; additional engines can be declared here.";
|
||||
type = lib.types.attrsOf (lib.types.submodule {
|
||||
options = {
|
||||
enable = lib.mkOption { type = lib.types.bool; default = true; };
|
||||
service = lib.mkOption { type = lib.types.str; };
|
||||
directory = lib.mkOption { type = lib.types.str; };
|
||||
exclude = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [
|
||||
"logs" "crash-reports" "backups" "cache" "libraries" "versions"
|
||||
"mods" "resources" "*.jar" "server.properties"
|
||||
];
|
||||
description = "Root entries regenerated by deployment, logs, and secret-bearing server properties.";
|
||||
};
|
||||
};
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertion = lib.hasPrefix "/" cfg.stateDir
|
||||
&& !lib.hasPrefix "/nix/store/" cfg.stateDir;
|
||||
message = "Minecraft backup stateDir must be an absolute runtime path.";
|
||||
}
|
||||
{
|
||||
assertion = lib.hasPrefix "/" cfg.s3.credentialsFile
|
||||
&& !lib.hasPrefix "/nix/store/" cfg.s3.credentialsFile;
|
||||
message = "Minecraft S3 credentials must be a runtime file outside /nix/store.";
|
||||
}
|
||||
{
|
||||
assertion = lib.hasPrefix "https://" cfg.s3.endpoint;
|
||||
message = "Minecraft S3 endpoint must use HTTPS.";
|
||||
}
|
||||
] ++ lib.mapAttrsToList (name: server: {
|
||||
assertion = builtins.match "[a-zA-Z0-9_-]+" name != null
|
||||
&& lib.hasPrefix "/" server.directory
|
||||
&& !(server.directory == cfg.stateDir || lib.hasPrefix "${server.directory}/" cfg.stateDir)
|
||||
&& !(server.directory == cfg.stateDir || lib.hasPrefix "${cfg.stateDir}/" server.directory);
|
||||
message = "Minecraft backup ${name} needs a safe name and a source directory separate from backup state.";
|
||||
}) servers;
|
||||
|
||||
services.minecraft-backups.servers = lib.mapAttrs (name: _: {
|
||||
service = lib.mkDefault "minecraft-server-${name}.service";
|
||||
directory = lib.mkDefault "${minecraft.dataDir}/${name}";
|
||||
}) (lib.filterAttrs (_: server: minecraft.enable && server.enable) minecraft.servers);
|
||||
|
||||
systemd.tmpfiles.rules = [ "d ${cfg.stateDir} 0700 root root - -" ]
|
||||
++ lib.mapAttrsToList (name: _: "d ${stateDir name} 0700 root root - -") servers;
|
||||
systemd.services = lib.mapAttrs' (name: server: lib.nameValuePair "minecraft-backup-${name}" {
|
||||
description = "S3 backup of Minecraft ${name}";
|
||||
wants = [ "network-online.target" ];
|
||||
after = [ "network-online.target" ];
|
||||
unitConfig.ConditionPathIsDirectory = server.directory;
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "root";
|
||||
UMask = "0077";
|
||||
EnvironmentFile = cfg.s3.credentialsFile;
|
||||
ExecStart = backup name server;
|
||||
# Also restore a stopped server when timeout/SIGKILL bypasses shell traps.
|
||||
ExecStopPost = restore name server;
|
||||
TimeoutStartSec = "2h";
|
||||
};
|
||||
}) servers;
|
||||
systemd.timers = lib.mapAttrs' (name: _: lib.nameValuePair "minecraft-backup-${name}" {
|
||||
wantedBy = [ "timers.target" ];
|
||||
timerConfig = {
|
||||
OnCalendar = cfg.onCalendar;
|
||||
Persistent = true;
|
||||
RandomizedDelaySec = "10min";
|
||||
};
|
||||
}) servers;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
minecraft = config.services.minecraft-servers;
|
||||
restores = lib.filterAttrs (_: restore: restore.enable) config.services.minecraft-backup-restores;
|
||||
marker = ".minecraft-backup-restore-complete";
|
||||
# Python's data filter resolves symlink chains against the extraction tree and
|
||||
# rejects escaping links and special files. Also reject absolute/traversal
|
||||
# names outright (data_filter alone strips leading slashes).
|
||||
extract = pkgs.writeText "minecraft-restore-extract.py" ''
|
||||
import pathlib
|
||||
import sys
|
||||
import tarfile
|
||||
|
||||
def safe_member(member: tarfile.TarInfo, destination: str) -> tarfile.TarInfo | None:
|
||||
path = pathlib.PurePosixPath(member.name)
|
||||
if path.is_absolute() or ".." in path.parts or path.parts == ("${marker}",):
|
||||
raise tarfile.FilterError(f"Unsafe archive entry: {member.name}")
|
||||
# nix-minecraft regenerates this as an absolute store symlink. Keep
|
||||
# bootstrap's EULA rather than restoring a possibly obsolete store path.
|
||||
if path.parts == ("eula.txt",):
|
||||
return None
|
||||
return tarfile.data_filter(member, destination)
|
||||
|
||||
with tarfile.open(sys.argv[1], mode="r:") as archive:
|
||||
archive.extractall(sys.argv[2], filter=safe_member)
|
||||
'';
|
||||
fresh = pkgs.writeText "minecraft-restore-fresh.py" ''
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
target = pathlib.Path(sys.argv[1])
|
||||
level_name = sys.argv[2]
|
||||
if os.path.lexists(target / level_name):
|
||||
sys.exit(f"Refusing existing Minecraft level directory: {target / level_name}")
|
||||
# Refuse even incomplete saves, including custom level-name directories
|
||||
# and save signatures nested beneath mod-specific dimension paths.
|
||||
for directory, directories, files in os.walk(target, followlinks=False):
|
||||
for name in directories + files:
|
||||
path = pathlib.Path(directory) / name
|
||||
if (
|
||||
name in {"level.dat", "level.dat_old", "session.lock", "region",
|
||||
"entities", "poi", "playerdata", "advancements", "stats",
|
||||
"dimensions", "DIM-1", "DIM1"}
|
||||
or name.endswith((".mca", ".mcr"))
|
||||
or (path.parent == target and (
|
||||
name.startswith("world") or name == level_name
|
||||
))
|
||||
):
|
||||
sys.exit(f"Refusing existing Minecraft world state: {path}")
|
||||
'';
|
||||
script = name: restore:
|
||||
let
|
||||
target = "${minecraft.dataDir}/${restore.serverName}";
|
||||
levelName = toString (minecraft.servers.${restore.serverName}.serverProperties.level-name or "world");
|
||||
identity = builtins.toJSON { inherit name; inherit (restore) bucket key endpoint; };
|
||||
in pkgs.writeShellScript "minecraft-backup-restore-${name}" ''
|
||||
set -euo pipefail
|
||||
umask 077
|
||||
target=${lib.escapeShellArg target}
|
||||
${pkgs.coreutils}/bin/mkdir -p ${lib.escapeShellArg minecraft.dataDir}
|
||||
exec 9>${lib.escapeShellArg "${minecraft.dataDir}/.minecraft-restore-${restore.serverName}.lock"}
|
||||
${pkgs.util-linux}/bin/flock 9
|
||||
if [ -L "$target" ]; then
|
||||
echo "Refusing symlink restore target: $target" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ -e "$target/${marker}" ] || [ -L "$target/${marker}" ]; then
|
||||
if [ -f "$target/${marker}" ] && [ ! -L "$target/${marker}" ] &&
|
||||
[ "$(${pkgs.coreutils}/bin/cat "$target/${marker}")" = ${lib.escapeShellArg identity} ]; then
|
||||
exit 0
|
||||
fi
|
||||
echo "Restore marker does not match the configured S3 backup: $target/${marker}" >&2
|
||||
exit 1
|
||||
fi
|
||||
${pkgs.python3}/bin/python ${fresh} "$target" ${lib.escapeShellArg levelName}
|
||||
work="$(${pkgs.coreutils}/bin/mktemp -d ${lib.escapeShellArg "${minecraft.dataDir}/.minecraft-restore-${restore.serverName}.XXXXXX"})"
|
||||
trap '${pkgs.coreutils}/bin/rm -rf -- "$work"' EXIT
|
||||
trap 'exit 1' HUP INT TERM
|
||||
${pkgs.coreutils}/bin/mkdir "$work/server"
|
||||
if [ -e "$target" ]; then
|
||||
test -d "$target"
|
||||
${pkgs.coreutils}/bin/cp -a -- "$target/." "$work/server/"
|
||||
fi
|
||||
: "''${AWS_ACCESS_KEY_ID:?AWS_ACCESS_KEY_ID is required}"
|
||||
: "''${AWS_SECRET_ACCESS_KEY:?AWS_SECRET_ACCESS_KEY is required}"
|
||||
${pkgs.awscli2}/bin/aws s3 cp \
|
||||
${lib.escapeShellArg "s3://${restore.bucket}/${restore.key}"} "$work/backup.tar.zst" \
|
||||
--endpoint-url ${lib.escapeShellArg restore.endpoint} \
|
||||
--region ${lib.escapeShellArg restore.region} \
|
||||
--cli-connect-timeout 30 --cli-read-timeout 300 --only-show-errors
|
||||
${lib.optionalString (restore.expectedSize != null) ''
|
||||
test "$(${pkgs.coreutils}/bin/stat -c %s "$work/backup.tar.zst")" = ${toString restore.expectedSize}
|
||||
''}
|
||||
${pkgs.zstd}/bin/zstd --test --quiet "$work/backup.tar.zst"
|
||||
${pkgs.zstd}/bin/zstd --decompress --stdout "$work/backup.tar.zst" > "$work/backup.tar"
|
||||
${pkgs.python3}/bin/python ${extract} "$work/backup.tar" "$work/server"
|
||||
# Require the configured save, not an unrelated nested level.dat that
|
||||
# would let Minecraft silently generate a fresh world after this restore.
|
||||
test -f "$work/server"/${lib.escapeShellArg "${levelName}/level.dat"}
|
||||
printf '%s\n' ${lib.escapeShellArg identity} > "$work/server/${marker}"
|
||||
${pkgs.coreutils}/bin/chown -hR minecraft:minecraft "$work/server"
|
||||
# The marker moves with the tree in the same atomic operation. When a
|
||||
# bootstrap exists, exchange leaves it in work/server for trap cleanup;
|
||||
# an exchange failure leaves the original directory untouched.
|
||||
if [ -e "$target" ]; then
|
||||
${pkgs.coreutils}/bin/mv --exchange --no-copy -T "$work/server" "$target"
|
||||
else
|
||||
${pkgs.coreutils}/bin/mv --no-copy -T "$work/server" "$target"
|
||||
fi
|
||||
'';
|
||||
in {
|
||||
options.services.minecraft-backup-restores = lib.mkOption {
|
||||
default = {};
|
||||
description = "One-time full S3 backup restores, optionally after modpack bootstrap. The regenerated root eula.txt is retained from bootstrap.";
|
||||
type = lib.types.attrsOf (lib.types.submodule ({ name, ... }: {
|
||||
options = {
|
||||
enable = lib.mkEnableOption "one-time Minecraft backup restore";
|
||||
serverName = lib.mkOption { type = lib.types.str; default = name; };
|
||||
completionMarker = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
readOnly = true;
|
||||
default = "${minecraft.dataDir}/${config.services.minecraft-backup-restores.${name}.serverName}/${marker}";
|
||||
description = "Persistent marker path; bootstrap units should use ConditionPathExists=!<this path> to preserve restored configuration on subsequent boots.";
|
||||
};
|
||||
bucket = lib.mkOption { type = lib.types.str; };
|
||||
key = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Exact S3 object key ending in .tar.zst.";
|
||||
};
|
||||
endpoint = lib.mkOption { type = lib.types.str; };
|
||||
region = lib.mkOption { type = lib.types.str; };
|
||||
credentialsFile = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Runtime EnvironmentFile outside /nix/store containing AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.";
|
||||
};
|
||||
expectedSize = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.ints.positive;
|
||||
default = null;
|
||||
description = "Expected compressed object size in bytes.";
|
||||
};
|
||||
timeout = lib.mkOption { type = lib.types.str; default = "2h"; };
|
||||
afterUnits = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [];
|
||||
description = "Required units that finish before restore, e.g. modpack bootstrap. Backup files override bootstrap files; bootstrap-only mods remain.";
|
||||
};
|
||||
};
|
||||
}));
|
||||
};
|
||||
|
||||
config = lib.mkIf (restores != {}) {
|
||||
assertions = [
|
||||
{
|
||||
assertion = lib.hasPrefix "/" minecraft.dataDir && !lib.hasPrefix "/nix/store/" minecraft.dataDir;
|
||||
message = "Minecraft restores require an absolute runtime dataDir.";
|
||||
}
|
||||
{
|
||||
assertion = lib.length (lib.unique (map (restore: restore.serverName) (lib.attrValues restores))) == lib.length (lib.attrNames restores);
|
||||
message = "Minecraft restores must have unique server targets.";
|
||||
}
|
||||
] ++ lib.concatLists (lib.mapAttrsToList (name: restore: [
|
||||
{
|
||||
assertion = builtins.match "[a-zA-Z0-9_-]+" name != null
|
||||
&& builtins.match "[a-zA-Z0-9_-]+" restore.serverName != null
|
||||
&& minecraft.enable
|
||||
&& (minecraft.servers.${restore.serverName}.enable or false);
|
||||
message = "Minecraft restore ${name} must target an enabled Minecraft server and use safe names.";
|
||||
}
|
||||
{
|
||||
assertion = lib.hasPrefix "/" restore.credentialsFile
|
||||
&& !lib.hasPrefix "/nix/store/" restore.credentialsFile;
|
||||
message = "Minecraft restore ${name} credentials must be a runtime file outside /nix/store.";
|
||||
}
|
||||
{
|
||||
assertion = lib.hasPrefix "https://" restore.endpoint && lib.hasSuffix ".tar.zst" restore.key;
|
||||
message = "Minecraft restore ${name} requires HTTPS and an exact .tar.zst object key.";
|
||||
}
|
||||
]) restores);
|
||||
|
||||
systemd.services = lib.mkMerge (lib.mapAttrsToList (name: restore: {
|
||||
"minecraft-backup-restore-${name}" = {
|
||||
description = "One-time full backup restore of Minecraft ${restore.serverName}";
|
||||
wants = [ "network-online.target" ];
|
||||
after = [ "network-online.target" ] ++ restore.afterUnits;
|
||||
requires = restore.afterUnits;
|
||||
before = [ "minecraft-server-${restore.serverName}.service" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "root";
|
||||
UMask = "0077";
|
||||
EnvironmentFile = restore.credentialsFile;
|
||||
ExecStart = script name restore;
|
||||
TimeoutStartSec = restore.timeout;
|
||||
};
|
||||
};
|
||||
"minecraft-server-${restore.serverName}" = {
|
||||
requires = [ "minecraft-backup-restore-${name}.service" ];
|
||||
after = [ "minecraft-backup-restore-${name}.service" ];
|
||||
};
|
||||
}) restores);
|
||||
};
|
||||
}
|
||||
@@ -12,7 +12,6 @@
|
||||
in {
|
||||
imports = [
|
||||
inputs.disko.nixosModules.default
|
||||
inputs.nixos-mailserver.nixosModules.mailserver
|
||||
];
|
||||
|
||||
options.hectic.archetype.base.enable = lib.mkEnableOption "Enable archetupe.dev";
|
||||
|
||||
@@ -18,6 +18,7 @@ in {
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.nixvim = {
|
||||
nixpkgs.source = inputs.nixpkgs;
|
||||
enable = true;
|
||||
|
||||
extraPackages = with pkgs; [ gcc ];
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
{ ... }:
|
||||
{ config, lib, pkgs, ... }: let
|
||||
cfg = config.hectic.services.affine-chatgpt;
|
||||
stateDirectory = "/var/lib/affine-chatgpt";
|
||||
in {
|
||||
options.hectic.services.affine-chatgpt = {
|
||||
enable = lib.mkEnableOption "native ChatGPT subscription gateway for AFFiNE";
|
||||
package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = pkgs.hectic.affine-chatgpt;
|
||||
description = "Package providing the affine-chatgpt executable.";
|
||||
};
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 3012;
|
||||
description = "Loopback-only gateway port.";
|
||||
};
|
||||
gatewayKeyFile = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = "${stateDirectory}/gateway-key";
|
||||
description = "Owner-only runtime bearer key readable by affine-chatgpt; never put its contents in Nix.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
users.groups.affine-chatgpt = {};
|
||||
users.users.affine-chatgpt = {
|
||||
isSystemUser = true;
|
||||
group = "affine-chatgpt";
|
||||
home = stateDirectory;
|
||||
};
|
||||
systemd.services.affine-chatgpt = {
|
||||
description = "Native ChatGPT subscription gateway for AFFiNE";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network-online.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
unitConfig.ConditionPathExists = "${stateDirectory}/session/credentials.json";
|
||||
preStart = ''
|
||||
install -d -m 0700 ${stateDirectory}/session
|
||||
'';
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
User = "affine-chatgpt";
|
||||
Group = "affine-chatgpt";
|
||||
StateDirectory = "affine-chatgpt";
|
||||
StateDirectoryMode = "0700";
|
||||
ExecStart = "${cfg.package}/bin/affine-chatgpt --state-dir ${stateDirectory}/session serve --host 127.0.0.1 --port ${toString cfg.port} --gateway-key-file ${cfg.gatewayKeyFile}";
|
||||
Restart = "on-failure";
|
||||
RestartSec = "5s";
|
||||
UMask = "0077";
|
||||
NoNewPrivileges = true;
|
||||
PrivateTmp = true;
|
||||
ProtectHome = true;
|
||||
ProtectSystem = "strict";
|
||||
ReadWritePaths = [ stateDirectory ];
|
||||
RestrictAddressFamilies = [ "AF_INET" "AF_INET6" "AF_UNIX" ];
|
||||
CapabilityBoundingSet = "";
|
||||
LimitCORE = 0;
|
||||
MemoryMax = "256M";
|
||||
TasksMax = 64;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,215 @@
|
||||
{
|
||||
inputs,
|
||||
flake,
|
||||
...
|
||||
}:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
cfg = config.hectic.services.affine;
|
||||
stateDirectory = "/var/lib/affine-native";
|
||||
configDirectory = "${stateDirectory}/.affine/config";
|
||||
storageDirectory = "${stateDirectory}/.affine/storage";
|
||||
initialConfig = pkgs.writeText "affine-native-config.json" (builtins.toJSON (
|
||||
lib.recursiveUpdate {
|
||||
server = {
|
||||
externalUrl = cfg.externalUrl;
|
||||
host = "localhost";
|
||||
listenAddr = cfg.address;
|
||||
name = cfg.serverName;
|
||||
port = cfg.port;
|
||||
};
|
||||
auth = {
|
||||
allowSignup = false;
|
||||
allowSignupForOauth = false;
|
||||
};
|
||||
copilot.enabled = false;
|
||||
} cfg.settings
|
||||
));
|
||||
prepareState = ''
|
||||
install -d -m 0700 ${configDirectory} ${storageDirectory}
|
||||
if [ ! -e ${configDirectory}/config.json ]; then
|
||||
install -m 0600 ${initialConfig} ${configDirectory}/config.json
|
||||
fi
|
||||
'';
|
||||
commonEnvironment = {
|
||||
HOME = stateDirectory;
|
||||
PORT = toString cfg.port;
|
||||
AFFINE_SERVER_PORT = toString cfg.port;
|
||||
LISTEN_ADDR = cfg.address;
|
||||
REDIS_SERVER_HOST = cfg.redisHost;
|
||||
REDIS_SERVER_PORT = toString cfg.redisPort;
|
||||
};
|
||||
commonServiceConfig = {
|
||||
User = "affine-native";
|
||||
Group = "affine-native";
|
||||
StateDirectory = "affine-native";
|
||||
StateDirectoryMode = "0700";
|
||||
EnvironmentFile = cfg.environmentFile;
|
||||
UMask = "0077";
|
||||
NoNewPrivileges = true;
|
||||
PrivateTmp = true;
|
||||
ProtectHome = true;
|
||||
ProtectSystem = "strict";
|
||||
ReadWritePaths = [ stateDirectory ];
|
||||
RestrictAddressFamilies = [ "AF_INET" "AF_INET6" "AF_UNIX" ];
|
||||
};
|
||||
in {
|
||||
options.hectic.services.affine = {
|
||||
enable = lib.mkEnableOption "native AFFiNE server";
|
||||
|
||||
package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = pkgs.callPackage (flake + "/package/affine") {
|
||||
inherit inputs;
|
||||
system = pkgs.stdenv.hostPlatform.system;
|
||||
nodejs = pkgs.nodejs_22;
|
||||
# Baseline bundle intentionally excludes independently deployed picker patches.
|
||||
frontendPatches = [ (flake + "/package/affine/gitea-document-typography.patch") ];
|
||||
};
|
||||
defaultText = lib.literalExpression "pkgs.callPackage ./package/affine { ...; }";
|
||||
description = ''
|
||||
AFFiNE package providing affine-server and affine-migrate. The default
|
||||
source-built package is available only on x86_64-linux and has an unfree
|
||||
backend license. Explicitly allow both "affine" and
|
||||
"affine-server-native" through nixpkgs.config.allowUnfreePredicate, or
|
||||
provide a package whose licensing policy you have configured separately.
|
||||
'';
|
||||
};
|
||||
|
||||
frontendPackage = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.package;
|
||||
default = null;
|
||||
description = ''
|
||||
Optional source-built AFFiNE web, admin, and mobile static assets to
|
||||
bind over the native server's bundled frontend.
|
||||
'';
|
||||
};
|
||||
|
||||
environmentFile = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
description = ''
|
||||
Runtime environment file containing DATABASE_URL and any secret AFFiNE
|
||||
or Redis variables. Keep this file outside the Nix store.
|
||||
'';
|
||||
};
|
||||
|
||||
address = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "127.0.0.1";
|
||||
description = "Address on which AFFiNE listens.";
|
||||
};
|
||||
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 3011;
|
||||
description = "Port on which AFFiNE listens.";
|
||||
};
|
||||
|
||||
externalUrl = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "http://localhost:${toString cfg.port}";
|
||||
description = "External URL written to the initial AFFiNE configuration.";
|
||||
};
|
||||
|
||||
serverName = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "AFFiNE";
|
||||
description = "Server name written to the initial AFFiNE configuration.";
|
||||
};
|
||||
|
||||
redisHost = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "127.0.0.1";
|
||||
description = "External Redis host exported as REDIS_SERVER_HOST.";
|
||||
};
|
||||
|
||||
redisPort = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 6388;
|
||||
description = "External Redis port exported as REDIS_SERVER_PORT.";
|
||||
};
|
||||
|
||||
settings = lib.mkOption {
|
||||
type = (pkgs.formats.json {}).type;
|
||||
default = {};
|
||||
description = ''
|
||||
Extra values recursively merged into the initial AFFiNE config.json.
|
||||
This seed is written only when config.json does not already exist.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertion = pkgs.stdenv.hostPlatform.system == "x86_64-linux";
|
||||
message = "hectic.services.affine currently supports only x86_64-linux.";
|
||||
}
|
||||
{
|
||||
assertion = cfg.frontendPackage == null || (
|
||||
cfg.package ? version &&
|
||||
cfg.frontendPackage ? version &&
|
||||
cfg.frontendPackage.version == cfg.package.version
|
||||
);
|
||||
message = "hectic.services.affine.frontendPackage version must match hectic.services.affine.package version.";
|
||||
}
|
||||
{
|
||||
assertion = cfg.frontendPackage == null || (
|
||||
cfg.package ? frontendStatic &&
|
||||
cfg.package.frontendStatic ? revision &&
|
||||
builtins.isString cfg.package.frontendStatic.revision &&
|
||||
cfg.package.frontendStatic.revision != "" &&
|
||||
cfg.frontendPackage ? revision &&
|
||||
builtins.isString cfg.frontendPackage.revision &&
|
||||
cfg.frontendPackage.revision != "" &&
|
||||
cfg.frontendPackage.revision == cfg.package.frontendStatic.revision
|
||||
);
|
||||
message = "hectic.services.affine.frontendPackage revision must be a non-empty string matching package.frontendStatic.revision.";
|
||||
}
|
||||
];
|
||||
|
||||
users.groups.affine-native = {};
|
||||
users.users.affine-native = {
|
||||
isSystemUser = true;
|
||||
group = "affine-native";
|
||||
home = stateDirectory;
|
||||
};
|
||||
|
||||
systemd.services.affine-native-migrate = {
|
||||
description = "AFFiNE database and data migrations";
|
||||
after = [ "network-online.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
environment = commonEnvironment;
|
||||
preStart = prepareState;
|
||||
restartTriggers = [ cfg.package initialConfig ];
|
||||
serviceConfig = commonServiceConfig // {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${cfg.package}/bin/affine-migrate";
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.affine-native = {
|
||||
description = "Native AFFiNE server";
|
||||
after = [ "network-online.target" "affine-native-migrate.service" ];
|
||||
wants = [ "network-online.target" ];
|
||||
requires = [ "affine-native-migrate.service" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
environment = commonEnvironment;
|
||||
preStart = prepareState;
|
||||
restartTriggers = [ cfg.package initialConfig ] ++ lib.optional (cfg.frontendPackage != null) cfg.frontendPackage;
|
||||
serviceConfig = commonServiceConfig // {
|
||||
Type = "simple";
|
||||
ExecStart = "${cfg.package}/bin/affine-server";
|
||||
Restart = "on-failure";
|
||||
RestartSec = "5s";
|
||||
BindReadOnlyPaths = lib.optional (cfg.frontendPackage != null)
|
||||
"${cfg.frontendPackage}:${cfg.package}/share/affine/static";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -9,49 +9,70 @@
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
legacyCfg = config.hectic.services.matrix;
|
||||
hasClusterCfg = config.hectic ? generic && config.hectic.generic ? matrix-cluster;
|
||||
clusterCfg = if hasClusterCfg then config.hectic.generic.matrix-cluster else null;
|
||||
clusterSynapseEnabled =
|
||||
if hasClusterCfg
|
||||
then clusterCfg.enable
|
||||
&& (if clusterCfg.overrideEnableSynapse != null then clusterCfg.overrideEnableSynapse else clusterCfg.role == "primary")
|
||||
else false;
|
||||
enabled = legacyCfg.enable || clusterSynapseEnabled;
|
||||
matrixDomain = if legacyCfg.enable then legacyCfg.matrixDomain else if hasClusterCfg then clusterCfg.matrixDomain else "";
|
||||
jitsiPreferredDomain =
|
||||
if legacyCfg.enable && config.hectic.services.jitsi.enable
|
||||
then config.hectic.services.jitsi.hostName
|
||||
else if hasClusterCfg then clusterCfg.jitsi.preferredDomain else null;
|
||||
cfg = config.hectic.services.element;
|
||||
nonEmptyStr = lib.types.strMatching ".+";
|
||||
generatedSettings = {
|
||||
default_server_config = {
|
||||
"m.homeserver".base_url = cfg.homeserverBaseUrl;
|
||||
"m.homeserver".server_name = cfg.homeserverServerName;
|
||||
"m.identity_server".base_url = "https://vector.im";
|
||||
};
|
||||
|
||||
room_directory.servers = [ cfg.homeserverServerName ];
|
||||
|
||||
jitsi = lib.optionalAttrs (cfg.jitsiPreferredDomain != null) {
|
||||
preferred_domain = cfg.jitsiPreferredDomain;
|
||||
};
|
||||
|
||||
default_theme = "dark";
|
||||
show_labs_settings = true;
|
||||
};
|
||||
in {
|
||||
config = lib.mkIf enabled {
|
||||
services.nginx.virtualHosts."element.${matrixDomain}" = {
|
||||
options.hectic.services.element = {
|
||||
enable = lib.mkEnableOption "Element web client";
|
||||
|
||||
hostName = lib.mkOption {
|
||||
type = nonEmptyStr;
|
||||
description = "FQDN serving the Element web client.";
|
||||
};
|
||||
|
||||
homeserverBaseUrl = lib.mkOption {
|
||||
type = nonEmptyStr;
|
||||
description = "Public Matrix homeserver base URL used by Element.";
|
||||
};
|
||||
|
||||
homeserverServerName = lib.mkOption {
|
||||
type = nonEmptyStr;
|
||||
description = "Matrix server name presented by Element.";
|
||||
};
|
||||
|
||||
jitsiPreferredDomain = lib.mkOption {
|
||||
type = lib.types.nullOr nonEmptyStr;
|
||||
default = null;
|
||||
description = "Preferred Jitsi domain, or null to leave it unset.";
|
||||
};
|
||||
|
||||
settings = lib.mkOption {
|
||||
type = lib.types.attrsOf (pkgs.formats.json {}).type;
|
||||
default = {};
|
||||
description = ''
|
||||
Extra Element config recursively merged over generated defaults.
|
||||
Values here may override generated keys. Settings are PUBLIC in the
|
||||
Nix store and served config.json; do not put secrets here.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.nginx.enable = true;
|
||||
services.nginx.virtualHosts.${cfg.hostName} = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
|
||||
locations."= /config.element.${matrixDomain}.json".return = "302 /config.json";
|
||||
locations."= /config.${cfg.hostName}.json".return = "302 /config.json";
|
||||
|
||||
root = pkgs.hectic.element-web.override {
|
||||
conf = {
|
||||
default_server_config = {
|
||||
"m.homeserver".base_url = "https://${matrixDomain}";
|
||||
"m.homeserver".server_name = matrixDomain;
|
||||
"m.identity_server".base_url = "https://vector.im";
|
||||
};
|
||||
|
||||
room_directory.servers = [
|
||||
matrixDomain
|
||||
];
|
||||
|
||||
hectic.videoMessages.enabled = true;
|
||||
|
||||
jitsi = lib.optionalAttrs (jitsiPreferredDomain != null) {
|
||||
preferred_domain = jitsiPreferredDomain;
|
||||
};
|
||||
|
||||
default_theme = "dark";
|
||||
show_labs_settings = true;
|
||||
};
|
||||
conf = lib.recursiveUpdate generatedSettings cfg.settings;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
timestampArchivePattern = "project-zomboid-${cfg.serverName}-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]T[0-9][0-9][0-9][0-9][0-9][0-9]Z.tar.zst";
|
||||
saveDir = "${zomboidDir}/Saves/Multiplayer/${cfg.serverName}";
|
||||
serverConfigDir = "${zomboidDir}/Server";
|
||||
s3RetentionScript = import ../../../../lib/s3-retention.nix {inherit pkgs;};
|
||||
backupScript = pkgs.writeShellScript "project-zomboid-backup" ''
|
||||
set -eu
|
||||
|
||||
@@ -163,69 +164,14 @@
|
||||
-mmin +${toString (backupCfg.retentionDays * 1440)} -delete
|
||||
''}
|
||||
|
||||
remote_prefix="$s3_prefix"
|
||||
if [ -n "$remote_prefix" ]; then
|
||||
remote_prefix="$remote_prefix/"
|
||||
fi
|
||||
archive_prefix=${lib.escapeShellArg "project-zomboid-${cfg.serverName}-"}
|
||||
remote_list="$staging_dir/.remote-objects.json"
|
||||
remote_delete_dir="$staging_dir/.remote-delete"
|
||||
${pkgs.awscli2}/bin/aws s3api list-objects-v2 \
|
||||
--bucket "$s3_bucket" \
|
||||
--prefix "$remote_prefix" \
|
||||
--endpoint-url ${lib.escapeShellArg s3Endpoint} \
|
||||
--region ${lib.escapeShellArg s3Region} \
|
||||
--output json > "$remote_list"
|
||||
${pkgs.python3}/bin/python3 - "$remote_list" "$remote_delete_dir" \
|
||||
"$(( $(${pkgs.coreutils}/bin/date +%s) - ${toString (backupCfg.s3.remoteRetentionDays * 86400)} ))" \
|
||||
"$remote_prefix$archive_prefix" <<'PY'
|
||||
import datetime
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
objects_path, delete_dir, cutoff, key_prefix = sys.argv[1:]
|
||||
cutoff = int(cutoff)
|
||||
archive_pattern = re.compile(
|
||||
re.escape(key_prefix) + r"\d{8}T\d{6}Z\.tar\.zst\Z"
|
||||
)
|
||||
with open(objects_path, encoding="utf-8") as stream:
|
||||
objects = json.load(stream).get("Contents", [])
|
||||
|
||||
old_keys = []
|
||||
for item in objects:
|
||||
key = item.get("Key", "")
|
||||
if not archive_pattern.fullmatch(key):
|
||||
continue
|
||||
modified = datetime.datetime.fromisoformat(
|
||||
item["LastModified"].replace("Z", "+00:00")
|
||||
)
|
||||
if int(modified.timestamp()) < cutoff:
|
||||
old_keys.append(key)
|
||||
|
||||
os.makedirs(delete_dir, exist_ok=True)
|
||||
for batch_number in range(0, len(old_keys), 1000):
|
||||
batch = old_keys[batch_number:batch_number + 1000]
|
||||
manifest_path = os.path.join(
|
||||
delete_dir, f"batch-{batch_number // 1000:04d}.json"
|
||||
)
|
||||
with open(manifest_path, "w", encoding="utf-8") as stream:
|
||||
json.dump(
|
||||
{"Objects": [{"Key": key} for key in batch], "Quiet": True},
|
||||
stream,
|
||||
)
|
||||
PY
|
||||
for remote_manifest in "$remote_delete_dir"/*.json; do
|
||||
[ -f "$remote_manifest" ] || continue
|
||||
${pkgs.awscli2}/bin/aws s3api delete-objects \
|
||||
--bucket "$s3_bucket" \
|
||||
--delete "file://$remote_manifest" \
|
||||
--endpoint-url ${lib.escapeShellArg s3Endpoint} \
|
||||
--region ${lib.escapeShellArg s3Region} \
|
||||
--only-show-errors
|
||||
done
|
||||
${pkgs.coreutils}/bin/rm -rf "$remote_list" "$remote_delete_dir"
|
||||
${s3RetentionScript} \
|
||||
"$s3_bucket" \
|
||||
${lib.escapeShellArg s3Endpoint} \
|
||||
${lib.escapeShellArg s3Region} \
|
||||
"$s3_prefix" \
|
||||
${lib.escapeShellArg "project-zomboid-${cfg.serverName}-"} \
|
||||
${toString backupCfg.s3.remoteRetentionDays} \
|
||||
"$staging_dir"
|
||||
''}
|
||||
|
||||
${lib.optionalString (!backupCfg.s3.enable) ''
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
{
|
||||
inputs,
|
||||
flake,
|
||||
self,
|
||||
}:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
cfg = config.hectic.services.routine-server;
|
||||
system = pkgs.stdenv.hostPlatform.system;
|
||||
in {
|
||||
options.hectic.services.routine-server = {
|
||||
enable = lib.mkEnableOption "daily, weekly, and monthly routine server";
|
||||
|
||||
address = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "127.0.0.1";
|
||||
description = "Address on which the routine server listens.";
|
||||
};
|
||||
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 8090;
|
||||
description = "Port on which the routine server listens.";
|
||||
};
|
||||
|
||||
generationDays = lib.mkOption {
|
||||
type = lib.types.ints.unsigned;
|
||||
default = 62;
|
||||
description = "Number of future routine days to materialize.";
|
||||
};
|
||||
|
||||
databaseName = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "routine-server";
|
||||
description = "PostgreSQL database used by the routine server.";
|
||||
};
|
||||
|
||||
databaseUser = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "routine-server";
|
||||
description = "PostgreSQL and dynamic system user used by the routine server.";
|
||||
};
|
||||
|
||||
databaseSocket = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = "/run/postgresql";
|
||||
description = "PostgreSQL Unix socket directory.";
|
||||
};
|
||||
|
||||
timezone = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "UTC";
|
||||
description = "Timezone used for dates and reminder times.";
|
||||
};
|
||||
|
||||
environmentFile = lib.mkOption {
|
||||
type = with lib.types; nullOr path;
|
||||
default = null;
|
||||
description = ''
|
||||
Optional secret environment file. Supported variables:
|
||||
ROUTINE_API_TOKEN=
|
||||
ROUTINE_TELEGRAM_BOT_TOKEN=
|
||||
ROUTINE_TELEGRAM_CHAT_ID=
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
ensureDatabases = [ cfg.databaseName ];
|
||||
ensureUsers = [
|
||||
{
|
||||
name = cfg.databaseUser;
|
||||
ensureDBOwnership = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
systemd.services.routine-server = {
|
||||
description = "Personal routine task server";
|
||||
after = [ "network-online.target" "postgresql.service" ];
|
||||
wants = [ "network-online.target" ];
|
||||
requires = [ "postgresql.service" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
environment = {
|
||||
ROUTINE_BIND = "${cfg.address}:${toString cfg.port}";
|
||||
ROUTINE_DATABASE_URL = "host=${cfg.databaseSocket} dbname=${cfg.databaseName} user=${cfg.databaseUser}";
|
||||
ROUTINE_GENERATION_DAYS = toString cfg.generationDays;
|
||||
TZ = cfg.timezone;
|
||||
};
|
||||
|
||||
serviceConfig = lib.mkMerge [
|
||||
{
|
||||
Type = "simple";
|
||||
ExecStart = "${self.packages.${system}.routine-server}/bin/routine-server";
|
||||
Restart = "on-failure";
|
||||
RestartSec = "5s";
|
||||
DynamicUser = true;
|
||||
User = cfg.databaseUser;
|
||||
Group = cfg.databaseUser;
|
||||
UMask = "0077";
|
||||
NoNewPrivileges = true;
|
||||
PrivateTmp = true;
|
||||
ProtectHome = true;
|
||||
ProtectSystem = "strict";
|
||||
RestrictAddressFamilies = [ "AF_INET" "AF_INET6" "AF_UNIX" ];
|
||||
}
|
||||
(lib.mkIf (cfg.environmentFile != null) {
|
||||
EnvironmentFile = cfg.environmentFile;
|
||||
})
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -4,7 +4,6 @@
|
||||
self,
|
||||
}: {
|
||||
lib,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
config,
|
||||
...
|
||||
@@ -66,6 +65,14 @@ in {
|
||||
hostName = jitsiHost;
|
||||
};
|
||||
|
||||
hectic.services.element = {
|
||||
enable = true;
|
||||
hostName = elementEntryDomain;
|
||||
homeserverBaseUrl = "https://${polandEntryDomain}";
|
||||
homeserverServerName = matrixHost;
|
||||
jitsiPreferredDomain = jitsiHost;
|
||||
};
|
||||
|
||||
# NOTE(yukkop): disk was provisioned outside disko, so the expected partition
|
||||
# label does not exist. Pin root to the live filesystem UUID so stage 1 can
|
||||
# mount `/` reliably.
|
||||
@@ -171,34 +178,6 @@ in {
|
||||
proxyPass = "http://127.0.0.1:8008";
|
||||
};
|
||||
};
|
||||
|
||||
virtualHosts.${elementEntryDomain} = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
|
||||
locations."= /config.${elementEntryDomain}.json".return = "302 /config.json";
|
||||
|
||||
root = pkgs.hectic.element-web.override {
|
||||
conf = {
|
||||
default_server_config = {
|
||||
"m.homeserver".base_url = "https://${polandEntryDomain}";
|
||||
"m.homeserver".server_name = matrixHost;
|
||||
"m.identity_server".base_url = "https://vector.im";
|
||||
};
|
||||
|
||||
jitsi = {
|
||||
preferred_domain = jitsiHost;
|
||||
};
|
||||
|
||||
hectic.videoMessages.enabled = true;
|
||||
|
||||
room_directory.servers = [ matrixHost ];
|
||||
|
||||
default_theme = "dark";
|
||||
show_labs_settings = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
sops.secrets."matrix/signing-key" = {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{ ... }: {
|
||||
hectic.services.affine-chatgpt.enable = true;
|
||||
|
||||
systemd.services.affine-native = {
|
||||
wants = [ "affine-chatgpt.service" ];
|
||||
after = [ "affine-chatgpt.service" ];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,289 @@
|
||||
{
|
||||
domain,
|
||||
...
|
||||
}: {
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
affineDomain = "affine.${domain}";
|
||||
stateDirectory = "/var/lib/affine";
|
||||
environmentFile = "${stateDirectory}/.env";
|
||||
bootstrapDirectory = "/var/lib/affine-bootstrap";
|
||||
bootstrapPasswordFile = "${bootstrapDirectory}/password";
|
||||
authFile = "${bootstrapDirectory}/htpasswd";
|
||||
|
||||
affineImage = "ghcr.io/toeverything/affine:0.27.4@sha256:c312116a134184947d98749c8a8e29f4e3bc97f4f2a51c9a3497f9baea2eec2b";
|
||||
postgresImage = "pgvector/pgvector:pg16@sha256:a97d77306ff47cc1d8add4d000cec2207da2e110746318df3137ce53c337ca30";
|
||||
redisImage = "redis:7-alpine@sha256:8be847644e195abc4c10c8d9936cfa45332eccc6b714fa7b186ff43f1f4d5579";
|
||||
|
||||
logging = {
|
||||
driver = "json-file";
|
||||
options = {
|
||||
max-file = "3";
|
||||
max-size = "10m";
|
||||
};
|
||||
};
|
||||
|
||||
commonEnvironment = {
|
||||
AFFINE_INDEXER_ENABLED = "false";
|
||||
DATABASE_URL = "postgresql://affine:\${DB_PASSWORD}@postgres:5432/affine";
|
||||
REDIS_SERVER_HOST = "redis";
|
||||
};
|
||||
|
||||
composeFile = (pkgs.formats.yaml {}).generate "affine-compose.yaml" {
|
||||
services = {
|
||||
affine = {
|
||||
image = affineImage;
|
||||
restart = "unless-stopped";
|
||||
mem_limit = "2g";
|
||||
inherit logging;
|
||||
ports = [ "127.0.0.1:3010:3010" ];
|
||||
volumes = [
|
||||
"${stateDirectory}/data/storage:/root/.affine/storage"
|
||||
"${stateDirectory}/data/config:/root/.affine/config"
|
||||
];
|
||||
environment = commonEnvironment;
|
||||
depends_on = {
|
||||
migration.condition = "service_completed_successfully";
|
||||
postgres.condition = "service_healthy";
|
||||
redis.condition = "service_healthy";
|
||||
};
|
||||
};
|
||||
|
||||
migration = {
|
||||
image = affineImage;
|
||||
command = [
|
||||
"sh"
|
||||
"-c"
|
||||
"node ./scripts/self-host-predeploy.js"
|
||||
];
|
||||
mem_limit = "1g";
|
||||
inherit logging;
|
||||
volumes = [
|
||||
"${stateDirectory}/data/storage:/root/.affine/storage"
|
||||
"${stateDirectory}/data/config:/root/.affine/config"
|
||||
];
|
||||
environment = commonEnvironment;
|
||||
depends_on = {
|
||||
postgres.condition = "service_healthy";
|
||||
redis.condition = "service_healthy";
|
||||
};
|
||||
};
|
||||
|
||||
postgres = {
|
||||
image = postgresImage;
|
||||
restart = "unless-stopped";
|
||||
mem_limit = "512m";
|
||||
inherit logging;
|
||||
environment = {
|
||||
POSTGRES_DB = "affine";
|
||||
POSTGRES_PASSWORD = "\${POSTGRES_PASSWORD}";
|
||||
POSTGRES_USER = "affine";
|
||||
};
|
||||
volumes = [ "${stateDirectory}/data/postgres:/var/lib/postgresql/data" ];
|
||||
healthcheck = {
|
||||
test = [ "CMD-SHELL" "pg_isready -U affine -d affine" ];
|
||||
interval = "10s";
|
||||
timeout = "5s";
|
||||
retries = 5;
|
||||
start_period = "10s";
|
||||
};
|
||||
};
|
||||
|
||||
redis = {
|
||||
image = redisImage;
|
||||
restart = "unless-stopped";
|
||||
mem_limit = "128m";
|
||||
inherit logging;
|
||||
command = [
|
||||
"redis-server"
|
||||
"--save"
|
||||
"60"
|
||||
"1"
|
||||
"--maxmemory"
|
||||
"96mb"
|
||||
"--maxmemory-policy"
|
||||
"noeviction"
|
||||
];
|
||||
healthcheck = {
|
||||
test = [ "CMD" "redis-cli" "ping" ];
|
||||
interval = "10s";
|
||||
timeout = "5s";
|
||||
retries = 5;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
configFile = pkgs.writeText "affine-config.json" (builtins.toJSON {
|
||||
server = {
|
||||
externalUrl = "https://${affineDomain}";
|
||||
name = "Hectic AFFiNE";
|
||||
};
|
||||
copilot.enabled = false;
|
||||
auth = {
|
||||
allowSignup = false;
|
||||
allowSignupForOauth = false;
|
||||
newAccountShareActionDelay = 0;
|
||||
};
|
||||
});
|
||||
|
||||
compose = "${pkgs.docker-compose}/bin/docker-compose --project-name affine --env-file ${environmentFile} --file ${composeFile}";
|
||||
frontendStatic = pkgs.hectic.affine-frontend-static;
|
||||
frontendOverride = (pkgs.formats.yaml {}).generate "affine-frontend-compose.yaml" {
|
||||
services.affine.volumes = [ "${frontendStatic}:/app/static:ro" ];
|
||||
};
|
||||
frontendCompose = "${compose} --file ${frontendOverride}";
|
||||
in {
|
||||
assertions = [
|
||||
{
|
||||
assertion = lib.hasPrefix "ghcr.io/toeverything/affine:${frontendStatic.version}@sha256:" affineImage;
|
||||
message = "AFFiNE frontend assets and the deployed backend image must use the same release.";
|
||||
}
|
||||
{
|
||||
assertion = frontendStatic.revision == "b4c8548c09da21b2898443559a5b846f0ccf5dd8";
|
||||
message = "AFFiNE frontend source revision must match the pinned 0.27.4 backend.";
|
||||
}
|
||||
];
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"d ${stateDirectory} 0750 root root -"
|
||||
"d ${stateDirectory}/data 0750 root root -"
|
||||
"d ${stateDirectory}/data/config 0750 root root -"
|
||||
"d ${stateDirectory}/data/postgres 0750 999 999 -"
|
||||
"d ${stateDirectory}/data/storage 0750 root root -"
|
||||
"d ${bootstrapDirectory} 0750 root nginx -"
|
||||
];
|
||||
|
||||
systemd.services.affine = {
|
||||
description = "AFFiNE Docker Compose stack";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
after = [
|
||||
"docker.service"
|
||||
"network-online.target"
|
||||
"systemd-tmpfiles-setup.service"
|
||||
];
|
||||
requires = [
|
||||
"docker.service"
|
||||
"network-online.target"
|
||||
];
|
||||
restartIfChanged = true;
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
ExecStartPre = pkgs.writeShellScript "affine-prepare" ''
|
||||
set -eu
|
||||
umask 077
|
||||
|
||||
if [ ! -s ${environmentFile} ]; then
|
||||
environment_tmp="$(${pkgs.coreutils}/bin/mktemp ${stateDirectory}/.env.XXXXXX)"
|
||||
trap '${pkgs.coreutils}/bin/rm -f "$environment_tmp"' EXIT
|
||||
password="$(${pkgs.openssl}/bin/openssl rand -hex 32)"
|
||||
${pkgs.coreutils}/bin/printf 'DB_PASSWORD=%s\nPOSTGRES_PASSWORD=%s\n' "$password" "$password" > "$environment_tmp"
|
||||
${pkgs.coreutils}/bin/chmod 0600 "$environment_tmp"
|
||||
${pkgs.coreutils}/bin/chown root:root "$environment_tmp"
|
||||
${pkgs.coreutils}/bin/mv "$environment_tmp" ${environmentFile}
|
||||
trap - EXIT
|
||||
fi
|
||||
|
||||
if [ ! -e ${stateDirectory}/data/config/config.json ]; then
|
||||
${pkgs.coreutils}/bin/install -m 0644 ${configFile} ${stateDirectory}/data/config/config.json
|
||||
fi
|
||||
|
||||
${pkgs.coreutils}/bin/chmod 0600 ${environmentFile}
|
||||
${pkgs.coreutils}/bin/chown root:root ${environmentFile}
|
||||
'';
|
||||
ExecStart = "${compose} up --detach --wait";
|
||||
ExecStop = "${compose} down";
|
||||
TimeoutStartSec = "15min";
|
||||
TimeoutStopSec = "5min";
|
||||
};
|
||||
};
|
||||
|
||||
# Reconcile only the application container; leave the database and migration job alone.
|
||||
systemd.services.affine-frontend = {
|
||||
description = "Source-built AFFiNE frontend assets";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
requires = [ "affine.service" ];
|
||||
after = [ "affine.service" ];
|
||||
partOf = [ "affine.service" ];
|
||||
reloadIfChanged = true;
|
||||
restartIfChanged = false;
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
ExecStart = "${frontendCompose} up --detach --no-deps --force-recreate affine";
|
||||
ExecReload = "${frontendCompose} up --detach --no-deps --force-recreate affine";
|
||||
ExecStop = "${compose} up --detach --no-deps --force-recreate affine";
|
||||
TimeoutStartSec = "5min";
|
||||
TimeoutStopSec = "5min";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.affine-bootstrap = {
|
||||
description = "Prepare AFFiNE pilot basic authentication";
|
||||
requiredBy = [ "nginx.service" ];
|
||||
before = [ "nginx.service" ];
|
||||
after = [ "systemd-tmpfiles-setup.service" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
script = ''
|
||||
set -eu
|
||||
umask 077
|
||||
|
||||
if [ ! -s ${bootstrapPasswordFile} ]; then
|
||||
password_tmp="$(${pkgs.coreutils}/bin/mktemp ${bootstrapDirectory}/.password.XXXXXX)"
|
||||
trap '${pkgs.coreutils}/bin/rm -f "$password_tmp"' EXIT
|
||||
${pkgs.openssl}/bin/openssl rand -hex 32 > "$password_tmp"
|
||||
${pkgs.coreutils}/bin/chmod 0600 "$password_tmp"
|
||||
${pkgs.coreutils}/bin/chown root:root "$password_tmp"
|
||||
${pkgs.coreutils}/bin/mv "$password_tmp" ${bootstrapPasswordFile}
|
||||
trap - EXIT
|
||||
fi
|
||||
|
||||
if [ ! -s ${authFile} ]; then
|
||||
auth_tmp="$(${pkgs.coreutils}/bin/mktemp ${bootstrapDirectory}/.htpasswd.XXXXXX)"
|
||||
trap '${pkgs.coreutils}/bin/rm -f "$auth_tmp"' EXIT
|
||||
hash="$(${pkgs.openssl}/bin/openssl passwd -6 -stdin < ${bootstrapPasswordFile})"
|
||||
${pkgs.coreutils}/bin/printf 'affine:%s\n' "$hash" > "$auth_tmp"
|
||||
${pkgs.coreutils}/bin/chmod 0640 "$auth_tmp"
|
||||
${pkgs.coreutils}/bin/chown root:nginx "$auth_tmp"
|
||||
${pkgs.coreutils}/bin/mv "$auth_tmp" ${authFile}
|
||||
trap - EXIT
|
||||
fi
|
||||
|
||||
${pkgs.coreutils}/bin/chmod 0600 ${bootstrapPasswordFile}
|
||||
${pkgs.coreutils}/bin/chown root:root ${bootstrapPasswordFile}
|
||||
${pkgs.coreutils}/bin/chmod 0640 ${authFile}
|
||||
${pkgs.coreutils}/bin/chown root:nginx ${authFile}
|
||||
'';
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts.${affineDomain} = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
# Create this marker only after configuring the administrator and signup policy.
|
||||
extraConfig = ''
|
||||
client_max_body_size 100m;
|
||||
set $affine_bootstrap_realm "AFFiNE setup";
|
||||
if (-f ${bootstrapDirectory}/initialized) {
|
||||
set $affine_bootstrap_realm off;
|
||||
}
|
||||
'';
|
||||
|
||||
locations."/" = {
|
||||
proxyPass = "http://127.0.0.1:3010";
|
||||
proxyWebsockets = true;
|
||||
extraConfig = ''
|
||||
auth_basic $affine_bootstrap_realm;
|
||||
auth_basic_user_file ${authFile};
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
{
|
||||
domain,
|
||||
...
|
||||
}: args@{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
cfg = config.hectic.affineDeployment;
|
||||
affineDomain = "affine.${domain}";
|
||||
databaseName = "affine-native";
|
||||
environmentFile = "/var/lib/affine-native/environment";
|
||||
postgresqlDataDirectory = "/var/lib/affine-postgresql";
|
||||
postgresqlSocketDirectory = "/run/affine-postgresql";
|
||||
|
||||
affinePgvector = pkgs.postgresql_16.pkgs.pgvector.overrideAttrs (_: {
|
||||
version = "0.8.7";
|
||||
# v0.8.7 resolves to release commit f37c13f68b57d2c3472b2214fbcff699d6d34876.
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "pgvector";
|
||||
repo = "pgvector";
|
||||
rev = "v0.8.7";
|
||||
hash = "sha256-YYXz8zqiuqYWpJwImAhMry/QTLHKOP5MzuY0Of+aflc=";
|
||||
};
|
||||
});
|
||||
affinePostgresql = pkgs.postgresql_16.withPackages (_: [ affinePgvector ]);
|
||||
dockerConfig = (import ./affine-docker.nix { inherit domain; }) args;
|
||||
in {
|
||||
options.hectic.affineDeployment.nativeActive = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Route production traffic to native AFFiNE and disable legacy Docker units.";
|
||||
};
|
||||
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
hectic.services.affine = {
|
||||
enable = true;
|
||||
frontendPackage = pkgs.hectic.affine-frontend-static;
|
||||
externalUrl = "https://${affineDomain}";
|
||||
serverName = "Hectic AFFiNE";
|
||||
address = "127.0.0.1";
|
||||
port = 3011;
|
||||
redisHost = "127.0.0.1";
|
||||
redisPort = 6388;
|
||||
inherit environmentFile;
|
||||
settings = {
|
||||
copilot.enabled = false;
|
||||
auth = {
|
||||
allowSignup = false;
|
||||
allowSignupForOauth = false;
|
||||
newAccountShareActionDelay = 0;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
users.groups.affine-postgres = {};
|
||||
users.users.affine-postgres = {
|
||||
isSystemUser = true;
|
||||
group = "affine-postgres";
|
||||
home = postgresqlDataDirectory;
|
||||
};
|
||||
|
||||
systemd.services.affine-postgresql = {
|
||||
description = "Isolated PostgreSQL cluster for AFFiNE";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "local-fs.target" ];
|
||||
unitConfig.RequiresMountsFor = postgresqlDataDirectory;
|
||||
path = [ affinePostgresql ];
|
||||
environment.POSTGRESQL_VERSION = affinePostgresql.version;
|
||||
restartTriggers = [ affinePgvector ];
|
||||
preStart = ''
|
||||
if [ ! -s ${postgresqlDataDirectory}/PG_VERSION ]; then
|
||||
initdb \
|
||||
--pgdata=${postgresqlDataDirectory} \
|
||||
--username=affine-postgres \
|
||||
--encoding=UTF8 \
|
||||
--locale=en_US.utf8 \
|
||||
--auth-local=peer \
|
||||
--auth-host=reject
|
||||
fi
|
||||
|
||||
cat > ${postgresqlDataDirectory}/pg_hba.conf <<'EOF'
|
||||
local all all peer
|
||||
host all all 0.0.0.0/0 reject
|
||||
host all all ::0/0 reject
|
||||
EOF
|
||||
'';
|
||||
postStart = ''
|
||||
ready=0
|
||||
for attempt in $(seq 1 60); do
|
||||
if pg_isready --host=${postgresqlSocketDirectory} --port=5433 --username=affine-postgres; then
|
||||
ready=1
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
if [ "$ready" -ne 1 ]; then
|
||||
echo "AFFiNE PostgreSQL did not become ready" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
psql --host=${postgresqlSocketDirectory} --port=5433 --dbname=postgres \
|
||||
--set=ON_ERROR_STOP=1 <<'SQL'
|
||||
DO $role$
|
||||
BEGIN
|
||||
IF NOT EXISTS (SELECT FROM pg_catalog.pg_roles WHERE rolname = 'affine-native') THEN
|
||||
CREATE ROLE "affine-native" LOGIN NOSUPERUSER NOCREATEDB NOCREATEROLE;
|
||||
END IF;
|
||||
END
|
||||
$role$;
|
||||
ALTER ROLE "affine-native" LOGIN NOSUPERUSER NOCREATEDB NOCREATEROLE;
|
||||
SELECT 'CREATE DATABASE "affine-native" OWNER "affine-native"'
|
||||
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'affine-native')\gexec
|
||||
ALTER DATABASE "affine-native" OWNER TO "affine-native";
|
||||
SQL
|
||||
|
||||
psql --host=${postgresqlSocketDirectory} --port=5433 --dbname=${databaseName} \
|
||||
--set=ON_ERROR_STOP=1 <<'SQL'
|
||||
CREATE EXTENSION IF NOT EXISTS vector;
|
||||
CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
||||
SQL
|
||||
'';
|
||||
serviceConfig = {
|
||||
Type = "notify";
|
||||
User = "affine-postgres";
|
||||
Group = "affine-postgres";
|
||||
StateDirectory = "affine-postgresql";
|
||||
StateDirectoryMode = "0700";
|
||||
RuntimeDirectory = "affine-postgresql";
|
||||
RuntimeDirectoryMode = "0755";
|
||||
ExecStart = "${affinePostgresql}/bin/postgres -D ${postgresqlDataDirectory} -k ${postgresqlSocketDirectory} -p 5433 -c \"listen_addresses=\"";
|
||||
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
|
||||
KillSignal = "SIGINT";
|
||||
TimeoutStopSec = "120s";
|
||||
MemoryMax = "512M";
|
||||
Restart = "on-failure";
|
||||
RestartSec = "5s";
|
||||
};
|
||||
};
|
||||
|
||||
services.redis.servers.affine = {
|
||||
enable = true;
|
||||
bind = "127.0.0.1";
|
||||
port = 6388;
|
||||
settings = {
|
||||
maxmemory = "96mb";
|
||||
maxmemory-policy = "noeviction";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.redis-affine.serviceConfig.MemoryMax = "128M";
|
||||
|
||||
# Live data restore is intentionally external. Main stages config, private.key,
|
||||
# storage, and the database before creating this runtime environment file.
|
||||
systemd.services.affine-native-migrate = {
|
||||
after = [ "affine-postgresql.service" "redis-affine.service" ];
|
||||
requires = [ "affine-postgresql.service" "redis-affine.service" ];
|
||||
unitConfig.ConditionPathExists = environmentFile;
|
||||
};
|
||||
|
||||
systemd.services.affine-native = {
|
||||
unitConfig.ConditionPathExists = environmentFile;
|
||||
serviceConfig.MemoryMax = "2G";
|
||||
};
|
||||
}
|
||||
|
||||
(lib.mkIf (!cfg.nativeActive) dockerConfig)
|
||||
|
||||
(lib.mkIf cfg.nativeActive {
|
||||
services.nginx.virtualHosts.${affineDomain} = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
extraConfig = ''
|
||||
client_max_body_size 100m;
|
||||
'';
|
||||
locations."/" = {
|
||||
proxyPass = "http://127.0.0.1:3011";
|
||||
proxyWebsockets = true;
|
||||
extraConfig = ''
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
||||
'';
|
||||
};
|
||||
};
|
||||
})
|
||||
];
|
||||
}
|
||||
@@ -65,15 +65,9 @@ in {
|
||||
# Restrict the SDK TLS connector to HTTP/1.1 after S3 REFUSED_STREAM errors.
|
||||
cargoDeps = pkgs.runCommand "attic-cargo-vendor-http1" { } ''
|
||||
mkdir "$out"
|
||||
shopt -s dotglob
|
||||
for entry in ${old.cargoDeps}/*; do
|
||||
ln -s "$entry" "$out/$(basename "$entry")"
|
||||
done
|
||||
crate=aws-smithy-http-client-1.0.6
|
||||
rm "$out/$crate"
|
||||
cp -rL ${old.cargoDeps}/"$crate" "$out/$crate"
|
||||
chmod -R u+w "$out/$crate"
|
||||
substituteInPlace "$out/$crate/src/client/tls.rs" \
|
||||
cp -a --no-preserve=mode ${old.cargoDeps}/. "$out/"
|
||||
crate="$out/source-registry-0/aws-smithy-http-client-1.0.6"
|
||||
substituteInPlace "$crate/src/client/tls.rs" \
|
||||
--replace-fail '.enable_http2()' ""
|
||||
'';
|
||||
postPatch = (old.postPatch or "") + ''
|
||||
|
||||
@@ -11,9 +11,30 @@
|
||||
in self.lib.nixpkgs-lib.nixosSystem {
|
||||
pkgs = import inputs.nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ self.overlays.default ];
|
||||
overlays = [
|
||||
self.overlays.default
|
||||
(final: prev: {
|
||||
python311 = prev.python311.overrideAttrs (old: {
|
||||
passthru = old.passthru // {
|
||||
doc = old.passthru.doc.overrideAttrs (oldDoc: {
|
||||
patches = (oldDoc.patches or [ ]) ++ [
|
||||
./python-docutils-0.22.patch
|
||||
./python-sphinx9-glossary.patch
|
||||
];
|
||||
});
|
||||
};
|
||||
});
|
||||
})
|
||||
];
|
||||
config.allowUnfreePredicate = pkg:
|
||||
builtins.elem (inputs.nixpkgs.lib.getName pkg) [ "steamcmd" "steam-unwrapped" "p4d" "p4" ];
|
||||
builtins.elem (inputs.nixpkgs.lib.getName pkg) [
|
||||
"affine"
|
||||
"affine-server-native"
|
||||
"steamcmd"
|
||||
"steam-unwrapped"
|
||||
"p4d"
|
||||
"p4"
|
||||
];
|
||||
};
|
||||
modules = [
|
||||
{ networking.hostName = name; }
|
||||
|
||||
@@ -52,8 +52,10 @@ let
|
||||
in {
|
||||
imports = [
|
||||
self.nixosModules.hectic
|
||||
self.nixosModules.mailserver
|
||||
self.nixosModules.matrix-cluster
|
||||
inputs.sops-nix.nixosModules.sops
|
||||
inputs.piu-piu.nixosModules.server
|
||||
|
||||
self.nixosModules."shadowsocks-rust" # NOTE(nrv): impl
|
||||
self.nixosModules."shadowsocks" # NOTE(nrv): usage/instance
|
||||
@@ -61,16 +63,24 @@ in {
|
||||
inputs.hectic-landing.nixosModules.hectic-landing
|
||||
inputs.iana-angl.nixosModules.iana-angl
|
||||
|
||||
(import ./affine.nix { inherit domain; })
|
||||
./affine-chatgpt.nix
|
||||
(import ./attic.nix { inherit flake self inputs domain; })
|
||||
(import ./containers.nix { inherit flake self inputs; })
|
||||
./experimental-sshd.nix
|
||||
./minecraft-wow-proxy.nix
|
||||
(import ./ente.nix { inherit domain; })
|
||||
(import ./immich.nix { inherit domain; })
|
||||
(import ./immich.nix { inherit domain inputs; })
|
||||
(import ./mechabellum.nix { inherit flake self inputs domain; })
|
||||
(import ./whiteboard.nix { inherit domain; })
|
||||
(import (./. + "/sentinèlla.nix") { inherit flake self inputs domain; })
|
||||
];
|
||||
|
||||
services.piu-piu-server = {
|
||||
enable = true;
|
||||
bindAddress = "0.0.0.0";
|
||||
};
|
||||
|
||||
services.hectic-landing = {
|
||||
enable = true;
|
||||
package = inputs.hectic-landing.packages.${pkgs.stdenv.hostPlatform.system}.hectic-landing;
|
||||
@@ -90,6 +100,7 @@ in {
|
||||
security.acme.defaults.email = lib.mkForce "security@${domain}";
|
||||
|
||||
hectic = {
|
||||
affineDeployment.nativeActive = true;
|
||||
archetype.dev.enable = true;
|
||||
hardware.hetzner-cloud = {
|
||||
enable = true;
|
||||
@@ -203,6 +214,10 @@ in {
|
||||
debugSshPublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBSWIv80pyCMDQ6zH34P2qWizpOcO7X86BVhMGtbob9U gcr-controller@hectic-lab";
|
||||
hcloudSshKeyId = 118512401;
|
||||
};
|
||||
services.routine-server = {
|
||||
enable = true;
|
||||
timezone = "Europe/Rome";
|
||||
};
|
||||
};
|
||||
|
||||
zramSwap = {
|
||||
@@ -347,7 +362,7 @@ in {
|
||||
services.mailserver = {
|
||||
enable = true;
|
||||
domain = domain;
|
||||
loginAccounts = builtins.listToAttrs (map mkMailLoginAccount mailUserNames);
|
||||
accounts = builtins.listToAttrs (map mkMailLoginAccount mailUserNames);
|
||||
};
|
||||
|
||||
mailserver.stateVersion = 3;
|
||||
@@ -372,6 +387,7 @@ in {
|
||||
55228 # ss-bfs
|
||||
];
|
||||
allowedUDPPorts = [
|
||||
config.services.piu-piu-server.port
|
||||
51820 # wg-bfs
|
||||
55228 # ss-bfs
|
||||
];
|
||||
@@ -422,6 +438,7 @@ in {
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
# NOTE(yukkop): virtualHosts.${domain} is owned by the hectic-landing module
|
||||
virtualHosts."mail.${domain}".enableACME = true;
|
||||
virtualHosts."store.${domain}" = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
@@ -431,6 +448,22 @@ in {
|
||||
autoindex on;
|
||||
'';
|
||||
};
|
||||
locations."= /wowmine" = {
|
||||
extraConfig = ''
|
||||
return 302 /wowmine/;
|
||||
'';
|
||||
};
|
||||
locations."^~ /wowmine/" = {
|
||||
extraConfig = ''
|
||||
alias ${./static/wowmine}/;
|
||||
index index.html;
|
||||
autoindex off;
|
||||
add_header Cache-Control "no-cache" always;
|
||||
limit_except GET {
|
||||
deny all;
|
||||
}
|
||||
'';
|
||||
};
|
||||
locations."= /world-of-sosal/" = {
|
||||
extraConfig = ''
|
||||
return 302 /world-of-sosal/index.html;
|
||||
@@ -529,7 +562,7 @@ in {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
# NOTE(yukkop): allow large git pushes over HTTPS.
|
||||
extraConfig = "client_max_body_size 512m;";
|
||||
extraConfig = "client_max_body_size 2g;";
|
||||
locations."/" = {
|
||||
extraConfig = ''
|
||||
proxy_pass http://127.0.0.1:11011/;
|
||||
@@ -547,7 +580,7 @@ in {
|
||||
enable = true;
|
||||
package = pkgs.hectic.gitea-heatmap;
|
||||
# Keep LFS storage limited to accounts provisioned by administrators.
|
||||
settings.service.DISABLE_REGISTRATION = true;
|
||||
settings.service.DISABLE_REGISTRATION = false;
|
||||
settings.session.COOKIE_SECURE = true;
|
||||
settings.actions.ENABLED = true;
|
||||
# Long CUDA builds must not hit Gitea's default three-hour task watchdog.
|
||||
@@ -558,9 +591,9 @@ in {
|
||||
ROOT_URL = "https://gitea.${domain}/";
|
||||
SSH_PORT = giteaSshPort;
|
||||
SSH_DOMAIN = "hectic-lab.com";
|
||||
LFS_MAX_FILE_SIZE = 2147483648;
|
||||
};
|
||||
lfs.enable = true;
|
||||
settings.lfs.LFS_MAX_FILE_SIZE = 536870912;
|
||||
database = {
|
||||
createDatabase = true;
|
||||
type = "postgres";
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{ domain, ... }:
|
||||
{ domain, inputs, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
@@ -13,4 +14,8 @@
|
||||
credentialsFile = config.sops.secrets."immich/storage-box".path;
|
||||
};
|
||||
};
|
||||
|
||||
# Immich 3 is not available on nixos-26.05.
|
||||
services.immich.package =
|
||||
inputs.nixpkgs-gitea.legacyPackages.${pkgs.stdenv.hostPlatform.system}.immich;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
--- a/Doc/tools/extensions/pyspecific.py
|
||||
+++ b/Doc/tools/extensions/pyspecific.py
|
||||
@@ -48,11 +48,21 @@
|
||||
SOURCE_URI = 'https://github.com/python/cpython/tree/3.11/%s'
|
||||
|
||||
# monkey-patch reST parser to disable alphabetic and roman enumerated lists
|
||||
+def _disable_alphabetic_and_roman(text):
|
||||
+ try:
|
||||
+ # docutils >= 0.22
|
||||
+ from docutils.parsers.rst.states import InvalidRomanNumeralError
|
||||
+ raise InvalidRomanNumeralError(text)
|
||||
+ except ImportError:
|
||||
+ # docutils < 0.22
|
||||
+ return None
|
||||
+
|
||||
+
|
||||
from docutils.parsers.rst.states import Body
|
||||
Body.enum.converters['loweralpha'] = \
|
||||
Body.enum.converters['upperalpha'] = \
|
||||
Body.enum.converters['lowerroman'] = \
|
||||
- Body.enum.converters['upperroman'] = lambda x: None
|
||||
+ Body.enum.converters['upperroman'] = _disable_alphabetic_and_roman
|
||||
@@ -0,0 +1,12 @@
|
||||
--- a/Doc/tools/extensions/glossary_search.py
|
||||
+++ b/Doc/tools/extensions/glossary_search.py
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
rendered = app.builder.render_partial(definition)
|
||||
terms[term] = {
|
||||
'title': glossary_item[0].astext(),
|
||||
- 'body': rendered['html_body']
|
||||
+ 'body': rendered['fragment']
|
||||
}
|
||||
|
||||
if hasattr(app.env, 'glossary_terms'):
|
||||
@@ -0,0 +1,93 @@
|
||||
Copyright 2019 The Golos Text Project Authors (https://github.com/googlefonts/golos-text)
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
https://scripts.sil.org/OFL
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
@@ -0,0 +1,93 @@
|
||||
Copyright (c) 2011-2012, Jovanny Lemonad (jovanny.ru), with Reserved Font Name "Russo"
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
@@ -0,0 +1,6 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48">
|
||||
<path fill="#a7d754" d="m24 2 22 11-22 11L2 13Z"/>
|
||||
<path fill="#765239" d="m2 13 22 11v22L2 35Z"/>
|
||||
<path fill="#513c30" d="m24 24 22-11v22L24 46Z"/>
|
||||
<path fill="#76a637" d="m2 13 22 11v8l-8-4v-4l-6-3v5l-8-4Zm22 11 22-11v9l-7 3v-4l-7 4v5l-8 4Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 322 B |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,251 @@
|
||||
@font-face {
|
||||
font-family: "Golos Text";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url("./golos-regular.ttf") format("truetype");
|
||||
}
|
||||
@font-face {
|
||||
font-family: "Golos Text";
|
||||
font-style: normal;
|
||||
font-weight: 600;
|
||||
font-display: swap;
|
||||
src: url("./golos-semibold.ttf") format("truetype");
|
||||
}
|
||||
@font-face {
|
||||
font-family: "Russo One";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url("./russo-one.ttf") format("truetype");
|
||||
}
|
||||
|
||||
:root {
|
||||
color-scheme: dark;
|
||||
--bg: #141a15;
|
||||
--surface: #202921;
|
||||
--inset: #101610;
|
||||
--ink: #f4f3e7;
|
||||
--muted: #bec9b8;
|
||||
--line: #394638;
|
||||
--grass: #a7d754;
|
||||
--grass-hover: #b9e66c;
|
||||
--action-ink: #17250d;
|
||||
--focus: #e8b86c;
|
||||
--hero-ink: #fffdf0;
|
||||
--hero-muted: #e5e9d7;
|
||||
--body-font: "Golos Text", sans-serif;
|
||||
--heading-font: "Russo One", sans-serif;
|
||||
--space-1: 4px;
|
||||
--space-2: 8px;
|
||||
--space-3: 12px;
|
||||
--space-4: 16px;
|
||||
--space-6: 24px;
|
||||
--space-8: 32px;
|
||||
--space-12: 48px;
|
||||
--space-16: 64px;
|
||||
--space-20: 80px;
|
||||
--space-24: 96px;
|
||||
--ease: 140ms ease-out;
|
||||
--gutter: clamp(24px, 4vw, 48px);
|
||||
scroll-behavior: smooth;
|
||||
scroll-padding-top: var(--space-8);
|
||||
scrollbar-color: var(--line) var(--bg);
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: light) {
|
||||
:root:not([data-theme]) {
|
||||
color-scheme: light;
|
||||
--bg: #f3f2e8;
|
||||
--surface: #fff;
|
||||
--inset: #e7e9dc;
|
||||
--ink: #202b21;
|
||||
--muted: #53624c;
|
||||
--line: #c8d1bd;
|
||||
--focus: #47671d;
|
||||
}
|
||||
}
|
||||
:root[data-theme="light"] {
|
||||
color-scheme: light;
|
||||
--bg: #f3f2e8;
|
||||
--surface: #fff;
|
||||
--inset: #e7e9dc;
|
||||
--ink: #202b21;
|
||||
--muted: #53624c;
|
||||
--line: #c8d1bd;
|
||||
--focus: #47671d;
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.65 var(--body-font); }
|
||||
::selection { background: var(--grass); color: var(--action-ink); }
|
||||
a { color: inherit; text-underline-offset: .22em; text-decoration-thickness: 1px; }
|
||||
button, summary, a { -webkit-tap-highlight-color: transparent; }
|
||||
button { font: inherit; cursor: pointer; }
|
||||
button, a { touch-action: manipulation; }
|
||||
:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
|
||||
h1, h2, h3, p { margin: 0; }
|
||||
h1, h2, h3 { font-family: var(--heading-font); font-weight: 400; line-height: 1.2; text-wrap: balance; }
|
||||
h2 { font-size: clamp(32px, 3.4vw, 48px); letter-spacing: -.02em; }
|
||||
h3 { font-size: clamp(24px, 2.1vw, 28px); }
|
||||
code { font-family: ui-monospace, "Cascadia Code", monospace; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
|
||||
.container { width: min(100% - var(--gutter) * 2, 1200px); margin-inline: auto; }
|
||||
.section { padding-block: var(--space-24); }
|
||||
.icon-sprite { position: absolute; inline-size: 0; block-size: 0; overflow: hidden; }
|
||||
.icon, .world-icon { inline-size: 24px; block-size: 24px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: square; stroke-linejoin: miter; }
|
||||
.skip-link { position: fixed; top: var(--space-4); left: var(--space-4); z-index: 3; padding: var(--space-3) var(--space-4); background: var(--grass); color: var(--action-ink); transform: translateY(-180%); }
|
||||
.skip-link:focus { transform: translateY(0); }
|
||||
|
||||
.site-header { background: var(--bg); border-bottom: 1px solid var(--line); }
|
||||
.header-inner { min-block-size: 88px; display: flex; align-items: center; gap: var(--space-8); }
|
||||
.brand { display: inline-flex; align-items: center; gap: var(--space-3); text-decoration: none; }
|
||||
.brand-block { inline-size: 36px; block-size: 40px; flex: 0 0 auto; }
|
||||
.brand-name { font-family: var(--heading-font); font-size: 20px; letter-spacing: -.02em; line-height: 1.1; }
|
||||
.brand-name span { display: block; font-size: 24px; }
|
||||
.main-nav { display: flex; align-items: center; justify-content: center; gap: var(--space-8); margin-inline-start: auto; }
|
||||
.main-nav a { display: flex; align-items: center; min-block-size: 48px; text-decoration: none; font-size: 14px; font-weight: 600; transition: color var(--ease); }
|
||||
.main-nav a:hover { color: var(--muted); text-decoration: underline; }
|
||||
.theme-toggle { display: grid; place-items: center; inline-size: 48px; block-size: 48px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); transition: background var(--ease), transform var(--ease); }
|
||||
.theme-toggle:hover { background: var(--inset); }
|
||||
.theme-toggle:active { transform: translateY(2px); }
|
||||
.theme-moon { display: none; }
|
||||
:root[data-theme="light"] .theme-sun { display: none; }
|
||||
:root[data-theme="light"] .theme-moon { display: block; }
|
||||
@media (prefers-color-scheme: light) {
|
||||
:root:not([data-theme]) .theme-sun { display: none; }
|
||||
:root:not([data-theme]) .theme-moon { display: block; }
|
||||
}
|
||||
|
||||
.hero { --focus: #e8b86c; position: relative; isolation: isolate; overflow: hidden; color: var(--hero-ink); background: #101a10; }
|
||||
.hero-scene { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; object-fit: cover; object-position: center; z-index: -2; }
|
||||
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgb(9 20 10 / 88%), rgb(9 20 10 / 68%) 38%, rgb(9 20 10 / 9%) 78%), linear-gradient(0deg, rgb(9 20 10 / 48%), transparent 45%); }
|
||||
.hero-inner { min-block-size: 640px; padding-block: var(--space-24) var(--space-24); display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
|
||||
h1 { max-inline-size: 800px; font-size: clamp(36px, 5.3vw, 84px); line-height: 1.09; letter-spacing: -.02em; text-shadow: 0 4px 0 rgb(9 20 10 / 75%); }
|
||||
h1 span { display: block; }
|
||||
.hero-lead { max-inline-size: 51ch; margin-block-start: var(--space-6); color: var(--hero-muted); font-size: 18px; line-height: 1.75; text-wrap: pretty; }
|
||||
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-8); margin-block-start: var(--space-8); }
|
||||
.button { display: inline-flex; justify-content: center; align-items: center; gap: var(--space-3); min-block-size: 56px; padding: var(--space-4) var(--space-6); border: 2px solid transparent; font-weight: 600; line-height: 1.3; text-decoration: none; transition: background var(--ease), transform var(--ease), box-shadow var(--ease); }
|
||||
.button-primary { background: var(--grass); color: var(--action-ink); border-color: rgb(23 37 13 / 28%); box-shadow: inset 0 3px 0 rgb(255 255 255 / 26%), 0 5px 0 #506c26; }
|
||||
.button-primary:hover { background: var(--grass-hover); transform: translateY(-2px); box-shadow: inset 0 3px 0 rgb(255 255 255 / 26%), 0 7px 0 #506c26; }
|
||||
.button-primary:active { transform: translateY(4px); box-shadow: inset 0 3px 0 rgb(255 255 255 / 26%), 0 1px 0 #506c26; }
|
||||
.hero-guide { display: inline-flex; align-items: center; gap: var(--space-3); min-block-size: 48px; text-decoration: none; font-weight: 600; }
|
||||
.hero-guide:hover { text-decoration: underline; }
|
||||
.hero-guide .icon { inline-size: 20px; }
|
||||
.hero-note { margin-block-start: var(--space-6); color: var(--hero-muted); font-size: 14px; }
|
||||
.hero-scroll { position: absolute; inset-block-end: var(--space-6); inset-inline-end: var(--gutter); display: flex; align-items: center; gap: var(--space-3); min-block-size: 44px; color: var(--hero-ink); text-decoration: none; font-size: 14px; }
|
||||
.hero-scroll .icon { transform: rotate(90deg); inline-size: 18px; }
|
||||
.hero-scroll:hover span { text-decoration: underline; }
|
||||
|
||||
.connection { background: var(--surface); border-bottom: 1px solid var(--line); }
|
||||
.connection-inner { position: relative; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--space-6); padding-block: var(--space-8) var(--space-12); }
|
||||
.connection-label { display: flex; align-items: center; gap: var(--space-4); }
|
||||
.signal-mark { inline-size: 12px; block-size: 12px; background: var(--muted); box-shadow: 6px -6px 0 var(--muted); margin-inline-end: var(--space-2); }
|
||||
.connection-title { font-weight: 600; }
|
||||
.connection-caption { color: var(--muted); font-size: 14px; }
|
||||
.address-group { display: flex; align-items: center; gap: var(--space-6); min-inline-size: 0; }
|
||||
#server-address { font-size: 17px; color: var(--ink); }
|
||||
.button-copy { inline-size: 184px; min-block-size: 48px; padding: var(--space-3) var(--space-4); border: 1px solid var(--line); color: var(--ink); background: var(--inset); font-size: 14px; }
|
||||
.button-copy:hover { background: var(--bg); }
|
||||
.button-copy:active { transform: translateY(2px); }
|
||||
.copied-icon { display: none; }
|
||||
[data-copied="true"] .copy-icon { display: none; }
|
||||
[data-copied="true"] .copied-icon { display: block; }
|
||||
.copy-feedback { position: absolute; inset-inline-end: 0; inset-block-end: var(--space-3); max-inline-size: 100%; min-block-size: 23px; color: var(--muted); font-size: 14px; }
|
||||
|
||||
.world-layout { display: grid; grid-template-columns: 1.05fr 1fr; gap: var(--space-24); }
|
||||
.section-intro > p { margin-block-start: var(--space-6); max-inline-size: 48ch; color: var(--muted); font-size: 18px; }
|
||||
.world-list { display: grid; gap: var(--space-8); align-content: center; }
|
||||
.world-entry { display: flex; gap: var(--space-6); }
|
||||
.world-entry + .world-entry { padding-block-start: var(--space-8); border-top: 1px solid var(--line); }
|
||||
.world-icon { inline-size: 32px; block-size: 32px; color: var(--muted); }
|
||||
.world-entry p { margin-block-start: var(--space-3); color: var(--muted); max-inline-size: 48ch; }
|
||||
|
||||
.setup-section { background: var(--inset); }
|
||||
.setup-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: var(--space-24); margin-block-start: var(--space-12); }
|
||||
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-8); }
|
||||
.steps li { display: flex; align-items: flex-start; gap: var(--space-6); }
|
||||
.step-number { flex: 0 0 48px; display: grid; place-items: center; block-size: 48px; color: var(--muted); border: 1px solid var(--line); font-family: var(--heading-font); font-size: 20px; font-variant-numeric: tabular-nums; }
|
||||
.steps h3 { font-size: 24px; }
|
||||
.steps p { margin-block-start: var(--space-3); max-inline-size: 63ch; color: var(--muted); }
|
||||
.steps a, .questions a { color: var(--ink); }
|
||||
.steps a:hover, .questions a:hover { text-decoration-thickness: 2px; }
|
||||
.requirements { align-self: start; padding: var(--space-8); background: var(--surface); }
|
||||
.requirements dl { margin-block: var(--space-6); }
|
||||
.requirements dl > div { display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--space-2) var(--space-4); padding-block: var(--space-3); border-bottom: 1px solid var(--line); font-size: 14px; }
|
||||
.requirements dt { color: var(--muted); }
|
||||
.requirements dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
|
||||
.requirements > p { color: var(--muted); font-size: 14px; }
|
||||
|
||||
.help-layout { display: grid; grid-template-columns: 1fr 1.65fr; gap: var(--space-24); }
|
||||
.questions details { border-bottom: 1px solid var(--line); }
|
||||
.questions details:first-child { border-top: 1px solid var(--line); }
|
||||
.questions summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: var(--space-6); min-block-size: 80px; padding-block: var(--space-6); cursor: pointer; font-size: 18px; font-weight: 600; line-height: 1.5; }
|
||||
.questions summary::-webkit-details-marker { display: none; }
|
||||
.questions summary:hover { color: var(--muted); }
|
||||
.questions summary .icon { transition: transform var(--ease); }
|
||||
.questions details[open] summary .icon { transform: rotate(45deg); }
|
||||
.questions details > p { max-inline-size: 65ch; padding-block-end: var(--space-6); padding-inline-end: var(--space-12); color: var(--muted); }
|
||||
.site-footer { border-top: 1px solid var(--line); padding-block: var(--space-12); background: var(--inset); }
|
||||
.footer-inner { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: var(--space-8); }
|
||||
.footer-brand { display: flex; flex-direction: column; min-block-size: 48px; text-decoration: none; font-family: var(--heading-font); font-size: 20px; }
|
||||
.footer-brand span { margin-block-start: var(--space-2); color: var(--muted); font: 400 14px/1.65 var(--body-font); }
|
||||
.footer-links { display: flex; flex-wrap: wrap; gap: var(--space-6); font-size: 14px; }
|
||||
.footer-links a { display: flex; align-items: center; min-block-size: 48px; }
|
||||
.footer-inner > p { flex-basis: 100%; color: var(--muted); font-size: 14px; }
|
||||
|
||||
@media (min-width: 1600px) {
|
||||
.hero-inner { min-block-size: 720px; }
|
||||
}
|
||||
@media (max-width: 960px) {
|
||||
.world-layout, .setup-layout, .help-layout { gap: var(--space-12); }
|
||||
.world-layout { grid-template-columns: 1fr 1fr; }
|
||||
.connection-label { flex-basis: 100%; }
|
||||
.address-group { inline-size: 100%; justify-content: space-between; }
|
||||
.copy-feedback { inset-inline-start: 0; }
|
||||
}
|
||||
@media (max-width: 700px) {
|
||||
.header-inner { min-block-size: 80px; gap: var(--space-4); }
|
||||
.brand-block { inline-size: 28px; block-size: 32px; }
|
||||
.brand-name { font-size: 16px; }
|
||||
.brand-name span { font-size: 19px; }
|
||||
.main-nav { gap: 0; }
|
||||
.main-nav a { font-size: 14px; }
|
||||
.main-nav .nav-world, .main-nav .nav-help { display: none; }
|
||||
.theme-toggle { inline-size: 44px; block-size: 44px; flex: 0 0 auto; }
|
||||
.hero-inner { min-block-size: 620px; padding-block: var(--space-16) var(--space-24); }
|
||||
.hero-scene { object-position: 61% center; }
|
||||
.hero::before { background: linear-gradient(90deg, rgb(9 20 10 / 88%), rgb(9 20 10 / 60%)), linear-gradient(0deg, rgb(9 20 10 / 30%), transparent); }
|
||||
h1 { font-size: clamp(34px, 7.7vw, 48px); }
|
||||
.hero-lead { margin-block-start: var(--space-6); font-size: 16px; }
|
||||
.hero-actions { gap: var(--space-4) var(--space-6); margin-block-start: var(--space-8); }
|
||||
.button-primary { min-block-size: 56px; }
|
||||
.hero-guide { font-size: 14px; }
|
||||
.hero-note { font-size: 14px; }
|
||||
.hero-scroll { inset-inline-start: var(--gutter); inset-inline-end: auto; font-size: 14px; }
|
||||
.connection-inner { gap: var(--space-6); padding-block: var(--space-8) 52px; }
|
||||
.address-group { gap: var(--space-3); }
|
||||
#server-address { font-size: 14px; }
|
||||
.button-copy { inline-size: 48px; flex: 0 0 48px; padding: var(--space-3); }
|
||||
.button-copy span { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); }
|
||||
.copy-feedback { font-size: 14px; line-height: 1.5; }
|
||||
.section { padding-block: var(--space-16); }
|
||||
.world-layout, .setup-layout, .help-layout { grid-template-columns: minmax(0, 1fr); gap: var(--space-12); }
|
||||
.section-intro > p { font-size: 16px; }
|
||||
.world-entry { gap: var(--space-4); }
|
||||
.world-entry h3 { font-size: 26px; }
|
||||
.world-icon { inline-size: 28px; block-size: 28px; }
|
||||
.setup-layout { margin-block-start: var(--space-8); }
|
||||
.steps li { gap: var(--space-4); }
|
||||
.step-number { flex-basis: 40px; block-size: 40px; font-size: 18px; }
|
||||
.steps h3 { font-size: 24px; }
|
||||
.requirements { padding: var(--space-6); }
|
||||
.questions summary { font-size: 16px; gap: var(--space-4); }
|
||||
.questions details > p { padding-inline-end: 0; }
|
||||
.footer-inner { gap: var(--space-6); }
|
||||
.footer-links { gap: var(--space-6); }
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
:root { scroll-behavior: auto; }
|
||||
*, *::before, *::after { transition: none !important; }
|
||||
.button-primary:hover, .button-primary:active, .button-copy:active, .theme-toggle:active { transform: none; }
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
// @ts-check
|
||||
|
||||
const root = document.documentElement;
|
||||
const darkPreference = window.matchMedia("(prefers-color-scheme: dark)");
|
||||
|
||||
document.querySelectorAll("[data-theme-toggle]").forEach((button) => {
|
||||
button.addEventListener("click", () => {
|
||||
const dark = root.dataset.theme
|
||||
? root.dataset.theme === "dark"
|
||||
: darkPreference.matches;
|
||||
root.dataset.theme = dark ? "light" : "dark";
|
||||
button.setAttribute(
|
||||
"aria-label",
|
||||
dark ? "Включить тёмную тему" : "Включить светлую тему",
|
||||
);
|
||||
button.setAttribute("title", button.getAttribute("aria-label") ?? "");
|
||||
});
|
||||
});
|
||||
|
||||
document.querySelectorAll("[data-copy-address]").forEach((button) => {
|
||||
button.addEventListener("click", async () => {
|
||||
const address = document.getElementById("server-address");
|
||||
const feedback = document.getElementById("copy-feedback");
|
||||
if (!address || !feedback) return;
|
||||
|
||||
try {
|
||||
await navigator.clipboard.writeText(address.innerText.trim());
|
||||
button.setAttribute("data-copied", "true");
|
||||
feedback.textContent = "Адрес скопирован. Увидимся в игре.";
|
||||
} catch (error) {
|
||||
if (!(error instanceof DOMException)) throw error;
|
||||
button.removeAttribute("data-copied");
|
||||
feedback.textContent = "Выдели адрес и скопируй его вручную.";
|
||||
}
|
||||
});
|
||||
});
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 226 KiB |
@@ -0,0 +1,179 @@
|
||||
<!doctype html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="color-scheme" content="dark light">
|
||||
<meta name="theme-color" content="#141a15">
|
||||
<meta name="description" content="WorldOfSosal — Азерот и Запределье в Minecraft. Скачай готовую сборку для Prism Launcher с автоматическими обновлениями и присоединяйся к серверу.">
|
||||
<meta property="og:title" content="WorldOfSosal — Азерот из блоков">
|
||||
<meta property="og:description" content="Знакомый мир, новая история. Готовая сборка Minecraft с автоматическими обновлениями через Prism Launcher.">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:locale" content="ru_RU">
|
||||
<meta property="og:image" content="https://store.hectic-lab.com/wowmine/assets/world-valley.webp">
|
||||
<link rel="canonical" href="https://store.hectic-lab.com/wowmine/">
|
||||
<link rel="icon" type="image/svg+xml" href="/wowmine/assets/favicon.svg">
|
||||
<link rel="preload" href="/wowmine/assets/russo-one.ttf" as="font" type="font/ttf" crossorigin>
|
||||
<link rel="preload" href="/wowmine/assets/world-valley.webp" as="image" fetchpriority="high">
|
||||
<link rel="stylesheet" href="/wowmine/assets/site.css">
|
||||
<script src="/wowmine/assets/site.js" defer></script>
|
||||
<title>WorldOfSosal — Азерот из блоков</title>
|
||||
</head>
|
||||
<body id="top">
|
||||
<a class="skip-link" href="#main">Перейти к содержимому</a>
|
||||
<svg class="icon-sprite" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
||||
<symbol id="arrow" viewBox="0 0 24 24"><path d="M5 12h14m-6-6 6 6-6 6"/></symbol>
|
||||
<symbol id="download" viewBox="0 0 24 24"><path d="M12 3v12m-5-5 5 5 5-5M5 16v5h14v-5"/></symbol>
|
||||
<symbol id="copy" viewBox="0 0 24 24"><path d="M9 9h11v11H9zM15 5V3H3v12h2"/></symbol>
|
||||
<symbol id="check" viewBox="0 0 24 24"><path d="m5 12 4 4L19 6"/></symbol>
|
||||
<symbol id="sun" viewBox="0 0 24 24"><path d="M12 2v2m0 16v2M2 12h2m16 0h2M5 5l1.5 1.5m11 11L19 19M5 19l1.5-1.5m11-11L19 5"/><circle cx="12" cy="12" r="4"/></symbol>
|
||||
<symbol id="moon" viewBox="0 0 24 24"><path d="M20.5 13A8.5 8.5 0 0 1 11 3.5 8.5 8.5 0 1 0 20.5 13Z"/></symbol>
|
||||
<symbol id="plus" viewBox="0 0 24 24"><path d="M5 12h14M12 5v14"/></symbol>
|
||||
<symbol id="map" viewBox="0 0 24 24"><path d="m3 5 6-2 6 2 6-2v16l-6 2-6-2-6 2Zm6-2v16m6-14v16"/></symbol>
|
||||
<symbol id="portal" viewBox="0 0 24 24"><path d="M5 21V7l4-4h6l4 4v14M9 21V9l2-2h2l2 2v12M3 21h18"/></symbol>
|
||||
</svg>
|
||||
|
||||
<header class="site-header">
|
||||
<div class="container header-inner">
|
||||
<a class="brand" href="#top" aria-label="WorldOfSosal — в начало">
|
||||
<svg class="brand-block" viewBox="0 0 40 44" aria-hidden="true">
|
||||
<path fill="#a7d754" d="m20 1 19 10-19 10L1 11Z"/>
|
||||
<path fill="#765239" d="m1 11 19 10v22L1 33Z"/>
|
||||
<path fill="#513c30" d="m20 21 19-10v22L20 43Z"/>
|
||||
<path fill="#76a637" d="m1 11 19 10v8l-6-3v-4l-5-2v4l-8-5Zm19 10 19-10v8l-5 3v-4l-6 4v5l-8 4Z"/>
|
||||
</svg>
|
||||
<span class="brand-name">World<span>OfSosal</span></span>
|
||||
</a>
|
||||
<nav class="main-nav" aria-label="Основная навигация">
|
||||
<a class="nav-world" href="#world">Мир сервера</a>
|
||||
<a href="#start">Как начать</a>
|
||||
<a class="nav-help" href="#help">Вопросы</a>
|
||||
</nav>
|
||||
<button class="theme-toggle" type="button" aria-label="Сменить тему" title="Сменить тему" data-theme-toggle>
|
||||
<svg class="icon theme-sun" aria-hidden="true"><use href="#sun"/></svg>
|
||||
<svg class="icon theme-moon" aria-hidden="true"><use href="#moon"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main id="main">
|
||||
<section class="hero" aria-labelledby="hero-title">
|
||||
<img class="hero-scene" src="/wowmine/assets/world-valley.webp" width="1600" height="900" alt="" fetchpriority="high">
|
||||
<div class="container hero-inner">
|
||||
<h1 id="hero-title">Азерот. <span>Теперь из блоков.</span></h1>
|
||||
<p class="hero-lead">Знакомые земли — совсем другая история.<br>Исследуй Азерот и Запределье в нашей сборке Minecraft.</p>
|
||||
<div class="hero-actions">
|
||||
<a class="button button-primary" href="/minecraft/world-of-sosal/WorldOfSosal-Prism.zip" download>
|
||||
<svg class="icon" aria-hidden="true"><use href="#download"/></svg>
|
||||
Скачать сборку
|
||||
</a>
|
||||
<a class="hero-guide" href="#start">Как установить <svg class="icon" aria-hidden="true"><use href="#arrow"/></svg></a>
|
||||
</div>
|
||||
<p class="hero-note">Для Prism Launcher · с автообновлениями</p>
|
||||
</div>
|
||||
<a class="hero-scroll" href="#world" aria-label="Узнать о мире"><span>Дальше — целый мир</span><svg class="icon" aria-hidden="true"><use href="#arrow"/></svg></a>
|
||||
</section>
|
||||
|
||||
<section class="connection" aria-label="Подключение к серверу">
|
||||
<div class="container connection-inner">
|
||||
<div class="connection-label">
|
||||
<span class="signal-mark" aria-hidden="true"></span>
|
||||
<div><p class="connection-title">Место встречи</p><p class="connection-caption">Добавь в список серверов</p></div>
|
||||
</div>
|
||||
<div class="address-group">
|
||||
<code id="server-address">store.hectic-lab.com:25568</code>
|
||||
<button class="button button-copy" type="button" data-copy-address>
|
||||
<svg class="icon copy-icon" aria-hidden="true"><use href="#copy"/></svg>
|
||||
<svg class="icon copied-icon" aria-hidden="true"><use href="#check"/></svg>
|
||||
<span>Скопировать IP</span>
|
||||
</button>
|
||||
</div>
|
||||
<p class="copy-feedback" id="copy-feedback" role="status" aria-live="polite"></p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section world-section" id="world" aria-labelledby="world-title">
|
||||
<div class="container world-layout">
|
||||
<div class="section-intro">
|
||||
<h2 id="world-title">За каждым блоком — <br>новое открытие.</h2>
|
||||
<p>Знакомые города и далёкие земли. Мир Warcraft, в котором можно не только путешествовать, но и строить свою историю.</p>
|
||||
</div>
|
||||
<div class="world-list">
|
||||
<article class="world-entry">
|
||||
<svg class="world-icon" aria-hidden="true"><use href="#map"/></svg>
|
||||
<div><h3>Азерот</h3><p>Знакомые земли, города и простор для собственных построек. Выбирай направление и отправляйся в путь.</p></div>
|
||||
</article>
|
||||
<article class="world-entry">
|
||||
<svg class="world-icon" aria-hidden="true"><use href="#portal"/></svg>
|
||||
<div><h3>Запределье</h3><p>Отдельное измерение для продолжения путешествия. Когда одного мира уже недостаточно.</p></div>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section setup-section" id="start" aria-labelledby="start-title">
|
||||
<div class="container">
|
||||
<h2 id="start-title">Три шага до приключения</h2>
|
||||
<div class="setup-layout">
|
||||
<ol class="steps">
|
||||
<li>
|
||||
<span class="step-number" aria-hidden="true">01</span>
|
||||
<div><h3>Установи Prism Launcher</h3><p>Скачай <a href="https://prismlauncher.org/download/">Prism Launcher</a> и выбери Java 21 в настройках. Это дом для твоей сборки.</p></div>
|
||||
</li>
|
||||
<li>
|
||||
<span class="step-number" aria-hidden="true">02</span>
|
||||
<div><h3>Добавь сборку</h3><p><a href="/minecraft/world-of-sosal/WorldOfSosal-Prism.zip" download>Скачай ZIP для Prism</a>. Затем открой «Добавить сборку» → «Импорт из ZIP» и выбери скачанный файл.</p></div>
|
||||
</li>
|
||||
<li>
|
||||
<span class="step-number" aria-hidden="true">03</span>
|
||||
<div><h3>Запускай и присоединяйся</h3><p>Разреши команду перед запуском: она установит и обновит моды через packwiz. Адрес сервера уже добавлен в сборку.</p></div>
|
||||
</li>
|
||||
</ol>
|
||||
<aside class="requirements" aria-label="Параметры сборки">
|
||||
<h3>Перед запуском</h3>
|
||||
<dl>
|
||||
<div><dt>Minecraft</dt><dd>1.21.1</dd></div>
|
||||
<div><dt>Загрузчик</dt><dd>NeoForge 21.1.250</dd></div>
|
||||
<div><dt>Java</dt><dd>21</dd></div>
|
||||
<div><dt>Память сборки</dt><dd>8 ГБ</dd></div>
|
||||
</dl>
|
||||
<p>Память уже настроена в инстансе. Моды не нужно устанавливать по одному.</p>
|
||||
</aside>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section help-section" id="help" aria-labelledby="help-title">
|
||||
<div class="container help-layout">
|
||||
<h2 id="help-title">Перед входом <br>в мир</h2>
|
||||
<div class="questions">
|
||||
<details>
|
||||
<summary>Как обновляется сборка?<svg class="icon" aria-hidden="true"><use href="#plus"/></svg></summary>
|
||||
<p>Перед каждым запуском packwiz проверяет файлы и устанавливает опубликованные обновления модов и конфигурации. Скачивать новую сборку вручную не нужно.</p>
|
||||
</details>
|
||||
<details>
|
||||
<summary>Сохранятся мои настройки?<svg class="icon" aria-hidden="true"><use href="#plus"/></svg></summary>
|
||||
<p>Личные настройки в <code>options.txt</code> сохраняются. Файлы конфигурации, которыми управляет сборка, могут заменяться при обновлении.</p>
|
||||
</details>
|
||||
<details>
|
||||
<summary>Что делать после обновления Minecraft?<svg class="icon" aria-hidden="true"><use href="#plus"/></svg></summary>
|
||||
<p>При смене версии Minecraft или NeoForge может понадобиться ещё раз запустить игру после обновления. Разрешённая команда перед запуском должна оставаться включённой.</p>
|
||||
</details>
|
||||
<details>
|
||||
<summary>Можно скачать обычный mrpack?<svg class="icon" aria-hidden="true"><use href="#plus"/></svg></summary>
|
||||
<p>Да, доступен <a href="/minecraft/world-of-sosal/latest.mrpack" download>обычный mrpack</a>. В нём нет автообновлений: новые версии нужно устанавливать вручную. Для проверки файлов есть <a href="/minecraft/world-of-sosal/SHA256SUMS">контрольные суммы SHA-256</a>.</p>
|
||||
</details>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<footer class="site-footer">
|
||||
<div class="container footer-inner">
|
||||
<a class="footer-brand" href="#top">WorldOfSosal<span>Увидимся по ту сторону экрана.</span></a>
|
||||
<div class="footer-links"><a href="/minecraft/world-of-sosal/">Страница сборки</a><a href="/minecraft/world-of-sosal/SHA256SUMS">SHA-256</a></div>
|
||||
<p>Неофициальный проект. Не связан с Mojang или Microsoft.</p>
|
||||
</div>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,81 @@
|
||||
{
|
||||
domain,
|
||||
...
|
||||
}: {
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
authDirectory = "/var/lib/whiteboard-auth";
|
||||
authFile = "${authDirectory}/htpasswd";
|
||||
passwordFile = "${authDirectory}/password";
|
||||
whiteboardDomain = "whiteboard.${domain}";
|
||||
in {
|
||||
# Retrieve generated credential with:
|
||||
# sudo cat /var/lib/whiteboard-auth/password
|
||||
# Whiteboard state is persisted under /var/lib/whitebophir.
|
||||
services.whitebophir = {
|
||||
enable = true;
|
||||
listenAddress = "127.0.0.1";
|
||||
port = 5001;
|
||||
};
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"d ${authDirectory} 0750 root nginx -"
|
||||
];
|
||||
|
||||
systemd.services.whiteboard-auth = {
|
||||
description = "Prepare Whitebophir basic authentication";
|
||||
requiredBy = [ "nginx.service" ];
|
||||
before = [ "nginx.service" ];
|
||||
after = [ "systemd-tmpfiles-setup.service" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
script = ''
|
||||
set -eu
|
||||
umask 077
|
||||
|
||||
if [ ! -s ${passwordFile} ]; then
|
||||
password_tmp="$(${pkgs.coreutils}/bin/mktemp ${authDirectory}/.password.XXXXXX)"
|
||||
trap '${pkgs.coreutils}/bin/rm -f "$password_tmp"' EXIT
|
||||
${pkgs.openssl}/bin/openssl rand -base64 48 > "$password_tmp"
|
||||
${pkgs.coreutils}/bin/chmod 0600 "$password_tmp"
|
||||
${pkgs.coreutils}/bin/chown root:root "$password_tmp"
|
||||
${pkgs.coreutils}/bin/mv "$password_tmp" ${passwordFile}
|
||||
trap - EXIT
|
||||
fi
|
||||
|
||||
if [ ! -s ${authFile} ]; then
|
||||
auth_tmp="$(${pkgs.coreutils}/bin/mktemp ${authDirectory}/.htpasswd.XXXXXX)"
|
||||
trap '${pkgs.coreutils}/bin/rm -f "$auth_tmp"' EXIT
|
||||
hash="$(${pkgs.openssl}/bin/openssl passwd -6 -stdin < ${passwordFile})"
|
||||
${pkgs.coreutils}/bin/printf 'whiteboard:%s\n' "$hash" > "$auth_tmp"
|
||||
${pkgs.coreutils}/bin/chmod 0640 "$auth_tmp"
|
||||
${pkgs.coreutils}/bin/chown root:nginx "$auth_tmp"
|
||||
${pkgs.coreutils}/bin/mv "$auth_tmp" ${authFile}
|
||||
trap - EXIT
|
||||
fi
|
||||
|
||||
${pkgs.coreutils}/bin/chmod 0600 ${passwordFile}
|
||||
${pkgs.coreutils}/bin/chown root:root ${passwordFile}
|
||||
${pkgs.coreutils}/bin/chmod 0640 ${authFile}
|
||||
${pkgs.coreutils}/bin/chown root:nginx ${authFile}
|
||||
'';
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts.${whiteboardDomain} = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
basicAuthFile = authFile;
|
||||
|
||||
locations."/" = {
|
||||
proxyPass = "http://127.0.0.1:5001";
|
||||
proxyWebsockets = true;
|
||||
extraConfig = ''
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -19,10 +19,9 @@ in self.lib.nixpkgs-lib.nixosSystem {
|
||||
self.lib.cudaUnfreePredicate pkg || builtins.elem (self.lib.nixpkgs-lib.getName pkg) [
|
||||
"minecraft-server"
|
||||
"neoforge"
|
||||
"steamcmd"
|
||||
"steam-unwrapped"
|
||||
|
||||
"nvidia-x11"
|
||||
"nvidia-kernel-modules"
|
||||
];
|
||||
# jitsi-meet depends on libolm which is marked insecure (CVE-2024-4519x)
|
||||
config.permittedInsecurePackages = [
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
{ config, pkgs, ... }:
|
||||
let
|
||||
name = "wowMineMapRestore";
|
||||
production = config.services.minecraft-servers.servers.wowMineMap;
|
||||
pack = config.services.minecraft-modpack-imports.worldOfSosal;
|
||||
restore = config.services.minecraft-backup-restores.${name};
|
||||
serverDir = "${config.services.minecraft-servers.dataDir}/${name}";
|
||||
in {
|
||||
imports = [ ../../../module/generic/minecraft-restore.nix ];
|
||||
|
||||
sops.secrets."minecraft/restore-storage-box-pack-key" = {
|
||||
sopsFile = config.sops.secrets."minecraft/storage-box-pack-key".sopsFile;
|
||||
key = "minecraft/storage-box-pack-key";
|
||||
owner = "mc-pack-${name}";
|
||||
group = "mc-pack-${name}";
|
||||
mode = "0400";
|
||||
};
|
||||
|
||||
services.minecraft-servers.servers.${name} = {
|
||||
enable = true;
|
||||
autoStart = false;
|
||||
openFirewall = false;
|
||||
package = production.package;
|
||||
jvmOpts = "-Xmx8G -Xms2G";
|
||||
serverProperties = production.serverProperties // {
|
||||
server-ip = "127.0.0.1";
|
||||
server-port = 25568;
|
||||
enable-rcon = false;
|
||||
enable-query = false;
|
||||
view-distance = 8;
|
||||
simulation-distance = 4;
|
||||
motd = "WorldOfSosal backup restore test";
|
||||
};
|
||||
};
|
||||
|
||||
services.minecraft-modpack-imports.${name} = {
|
||||
inherit (pack) remoteHost remoteUser remotePath archiveName archiveSha256
|
||||
expectedDependencies hostPublicKey retries timeout;
|
||||
enable = true;
|
||||
serverName = name;
|
||||
sshKeyFile = config.sops.secrets."minecraft/restore-storage-box-pack-key".path;
|
||||
};
|
||||
|
||||
systemd.services."minecraft-modpack-import-${name}" = {
|
||||
unitConfig.ConditionPathExists = "!${restore.completionMarker}";
|
||||
postStart = import ./world-of-sosal-settings.nix { inherit pkgs serverDir; };
|
||||
};
|
||||
|
||||
services.minecraft-backup-restores.${name} = {
|
||||
enable = true;
|
||||
serverName = name;
|
||||
inherit (config.services.minecraft-backups.s3)
|
||||
bucket endpoint region credentialsFile;
|
||||
key = "minecraft/neuro/wowMineMap/minecraft-wowMineMap-20261117T172531Z.tar.zst";
|
||||
expectedSize = 9206330929;
|
||||
afterUnits = [ "minecraft-modpack-import-${name}.service" ];
|
||||
};
|
||||
|
||||
services.minecraft-backups.servers.${name}.enable = false;
|
||||
}
|
||||
@@ -1,12 +1,15 @@
|
||||
{
|
||||
imports = [
|
||||
./vanilla.nix
|
||||
./horizon.nix
|
||||
./create-aeronautics.nix
|
||||
./wow-mine-map.nix
|
||||
./world-of-sosal.nix
|
||||
./backup-restore-test.nix
|
||||
./public-tunnel.nix
|
||||
./world-import.nix
|
||||
./modpack-import.nix
|
||||
../../../module/generic/minecraft-backups.nix
|
||||
];
|
||||
|
||||
services.minecraft-servers = {
|
||||
@@ -14,4 +17,18 @@
|
||||
eula = true;
|
||||
openFirewall = true;
|
||||
};
|
||||
|
||||
services.minecraft-backups = {
|
||||
enable = true;
|
||||
s3 = {
|
||||
bucket = "backup-hectic-lab";
|
||||
endpoint = "https://hel1.your-objectstorage.com";
|
||||
region = "hel1";
|
||||
credentialsFile = "/var/lib/minecraft-backups/s3-credentials";
|
||||
};
|
||||
servers.horizon = {
|
||||
service = "horizon.service";
|
||||
directory = "/var/lib/horizon";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
# Horizon on neuro
|
||||
|
||||
Horizon Nightly 2026-11-01 serves Minecraft Java Edition 26.3 on TCP 25569.
|
||||
It runs without Java on neuro, uses `/var/lib/horizon`, and starts only when
|
||||
`/var/lib/horizon/resources/registries.json` exists. The whitelist is enabled;
|
||||
add an account with:
|
||||
|
||||
```sh
|
||||
sudo -u horizon horizon-server --dir /var/lib/horizon whitelist add PLAYER
|
||||
```
|
||||
|
||||
## Prepare resources
|
||||
|
||||
Horizon cannot redistribute Minecraft resources. On a computer with Minecraft
|
||||
26.3 installed and played once, Java 25, its `server.jar`, and this pinned
|
||||
Horizon package, prepare them locally:
|
||||
|
||||
```sh
|
||||
horizon-prepare --prepare \
|
||||
--server-jar /path/to/26.3/server.jar \
|
||||
--minecraft-dir /path/to/.minecraft \
|
||||
--output ./horizon-resources
|
||||
```
|
||||
|
||||
The packaged command seeds its pinned exporter support files into
|
||||
`$XDG_CACHE_HOME/horizon/prepare-root-nightly-2026-11-01` (or `~/.cache` when
|
||||
`XDG_CACHE_HOME` is unset). Bundled support files contain no Mojang data.
|
||||
Preparation imports your local game files into this writable root. Pass
|
||||
`--root PATH` to seed and use another writable location.
|
||||
|
||||
Copy the complete `horizon-resources` folder to neuro without changing its
|
||||
contents, then grant the service read access and explicitly restart it:
|
||||
|
||||
```sh
|
||||
sudo install -d -o horizon -g horizon -m 0750 /var/lib/horizon/resources
|
||||
sudo rsync -a --chown=horizon:horizon ./horizon-resources/ /var/lib/horizon/resources/
|
||||
sudo systemctl restart horizon
|
||||
```
|
||||
|
||||
If `registries.json` is absent, systemd leaves the unit skipped instead of
|
||||
crash-looping. `server.toml` and Horizon's `eula.txt` are copied to writable
|
||||
state on every start;
|
||||
declarative defaults remain authoritative while worlds, backups, whitelist,
|
||||
operators, bans, and other generated files persist under `/var/lib/horizon`.
|
||||
@@ -0,0 +1,83 @@
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
horizon = pkgs.hectic.horizon;
|
||||
eulaFile = pkgs.writeText "horizon-eula.txt" ''
|
||||
eula=true
|
||||
'';
|
||||
serverConfig = pkgs.writeText "horizon-server.toml" ''
|
||||
[server]
|
||||
port = 25569
|
||||
online_mode = true
|
||||
whitelist = true
|
||||
|
||||
[world]
|
||||
name = "world"
|
||||
|
||||
[engine]
|
||||
path = "${horizon}/libexec/horizon/horizon-engine"
|
||||
resources = "/var/lib/horizon/resources"
|
||||
restart_on_crash = true
|
||||
|
||||
[backups]
|
||||
every = "6h"
|
||||
keep = 12
|
||||
|
||||
[panel]
|
||||
bind = ""
|
||||
allow_public = false
|
||||
|
||||
[api]
|
||||
bind = "127.0.0.1:8131"
|
||||
token = ""
|
||||
allow_public = false
|
||||
'';
|
||||
in {
|
||||
users.groups.horizon = {};
|
||||
users.users.horizon = {
|
||||
isSystemUser = true;
|
||||
group = "horizon";
|
||||
home = "/var/lib/horizon";
|
||||
};
|
||||
|
||||
environment.systemPackages = [ horizon ];
|
||||
networking.firewall.allowedTCPPorts = [ 25569 ];
|
||||
|
||||
systemd.services.horizon = {
|
||||
description = "Horizon Minecraft server";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
after = [ "network-online.target" ];
|
||||
unitConfig.ConditionPathExists = "/var/lib/horizon/resources/registries.json";
|
||||
environment.HORIZON_NO_UPDATE_CHECK = "1";
|
||||
restartTriggers = [ serverConfig eulaFile ];
|
||||
preStart = ''
|
||||
install -m 0640 ${serverConfig} /var/lib/horizon/server.toml
|
||||
install -m 0640 ${eulaFile} /var/lib/horizon/eula.txt
|
||||
'';
|
||||
serviceConfig = {
|
||||
User = "horizon";
|
||||
Group = "horizon";
|
||||
WorkingDirectory = "/var/lib/horizon";
|
||||
ExecStart = "${horizon}/bin/horizon-server --dir /var/lib/horizon run";
|
||||
Restart = "on-failure";
|
||||
RestartSec = 10;
|
||||
KillSignal = "SIGTERM";
|
||||
TimeoutStopSec = 180;
|
||||
StateDirectory = "horizon";
|
||||
StateDirectoryMode = "0750";
|
||||
UMask = "0027";
|
||||
NoNewPrivileges = true;
|
||||
PrivateDevices = true;
|
||||
PrivateTmp = true;
|
||||
ProtectHome = true;
|
||||
ProtectSystem = "strict";
|
||||
ProtectKernelLogs = true;
|
||||
ProtectKernelModules = true;
|
||||
ProtectKernelTunables = true;
|
||||
ProtectControlGroups = true;
|
||||
RestrictSUIDSGID = true;
|
||||
CapabilityBoundingSet = [ "" ];
|
||||
RestrictAddressFamilies = [ "AF_INET" "AF_INET6" "AF_UNIX" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -9,7 +9,7 @@ let
|
||||
serviceConfig = {
|
||||
User = "mc-wow-tunnel";
|
||||
Group = "mc-wow-tunnel";
|
||||
ExecStart = "${pkgs.openssh}/bin/ssh -NT -i ${config.sops.secrets."minecraft/wow-tunnel-key".path} -o IPQoS=none -o Ciphers=aes256-ctr -o MACs=hmac-sha2-256-etm@openssh.com -o KexAlgorithms=curve25519-sha256 -o BatchMode=yes -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes -o UserKnownHostsFile=/etc/ssh/ssh_known_hosts -o ExitOnForwardFailure=yes -o ServerAliveInterval=15 -o ServerAliveCountMax=3 -o ConnectTimeout=10 -R 127.0.0.1:25577:127.0.0.1:25567 mc-wow-relay@${relay.address}";
|
||||
ExecStart = "${pkgs.openssh}/bin/ssh -NT -p ${toString (relay.port or 22)} -i ${config.sops.secrets."minecraft/wow-tunnel-key".path} -o IPQoS=none -o Ciphers=aes256-ctr -o MACs=hmac-sha2-256-etm@openssh.com -o KexAlgorithms=curve25519-sha256 -o BatchMode=yes -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes -o UserKnownHostsFile=/etc/ssh/ssh_known_hosts -o ExitOnForwardFailure=yes -o ServerAliveInterval=15 -o ServerAliveCountMax=3 -o ConnectTimeout=10 -R 127.0.0.1:25577:127.0.0.1:25567 mc-wow-relay@${relay.address}";
|
||||
Restart = "always";
|
||||
RestartSec = 10;
|
||||
NoNewPrivileges = true;
|
||||
@@ -31,7 +31,7 @@ in {
|
||||
mode = "0400";
|
||||
};
|
||||
programs.ssh.knownHosts.minecraft-wow-relay = {
|
||||
hostNames = [ "128.140.75.58" ];
|
||||
hostNames = [ "[128.140.75.58]:22223" ];
|
||||
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAFpr4DPSaJt0xeuGIfcZBJD3LsJHTdIRIs2Tt9HF+CT";
|
||||
};
|
||||
programs.ssh.knownHosts.minecraft-wow-relay-bfs = {
|
||||
@@ -41,6 +41,7 @@ in {
|
||||
systemd.services.minecraft-wow-tunnel = mkTunnel {
|
||||
name = "hectic-lab";
|
||||
address = "128.140.75.58";
|
||||
port = 22223;
|
||||
};
|
||||
systemd.services.minecraft-wow-tunnel-bfs = mkTunnel {
|
||||
name = "bfs.band";
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
{ pkgs, serverDir }:
|
||||
''
|
||||
rm -f -- \
|
||||
"${serverDir}/mods/dynamicheight-0.2.0+neoforge-1.21-1.21.1.jar" \
|
||||
"${serverDir}/mods/sable_dynamicheight_compat-1.0.0.jar"
|
||||
${pkgs.gnused}/bin/sed -i \
|
||||
-e '/^[[:space:]]*levelKeyPrefix[[:space:]]*=/d' \
|
||||
-e '/^\[server\]$/a\levelKeyPrefix = "world-of-sosal-20261114T223938Z-winter-biomes-"' \
|
||||
"${serverDir}/config/DistantHorizons.toml"
|
||||
${pkgs.gnused}/bin/sed -i \
|
||||
-e 's/^\([[:space:]]*enableCheatModeForCreative[[:space:]]*=\).*/\1 false/' \
|
||||
"${serverDir}/config/jei-server.toml"
|
||||
''
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"values": ["worldofsosal:spawn_tick"]
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
spawnpoint @s 3742 89 8891
|
||||
tp @s 3742 89 8891
|
||||
tag @s add worldofsosal_initialized
|
||||
+1
@@ -0,0 +1 @@
|
||||
execute as @a[tag=!worldofsosal_initialized] in crafting_azeroth:azeroth run function worldofsosal:first_spawn
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"pack": {
|
||||
"pack_format": 48,
|
||||
"description": "WorldOfSosal: initial spawn in Azeroth"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
{ config, ... }:
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
packVersion = "v13-lootplus-cleanup";
|
||||
in
|
||||
{
|
||||
sops.secrets."minecraft/storage-box-pack-key" = {
|
||||
sopsFile = ../../../../sus/neuro-minecraft.yaml;
|
||||
@@ -13,10 +16,10 @@
|
||||
serverName = "wowMineMap";
|
||||
remoteHost = "u664722.your-storagebox.de";
|
||||
remoteUser = "u664722";
|
||||
remotePath = "minecraft/pack/WorldOfSosal-v3.mrpack";
|
||||
remotePath = "minecraft/pack/WorldOfSosal-${packVersion}.mrpack";
|
||||
archiveName = "WorldOfSosal.mrpack";
|
||||
cacheDir = "/var/lib/minecraft-modpacks/worldOfSosal";
|
||||
archiveSha256 = "f97cf251b14f40590e97e7b39e8a8ec43dacfce6da1b02357d15e0eee10d3ade";
|
||||
archiveSha256 = "e5895994e95a4df476d7da00b53c39d0372885265acb6cf9b5a9647a015db5f7";
|
||||
expectedDependencies = {
|
||||
minecraft = "1.21.1";
|
||||
neoforge = "21.1.250";
|
||||
@@ -25,9 +28,17 @@
|
||||
hostPublicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5EB5p/5Hp3hGW1oHok+PIOH9Pbn7cnUiGmUEBrCVjnAw+HrKyN8bYVV0dIGllswYXwkG/+bgiBlE6IVIBAq+JwVWu1Sss3KarHY3OvFJUXZoZyRRg/Gc/+LRCE7lyKpwWQ70dbelGRyyJFH36eNv6ySXoUYtGkwlU5IVaHPApOxe4LHPZa/qhSRbPo2hwoh0orCtgejRebNtW5nlx00DNFgsvn8Svz2cIYLxsPVzKgUxs8Zxsxgn+Q/UvR7uq4AbAhyBMLxv7DjJ1pc7PJocuTno2Rw9uMZi1gkjbnmiOh6TTXIEWbnroyIhwc8555uto9melEUmWNQ+C+PwAK+MPw==";
|
||||
};
|
||||
|
||||
services.minecraft-servers.servers.wowMineMap.serverProperties.motd =
|
||||
"WorldOfSosal ${packVersion} — World of Warcraft";
|
||||
|
||||
# Import the map before writing modpack configuration into the same server.
|
||||
systemd.services.minecraft-modpack-import-worldOfSosal = {
|
||||
after = [ "minecraft-world-import-wowMineMap.service" ];
|
||||
requires = [ "minecraft-world-import-wowMineMap.service" ];
|
||||
# Test the map's native dimension height without runtime height overrides.
|
||||
postStart = import ./world-of-sosal-settings.nix {
|
||||
inherit pkgs;
|
||||
serverDir = "${config.services.minecraft-servers.dataDir}/wowMineMap";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -13,15 +13,35 @@
|
||||
serverName = "wowMineMap";
|
||||
remoteHost = "u664722.your-storagebox.de";
|
||||
remoteUser = "u664722";
|
||||
remotePath = "minecraft/map/wow mine map.rar";
|
||||
archiveName = "wow mine map.rar";
|
||||
remotePath = "minecraft/map/versions/world-of-sosal-20261114T223938Z-winter-biomes.tar.gz";
|
||||
archiveName = "world-of-sosal-20261114T223938Z-winter-biomes.tar.gz";
|
||||
cacheDir = "/var/lib/minecraft-maps";
|
||||
archiveSha256 = "bc80084de10a06b0fc2cb1651c61936b9e2fd2288f3f0fe44c964d83a393aa30";
|
||||
archiveSha256 = "d1afd169b16b7b50a57c47da46245e93285b46b6c833bfd08941d07d0341b208";
|
||||
sshKeyFile = config.sops.secrets."minecraft/storage-box-key".path;
|
||||
worldName = "world";
|
||||
hostPublicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5EB5p/5Hp3hGW1oHok+PIOH9Pbn7cnUiGmUEBrCVjnAw+HrKyN8bYVV0dIGllswYXwkG/+bgiBlE6IVIBAq+JwVWu1Sss3KarHY3OvFJUXZoZyRRg/Gc/+LRCE7lyKpwWQ70dbelGRyyJFH36eNv6ySXoUYtGkwlU5IVaHPApOxe4LHPZa/qhSRbPo2hwoh0orCtgejRebNtW5nlx00DNFgsvn8Svz2cIYLxsPVzKgUxs8Zxsxgn+Q/UvR7uq4AbAhyBMLxv7DjJ1pc7PJocuTno2Rw9uMZi1gkjbnmiOh6TTXIEWbnroyIhwc8555uto9melEUmWNQ+C+PwAK+MPw==";
|
||||
};
|
||||
|
||||
systemd.services.minecraft-world-reset-wowMineMap = {
|
||||
description = "Reset WorldOfSosal to the pinned source map";
|
||||
path = [ pkgs.coreutils pkgs.systemd ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
TimeoutStartSec = "45min";
|
||||
};
|
||||
script = let
|
||||
source = config.services.minecraft-world-imports.wowMineMap;
|
||||
in ''
|
||||
set -eu
|
||||
printf '%s %s\n' \
|
||||
'${source.archiveSha256}' \
|
||||
'${source.cacheDir}/${source.archiveName}' | sha256sum -c -
|
||||
systemctl stop minecraft-server-wowMineMap.service minecraft-world-import-wowMineMap.service
|
||||
rm -rf -- '${config.services.minecraft-servers.dataDir}/wowMineMap/${source.worldName}'
|
||||
systemctl start minecraft-server-wowMineMap.service
|
||||
'';
|
||||
};
|
||||
|
||||
sops.secrets."minecraft/rcon-password" = {
|
||||
sopsFile = ../../../../sus/neuro-minecraft.yaml;
|
||||
owner = "minecraft";
|
||||
@@ -54,10 +74,10 @@
|
||||
difficulty = "hard";
|
||||
online-mode = false;
|
||||
enable-rcon = true;
|
||||
enable-command-block = true;
|
||||
"rcon.port" = 25575;
|
||||
view-distance = 12;
|
||||
simulation-distance = 8;
|
||||
motd = "WorldOfSosal — World of Warcraft";
|
||||
view-distance = 32;
|
||||
simulation-distance = 32;
|
||||
level-name = "world";
|
||||
pause-when-empty-seconds = 0;
|
||||
};
|
||||
|
||||
@@ -182,7 +182,7 @@ in {
|
||||
};
|
||||
|
||||
hectic.services.stable-video-diffusion = {
|
||||
enable = true;
|
||||
enable = false;
|
||||
host = "127.0.0.1";
|
||||
port = 7861;
|
||||
package = pkgs.hectic.stable-video-diffusion-api;
|
||||
@@ -224,70 +224,6 @@ in {
|
||||
archetype.dev.enable = true;
|
||||
};
|
||||
|
||||
hectic.services."project-zomboid" = {
|
||||
enable = true;
|
||||
memory = "8g";
|
||||
serverName = "servertest";
|
||||
serverPropertiesFile = /var/lib/project-zomboid/server-password.ini;
|
||||
serverProperties = {
|
||||
Map = "Muldraugh, KY";
|
||||
DoLuaChecksum = false;
|
||||
Public = true;
|
||||
AntiCheatSafety = 4;
|
||||
AntiCheatMovement = 4;
|
||||
AntiCheatSpeed = 4;
|
||||
AntiCheatHit = 4;
|
||||
AntiCheatPacket = 4;
|
||||
AntiCheatPacketException = 4;
|
||||
AntiCheatPermission = 4;
|
||||
AntiCheatXP = 4;
|
||||
AntiCheatFire = 4;
|
||||
AntiCheatSafeHouse = 4;
|
||||
AntiCheatRecipe = 4;
|
||||
AntiCheatPlayer = 4;
|
||||
AntiCheatChecksum = 4;
|
||||
AntiCheatItem = 4;
|
||||
AntiCheatNoClip = 4;
|
||||
AntiCheatServerCustomization = 4;
|
||||
};
|
||||
workshopItems = [
|
||||
"3676456221" # Lua Digital Watch Framework
|
||||
"3600401184" # Realistic Temperature Mod
|
||||
];
|
||||
mods = [
|
||||
"\\LuaDigitalWatchUI"
|
||||
"\\RC_RealisticColdMod"
|
||||
];
|
||||
sandboxProperties = {
|
||||
Zombies = 6;
|
||||
ZombieConfig = {
|
||||
PopulationMultiplier = 0.0;
|
||||
PopulationStartMultiplier = 0.0;
|
||||
PopulationPeakMultiplier = 0.0;
|
||||
RespawnHours = 0.0;
|
||||
RespawnUnseenHours = 0.0;
|
||||
RespawnMultiplier = 0.0;
|
||||
RedistributeHours = 0.0;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.project-zomboid.preStart = lib.mkBefore ''
|
||||
password_file=${lib.escapeShellArg "/var/lib/project-zomboid/server-password"}
|
||||
properties_file=${lib.escapeShellArg "/var/lib/project-zomboid/server-password.ini"}
|
||||
|
||||
if [ ! -s "$password_file" ] || ! ${pkgs.gnugrep}/bin/grep -Eq '^[0-9a-f]{48}$' "$password_file"; then
|
||||
umask 077
|
||||
${pkgs.openssl}/bin/openssl rand -hex 24 > "$password_file"
|
||||
fi
|
||||
${pkgs.coreutils}/bin/chmod 0600 "$password_file"
|
||||
|
||||
properties_file_tmp="$( ${pkgs.coreutils}/bin/mktemp "$(dirname "$properties_file")/.server-password.ini.XXXXXX")"
|
||||
${pkgs.coreutils}/bin/printf 'Password=%s\n' "$(<"$password_file")" > "$properties_file_tmp"
|
||||
${pkgs.coreutils}/bin/chmod 0600 "$properties_file_tmp"
|
||||
${pkgs.coreutils}/bin/mv "$properties_file_tmp" "$properties_file"
|
||||
'';
|
||||
|
||||
sops = {
|
||||
gnupg.sshKeyPaths = [ ];
|
||||
age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
};
|
||||
|
||||
wsl.defaultUser = "yukkop";
|
||||
networking.resolvconf.enable = false;
|
||||
|
||||
# 16 GiB swap
|
||||
swapDevices = [{
|
||||
|
||||
+2
-1
@@ -13,12 +13,13 @@ in final: prev: (
|
||||
hash = "sha256-O8znAlq2XjrixG0FA4cfkgcI9t/w9QMHV0spUjYKl48=";
|
||||
};
|
||||
}) else prev.p4d;
|
||||
p4 = prev.p4.overrideAttrs (_: {
|
||||
p4 = prev.p4.overrideAttrs (old: {
|
||||
version = "2024.1/3006289";
|
||||
src = final.fetchurl {
|
||||
url = "https://ftp.perforce.com/pub/perforce/r24.1/bin.tools/p4source.tgz";
|
||||
hash = "sha256-z3I3cikbbSrmS7dUMMKi6edPnZk2BYAmdO+pfYRJUVQ=";
|
||||
};
|
||||
NIX_CFLAGS_COMPILE = (old.NIX_CFLAGS_COMPILE or "") + " -std=gnu17";
|
||||
});
|
||||
postgresql_17 = prev.postgresql_17 // {pkgs = prev.postgresql_17.pkgs // {
|
||||
http = packages.pg-17-ext-http;
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
);
|
||||
# everything needed to run the server that isn't python
|
||||
pack = [
|
||||
pkgs.wineWowPackages.staging
|
||||
pkgs.wineWow64Packages.staging
|
||||
pkgs.dotnet-sdk_8
|
||||
pkgs.depotdownloader
|
||||
pkgs.winetricks
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
.venv
|
||||
__pycache__/
|
||||
*.pyc
|
||||
@@ -0,0 +1,41 @@
|
||||
# affine-chatgpt
|
||||
|
||||
Local ChatGPT OAuth enrollment companion and minimal OpenAI Responses gateway
|
||||
for AFFiNE. It supports sign-in, safe status inspection, visible-model listing,
|
||||
text Responses, and client-executed function/custom tools. Gateway runs in
|
||||
foreground and has no login or administration HTTP endpoints.
|
||||
|
||||
```sh
|
||||
affine-chatgpt login
|
||||
affine-chatgpt status
|
||||
affine-chatgpt models
|
||||
affine-chatgpt serve --gateway-key-file /run/keys/affine-chatgpt
|
||||
```
|
||||
|
||||
`login` binds only `127.0.0.1:1455` (override with `--port`) before printing a
|
||||
public authorization URL. Open that URL in a local browser and personally
|
||||
approve access. State defaults to `~/.local/state/affine-chatgpt`; override it
|
||||
with `--state-dir`. Files are owner-only and must never be copied into the Nix
|
||||
store, source control, logs, or shared AFFiNE configuration.
|
||||
|
||||
`serve` binds `127.0.0.1:3012` by default (`--host` and `--port` override it).
|
||||
Gateway key file is required, must contain at least 32 characters, and must be
|
||||
an owner-only regular file. Every `/v1/models` and `/v1/responses` request
|
||||
requires `Authorization: Bearer <gateway-key>`. `/healthz` returns only generic
|
||||
readiness. Configure AFFiNE for Responses dialect and choose one of models
|
||||
returned by `/v1/models`; gateway does not select or invent default model.
|
||||
|
||||
Incoming Responses requests are reduced to preview-compatible fields and sent
|
||||
upstream with `store:false`, `stream:true`, and complete array input history.
|
||||
Streaming callers receive official SSE events unchanged. Non-stream callers
|
||||
receive actual terminal completed Response JSON, including text, function
|
||||
calls, and usage. AFFiNE executes tools and returns `function_call_output` in
|
||||
next request; gateway never executes tools.
|
||||
|
||||
OAuth plan usage remains preview functionality. Supported inputs are text
|
||||
messages, function-call history/output, and necessary reasoning history.
|
||||
Function/custom tools are grouped in Responses namespaces. Unsupported:
|
||||
images/media, files, audio, image generation, file search, Code Interpreter,
|
||||
hosted MCP/connectors, conversations, background mode, persistent response
|
||||
continuation, and Chat Completions conversion. No billing fallback exists.
|
||||
A successful login/model listing does not prove inference entitlement.
|
||||
@@ -0,0 +1,51 @@
|
||||
{
|
||||
lib,
|
||||
makeWrapper,
|
||||
stdenvNoCC,
|
||||
python3,
|
||||
}:
|
||||
|
||||
let
|
||||
pythonEnv = python3.withPackages (ps: [
|
||||
ps.requests
|
||||
ps.pyjwt
|
||||
ps.cryptography
|
||||
]);
|
||||
in
|
||||
stdenvNoCC.mkDerivation {
|
||||
pname = "affine-chatgpt";
|
||||
version = "0.1.0";
|
||||
src = lib.cleanSourceWith {
|
||||
src = ./.;
|
||||
filter = path: type:
|
||||
!(builtins.elem (builtins.baseNameOf path) [ "__pycache__" ".venv" ]) && !(lib.hasSuffix ".pyc" path);
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
passthru = { inherit pythonEnv; };
|
||||
|
||||
doCheck = true;
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
PYTHONPATH="$PWD/src" ${pythonEnv}/bin/python3 -m unittest discover -s test -v
|
||||
runHook postCheck
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
install -Dm444 src/affine_chatgpt.py "$out/share/affine-chatgpt/affine_chatgpt.py"
|
||||
install -Dm444 src/affine_gateway.py "$out/share/affine-chatgpt/affine_gateway.py"
|
||||
makeWrapper ${pythonEnv}/bin/python3 "$out/bin/affine-chatgpt" \
|
||||
--add-flags "$out/share/affine-chatgpt/affine_chatgpt.py" \
|
||||
--run 'umask 077'
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Local ChatGPT OAuth enrollment companion for AFFiNE";
|
||||
homepage = "https://developers.openai.com/siwc/token-sharing-open-source/";
|
||||
license = lib.licenses.mit;
|
||||
mainProgram = "affine-chatgpt";
|
||||
platforms = lib.platforms.unix;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"venvPath": ".",
|
||||
"venv": ".venv",
|
||||
"extraPaths": ["src"]
|
||||
}
|
||||
@@ -0,0 +1,617 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Secure local ChatGPT OAuth enrollment and model discovery."""
|
||||
|
||||
import argparse
|
||||
import base64
|
||||
import contextlib
|
||||
import fcntl
|
||||
import hashlib
|
||||
import hmac
|
||||
import ipaddress
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import secrets
|
||||
import stat
|
||||
import sys
|
||||
import tempfile
|
||||
import threading
|
||||
import time
|
||||
import uuid
|
||||
from datetime import datetime, timezone
|
||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||
from pathlib import Path
|
||||
from socketserver import ThreadingMixIn
|
||||
from urllib.parse import parse_qs, urlencode, urlsplit
|
||||
|
||||
import jwt
|
||||
import requests
|
||||
|
||||
|
||||
# The installed wrapper executes this file directly; keep lazy gateway imports
|
||||
# on the same module instance so expected AppError exceptions remain catchable.
|
||||
sys.modules.setdefault("affine_chatgpt", sys.modules[__name__])
|
||||
|
||||
|
||||
ISSUER = "https://auth.openai.com"
|
||||
DISCOVERY_URL = ISSUER + "/.well-known/openid-configuration"
|
||||
AUTHORIZE_URL = ISSUER + "/api/accounts/authorize"
|
||||
TOKEN_URL = ISSUER + "/api/accounts/oauth/token"
|
||||
JWKS_URL = ISSUER + "/.well-known/jwks.json"
|
||||
RESOURCE = "https://api.openai.com/v1"
|
||||
MODELS_URL = RESOURCE + "/models"
|
||||
RESPONSES_URL = RESOURCE + "/responses"
|
||||
DYNAMIC_CLIENT = "dynamic_agent_client"
|
||||
AGENT_NAME = "Hearth AFFiNE ChatGPT connector"
|
||||
SCOPES = "openid profile email offline_access resource.invoke chatgpt.tokens.use.direct"
|
||||
REQUIRED_SCOPE = "chatgpt.tokens.use.direct"
|
||||
HTTP_TIMEOUT = 15
|
||||
SOCKET_TIMEOUT = 5
|
||||
MAX_CALLBACK = 8192
|
||||
CLIENT_RE = re.compile(r"^[A-Za-z0-9._~-]{1,256}$")
|
||||
|
||||
|
||||
class AppError(Exception):
|
||||
"""Expected failure with a non-sensitive stable error code."""
|
||||
|
||||
|
||||
def new_session():
|
||||
session = requests.Session()
|
||||
session.trust_env = False
|
||||
return session
|
||||
|
||||
|
||||
def utc_now():
|
||||
return datetime.now(timezone.utc).isoformat()
|
||||
|
||||
|
||||
def default_state_dir():
|
||||
return Path.home() / ".local" / "state" / "affine-chatgpt"
|
||||
|
||||
|
||||
def secure_dir(path):
|
||||
path = Path(path).expanduser()
|
||||
try:
|
||||
info = path.lstat()
|
||||
except FileNotFoundError:
|
||||
path.mkdir(parents=True, mode=0o700)
|
||||
info = path.lstat()
|
||||
if stat.S_ISLNK(info.st_mode) or not stat.S_ISDIR(info.st_mode):
|
||||
raise AppError("unsafe_state_dir")
|
||||
os.chmod(path, 0o700)
|
||||
return path
|
||||
|
||||
|
||||
def _regular_nofollow(path):
|
||||
try:
|
||||
info = Path(path).lstat()
|
||||
except FileNotFoundError:
|
||||
return False
|
||||
if stat.S_ISLNK(info.st_mode) or not stat.S_ISREG(info.st_mode):
|
||||
raise AppError("unsafe_state_file")
|
||||
if info.st_mode & 0o077:
|
||||
raise AppError("unsafe_state_file")
|
||||
return True
|
||||
|
||||
|
||||
def read_json(path):
|
||||
if not _regular_nofollow(path):
|
||||
return None
|
||||
try:
|
||||
with open(path, "r", encoding="utf-8") as stream:
|
||||
return json.load(stream)
|
||||
except (ValueError, TypeError):
|
||||
raise AppError("invalid_state") from None
|
||||
|
||||
|
||||
def atomic_json(path, value):
|
||||
path = Path(path)
|
||||
secure_dir(path.parent)
|
||||
_regular_nofollow(path)
|
||||
descriptor, temporary = tempfile.mkstemp(prefix=".tmp-", dir=path.parent)
|
||||
try:
|
||||
os.fchmod(descriptor, 0o600)
|
||||
with os.fdopen(descriptor, "w", encoding="utf-8") as stream:
|
||||
descriptor = -1
|
||||
json.dump(value, stream, sort_keys=True, separators=(",", ":"))
|
||||
stream.write("\n")
|
||||
stream.flush()
|
||||
os.fsync(stream.fileno())
|
||||
os.replace(temporary, path)
|
||||
os.chmod(path, 0o600)
|
||||
directory_descriptor = os.open(path.parent, os.O_RDONLY | os.O_DIRECTORY)
|
||||
try:
|
||||
os.fsync(directory_descriptor)
|
||||
finally:
|
||||
os.close(directory_descriptor)
|
||||
finally:
|
||||
if descriptor >= 0:
|
||||
os.close(descriptor)
|
||||
with contextlib.suppress(FileNotFoundError):
|
||||
os.unlink(temporary)
|
||||
|
||||
|
||||
def host_id(state_dir, supplied=None):
|
||||
target = secure_dir(state_dir) / "host.json"
|
||||
saved = read_json(target)
|
||||
if saved is not None:
|
||||
if not isinstance(saved, dict):
|
||||
raise AppError("invalid_state")
|
||||
saved_value = saved.get("host_id")
|
||||
if not isinstance(saved_value, str):
|
||||
raise AppError("invalid_state")
|
||||
value = saved_value
|
||||
elif supplied:
|
||||
source = Path(supplied).expanduser()
|
||||
if not _regular_nofollow(source) or source.stat().st_mode & 0o077:
|
||||
raise AppError("unsafe_host_id_file")
|
||||
try:
|
||||
value = source.read_text(encoding="ascii").strip()
|
||||
except OSError:
|
||||
raise AppError("invalid_host_id") from None
|
||||
else:
|
||||
value = "urn:uuid:" + str(uuid.uuid4())
|
||||
try:
|
||||
if not value.startswith("urn:uuid:"):
|
||||
raise ValueError
|
||||
parsed = uuid.UUID(value.removeprefix("urn:uuid:"))
|
||||
if parsed.version != 4:
|
||||
raise ValueError
|
||||
except (ValueError, AttributeError):
|
||||
raise AppError("invalid_host_id") from None
|
||||
value = "urn:uuid:" + str(parsed)
|
||||
if saved is None:
|
||||
atomic_json(target, {"host_id": value})
|
||||
return value
|
||||
|
||||
|
||||
def pkce_challenge(verifier):
|
||||
digest = hashlib.sha256(verifier.encode("ascii")).digest()
|
||||
return base64.urlsafe_b64encode(digest).rstrip(b"=").decode("ascii")
|
||||
|
||||
|
||||
def _safe_response(response, expected=200):
|
||||
if response.is_redirect or response.status_code != expected:
|
||||
raise AppError("oauth_http_error")
|
||||
try:
|
||||
value = response.json()
|
||||
except (requests.RequestException, ValueError):
|
||||
raise AppError("oauth_response_invalid") from None
|
||||
if not isinstance(value, dict):
|
||||
raise AppError("oauth_response_invalid")
|
||||
return value
|
||||
|
||||
|
||||
def _request(session, method, url, **kwargs):
|
||||
if url not in {DISCOVERY_URL, TOKEN_URL, JWKS_URL, MODELS_URL, RESPONSES_URL}:
|
||||
raise AppError("endpoint_not_allowed")
|
||||
kwargs.update(timeout=HTTP_TIMEOUT, allow_redirects=False)
|
||||
try:
|
||||
return session.request(method, url, **kwargs)
|
||||
except requests.RequestException:
|
||||
raise AppError("network_error") from None
|
||||
|
||||
|
||||
def check_discovery(session):
|
||||
data = _safe_response(_request(session, "GET", DISCOVERY_URL))
|
||||
if (
|
||||
data.get("issuer") != ISSUER
|
||||
or data.get("authorization_endpoint") != AUTHORIZE_URL
|
||||
or data.get("token_endpoint") != TOKEN_URL
|
||||
or data.get("jwks_uri") != JWKS_URL
|
||||
):
|
||||
raise AppError("discovery_mismatch")
|
||||
|
||||
|
||||
def fetch_jwks(session):
|
||||
data = _safe_response(_request(session, "GET", JWKS_URL))
|
||||
if not isinstance(data.get("keys"), list):
|
||||
raise AppError("jwks_invalid")
|
||||
return data
|
||||
|
||||
|
||||
def validate_id_token(encoded, client_id, nonce, session, now=None):
|
||||
try:
|
||||
header = jwt.get_unverified_header(encoded)
|
||||
except jwt.PyJWTError:
|
||||
raise AppError("id_token_invalid") from None
|
||||
kid = header.get("kid")
|
||||
if header.get("alg") != "RS256" or not isinstance(kid, str) or not kid:
|
||||
raise AppError("id_token_invalid")
|
||||
try:
|
||||
key_set = jwt.PyJWKSet.from_dict(fetch_jwks(session))
|
||||
key = next(item.key for item in key_set.keys if item.key_id == kid)
|
||||
claims = jwt.decode(
|
||||
encoded,
|
||||
key,
|
||||
algorithms=["RS256"],
|
||||
audience=client_id,
|
||||
issuer=ISSUER,
|
||||
options={"require": ["iss", "aud", "exp", "iat", "nonce", "sub"]},
|
||||
leeway=0,
|
||||
)
|
||||
except (jwt.PyJWTError, StopIteration, ValueError, TypeError):
|
||||
raise AppError("id_token_invalid") from None
|
||||
if now is not None and claims.get("exp", 0) <= now:
|
||||
raise AppError("id_token_invalid")
|
||||
if not hmac.compare_digest(str(claims["nonce"]), nonce):
|
||||
raise AppError("id_token_invalid")
|
||||
if not isinstance(claims["sub"], str) or not claims["sub"]:
|
||||
raise AppError("id_token_invalid")
|
||||
return claims
|
||||
|
||||
|
||||
def validate_token_response(data):
|
||||
required = ("access_token", "refresh_token", "id_token", "scope")
|
||||
if any(not isinstance(data.get(field), str) or not data[field] for field in required):
|
||||
raise AppError("token_response_invalid")
|
||||
if data.get("token_type") != "Bearer" or isinstance(data.get("expires_in"), bool):
|
||||
raise AppError("token_response_invalid")
|
||||
if not isinstance(data.get("expires_in"), int) or data["expires_in"] <= 0:
|
||||
raise AppError("token_response_invalid")
|
||||
scopes = sorted(set(data["scope"].split()))
|
||||
if REQUIRED_SCOPE not in scopes:
|
||||
raise AppError("scope_missing")
|
||||
return scopes
|
||||
|
||||
|
||||
class CallbackAttempt:
|
||||
def __init__(self, state, client_id, deadline):
|
||||
self.state = state
|
||||
self.client_id = client_id
|
||||
self.deadline = deadline
|
||||
self.result = None
|
||||
self.consumed = False
|
||||
self.lock = threading.Lock()
|
||||
|
||||
def process(self, raw_query, host, expected_host, now=None):
|
||||
now = time.monotonic() if now is None else now
|
||||
if len(raw_query) > MAX_CALLBACK or host != expected_host or now > self.deadline:
|
||||
raise AppError("callback_invalid")
|
||||
try:
|
||||
values = parse_qs(raw_query, keep_blank_values=True, strict_parsing=True)
|
||||
except ValueError:
|
||||
raise AppError("callback_invalid") from None
|
||||
allowed = {"state", "code", "scope", "client_id", "error", "error_description"}
|
||||
if not values or set(values) - allowed or any(len(items) != 1 for items in values.values()):
|
||||
raise AppError("callback_invalid")
|
||||
if any(len(items[0]) > 4096 for items in values.values()):
|
||||
raise AppError("callback_invalid")
|
||||
returned_state = values.get("state", [""])[0]
|
||||
if not hmac.compare_digest(returned_state, self.state):
|
||||
raise AppError("state_mismatch")
|
||||
with self.lock:
|
||||
if self.consumed:
|
||||
raise AppError("callback_replayed")
|
||||
if "error" in values:
|
||||
if "code" in values or not values["error"][0]:
|
||||
raise AppError("callback_invalid")
|
||||
self.consumed = True
|
||||
self.result = {"denied": True}
|
||||
return self.result
|
||||
code = values.get("code", [""])[0]
|
||||
if not code:
|
||||
raise AppError("callback_invalid")
|
||||
supplied = values.get("client_id", [None])[0]
|
||||
if self.client_id == DYNAMIC_CLIENT:
|
||||
if not supplied or supplied == DYNAMIC_CLIENT or not CLIENT_RE.fullmatch(supplied):
|
||||
raise AppError("client_id_invalid")
|
||||
issued = supplied
|
||||
else:
|
||||
if supplied is not None and supplied != self.client_id:
|
||||
raise AppError("client_id_mismatch")
|
||||
issued = self.client_id
|
||||
self.consumed = True
|
||||
self.result = {"denied": False, "code": code, "client_id": issued}
|
||||
return self.result
|
||||
|
||||
|
||||
class LoopbackHTTPServer(ThreadingMixIn, HTTPServer):
|
||||
daemon_threads = True
|
||||
block_on_close = False
|
||||
|
||||
def handle_error(self, request, client_address):
|
||||
return
|
||||
|
||||
def get_request(self):
|
||||
request, address = super().get_request()
|
||||
request.settimeout(SOCKET_TIMEOUT)
|
||||
return request, address
|
||||
|
||||
|
||||
def callback_handler(attempt, expected_host):
|
||||
class Handler(BaseHTTPRequestHandler):
|
||||
def log_message(self, format, *args):
|
||||
return
|
||||
|
||||
def _reply(self, status, text):
|
||||
body = (text + "\n").encode("utf-8")
|
||||
try:
|
||||
self.send_response(status)
|
||||
self.send_header("Content-Type", "text/plain; charset=utf-8")
|
||||
self.send_header("Referrer-Policy", "no-referrer")
|
||||
self.send_header("Cache-Control", "no-store")
|
||||
self.send_header("Content-Length", str(len(body)))
|
||||
self.end_headers()
|
||||
self.wfile.write(body)
|
||||
except OSError:
|
||||
return
|
||||
|
||||
def do_GET(self):
|
||||
split = urlsplit(self.path)
|
||||
if split.path != "/auth/callback" or split.fragment or len(self.path) > MAX_CALLBACK:
|
||||
self._reply(404, "Not found")
|
||||
return
|
||||
try:
|
||||
result = attempt.process(split.query, self.headers.get("Host", ""), expected_host)
|
||||
except AppError:
|
||||
self._reply(400, "Invalid callback. Return to the terminal and retry if needed.")
|
||||
return
|
||||
if result["denied"]:
|
||||
self._reply(200, "Authorization declined. You may close this page.")
|
||||
else:
|
||||
self._reply(200, "Authorization received. You may close this page.")
|
||||
|
||||
return Handler
|
||||
|
||||
|
||||
def credentials_path(state_dir):
|
||||
return secure_dir(state_dir) / "credentials.json"
|
||||
|
||||
|
||||
def credentials_valid(value):
|
||||
strings = (
|
||||
"issuer",
|
||||
"subject",
|
||||
"client_id",
|
||||
"host_id",
|
||||
"access_token",
|
||||
"refresh_token",
|
||||
"id_token",
|
||||
"token_type",
|
||||
"saved_at",
|
||||
)
|
||||
return bool(
|
||||
isinstance(value, dict)
|
||||
and all(isinstance(value.get(field), str) and value[field] for field in strings)
|
||||
and value["issuer"] == ISSUER
|
||||
and value["token_type"] == "Bearer"
|
||||
and isinstance(value.get("scopes"), list)
|
||||
and REQUIRED_SCOPE in value["scopes"]
|
||||
and not isinstance(value.get("expires_at"), bool)
|
||||
and isinstance(value.get("expires_at"), (int, float))
|
||||
)
|
||||
|
||||
|
||||
def read_credentials(directory):
|
||||
value = read_json(credentials_path(directory))
|
||||
if value is not None and not credentials_valid(value):
|
||||
raise AppError("invalid_state")
|
||||
return value
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def credential_lock(state_dir):
|
||||
directory = secure_dir(state_dir)
|
||||
lock_path = directory / "credentials.lock"
|
||||
_regular_nofollow(lock_path)
|
||||
descriptor = os.open(lock_path, os.O_CREAT | os.O_RDWR | os.O_NOFOLLOW, 0o600)
|
||||
try:
|
||||
os.fchmod(descriptor, 0o600)
|
||||
fcntl.flock(descriptor, fcntl.LOCK_EX)
|
||||
yield directory
|
||||
finally:
|
||||
os.close(descriptor)
|
||||
|
||||
|
||||
def exchange_code(session, code, verifier, redirect_uri, client_id):
|
||||
response = _request(
|
||||
session,
|
||||
"POST",
|
||||
TOKEN_URL,
|
||||
data={
|
||||
"grant_type": "authorization_code",
|
||||
"client_id": client_id,
|
||||
"code": code,
|
||||
"code_verifier": verifier,
|
||||
"redirect_uri": redirect_uri,
|
||||
"resource": RESOURCE,
|
||||
},
|
||||
)
|
||||
return _safe_response(response)
|
||||
|
||||
|
||||
def login(args, session=None):
|
||||
session = session or new_session()
|
||||
with credential_lock(args.state_dir) as directory:
|
||||
host = host_id(directory, args.host_id_file)
|
||||
old = read_credentials(directory)
|
||||
requested_client = old["client_id"] if old else DYNAMIC_CLIENT
|
||||
verifier = secrets.token_urlsafe(64)
|
||||
state = secrets.token_urlsafe(32)
|
||||
nonce = secrets.token_urlsafe(32)
|
||||
server = LoopbackHTTPServer(("127.0.0.1", args.port), BaseHTTPRequestHandler)
|
||||
port = server.server_address[1]
|
||||
expected_host = f"127.0.0.1:{port}"
|
||||
redirect_uri = f"http://{expected_host}/auth/callback"
|
||||
attempt = CallbackAttempt(state, requested_client, time.monotonic() + args.timeout)
|
||||
server.RequestHandlerClass = callback_handler(attempt, expected_host)
|
||||
server.timeout = min(1, args.timeout)
|
||||
query = {
|
||||
"client_id": requested_client,
|
||||
"ext_agent_host_id": host,
|
||||
"response_type": "code",
|
||||
"redirect_uri": redirect_uri,
|
||||
"scope": SCOPES,
|
||||
"resource": RESOURCE,
|
||||
"state": state,
|
||||
"nonce": nonce,
|
||||
"code_challenge_method": "S256",
|
||||
"code_challenge": pkce_challenge(verifier),
|
||||
}
|
||||
if requested_client == DYNAMIC_CLIENT:
|
||||
query["agent_name_hint"] = AGENT_NAME
|
||||
print(AUTHORIZE_URL + "?" + urlencode(query), flush=True)
|
||||
try:
|
||||
while attempt.result is None and time.monotonic() <= attempt.deadline:
|
||||
server.handle_request()
|
||||
finally:
|
||||
server.server_close()
|
||||
if attempt.result is None:
|
||||
raise AppError("callback_timeout")
|
||||
if attempt.result["denied"]:
|
||||
raise AppError("authorization_denied")
|
||||
check_discovery(session)
|
||||
issued = attempt.result["client_id"]
|
||||
token = exchange_code(session, attempt.result["code"], verifier, redirect_uri, issued)
|
||||
scopes = validate_token_response(token)
|
||||
claims = validate_id_token(token["id_token"], issued, nonce, session)
|
||||
if old and old["subject"] != claims["sub"]:
|
||||
raise AppError("account_mismatch")
|
||||
now = time.time()
|
||||
saved = {
|
||||
"issuer": ISSUER,
|
||||
"subject": claims["sub"],
|
||||
"client_id": issued,
|
||||
"host_id": host,
|
||||
"access_token": token["access_token"],
|
||||
"refresh_token": token["refresh_token"],
|
||||
"id_token": token["id_token"],
|
||||
"token_type": "Bearer",
|
||||
"scopes": scopes,
|
||||
"saved_at": utc_now(),
|
||||
"expires_at": now + token["expires_in"],
|
||||
}
|
||||
atomic_json(credentials_path(directory), saved)
|
||||
print(json.dumps({"authorized": True}))
|
||||
|
||||
|
||||
def status(args):
|
||||
directory = secure_dir(args.state_dir)
|
||||
host_data = read_json(directory / "host.json")
|
||||
if host_data is not None and (
|
||||
not isinstance(host_data, dict) or not isinstance(host_data.get("host_id"), str)
|
||||
):
|
||||
raise AppError("invalid_state")
|
||||
creds = read_credentials(directory)
|
||||
authorized = credentials_valid(creds)
|
||||
result = {
|
||||
"authorized": authorized,
|
||||
"access_token_expired": not isinstance(creds, dict)
|
||||
or not isinstance(creds.get("expires_at"), (int, float))
|
||||
or creds.get("expires_at", 0) <= time.time(),
|
||||
}
|
||||
if host_data and isinstance(host_data.get("host_id"), str):
|
||||
result["host_id"] = host_data["host_id"]
|
||||
print(json.dumps(result, sort_keys=True))
|
||||
|
||||
|
||||
def refresh(session, path, creds):
|
||||
response = _request(
|
||||
session,
|
||||
"POST",
|
||||
TOKEN_URL,
|
||||
data={
|
||||
"grant_type": "refresh_token",
|
||||
"client_id": creds["client_id"],
|
||||
"refresh_token": creds["refresh_token"],
|
||||
"resource": RESOURCE,
|
||||
},
|
||||
)
|
||||
data = _safe_response(response)
|
||||
scopes = validate_token_response({**data, "id_token": data.get("id_token", creds.get("id_token"))})
|
||||
if data["refresh_token"] == creds["refresh_token"]:
|
||||
raise AppError("refresh_not_rotated")
|
||||
updated = dict(creds)
|
||||
updated.update(
|
||||
access_token=data["access_token"],
|
||||
refresh_token=data["refresh_token"],
|
||||
token_type="Bearer",
|
||||
scopes=scopes,
|
||||
saved_at=utc_now(),
|
||||
expires_at=time.time() + data["expires_in"],
|
||||
)
|
||||
atomic_json(path, updated)
|
||||
return updated
|
||||
|
||||
|
||||
def models(args, session=None):
|
||||
session = session or new_session()
|
||||
with credential_lock(args.state_dir) as directory:
|
||||
path = credentials_path(directory)
|
||||
creds = read_credentials(directory)
|
||||
if not isinstance(creds, dict):
|
||||
raise AppError("not_authorized")
|
||||
if creds.get("expires_at", 0) <= time.time() + 120:
|
||||
creds = refresh(session, path, creds)
|
||||
response = _request(
|
||||
session,
|
||||
"GET",
|
||||
MODELS_URL,
|
||||
headers={"Authorization": "Bearer " + creds["access_token"]},
|
||||
)
|
||||
data = _safe_response(response)
|
||||
entries = data.get("models")
|
||||
if not isinstance(entries, list):
|
||||
raise AppError("models_response_invalid")
|
||||
visible = []
|
||||
for item in entries:
|
||||
if (
|
||||
isinstance(item, dict)
|
||||
and item.get("visibility") == "list"
|
||||
and isinstance(item.get("slug"), str)
|
||||
and isinstance(item.get("display_name"), str)
|
||||
):
|
||||
visible.append({"slug": item["slug"], "display_name": item["display_name"]})
|
||||
print(json.dumps(visible, separators=(",", ":")))
|
||||
|
||||
|
||||
def parser():
|
||||
result = argparse.ArgumentParser(prog="affine-chatgpt")
|
||||
result.add_argument("--state-dir", type=Path, default=default_state_dir())
|
||||
commands = result.add_subparsers(dest="command", required=True)
|
||||
login_parser = commands.add_parser("login")
|
||||
login_parser.add_argument("--port", type=int, default=1455)
|
||||
login_parser.add_argument("--timeout", type=int, default=900)
|
||||
login_parser.add_argument("--host-id-file", type=Path)
|
||||
commands.add_parser("status")
|
||||
commands.add_parser("models")
|
||||
serve_parser = commands.add_parser("serve")
|
||||
serve_parser.add_argument("--host", default="127.0.0.1")
|
||||
serve_parser.add_argument("--port", type=int, default=3012)
|
||||
serve_parser.add_argument("--gateway-key-file", type=Path, required=True)
|
||||
return result
|
||||
|
||||
|
||||
def main(argv=None):
|
||||
args = parser().parse_args(argv)
|
||||
try:
|
||||
if args.command == "login":
|
||||
if not 0 <= args.port <= 65535 or args.timeout <= 0:
|
||||
raise AppError("invalid_argument")
|
||||
login(args)
|
||||
elif args.command == "status":
|
||||
status(args)
|
||||
elif args.command == "models":
|
||||
models(args)
|
||||
else:
|
||||
if not 0 <= args.port <= 65535:
|
||||
raise AppError("invalid_argument")
|
||||
try:
|
||||
ipaddress.ip_address(args.host)
|
||||
except ValueError:
|
||||
raise AppError("invalid_argument") from None
|
||||
from affine_gateway import serve
|
||||
|
||||
serve(args)
|
||||
except AppError as error:
|
||||
print(f"error: {error}", file=sys.stderr)
|
||||
return 1
|
||||
except OSError:
|
||||
print("error: local_io_error", file=sys.stderr)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -0,0 +1,612 @@
|
||||
"""Minimal OpenAI Responses-compatible gateway for AFFiNE."""
|
||||
|
||||
import hmac
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import socket
|
||||
import stat
|
||||
import threading
|
||||
import time
|
||||
from typing import cast
|
||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||
from socketserver import ThreadingMixIn
|
||||
from urllib.parse import urlsplit
|
||||
|
||||
import requests
|
||||
|
||||
import affine_chatgpt as auth
|
||||
|
||||
|
||||
MAX_BODY = 2 * 1024 * 1024
|
||||
MAX_EVENT = 8 * 1024 * 1024
|
||||
CONNECT_TIMEOUT = 15
|
||||
READ_TIMEOUT = 90
|
||||
SOCKET_TIMEOUT = 95
|
||||
HEADER_TIMEOUT = 10
|
||||
CATALOG_TTL = 300
|
||||
MAX_CONCURRENT = 16
|
||||
MAX_CONNECTIONS = 32
|
||||
NAMESPACE = "affine"
|
||||
NAME_RE = re.compile(r"^[A-Za-z0-9_.-]{1,128}$")
|
||||
NAMESPACE_RE = re.compile(r"^[A-Za-z0-9_-]{1,64}$")
|
||||
SAFE_UPSTREAM_CODES = {
|
||||
"invalid_request_error",
|
||||
"model_not_found",
|
||||
"rate_limit_exceeded",
|
||||
"server_error",
|
||||
"insufficient_quota",
|
||||
}
|
||||
IGNORED_FIELDS = {
|
||||
"max_output_tokens",
|
||||
"max_tool_calls",
|
||||
"metadata",
|
||||
"moderation",
|
||||
"multi_agent",
|
||||
"prompt_cache_retention",
|
||||
"safety_identifier",
|
||||
"temperature",
|
||||
"top_logprobs",
|
||||
"top_p",
|
||||
"truncation",
|
||||
"user",
|
||||
}
|
||||
REJECTED_FIELDS = {"background", "conversation", "previous_response_id", "prompt"}
|
||||
|
||||
|
||||
class GatewayError(Exception):
|
||||
"""Expected client/upstream failure safe for public output."""
|
||||
|
||||
def __init__(self, status, code):
|
||||
super().__init__(code)
|
||||
self.status = status
|
||||
self.code = code
|
||||
|
||||
|
||||
def read_gateway_key(path):
|
||||
try:
|
||||
info = path.lstat()
|
||||
except OSError:
|
||||
raise auth.AppError("invalid_gateway_key") from None
|
||||
if stat.S_ISLNK(info.st_mode) or not stat.S_ISREG(info.st_mode) or info.st_mode & 0o077:
|
||||
raise auth.AppError("invalid_gateway_key")
|
||||
try:
|
||||
descriptor = os.open(path, os.O_RDONLY | os.O_NOFOLLOW)
|
||||
with os.fdopen(descriptor, "r", encoding="utf-8") as stream:
|
||||
value = stream.read(4097).strip()
|
||||
except (OSError, UnicodeError):
|
||||
raise auth.AppError("invalid_gateway_key") from None
|
||||
if len(value) < 32 or len(value) > 4096 or "\n" in value or "\r" in value:
|
||||
raise auth.AppError("invalid_gateway_key")
|
||||
return value
|
||||
|
||||
|
||||
def new_session():
|
||||
session = requests.Session()
|
||||
session.trust_env = False
|
||||
return session
|
||||
|
||||
|
||||
def _response_json(response, code):
|
||||
if response.is_redirect:
|
||||
raise GatewayError(response.status_code, "upstream_redirect")
|
||||
try:
|
||||
value = response.json()
|
||||
except (requests.RequestException, ValueError):
|
||||
raise GatewayError(502, code) from None
|
||||
if not isinstance(value, dict):
|
||||
raise GatewayError(502, code)
|
||||
return value
|
||||
|
||||
|
||||
class Provider:
|
||||
def __init__(self, state_dir, session=None, now=time.time):
|
||||
self.state_dir = state_dir
|
||||
self.session = session or new_session()
|
||||
self.now = now
|
||||
self.catalog = None
|
||||
self.catalog_at = 0
|
||||
self.lock = threading.Lock()
|
||||
|
||||
def credentials(self):
|
||||
with auth.credential_lock(self.state_dir) as directory:
|
||||
path = auth.credentials_path(directory)
|
||||
creds = auth.read_credentials(directory)
|
||||
if not isinstance(creds, dict):
|
||||
raise auth.AppError("not_authorized")
|
||||
if creds.get("expires_at", 0) <= self.now() + 120:
|
||||
creds = auth.refresh(self.session, path, creds)
|
||||
return creds
|
||||
|
||||
def ready(self):
|
||||
self.credentials()
|
||||
|
||||
def models(self):
|
||||
with self.lock:
|
||||
if self.catalog is not None and self.now() - self.catalog_at < CATALOG_TTL:
|
||||
return list(self.catalog)
|
||||
creds = self.credentials()
|
||||
response = auth._request(
|
||||
self.session,
|
||||
"GET",
|
||||
auth.MODELS_URL,
|
||||
headers={"Authorization": "Bearer " + creds["access_token"]},
|
||||
)
|
||||
if response.is_redirect or response.status_code != 200:
|
||||
raise GatewayError(response.status_code, "upstream_models_error")
|
||||
data = _response_json(response, "upstream_models_invalid")
|
||||
entries = data.get("models")
|
||||
if not isinstance(entries, list):
|
||||
raise GatewayError(502, "upstream_models_invalid")
|
||||
catalog = []
|
||||
for item in entries:
|
||||
if (
|
||||
isinstance(item, dict)
|
||||
and item.get("visibility") == "list"
|
||||
and isinstance(item.get("slug"), str)
|
||||
and item["slug"]
|
||||
and isinstance(item.get("display_name"), str)
|
||||
):
|
||||
catalog.append((item["slug"], item["display_name"]))
|
||||
self.catalog = catalog
|
||||
self.catalog_at = self.now()
|
||||
return list(catalog)
|
||||
|
||||
def response(self, body):
|
||||
if auth.RESPONSES_URL != "https://api.openai.com/v1/responses":
|
||||
raise GatewayError(500, "endpoint_not_allowed")
|
||||
creds = self.credentials()
|
||||
try:
|
||||
return self.session.request(
|
||||
"POST",
|
||||
auth.RESPONSES_URL,
|
||||
headers={
|
||||
"Authorization": "Bearer " + creds["access_token"],
|
||||
"Content-Type": "application/json",
|
||||
"Accept": "text/event-stream",
|
||||
},
|
||||
json=body,
|
||||
stream=True,
|
||||
timeout=(CONNECT_TIMEOUT, READ_TIMEOUT),
|
||||
allow_redirects=False,
|
||||
)
|
||||
except requests.RequestException:
|
||||
raise GatewayError(502, "upstream_network_error") from None
|
||||
|
||||
|
||||
def _copy_keys(value, allowed):
|
||||
return {key: value[key] for key in allowed if key in value}
|
||||
|
||||
|
||||
def _normalize_content(content, role):
|
||||
if isinstance(content, str):
|
||||
return [{"type": "output_text" if role == "assistant" else "input_text", "text": content}]
|
||||
if not isinstance(content, list) or not content:
|
||||
raise GatewayError(400, "invalid_input")
|
||||
result = []
|
||||
for part in content:
|
||||
if not isinstance(part, dict) or part.get("type") not in {"input_text", "output_text"}:
|
||||
raise GatewayError(400, "unsupported_media")
|
||||
if not isinstance(part.get("text"), str):
|
||||
raise GatewayError(400, "invalid_input")
|
||||
result.append({"type": part["type"], "text": part["text"]})
|
||||
return result
|
||||
|
||||
|
||||
def _normalize_item(item):
|
||||
if not isinstance(item, dict):
|
||||
raise GatewayError(400, "invalid_input")
|
||||
item_type = item.get("type")
|
||||
if item_type in (None, "message"):
|
||||
role = item.get("role")
|
||||
if role == "system":
|
||||
role = "developer"
|
||||
if role not in {"user", "assistant", "developer"}:
|
||||
raise GatewayError(400, "invalid_input")
|
||||
return {
|
||||
"type": "message",
|
||||
"role": role,
|
||||
"content": _normalize_content(item.get("content"), role),
|
||||
}
|
||||
if item_type == "function_call":
|
||||
result = _copy_keys(item, {"id", "call_id", "name", "arguments", "namespace", "status"})
|
||||
if not all(isinstance(result.get(key), str) and result[key] for key in ("call_id", "name", "arguments")):
|
||||
raise GatewayError(400, "invalid_input")
|
||||
result["type"] = item_type
|
||||
return result
|
||||
if item_type == "function_call_output":
|
||||
result = _copy_keys(item, {"id", "call_id", "output", "status"})
|
||||
if not isinstance(result.get("call_id"), str) or not result["call_id"] or not isinstance(result.get("output"), str):
|
||||
raise GatewayError(400, "invalid_input")
|
||||
result["type"] = item_type
|
||||
return result
|
||||
if item_type == "reasoning":
|
||||
result = _copy_keys(item, {"id", "summary", "content", "encrypted_content", "status"})
|
||||
if not any(key in result for key in ("summary", "content", "encrypted_content")):
|
||||
raise GatewayError(400, "invalid_input")
|
||||
result["type"] = item_type
|
||||
return result
|
||||
raise GatewayError(400, "unsupported_input_type")
|
||||
|
||||
|
||||
def _normalize_inner_tool(tool):
|
||||
if not isinstance(tool, dict) or tool.get("type") not in {"function", "custom"}:
|
||||
raise GatewayError(400, "unsupported_tool")
|
||||
name = tool.get("name")
|
||||
if not isinstance(name, str) or not NAME_RE.fullmatch(name):
|
||||
raise GatewayError(400, "invalid_tool")
|
||||
if tool["type"] == "function":
|
||||
allowed = {"type", "name", "description", "parameters", "strict"}
|
||||
else:
|
||||
allowed = {"type", "name", "description", "format"}
|
||||
if set(tool) - allowed:
|
||||
raise GatewayError(400, "unsupported_tool_field")
|
||||
return _copy_keys(tool, allowed)
|
||||
|
||||
|
||||
def _normalize_tools(tools):
|
||||
if not isinstance(tools, list) or not tools:
|
||||
raise GatewayError(400, "invalid_tools")
|
||||
if all(isinstance(tool, dict) and tool.get("type") in {"function", "custom"} for tool in tools):
|
||||
return [{
|
||||
"type": "namespace",
|
||||
"name": NAMESPACE,
|
||||
"description": "Functions provided and executed by AFFiNE.",
|
||||
"tools": [_normalize_inner_tool(tool) for tool in tools],
|
||||
}]
|
||||
result = []
|
||||
for namespace in tools:
|
||||
if not isinstance(namespace, dict) or set(namespace) - {"type", "name", "description", "tools"}:
|
||||
raise GatewayError(400, "unsupported_tool")
|
||||
name = namespace.get("name")
|
||||
nested = namespace.get("tools")
|
||||
if namespace.get("type") != "namespace" or not isinstance(name, str) or not NAMESPACE_RE.fullmatch(name):
|
||||
raise GatewayError(400, "unsupported_tool")
|
||||
if not isinstance(namespace.get("description"), str) or not isinstance(nested, list) or not nested:
|
||||
raise GatewayError(400, "invalid_tools")
|
||||
result.append({
|
||||
"type": "namespace",
|
||||
"name": name,
|
||||
"description": namespace["description"],
|
||||
"tools": [_normalize_inner_tool(tool) for tool in nested],
|
||||
})
|
||||
return result
|
||||
|
||||
|
||||
def _normalize_choice(choice, had_flat_tools):
|
||||
if isinstance(choice, str) and choice in {"auto", "none", "required"}:
|
||||
return choice
|
||||
if not isinstance(choice, dict):
|
||||
raise GatewayError(400, "unsupported_tool_choice")
|
||||
result = dict(choice)
|
||||
if result.get("type") in {"function", "custom"} and had_flat_tools:
|
||||
if set(result) - {"type", "name"} or not isinstance(result.get("name"), str):
|
||||
raise GatewayError(400, "unsupported_tool_choice")
|
||||
result["namespace"] = NAMESPACE
|
||||
return result
|
||||
if result.get("type") in {"function", "custom"}:
|
||||
if set(result) - {"type", "name", "namespace"}:
|
||||
raise GatewayError(400, "unsupported_tool_choice")
|
||||
return result
|
||||
raise GatewayError(400, "unsupported_tool_choice")
|
||||
|
||||
|
||||
def normalize_request(value, eligible):
|
||||
if not isinstance(value, dict):
|
||||
raise GatewayError(400, "invalid_json")
|
||||
allowed = {"model", "input", "instructions", "tools", "tool_choice", "store", "stream"}
|
||||
unknown = set(value) - allowed - IGNORED_FIELDS - REJECTED_FIELDS
|
||||
if set(value) & REJECTED_FIELDS:
|
||||
raise GatewayError(400, "unsupported_parameter")
|
||||
if unknown:
|
||||
raise GatewayError(400, "unsupported_parameter")
|
||||
if "stream" in value and not isinstance(value["stream"], bool):
|
||||
raise GatewayError(400, "invalid_stream")
|
||||
if "store" in value and not isinstance(value["store"], bool):
|
||||
raise GatewayError(400, "invalid_store")
|
||||
model = value.get("model")
|
||||
if not isinstance(model, str) or model not in eligible:
|
||||
raise GatewayError(400, "model_not_available")
|
||||
incoming = value.get("input")
|
||||
if not isinstance(incoming, list) or not incoming:
|
||||
raise GatewayError(400, "invalid_input")
|
||||
result = {
|
||||
"model": model,
|
||||
"input": [_normalize_item(item) for item in incoming],
|
||||
"store": False,
|
||||
"stream": True,
|
||||
}
|
||||
if "instructions" in value:
|
||||
if not isinstance(value["instructions"], str):
|
||||
raise GatewayError(400, "invalid_instructions")
|
||||
result["instructions"] = value["instructions"]
|
||||
if "tools" in value:
|
||||
flat = all(isinstance(tool, dict) and tool.get("type") in {"function", "custom"} for tool in value["tools"]) if isinstance(value["tools"], list) else False
|
||||
result["tools"] = _normalize_tools(value["tools"])
|
||||
if "tool_choice" in value:
|
||||
result["tool_choice"] = _normalize_choice(value["tool_choice"], flat)
|
||||
elif "tool_choice" in value:
|
||||
raise GatewayError(400, "unsupported_tool_choice")
|
||||
return result
|
||||
|
||||
|
||||
def _events(response):
|
||||
buffer = b""
|
||||
try:
|
||||
for chunk in response.iter_content(chunk_size=16384):
|
||||
if not chunk:
|
||||
continue
|
||||
buffer += chunk
|
||||
if len(buffer) > MAX_EVENT:
|
||||
raise GatewayError(502, "upstream_stream_invalid")
|
||||
while True:
|
||||
positions = [(buffer.find(b"\n\n"), 2), (buffer.find(b"\r\n\r\n"), 4)]
|
||||
positions = [(position, size) for position, size in positions if position >= 0]
|
||||
if not positions:
|
||||
break
|
||||
position, size = min(positions)
|
||||
raw, buffer = buffer[: position + size], buffer[position + size :]
|
||||
yield raw, _event_data(raw)
|
||||
if buffer.strip():
|
||||
raise GatewayError(502, "upstream_stream_interrupted")
|
||||
except requests.RequestException:
|
||||
raise GatewayError(502, "upstream_stream_interrupted") from None
|
||||
|
||||
|
||||
def _event_data(raw):
|
||||
data = []
|
||||
for line in raw.replace(b"\r\n", b"\n").split(b"\n"):
|
||||
if line.startswith(b"data:"):
|
||||
data.append(line[5:].lstrip())
|
||||
if not data or b"\n".join(data) == b"[DONE]":
|
||||
return None
|
||||
try:
|
||||
value = json.loads(b"\n".join(data))
|
||||
except (ValueError, UnicodeError):
|
||||
raise GatewayError(502, "upstream_stream_invalid") from None
|
||||
if not isinstance(value, dict) or not isinstance(value.get("type"), str):
|
||||
raise GatewayError(502, "upstream_stream_invalid")
|
||||
return value
|
||||
|
||||
|
||||
def _upstream_error(response):
|
||||
code = "upstream_http_error"
|
||||
try:
|
||||
value = response.json()
|
||||
candidate = value.get("error", {}).get("code")
|
||||
if candidate in SAFE_UPSTREAM_CODES:
|
||||
code = candidate
|
||||
except (requests.RequestException, ValueError, AttributeError):
|
||||
return GatewayError(response.status_code, code)
|
||||
return GatewayError(response.status_code, code)
|
||||
|
||||
|
||||
class GatewayServer(ThreadingMixIn, HTTPServer):
|
||||
daemon_threads = True
|
||||
block_on_close = False
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
address,
|
||||
provider,
|
||||
key,
|
||||
max_concurrent=MAX_CONCURRENT,
|
||||
max_connections=MAX_CONNECTIONS,
|
||||
):
|
||||
self.provider = provider
|
||||
self.gateway_key = key
|
||||
self.capacity = threading.BoundedSemaphore(max_concurrent)
|
||||
self.connection_capacity = threading.BoundedSemaphore(max_connections)
|
||||
super().__init__(address, GatewayHandler)
|
||||
|
||||
def get_request(self):
|
||||
request, address = super().get_request()
|
||||
request.settimeout(HEADER_TIMEOUT)
|
||||
return request, address
|
||||
|
||||
def process_request(self, request, client_address):
|
||||
if not self.connection_capacity.acquire(blocking=False):
|
||||
self.shutdown_request(request)
|
||||
return
|
||||
try:
|
||||
super().process_request(request, client_address)
|
||||
except BaseException:
|
||||
self.connection_capacity.release()
|
||||
raise
|
||||
|
||||
def process_request_thread(self, request, client_address):
|
||||
try:
|
||||
super().process_request_thread(request, client_address)
|
||||
finally:
|
||||
self.connection_capacity.release()
|
||||
|
||||
def handle_error(self, request, client_address):
|
||||
return
|
||||
|
||||
|
||||
class GatewayHandler(BaseHTTPRequestHandler):
|
||||
protocol_version = "HTTP/1.1"
|
||||
|
||||
def log_message(self, format, *args):
|
||||
return
|
||||
|
||||
@property
|
||||
def gateway(self):
|
||||
return cast(GatewayServer, self.server)
|
||||
|
||||
def _authorized(self):
|
||||
value = self.headers.get("Authorization", "")
|
||||
prefix = "Bearer "
|
||||
supplied = value[len(prefix) :] if value.startswith(prefix) else ""
|
||||
return hmac.compare_digest(supplied.encode(), self.gateway.gateway_key.encode())
|
||||
|
||||
def _json(self, status, value):
|
||||
body = json.dumps(value, separators=(",", ":")).encode()
|
||||
try:
|
||||
self.send_response(status)
|
||||
self.send_header("Content-Type", "application/json")
|
||||
self.send_header("Cache-Control", "no-store")
|
||||
self.send_header("Connection", "close")
|
||||
self.send_header("Content-Length", str(len(body)))
|
||||
self.end_headers()
|
||||
self.wfile.write(body)
|
||||
self.close_connection = True
|
||||
except OSError:
|
||||
return
|
||||
|
||||
def _error(self, error):
|
||||
self.close_connection = True
|
||||
self._json(error.status, {"error": {"message": "Gateway request failed.", "type": "gateway_error", "code": error.code}})
|
||||
|
||||
def _enter(self):
|
||||
if not self.gateway.capacity.acquire(blocking=False):
|
||||
self._error(GatewayError(503, "gateway_busy"))
|
||||
return False
|
||||
return True
|
||||
|
||||
def do_GET(self):
|
||||
self.connection.settimeout(SOCKET_TIMEOUT)
|
||||
if not self._enter():
|
||||
return
|
||||
try:
|
||||
target = urlsplit(self.path)
|
||||
if target.query or target.fragment:
|
||||
self._error(GatewayError(404, "not_found"))
|
||||
return
|
||||
path = target.path
|
||||
if path == "/healthz":
|
||||
self._json(200, {"status": "ready"})
|
||||
return
|
||||
if not self._authorized():
|
||||
self._error(GatewayError(401, "unauthorized"))
|
||||
return
|
||||
if path != "/v1/models":
|
||||
self._error(GatewayError(404, "not_found"))
|
||||
return
|
||||
data = [{"id": slug, "object": "model", "created": 0, "owned_by": "openai"} for slug, _name in self.gateway.provider.models()]
|
||||
self._json(200, {"object": "list", "data": data})
|
||||
except GatewayError as error:
|
||||
self._error(error)
|
||||
except (auth.AppError, OSError):
|
||||
self._error(GatewayError(503, "credentials_unavailable"))
|
||||
finally:
|
||||
self.gateway.capacity.release()
|
||||
|
||||
def do_POST(self):
|
||||
self.connection.settimeout(SOCKET_TIMEOUT)
|
||||
if not self._enter():
|
||||
return
|
||||
upstream = None
|
||||
try:
|
||||
if not self._authorized():
|
||||
raise GatewayError(401, "unauthorized")
|
||||
target = urlsplit(self.path)
|
||||
if target.path != "/v1/responses" or target.query or target.fragment:
|
||||
raise GatewayError(404, "not_found")
|
||||
if self.headers.get("Transfer-Encoding") is not None:
|
||||
raise GatewayError(400, "unsupported_transfer_encoding")
|
||||
content_type = self.headers.get("Content-Type", "").lower().replace(" ", "")
|
||||
if content_type not in {"application/json", "application/json;charset=utf-8"}:
|
||||
raise GatewayError(415, "unsupported_content_type")
|
||||
lengths = self.headers.get_all("Content-Length", [])
|
||||
if len(lengths) != 1:
|
||||
raise GatewayError(400, "invalid_content_length")
|
||||
raw_length = lengths[0]
|
||||
try:
|
||||
length = int(raw_length) if raw_length is not None else -1
|
||||
except ValueError:
|
||||
length = -1
|
||||
if length < 0:
|
||||
raise GatewayError(411, "content_length_required")
|
||||
if length > MAX_BODY:
|
||||
raise GatewayError(413, "request_too_large")
|
||||
try:
|
||||
value = json.loads(self.rfile.read(length))
|
||||
except (ValueError, UnicodeError):
|
||||
raise GatewayError(400, "invalid_json") from None
|
||||
eligible = {slug for slug, _name in self.gateway.provider.models()}
|
||||
body = normalize_request(value, eligible)
|
||||
wants_stream = value.get("stream") is True
|
||||
upstream = self.gateway.provider.response(body)
|
||||
if upstream.is_redirect or upstream.status_code != 200:
|
||||
raise _upstream_error(upstream)
|
||||
media_type = upstream.headers.get("Content-Type", "").split(";", 1)[0].strip().lower()
|
||||
if media_type and media_type != "text/event-stream":
|
||||
raise GatewayError(502, "upstream_content_type_invalid")
|
||||
if wants_stream:
|
||||
self._stream(upstream)
|
||||
else:
|
||||
self._aggregate(upstream)
|
||||
except GatewayError as error:
|
||||
self._error(error)
|
||||
except (auth.AppError, OSError):
|
||||
self._error(GatewayError(503, "credentials_unavailable"))
|
||||
finally:
|
||||
if upstream is not None:
|
||||
upstream.close()
|
||||
self.gateway.capacity.release()
|
||||
|
||||
def _stream(self, upstream):
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Type", "text/event-stream")
|
||||
self.send_header("Cache-Control", "no-store")
|
||||
self.send_header("Connection", "close")
|
||||
self.end_headers()
|
||||
terminal = False
|
||||
try:
|
||||
for raw, event in _events(upstream):
|
||||
self.wfile.write(raw)
|
||||
self.wfile.flush()
|
||||
if event and event["type"] in {"response.completed", "response.failed", "response.incomplete", "error"}:
|
||||
terminal = True
|
||||
if not terminal:
|
||||
raise GatewayError(502, "upstream_stream_interrupted")
|
||||
except (GatewayError, OSError):
|
||||
if not terminal:
|
||||
safe = b'event: error\ndata: {"type":"error","code":"upstream_stream_interrupted","message":"Gateway stream interrupted."}\n\n'
|
||||
try:
|
||||
self.wfile.write(safe)
|
||||
self.wfile.flush()
|
||||
except OSError:
|
||||
return
|
||||
finally:
|
||||
self.close_connection = True
|
||||
|
||||
def _aggregate(self, upstream):
|
||||
completed = None
|
||||
terminal_error = None
|
||||
output_items = {}
|
||||
for _raw, event in _events(upstream):
|
||||
if event is None:
|
||||
continue
|
||||
if event["type"] == "response.output_item.done":
|
||||
index = event.get("output_index")
|
||||
item = event.get("item")
|
||||
if isinstance(index, int) and not isinstance(index, bool) and 0 <= index < 1024 and isinstance(item, dict):
|
||||
output_items[index] = item
|
||||
else:
|
||||
terminal_error = "upstream_response_invalid"
|
||||
elif event["type"] == "response.completed":
|
||||
response = event.get("response")
|
||||
if isinstance(response, dict) and response.get("status") == "completed" and isinstance(response.get("output"), list):
|
||||
completed = response
|
||||
else:
|
||||
terminal_error = "upstream_response_invalid"
|
||||
elif event["type"] in {"response.failed", "response.incomplete", "error"}:
|
||||
terminal_error = "upstream_response_failed"
|
||||
if terminal_error or completed is None:
|
||||
raise GatewayError(502, terminal_error or "upstream_stream_interrupted")
|
||||
if not completed["output"] and output_items:
|
||||
completed = {**completed, "output": [output_items[index] for index in sorted(output_items)]}
|
||||
self._json(200, completed)
|
||||
|
||||
|
||||
def serve(args):
|
||||
key = read_gateway_key(args.gateway_key_file)
|
||||
provider = Provider(args.state_dir)
|
||||
provider.ready()
|
||||
server = GatewayServer((args.host, args.port), provider, key)
|
||||
try:
|
||||
server.serve_forever(poll_interval=0.25)
|
||||
finally:
|
||||
server.server_close()
|
||||
@@ -0,0 +1,706 @@
|
||||
import io
|
||||
import http.client
|
||||
import json
|
||||
import os
|
||||
import socket
|
||||
import stat
|
||||
import tempfile
|
||||
import threading
|
||||
import time
|
||||
import unittest
|
||||
from contextlib import redirect_stderr, redirect_stdout
|
||||
from pathlib import Path
|
||||
from types import SimpleNamespace
|
||||
from unittest import mock
|
||||
from urllib.parse import parse_qs, urlencode, urlsplit
|
||||
|
||||
import jwt
|
||||
import requests
|
||||
from cryptography.hazmat.primitives.asymmetric import rsa
|
||||
|
||||
import affine_chatgpt as app
|
||||
|
||||
|
||||
class Response:
|
||||
def __init__(self, data=None, status=200, redirect=False):
|
||||
self.data = data
|
||||
self.status_code = status
|
||||
self.is_redirect = redirect
|
||||
|
||||
def json(self):
|
||||
if isinstance(self.data, Exception):
|
||||
raise self.data
|
||||
return self.data
|
||||
|
||||
|
||||
class Session:
|
||||
def __init__(self, responses=()):
|
||||
self.trust_env = True
|
||||
self.responses = list(responses)
|
||||
self.calls = []
|
||||
|
||||
def request(self, method, url, **kwargs):
|
||||
self.calls.append((method, url, kwargs))
|
||||
result = self.responses.pop(0)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
return result
|
||||
|
||||
|
||||
class ProviderSession:
|
||||
def __init__(self, key, subject="account-subject"):
|
||||
self.key = key
|
||||
self.subject = subject
|
||||
self.nonce = None
|
||||
self.calls = []
|
||||
|
||||
def request(self, method, url, **kwargs):
|
||||
self.calls.append((method, url, kwargs))
|
||||
if url == app.DISCOVERY_URL:
|
||||
return Response(
|
||||
{
|
||||
"issuer": app.ISSUER,
|
||||
"authorization_endpoint": app.AUTHORIZE_URL,
|
||||
"token_endpoint": app.TOKEN_URL,
|
||||
"jwks_uri": app.JWKS_URL,
|
||||
}
|
||||
)
|
||||
if url == app.TOKEN_URL:
|
||||
now = int(time.time())
|
||||
client_id = kwargs["data"]["client_id"]
|
||||
identity = jwt.encode(
|
||||
{
|
||||
"iss": app.ISSUER,
|
||||
"aud": client_id,
|
||||
"exp": now + 300,
|
||||
"iat": now,
|
||||
"nonce": self.nonce,
|
||||
"sub": self.subject,
|
||||
},
|
||||
self.key,
|
||||
algorithm="RS256",
|
||||
headers={"kid": "integration-key"},
|
||||
)
|
||||
return Response(
|
||||
{
|
||||
"access_token": "integration-access",
|
||||
"refresh_token": "integration-refresh",
|
||||
"id_token": identity,
|
||||
"token_type": "Bearer",
|
||||
"expires_in": 3600,
|
||||
"scope": app.SCOPES,
|
||||
}
|
||||
)
|
||||
if url == app.JWKS_URL:
|
||||
return Response({"keys": [jwk_for(self.key, "integration-key")]})
|
||||
raise AssertionError(f"unexpected provider URL: {url}")
|
||||
|
||||
|
||||
def jwk_for(key, kid="test-key"):
|
||||
numbers = key.public_key().public_numbers()
|
||||
|
||||
def encoded(number):
|
||||
size = (number.bit_length() + 7) // 8
|
||||
return app.base64.urlsafe_b64encode(number.to_bytes(size, "big")).rstrip(b"=").decode()
|
||||
|
||||
return {
|
||||
"kty": "RSA",
|
||||
"kid": kid,
|
||||
"use": "sig",
|
||||
"alg": "RS256",
|
||||
"n": encoded(numbers.n),
|
||||
"e": encoded(numbers.e),
|
||||
}
|
||||
|
||||
|
||||
class SecurityTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.temporary = tempfile.TemporaryDirectory()
|
||||
self.state = Path(self.temporary.name) / "state"
|
||||
|
||||
def tearDown(self):
|
||||
self.temporary.cleanup()
|
||||
|
||||
def test_pkce_is_deterministic_and_unpadded(self):
|
||||
self.assertEqual(
|
||||
app.pkce_challenge("verifier"),
|
||||
"iMnq5o6zALKXGivsnlom_0F5_WYda32GHkxlV7mq7hQ",
|
||||
)
|
||||
self.assertNotIn("=", app.pkce_challenge("verifier"))
|
||||
|
||||
def test_login_default_session_ignores_proxy_environment(self):
|
||||
session = Session()
|
||||
args = SimpleNamespace(state_dir=self.state, host_id_file=None, port=0, timeout=0)
|
||||
with mock.patch.object(app.requests, "Session", return_value=session):
|
||||
with redirect_stdout(io.StringIO()):
|
||||
with self.assertRaisesRegex(app.AppError, "callback_timeout"):
|
||||
app.login(args)
|
||||
self.assertFalse(session.trust_env)
|
||||
|
||||
def test_atomic_permissions_and_symlink_protection(self):
|
||||
path = self.state / "credentials.json"
|
||||
app.atomic_json(path, {"safe": True})
|
||||
self.assertEqual(stat.S_IMODE(self.state.stat().st_mode), 0o700)
|
||||
self.assertEqual(stat.S_IMODE(path.stat().st_mode), 0o600)
|
||||
path.unlink()
|
||||
target = Path(self.temporary.name) / "target"
|
||||
target.write_text("unchanged", encoding="utf-8")
|
||||
path.symlink_to(target)
|
||||
with self.assertRaisesRegex(app.AppError, "unsafe_state_file"):
|
||||
app.atomic_json(path, {"unsafe": True})
|
||||
self.assertEqual(target.read_text(encoding="utf-8"), "unchanged")
|
||||
|
||||
def test_state_directory_symlink_rejected(self):
|
||||
real = Path(self.temporary.name) / "real"
|
||||
real.mkdir()
|
||||
self.state.symlink_to(real, target_is_directory=True)
|
||||
with self.assertRaisesRegex(app.AppError, "unsafe_state_dir"):
|
||||
app.secure_dir(self.state)
|
||||
|
||||
def test_atomic_write_syncs_file_and_parent_directory(self):
|
||||
original_fsync = os.fsync
|
||||
synced_directories = []
|
||||
|
||||
def record_fsync(descriptor):
|
||||
synced_directories.append(stat.S_ISDIR(os.fstat(descriptor).st_mode))
|
||||
original_fsync(descriptor)
|
||||
|
||||
with mock.patch.object(app.os, "fsync", side_effect=record_fsync):
|
||||
app.atomic_json(self.state / "credentials.json", {"safe": True})
|
||||
self.assertEqual(synced_directories, [False, True])
|
||||
|
||||
def test_insecure_existing_file_rejected(self):
|
||||
self.state.mkdir(mode=0o700)
|
||||
path = self.state / "credentials.json"
|
||||
path.write_text("{}", encoding="utf-8")
|
||||
path.chmod(0o644)
|
||||
with self.assertRaisesRegex(app.AppError, "unsafe_state_file"):
|
||||
app.read_json(path)
|
||||
|
||||
def test_status_exposes_only_allowed_fields(self):
|
||||
app.atomic_json(self.state / "host.json", {"host_id": "urn:uuid:test"})
|
||||
app.atomic_json(
|
||||
self.state / "credentials.json",
|
||||
{
|
||||
"issuer": app.ISSUER,
|
||||
"subject": "private-subject",
|
||||
"client_id": "issued",
|
||||
"host_id": "urn:uuid:test",
|
||||
"access_token": "access-secret",
|
||||
"refresh_token": "refresh-secret",
|
||||
"id_token": "identity-secret",
|
||||
"token_type": "Bearer",
|
||||
"saved_at": "date",
|
||||
"expires_at": time.time() + 60,
|
||||
"scopes": [app.REQUIRED_SCOPE],
|
||||
},
|
||||
)
|
||||
output = io.StringIO()
|
||||
with redirect_stdout(output):
|
||||
app.status(SimpleNamespace(state_dir=self.state))
|
||||
result = json.loads(output.getvalue())
|
||||
self.assertEqual(set(result), {"authorized", "access_token_expired", "host_id"})
|
||||
self.assertTrue(result["authorized"])
|
||||
self.assertNotIn("secret", output.getvalue())
|
||||
self.assertNotIn("subject", output.getvalue())
|
||||
|
||||
def test_status_handles_malformed_json_shape(self):
|
||||
app.atomic_json(self.state / "credentials.json", ["malformed"])
|
||||
with self.assertRaisesRegex(app.AppError, "invalid_state"):
|
||||
app.status(SimpleNamespace(state_dir=self.state))
|
||||
|
||||
def test_main_sanitizes_malformed_json_and_shape(self):
|
||||
cases = ("{broken", '["wrong-shape"]')
|
||||
for content in cases:
|
||||
with self.subTest(content=content):
|
||||
self.state.mkdir(mode=0o700, exist_ok=True)
|
||||
path = self.state / "credentials.json"
|
||||
path.write_text(content, encoding="utf-8")
|
||||
path.chmod(0o600)
|
||||
stderr = io.StringIO()
|
||||
with redirect_stderr(stderr):
|
||||
result = app.main(
|
||||
["--state-dir", str(self.state), "login", "--port", "0", "--timeout", "1"]
|
||||
)
|
||||
self.assertEqual(result, 1)
|
||||
self.assertEqual(stderr.getvalue(), "error: invalid_state\n")
|
||||
|
||||
def test_main_sanitizes_malformed_host_shape(self):
|
||||
app.atomic_json(self.state / "host.json", ["wrong-shape"])
|
||||
stderr = io.StringIO()
|
||||
with redirect_stderr(stderr):
|
||||
result = app.main(
|
||||
["--state-dir", str(self.state), "login", "--port", "0", "--timeout", "1"]
|
||||
)
|
||||
self.assertEqual(result, 1)
|
||||
self.assertEqual(stderr.getvalue(), "error: invalid_state\n")
|
||||
|
||||
def test_occupied_port_is_sanitized_local_io_error(self):
|
||||
listener = socket.socket()
|
||||
listener.bind(("127.0.0.1", 0))
|
||||
listener.listen()
|
||||
try:
|
||||
port = listener.getsockname()[1]
|
||||
stderr = io.StringIO()
|
||||
with redirect_stderr(stderr):
|
||||
result = app.main(
|
||||
["--state-dir", str(self.state), "login", "--port", str(port), "--timeout", "1"]
|
||||
)
|
||||
self.assertEqual(result, 1)
|
||||
self.assertEqual(stderr.getvalue(), "error: local_io_error\n")
|
||||
finally:
|
||||
listener.close()
|
||||
|
||||
|
||||
class CallbackTests(unittest.TestCase):
|
||||
def attempt(self, client=app.DYNAMIC_CLIENT):
|
||||
return app.CallbackAttempt("expected-state", client, 100)
|
||||
|
||||
def test_state_nonce_mismatch_does_not_consume(self):
|
||||
attempt = self.attempt()
|
||||
with self.assertRaisesRegex(app.AppError, "state_mismatch"):
|
||||
attempt.process("state=wrong&error=access_denied", "127.0.0.1:1455", "127.0.0.1:1455", 1)
|
||||
self.assertFalse(attempt.consumed)
|
||||
|
||||
|
||||
class LoopbackIntegrationTests(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.key = rsa.generate_private_key(public_exponent=65537, key_size=2048)
|
||||
|
||||
def setUp(self):
|
||||
self.temporary = tempfile.TemporaryDirectory()
|
||||
self.state = Path(self.temporary.name) / "state"
|
||||
|
||||
def tearDown(self):
|
||||
self.temporary.cleanup()
|
||||
|
||||
def start_login(self, provider):
|
||||
output = io.StringIO()
|
||||
errors = io.StringIO()
|
||||
failures = []
|
||||
args = SimpleNamespace(
|
||||
state_dir=self.state,
|
||||
host_id_file=None,
|
||||
port=0,
|
||||
timeout=5,
|
||||
)
|
||||
|
||||
def run():
|
||||
try:
|
||||
with mock.patch.object(app, "SOCKET_TIMEOUT", 0.1):
|
||||
with redirect_stdout(output), redirect_stderr(errors):
|
||||
app.login(args, provider)
|
||||
except Exception as error:
|
||||
failures.append(error)
|
||||
|
||||
thread = threading.Thread(target=run)
|
||||
thread.start()
|
||||
deadline = time.time() + 2
|
||||
while "\n" not in output.getvalue() and time.time() < deadline:
|
||||
time.sleep(0.01)
|
||||
self.assertIn("\n", output.getvalue())
|
||||
authorization = output.getvalue().splitlines()[0]
|
||||
query = parse_qs(urlsplit(authorization).query)
|
||||
provider.nonce = query["nonce"][0]
|
||||
return thread, output, errors, failures, query
|
||||
|
||||
def callback(self, redirect_uri, parameters):
|
||||
target = urlsplit(redirect_uri)
|
||||
connection = http.client.HTTPConnection(target.hostname, target.port, timeout=2)
|
||||
path = target.path + "?" + urlencode(parameters)
|
||||
connection.request("GET", path, headers={"Host": f"127.0.0.1:{target.port}"})
|
||||
response = connection.getresponse()
|
||||
body = response.read()
|
||||
connection.close()
|
||||
return response.status, body
|
||||
|
||||
def test_real_listener_retries_malformed_callback_and_logs_nothing(self):
|
||||
provider = ProviderSession(self.key)
|
||||
thread, output, errors, failures, query = self.start_login(provider)
|
||||
redirect_uri = query["redirect_uri"][0]
|
||||
target = urlsplit(redirect_uri)
|
||||
host, port = target.hostname, target.port
|
||||
if not isinstance(host, str) or not isinstance(port, int):
|
||||
self.fail("redirect URI did not contain loopback host and port")
|
||||
|
||||
stalled = socket.create_connection((host, port), timeout=1)
|
||||
|
||||
secret_code = "must-not-appear-in-http-log"
|
||||
status, body = self.callback(
|
||||
redirect_uri,
|
||||
{"state": "wrong-state", "code": secret_code, "client_id": "issued-client"},
|
||||
)
|
||||
self.assertEqual(status, 400)
|
||||
self.assertNotIn(secret_code.encode(), body)
|
||||
|
||||
status, body = self.callback(
|
||||
redirect_uri,
|
||||
{
|
||||
"state": query["state"][0],
|
||||
"code": "valid-code",
|
||||
"client_id": "issued-client",
|
||||
},
|
||||
)
|
||||
self.assertEqual(status, 200)
|
||||
self.assertNotIn(b"valid-code", body)
|
||||
stalled.close()
|
||||
thread.join(3)
|
||||
self.assertFalse(thread.is_alive())
|
||||
self.assertEqual(failures, [])
|
||||
self.assertEqual(errors.getvalue(), "")
|
||||
self.assertNotIn(secret_code, output.getvalue())
|
||||
saved = app.read_json(self.state / "credentials.json")
|
||||
assert isinstance(saved, dict)
|
||||
self.assertEqual(saved["subject"], "account-subject")
|
||||
self.assertEqual(saved["client_id"], "issued-client")
|
||||
token_call = next(call for call in provider.calls if call[1] == app.TOKEN_URL)
|
||||
self.assertEqual(token_call[2]["data"]["code"], "valid-code")
|
||||
|
||||
def test_valid_rsa_failure_preserves_old_credentials(self):
|
||||
host = "urn:uuid:00000000-0000-4000-8000-000000000000"
|
||||
app.atomic_json(self.state / "host.json", {"host_id": host})
|
||||
old = {
|
||||
"issuer": app.ISSUER,
|
||||
"subject": "old-subject",
|
||||
"client_id": "issued-client",
|
||||
"host_id": host,
|
||||
"access_token": "old-access",
|
||||
"refresh_token": "old-refresh",
|
||||
"id_token": "old-identity",
|
||||
"token_type": "Bearer",
|
||||
"scopes": [app.REQUIRED_SCOPE],
|
||||
"saved_at": "old-date",
|
||||
"expires_at": time.time() + 60,
|
||||
}
|
||||
path = self.state / "credentials.json"
|
||||
app.atomic_json(path, old)
|
||||
before = path.read_bytes()
|
||||
provider = ProviderSession(self.key, subject="different-subject")
|
||||
thread, _output, errors, failures, query = self.start_login(provider)
|
||||
status, _body = self.callback(
|
||||
query["redirect_uri"][0],
|
||||
{"state": query["state"][0], "code": "valid-code"},
|
||||
)
|
||||
self.assertEqual(status, 200)
|
||||
thread.join(3)
|
||||
self.assertFalse(thread.is_alive())
|
||||
self.assertEqual(len(failures), 1)
|
||||
self.assertIsInstance(failures[0], app.AppError)
|
||||
self.assertEqual(str(failures[0]), "account_mismatch")
|
||||
self.assertEqual(errors.getvalue(), "")
|
||||
self.assertEqual(path.read_bytes(), before)
|
||||
|
||||
def test_disconnected_browser_does_not_abandon_valid_callback(self):
|
||||
provider = ProviderSession(self.key)
|
||||
thread, _output, errors, failures, query = self.start_login(provider)
|
||||
target = urlsplit(query["redirect_uri"][0])
|
||||
host, port = target.hostname, target.port
|
||||
if not isinstance(host, str) or not isinstance(port, int):
|
||||
self.fail("redirect URI did not contain loopback host and port")
|
||||
path = target.path + "?" + urlencode(
|
||||
{
|
||||
"state": query["state"][0],
|
||||
"code": "valid-code",
|
||||
"client_id": "issued-client",
|
||||
}
|
||||
)
|
||||
browser = socket.create_connection((host, port), timeout=1)
|
||||
browser.sendall(
|
||||
(
|
||||
f"GET {path} HTTP/1.1\r\n"
|
||||
f"Host: 127.0.0.1:{target.port}\r\n"
|
||||
"Connection: close\r\n\r\n"
|
||||
).encode("ascii")
|
||||
)
|
||||
browser.close()
|
||||
thread.join(3)
|
||||
self.assertFalse(thread.is_alive())
|
||||
self.assertEqual(failures, [])
|
||||
self.assertEqual(errors.getvalue(), "")
|
||||
saved = app.read_json(self.state / "credentials.json")
|
||||
assert isinstance(saved, dict)
|
||||
self.assertEqual(saved["subject"], "account-subject")
|
||||
|
||||
|
||||
class LockingTests(unittest.TestCase):
|
||||
def attempt(self, client=app.DYNAMIC_CLIENT):
|
||||
return app.CallbackAttempt("expected-state", client, 100)
|
||||
|
||||
def test_authorization_lock_serializes_concurrent_operation(self):
|
||||
with tempfile.TemporaryDirectory() as temporary:
|
||||
state = Path(temporary) / "state"
|
||||
acquired = threading.Event()
|
||||
release = threading.Event()
|
||||
second_acquired = threading.Event()
|
||||
|
||||
def first():
|
||||
with app.credential_lock(state):
|
||||
acquired.set()
|
||||
release.wait(2)
|
||||
|
||||
def second():
|
||||
with app.credential_lock(state):
|
||||
second_acquired.set()
|
||||
|
||||
first_thread = threading.Thread(target=first)
|
||||
second_thread = threading.Thread(target=second)
|
||||
first_thread.start()
|
||||
self.assertTrue(acquired.wait(1))
|
||||
second_thread.start()
|
||||
self.assertFalse(second_acquired.wait(0.1))
|
||||
release.set()
|
||||
first_thread.join(1)
|
||||
second_thread.join(1)
|
||||
self.assertTrue(second_acquired.is_set())
|
||||
|
||||
def test_client_mismatch_and_valid_retry(self):
|
||||
attempt = self.attempt("saved-client")
|
||||
query = "state=expected-state&code=secret-code&client_id=other"
|
||||
with self.assertRaisesRegex(app.AppError, "client_id_mismatch"):
|
||||
attempt.process(query, "127.0.0.1:1455", "127.0.0.1:1455", 1)
|
||||
result = attempt.process(
|
||||
"state=expected-state&code=secret-code&client_id=saved-client",
|
||||
"127.0.0.1:1455",
|
||||
"127.0.0.1:1455",
|
||||
1,
|
||||
)
|
||||
self.assertEqual(result["client_id"], "saved-client")
|
||||
|
||||
def test_dynamic_client_must_be_replaced(self):
|
||||
for returned in ("", app.DYNAMIC_CLIENT, "bad client"):
|
||||
attempt = self.attempt()
|
||||
suffix = "" if not returned else "&client_id=" + returned.replace(" ", "+")
|
||||
with self.assertRaisesRegex(app.AppError, "client_id_invalid"):
|
||||
attempt.process(
|
||||
"state=expected-state&code=code" + suffix,
|
||||
"127.0.0.1:1455",
|
||||
"127.0.0.1:1455",
|
||||
1,
|
||||
)
|
||||
|
||||
def test_replay_rejected(self):
|
||||
attempt = self.attempt()
|
||||
query = "state=expected-state&code=code&client_id=issued-client"
|
||||
attempt.process(query, "127.0.0.1:1455", "127.0.0.1:1455", 1)
|
||||
with self.assertRaisesRegex(app.AppError, "callback_replayed"):
|
||||
attempt.process(query, "127.0.0.1:1455", "127.0.0.1:1455", 1)
|
||||
|
||||
def test_denial_is_terminal_and_nonsecret(self):
|
||||
attempt = self.attempt()
|
||||
result = attempt.process(
|
||||
"state=expected-state&error=access_denied&error_description=private",
|
||||
"127.0.0.1:1455",
|
||||
"127.0.0.1:1455",
|
||||
1,
|
||||
)
|
||||
self.assertEqual(result, {"denied": True})
|
||||
self.assertNotIn("private", str(result))
|
||||
|
||||
def test_duplicate_and_unknown_query_fields_rejected(self):
|
||||
bad_queries = (
|
||||
"state=expected-state&state=expected-state&code=x&client_id=issued",
|
||||
"state=expected-state&code=x&client_id=issued&extra=x",
|
||||
)
|
||||
for query in bad_queries:
|
||||
with self.subTest(query=query):
|
||||
with self.assertRaisesRegex(app.AppError, "callback_invalid"):
|
||||
self.attempt().process(query, "127.0.0.1:1455", "127.0.0.1:1455", 1)
|
||||
|
||||
def test_host_and_expiry_rejected_without_consuming(self):
|
||||
attempt = self.attempt()
|
||||
query = "state=expected-state&code=x&client_id=issued"
|
||||
with self.assertRaisesRegex(app.AppError, "callback_invalid"):
|
||||
attempt.process(query, "localhost:1455", "127.0.0.1:1455", 1)
|
||||
with self.assertRaisesRegex(app.AppError, "callback_invalid"):
|
||||
attempt.process(query, "127.0.0.1:1455", "127.0.0.1:1455", 101)
|
||||
self.assertFalse(attempt.consumed)
|
||||
|
||||
|
||||
class TokenTests(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.key = rsa.generate_private_key(public_exponent=65537, key_size=2048)
|
||||
cls.jwks = {"keys": [jwk_for(cls.key)]}
|
||||
|
||||
def token(self, **changes):
|
||||
now = int(time.time())
|
||||
claims = {
|
||||
"iss": app.ISSUER,
|
||||
"aud": "issued-client",
|
||||
"exp": now + 300,
|
||||
"iat": now,
|
||||
"nonce": "expected-nonce",
|
||||
"sub": "account-subject",
|
||||
}
|
||||
claims.update(changes)
|
||||
return jwt.encode(claims, self.key, algorithm="RS256", headers={"kid": "test-key"})
|
||||
|
||||
def session(self):
|
||||
return Session([Response(self.jwks)])
|
||||
|
||||
def test_rsa_signature_verification(self):
|
||||
claims = app.validate_id_token(self.token(), "issued-client", "expected-nonce", self.session())
|
||||
self.assertEqual(claims["sub"], "account-subject")
|
||||
|
||||
def test_wrong_issuer_audience_expiry_and_nonce_rejected(self):
|
||||
cases = (
|
||||
self.token(iss="https://evil.example"),
|
||||
self.token(aud="wrong-client"),
|
||||
self.token(exp=int(time.time()) - 1),
|
||||
self.token(iat=int(time.time()) + 300),
|
||||
self.token(nonce="wrong-nonce"),
|
||||
)
|
||||
for encoded in cases:
|
||||
with self.subTest(encoded=encoded[-12:]):
|
||||
with self.assertRaisesRegex(app.AppError, "id_token_invalid"):
|
||||
app.validate_id_token(encoded, "issued-client", "expected-nonce", self.session())
|
||||
|
||||
def test_wrong_signature_and_untrusted_jku_rejected(self):
|
||||
other = rsa.generate_private_key(public_exponent=65537, key_size=2048)
|
||||
encoded = jwt.encode(
|
||||
jwt.decode(self.token(), options={"verify_signature": False}),
|
||||
other,
|
||||
algorithm="RS256",
|
||||
headers={"kid": "test-key", "jku": "https://evil.example/jwks"},
|
||||
)
|
||||
with self.assertRaisesRegex(app.AppError, "id_token_invalid"):
|
||||
app.validate_id_token(encoded, "issued-client", "expected-nonce", self.session())
|
||||
|
||||
def test_missing_scope_rejected(self):
|
||||
response = {
|
||||
"access_token": "access",
|
||||
"refresh_token": "refresh",
|
||||
"id_token": "identity",
|
||||
"token_type": "Bearer",
|
||||
"expires_in": 3600,
|
||||
"scope": "openid offline_access",
|
||||
}
|
||||
with self.assertRaisesRegex(app.AppError, "scope_missing"):
|
||||
app.validate_token_response(response)
|
||||
|
||||
|
||||
class NetworkAndModelsTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.temporary = tempfile.TemporaryDirectory()
|
||||
self.state = Path(self.temporary.name) / "state"
|
||||
self.path = self.state / "credentials.json"
|
||||
self.creds = {
|
||||
"issuer": app.ISSUER,
|
||||
"subject": "subject",
|
||||
"client_id": "issued-client",
|
||||
"host_id": "urn:uuid:00000000-0000-4000-8000-000000000000",
|
||||
"access_token": "old-access-secret",
|
||||
"refresh_token": "old-refresh-secret",
|
||||
"id_token": "old-id-token",
|
||||
"token_type": "Bearer",
|
||||
"scopes": [app.REQUIRED_SCOPE],
|
||||
"saved_at": "date",
|
||||
"expires_at": time.time() - 1,
|
||||
}
|
||||
app.atomic_json(self.path, self.creds)
|
||||
|
||||
def tearDown(self):
|
||||
self.temporary.cleanup()
|
||||
|
||||
def test_models_default_session_ignores_proxy_environment(self):
|
||||
credentials = {**self.creds, "expires_at": time.time() + 3600}
|
||||
app.atomic_json(self.path, credentials)
|
||||
session = Session([Response({"models": []})])
|
||||
with mock.patch.object(app.requests, "Session", return_value=session):
|
||||
with redirect_stdout(io.StringIO()):
|
||||
app.models(SimpleNamespace(state_dir=self.state))
|
||||
self.assertFalse(session.trust_env)
|
||||
|
||||
def test_refresh_rotation_and_models_visibility_filter(self):
|
||||
refreshed = {
|
||||
"access_token": "new-access-secret",
|
||||
"refresh_token": "new-refresh-secret",
|
||||
"token_type": "Bearer",
|
||||
"expires_in": 3600,
|
||||
"scope": app.REQUIRED_SCOPE + " openid",
|
||||
}
|
||||
catalog = {
|
||||
"models": [
|
||||
{"slug": "visible", "display_name": "Visible", "visibility": "list", "secret": "drop"},
|
||||
{"slug": "hidden", "display_name": "Hidden", "visibility": "hide"},
|
||||
{"slug": 1, "display_name": "Malformed", "visibility": "list"},
|
||||
]
|
||||
}
|
||||
session = Session([Response(refreshed), Response(catalog)])
|
||||
output = io.StringIO()
|
||||
with redirect_stdout(output):
|
||||
app.models(SimpleNamespace(state_dir=self.state), session)
|
||||
self.assertEqual(json.loads(output.getvalue()), [{"slug": "visible", "display_name": "Visible"}])
|
||||
saved = app.read_json(self.path)
|
||||
assert isinstance(saved, dict)
|
||||
self.assertEqual(saved["refresh_token"], "new-refresh-secret")
|
||||
self.assertEqual(saved["id_token"], "old-id-token")
|
||||
self.assertEqual(session.calls[1][2]["headers"]["Authorization"], "Bearer new-access-secret")
|
||||
|
||||
def test_refresh_failure_preserves_good_credentials(self):
|
||||
before = self.path.read_bytes()
|
||||
session = Session([Response({"error": "invalid_grant"}, status=400)])
|
||||
with self.assertRaisesRegex(app.AppError, "oauth_http_error"):
|
||||
app.models(SimpleNamespace(state_dir=self.state), session)
|
||||
self.assertEqual(self.path.read_bytes(), before)
|
||||
|
||||
def test_malformed_credentials_fail_closed(self):
|
||||
app.atomic_json(self.path, {"scopes": [app.REQUIRED_SCOPE], "expires_at": 0})
|
||||
with self.assertRaisesRegex(app.AppError, "invalid_state"):
|
||||
app.models(SimpleNamespace(state_dir=self.state), Session())
|
||||
|
||||
def test_unrotated_refresh_rejected_and_preserved(self):
|
||||
before = self.path.read_bytes()
|
||||
response = {
|
||||
"access_token": "new-access",
|
||||
"refresh_token": "old-refresh-secret",
|
||||
"token_type": "Bearer",
|
||||
"expires_in": 3600,
|
||||
"scope": app.REQUIRED_SCOPE,
|
||||
}
|
||||
with self.assertRaisesRegex(app.AppError, "refresh_not_rotated"):
|
||||
app.models(SimpleNamespace(state_dir=self.state), Session([Response(response)]))
|
||||
self.assertEqual(self.path.read_bytes(), before)
|
||||
|
||||
def test_redirect_refused_for_credentials(self):
|
||||
with self.assertRaisesRegex(app.AppError, "oauth_http_error"):
|
||||
app.refresh(Session([Response({}, status=302, redirect=True)]), self.path, self.creds)
|
||||
|
||||
def test_lock_symlink_rejected_without_traceback(self):
|
||||
target = Path(self.temporary.name) / "elsewhere"
|
||||
target.write_text("safe", encoding="utf-8")
|
||||
(self.state / "credentials.lock").symlink_to(target)
|
||||
with self.assertRaisesRegex(app.AppError, "unsafe_state_file"):
|
||||
app.models(SimpleNamespace(state_dir=self.state), Session())
|
||||
|
||||
def test_network_timeout_and_output_are_sanitized(self):
|
||||
secret = "refresh-token-must-not-leak"
|
||||
self.creds["refresh_token"] = secret
|
||||
app.atomic_json(self.path, self.creds)
|
||||
stderr = io.StringIO()
|
||||
with mock.patch.object(app.requests, "Session", return_value=Session([requests.Timeout(secret)])):
|
||||
with redirect_stderr(stderr):
|
||||
result = app.main(["--state-dir", str(self.state), "models"])
|
||||
self.assertEqual(result, 1)
|
||||
self.assertEqual(stderr.getvalue(), "error: network_error\n")
|
||||
self.assertNotIn(secret, stderr.getvalue())
|
||||
|
||||
def test_all_credential_requests_disable_redirects_and_have_timeout(self):
|
||||
response = {
|
||||
"access_token": "new-access",
|
||||
"refresh_token": "new-refresh",
|
||||
"token_type": "Bearer",
|
||||
"expires_in": 3600,
|
||||
"scope": app.REQUIRED_SCOPE,
|
||||
}
|
||||
session = Session([Response(response)])
|
||||
app.refresh(session, self.path, self.creds)
|
||||
kwargs = session.calls[0][2]
|
||||
self.assertIs(kwargs["allow_redirects"], False)
|
||||
self.assertEqual(kwargs["timeout"], app.HTTP_TIMEOUT)
|
||||
self.assertNotIn("old-refresh-secret", str({k: v for k, v in kwargs.items() if k != "data"}))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -0,0 +1,498 @@
|
||||
import http.client
|
||||
import json
|
||||
import os
|
||||
import socket
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import threading
|
||||
import time
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
from types import SimpleNamespace
|
||||
from unittest import mock
|
||||
|
||||
import requests
|
||||
|
||||
import affine_chatgpt as auth
|
||||
import affine_gateway as gateway
|
||||
|
||||
|
||||
KEY = "gateway-test-key-0123456789abcdef"
|
||||
MODEL = "gpt-5.6-luna"
|
||||
|
||||
|
||||
def completed_response(output=None):
|
||||
response = {
|
||||
"id": "resp_test",
|
||||
"object": "response",
|
||||
"status": "completed",
|
||||
"model": MODEL,
|
||||
"output": output if output is not None else [{"type": "message", "role": "assistant", "content": [{"type": "output_text", "text": "ok"}]}],
|
||||
"usage": {"input_tokens": 1, "output_tokens": 1, "total_tokens": 2},
|
||||
}
|
||||
event = json.dumps({"type": "response.completed", "response": response}, separators=(",", ":"))
|
||||
return response, ("event: response.completed\ndata: " + event + "\n\n").encode()
|
||||
|
||||
|
||||
class FakeResponse:
|
||||
def __init__(self, chunks=(), status=200, data=None, redirect=False, error=None, headers=None):
|
||||
self.chunks = list(chunks)
|
||||
self.status_code = status
|
||||
self.data = data
|
||||
self.is_redirect = redirect
|
||||
self.error = error
|
||||
self.headers = headers if headers is not None else {"Content-Type": "text/event-stream"}
|
||||
self.closed = False
|
||||
|
||||
def iter_content(self, chunk_size=1):
|
||||
for chunk in self.chunks:
|
||||
if isinstance(chunk, Exception):
|
||||
raise chunk
|
||||
yield chunk
|
||||
|
||||
def json(self):
|
||||
if isinstance(self.data, Exception):
|
||||
raise self.data
|
||||
return self.data
|
||||
|
||||
def close(self):
|
||||
self.closed = True
|
||||
|
||||
|
||||
class FakeProvider:
|
||||
def __init__(self, responses=()):
|
||||
self.responses = list(responses)
|
||||
self.calls = []
|
||||
|
||||
def models(self):
|
||||
self.calls.append("models")
|
||||
return [(MODEL, "GPT 5.6 Luna")]
|
||||
|
||||
def response(self, body):
|
||||
self.calls.append(("response", body))
|
||||
return self.responses.pop(0)
|
||||
|
||||
|
||||
class GatewayCase(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.temporary = tempfile.TemporaryDirectory()
|
||||
|
||||
def tearDown(self):
|
||||
self.temporary.cleanup()
|
||||
|
||||
def valid(self, **changes):
|
||||
value = {"model": MODEL, "input": [{"role": "user", "content": "hello"}]}
|
||||
value.update(changes)
|
||||
return value
|
||||
|
||||
|
||||
class KeyAndNormalizationTests(GatewayCase):
|
||||
def test_key_requires_owner_only_regular_nonempty_file(self):
|
||||
path = Path(self.temporary.name) / "key"
|
||||
path.write_text(KEY + "\n", encoding="utf-8")
|
||||
path.chmod(0o600)
|
||||
self.assertEqual(gateway.read_gateway_key(path), KEY)
|
||||
path.chmod(0o640)
|
||||
with self.assertRaisesRegex(auth.AppError, "invalid_gateway_key"):
|
||||
gateway.read_gateway_key(path)
|
||||
path.unlink()
|
||||
target = Path(self.temporary.name) / "target"
|
||||
target.write_text(KEY, encoding="utf-8")
|
||||
path.symlink_to(target)
|
||||
with self.assertRaisesRegex(auth.AppError, "invalid_gateway_key"):
|
||||
gateway.read_gateway_key(path)
|
||||
|
||||
def test_serve_fails_before_listener_without_credentials(self):
|
||||
path = Path(self.temporary.name) / "key"
|
||||
path.write_text(KEY, encoding="utf-8")
|
||||
path.chmod(0o600)
|
||||
args = SimpleNamespace(
|
||||
gateway_key_file=path,
|
||||
state_dir=Path(self.temporary.name) / "state",
|
||||
host="127.0.0.1",
|
||||
port=0,
|
||||
)
|
||||
with self.assertRaisesRegex(auth.AppError, "not_authorized"):
|
||||
gateway.serve(args)
|
||||
|
||||
def test_direct_script_sanitizes_gateway_startup_error(self):
|
||||
path = Path(self.temporary.name) / "key"
|
||||
path.write_text(KEY, encoding="utf-8")
|
||||
path.chmod(0o600)
|
||||
self.assertIsNotNone(auth.__file__)
|
||||
script = Path(str(auth.__file__))
|
||||
result = subprocess.run(
|
||||
[
|
||||
sys.executable,
|
||||
str(script),
|
||||
"--state-dir",
|
||||
str(Path(self.temporary.name) / "state"),
|
||||
"serve",
|
||||
"--gateway-key-file",
|
||||
str(path),
|
||||
],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=5,
|
||||
check=False,
|
||||
)
|
||||
self.assertEqual(result.returncode, 1)
|
||||
self.assertEqual(result.stderr, "error: not_authorized\n")
|
||||
self.assertNotIn("Traceback", result.stderr)
|
||||
|
||||
def test_normalization_forces_preview_contract_and_strips_sampling(self):
|
||||
value = self.valid(
|
||||
stream=False,
|
||||
temperature=0.1,
|
||||
max_output_tokens=20,
|
||||
input=[{"role": "system", "content": [{"type": "input_text", "text": "rules"}]}],
|
||||
)
|
||||
result = gateway.normalize_request(value, {MODEL})
|
||||
self.assertEqual(result["input"][0]["role"], "developer")
|
||||
self.assertIs(result["store"], False)
|
||||
self.assertIs(result["stream"], True)
|
||||
self.assertNotIn("temperature", result)
|
||||
self.assertNotIn("max_output_tokens", result)
|
||||
|
||||
def test_normalization_accepts_boolean_store_and_always_disables_it(self):
|
||||
for incoming in (True, False):
|
||||
with self.subTest(store=incoming):
|
||||
result = gateway.normalize_request(self.valid(store=incoming), {MODEL})
|
||||
self.assertIs(result["store"], False)
|
||||
|
||||
def test_flat_function_and_custom_tools_become_namespace(self):
|
||||
tools = [
|
||||
{"type": "function", "name": "artifactRead", "description": "Read", "parameters": {"type": "object"}},
|
||||
{"type": "custom", "name": "artifactSearch", "format": {"type": "text"}},
|
||||
]
|
||||
result = gateway.normalize_request(
|
||||
self.valid(tools=tools, tool_choice={"type": "function", "name": "artifactRead"}),
|
||||
{MODEL},
|
||||
)
|
||||
namespace = result["tools"][0]
|
||||
self.assertEqual(namespace["type"], "namespace")
|
||||
self.assertEqual(namespace["name"], "affine")
|
||||
self.assertEqual([tool["name"] for tool in namespace["tools"]], ["artifactRead", "artifactSearch"])
|
||||
self.assertEqual(result["tool_choice"]["namespace"], "affine")
|
||||
|
||||
def test_nested_namespace_validates_function_custom_only(self):
|
||||
tools = [{"type": "namespace", "name": "affine", "description": "AFFiNE", "tools": [{"type": "function", "name": "artifactRead"}]}]
|
||||
self.assertEqual(gateway.normalize_request(self.valid(tools=tools), {MODEL})["tools"], tools)
|
||||
tools[0]["tools"] = [{"type": "web_search"}]
|
||||
with self.assertRaisesRegex(gateway.GatewayError, "unsupported_tool"):
|
||||
gateway.normalize_request(self.valid(tools=tools), {MODEL})
|
||||
|
||||
def test_history_preserves_function_calls_outputs_and_reasoning_ciphertext(self):
|
||||
history = [
|
||||
{"type": "function_call", "id": "fc", "call_id": "call", "name": "artifactRead", "arguments": "{}", "namespace": "affine"},
|
||||
{"type": "function_call_output", "call_id": "call", "output": "result"},
|
||||
{"type": "reasoning", "id": "rs", "summary": [], "encrypted_content": "ciphertext"},
|
||||
]
|
||||
result = gateway.normalize_request(self.valid(input=history), {MODEL})
|
||||
self.assertEqual(result["input"], history)
|
||||
|
||||
def test_rejects_unknown_model_media_tools_state_and_unknown_fields(self):
|
||||
cases = [
|
||||
(self.valid(model="fake-model"), "model_not_available"),
|
||||
(self.valid(input=[{"role": "user", "content": [{"type": "input_image", "image_url": "x"}]}]), "unsupported_media"),
|
||||
(self.valid(tools=[{"type": "code_interpreter"}]), "unsupported_tool"),
|
||||
(self.valid(previous_response_id="resp"), "unsupported_parameter"),
|
||||
(self.valid(secret_extension=True), "unsupported_parameter"),
|
||||
(self.valid(stream="true"), "invalid_stream"),
|
||||
(self.valid(store="false"), "invalid_store"),
|
||||
]
|
||||
for value, code in cases:
|
||||
with self.subTest(code=code), self.assertRaisesRegex(gateway.GatewayError, code):
|
||||
gateway.normalize_request(value, {MODEL})
|
||||
|
||||
def test_endpoint_allowlist_includes_only_official_response_url(self):
|
||||
with self.assertRaisesRegex(auth.AppError, "endpoint_not_allowed"):
|
||||
auth._request(mock.Mock(), "POST", "https://example.invalid/v1/responses")
|
||||
self.assertEqual(auth.RESPONSES_URL, "https://api.openai.com/v1/responses")
|
||||
|
||||
|
||||
class ProviderTests(GatewayCase):
|
||||
def credentials(self, expires_at=None):
|
||||
return {
|
||||
"issuer": auth.ISSUER,
|
||||
"subject": "subject",
|
||||
"client_id": "client",
|
||||
"host_id": "urn:uuid:00000000-0000-4000-8000-000000000000",
|
||||
"access_token": "old-access-secret",
|
||||
"refresh_token": "old-refresh-secret",
|
||||
"id_token": "identity",
|
||||
"token_type": "Bearer",
|
||||
"saved_at": "date",
|
||||
"expires_at": expires_at if expires_at is not None else time.time() + 3600,
|
||||
"scopes": [auth.REQUIRED_SCOPE],
|
||||
}
|
||||
|
||||
def test_new_session_ignores_proxy_environment(self):
|
||||
self.assertIs(gateway.new_session().trust_env, False)
|
||||
|
||||
def test_catalog_filters_and_caches_visible_models(self):
|
||||
response = FakeResponse(data={"models": [
|
||||
{"slug": MODEL, "display_name": "Luna", "visibility": "list"},
|
||||
{"slug": "hidden", "display_name": "Hidden", "visibility": "hide"},
|
||||
]})
|
||||
session = mock.Mock()
|
||||
session.request.return_value = response
|
||||
state = Path(self.temporary.name) / "state"
|
||||
auth.atomic_json(state / "credentials.json", self.credentials())
|
||||
provider = gateway.Provider(state, session=session)
|
||||
self.assertEqual(provider.models(), [(MODEL, "Luna")])
|
||||
self.assertEqual(provider.models(), [(MODEL, "Luna")])
|
||||
self.assertEqual(session.request.call_count, 1)
|
||||
kwargs = session.request.call_args.kwargs
|
||||
self.assertIs(kwargs["allow_redirects"], False)
|
||||
|
||||
def test_refresh_rotation_under_lock_preserves_identity_token(self):
|
||||
refreshed = FakeResponse(data={
|
||||
"access_token": "new-access",
|
||||
"refresh_token": "new-refresh",
|
||||
"token_type": "Bearer",
|
||||
"expires_in": 3600,
|
||||
"scope": auth.REQUIRED_SCOPE,
|
||||
})
|
||||
session = mock.Mock()
|
||||
session.request.return_value = refreshed
|
||||
state = Path(self.temporary.name) / "state"
|
||||
auth.atomic_json(state / "credentials.json", self.credentials(expires_at=0))
|
||||
provider = gateway.Provider(state, session=session)
|
||||
self.assertEqual(provider.credentials()["access_token"], "new-access")
|
||||
saved = auth.read_json(state / "credentials.json")
|
||||
assert isinstance(saved, dict)
|
||||
self.assertEqual(saved["refresh_token"], "new-refresh")
|
||||
self.assertEqual(saved["id_token"], "identity")
|
||||
|
||||
def test_response_transport_has_timeouts_no_redirects_and_sanitizes_network_error(self):
|
||||
session = mock.Mock()
|
||||
session.request.side_effect = requests.Timeout("access-secret-must-not-leak")
|
||||
state = Path(self.temporary.name) / "state"
|
||||
auth.atomic_json(state / "credentials.json", self.credentials())
|
||||
provider = gateway.Provider(state, session=session)
|
||||
with self.assertRaisesRegex(gateway.GatewayError, "upstream_network_error") as caught:
|
||||
provider.response({"model": MODEL})
|
||||
self.assertNotIn("secret", str(caught.exception))
|
||||
kwargs = session.request.call_args.kwargs
|
||||
self.assertEqual(kwargs["timeout"], (15, 90))
|
||||
self.assertIs(kwargs["allow_redirects"], False)
|
||||
self.assertIs(kwargs["stream"], True)
|
||||
|
||||
|
||||
class LoopbackGatewayTests(GatewayCase):
|
||||
def start_server(self, provider):
|
||||
server = gateway.GatewayServer(("127.0.0.1", 0), provider, KEY)
|
||||
thread = threading.Thread(target=server.serve_forever, kwargs={"poll_interval": 0.01})
|
||||
thread.start()
|
||||
self.addCleanup(server.server_close)
|
||||
self.addCleanup(thread.join, 2)
|
||||
self.addCleanup(server.shutdown)
|
||||
return server
|
||||
|
||||
def request(self, server, method, path, body=None, headers=None):
|
||||
connection = http.client.HTTPConnection("127.0.0.1", server.server_address[1], timeout=2)
|
||||
encoded = None if body is None else json.dumps(body).encode()
|
||||
actual = dict(headers or {})
|
||||
if encoded is not None:
|
||||
actual.setdefault("Content-Type", "application/json")
|
||||
actual.setdefault("Content-Length", str(len(encoded)))
|
||||
connection.request(method, path, body=encoded, headers=actual)
|
||||
response = connection.getresponse()
|
||||
data = response.read()
|
||||
result = response.status, dict(response.getheaders()), data
|
||||
connection.close()
|
||||
return result
|
||||
|
||||
def authorized(self):
|
||||
return {"Authorization": "Bearer " + KEY}
|
||||
|
||||
def test_unauthorized_request_does_not_parse_or_touch_provider(self):
|
||||
provider = FakeProvider()
|
||||
server = self.start_server(provider)
|
||||
status, _headers, body = self.request(
|
||||
server,
|
||||
"POST",
|
||||
"/v1/responses",
|
||||
body=b"not-json".decode(),
|
||||
headers={"Authorization": "Bearer wrong", "Content-Type": "text/plain"},
|
||||
)
|
||||
self.assertEqual(status, 401)
|
||||
self.assertEqual(provider.calls, [])
|
||||
self.assertNotIn(b"not-json", body)
|
||||
|
||||
def test_connections_are_bounded_before_header_parsing(self):
|
||||
provider = FakeProvider()
|
||||
server = gateway.GatewayServer(("127.0.0.1", 0), provider, KEY, max_connections=1)
|
||||
thread = threading.Thread(target=server.serve_forever, kwargs={"poll_interval": 0.01})
|
||||
thread.start()
|
||||
first = socket.create_connection(("127.0.0.1", server.server_address[1]), timeout=2)
|
||||
deadline = time.time() + 1
|
||||
while time.time() < deadline:
|
||||
if not server.connection_capacity.acquire(blocking=False):
|
||||
break
|
||||
server.connection_capacity.release()
|
||||
time.sleep(0.01)
|
||||
else:
|
||||
self.fail("first connection was not admitted")
|
||||
second = socket.create_connection(("127.0.0.1", server.server_address[1]), timeout=2)
|
||||
second.settimeout(1)
|
||||
second.sendall(b"GET /healthz HTTP/1.1\r\nHost: localhost\r\n\r\n")
|
||||
self.assertEqual(second.recv(1), b"")
|
||||
second.close()
|
||||
first.close()
|
||||
server.shutdown()
|
||||
thread.join(2)
|
||||
server.server_close()
|
||||
|
||||
def test_health_and_models_are_minimal_and_no_store(self):
|
||||
provider = FakeProvider()
|
||||
server = self.start_server(provider)
|
||||
status, headers, body = self.request(server, "GET", "/healthz")
|
||||
self.assertEqual((status, json.loads(body)), (200, {"status": "ready"}))
|
||||
self.assertEqual(headers["Cache-Control"], "no-store")
|
||||
status, _headers, body = self.request(server, "GET", "/v1/models", headers=self.authorized())
|
||||
self.assertEqual(status, 200)
|
||||
self.assertEqual(json.loads(body)["data"][0]["id"], MODEL)
|
||||
|
||||
def test_invalid_oversize_and_chunked_bodies_never_reach_provider(self):
|
||||
provider = FakeProvider()
|
||||
server = self.start_server(provider)
|
||||
base = {**self.authorized(), "Content-Type": "text/plain"}
|
||||
status, _headers, _body = self.request(server, "POST", "/v1/responses", {}, base)
|
||||
self.assertEqual(status, 415)
|
||||
raw = socket.create_connection(("127.0.0.1", server.server_address[1]), timeout=2)
|
||||
raw.sendall((
|
||||
"POST /v1/responses HTTP/1.1\r\nHost: localhost\r\n"
|
||||
f"Authorization: Bearer {KEY}\r\nContent-Type: application/json\r\n"
|
||||
"Transfer-Encoding: chunked\r\n\r\n2\r\n{}\r\n0\r\n\r\n"
|
||||
).encode())
|
||||
self.assertIn(b" 400 ", raw.recv(4096))
|
||||
raw.close()
|
||||
malformed = socket.create_connection(("127.0.0.1", server.server_address[1]), timeout=2)
|
||||
malformed.sendall((
|
||||
"POST /v1/responses HTTP/1.1\r\nHost: localhost\r\n"
|
||||
f"Authorization: Bearer {KEY}\r\nContent-Type: application/json\r\n"
|
||||
"Content-Length: 7\r\n\r\n{broken"
|
||||
).encode())
|
||||
self.assertIn(b" 400 ", malformed.recv(4096))
|
||||
malformed.close()
|
||||
headers = {**self.authorized(), "Content-Type": "application/json", "Content-Length": str(gateway.MAX_BODY + 1)}
|
||||
status, _headers, _body = self.request(server, "POST", "/v1/responses", None, headers)
|
||||
self.assertEqual(status, 413)
|
||||
self.assertEqual(provider.calls, [])
|
||||
|
||||
def test_query_endpoint_and_non_sse_upstream_are_rejected(self):
|
||||
provider = FakeProvider([FakeResponse(headers={"Content-Type": "application/json"})])
|
||||
server = self.start_server(provider)
|
||||
status, _headers, _body = self.request(server, "POST", "/v1/responses?debug=1", self.valid(), self.authorized())
|
||||
self.assertEqual(status, 404)
|
||||
status, _headers, body = self.request(server, "POST", "/v1/responses", self.valid(), self.authorized())
|
||||
self.assertEqual(status, 502)
|
||||
self.assertIn(b"upstream_content_type_invalid", body)
|
||||
|
||||
def test_nonstream_returns_actual_completed_response_with_function_call(self):
|
||||
output = [{"type": "function_call", "call_id": "call", "name": "artifactRead", "arguments": "{}", "namespace": "affine"}]
|
||||
expected, event = completed_response(output)
|
||||
upstream = FakeResponse([event[:19], event[19:]])
|
||||
provider = FakeProvider([upstream])
|
||||
server = self.start_server(provider)
|
||||
status, headers, body = self.request(server, "POST", "/v1/responses", self.valid(stream=False), self.authorized())
|
||||
self.assertEqual(status, 200)
|
||||
self.assertEqual(json.loads(body), expected)
|
||||
self.assertEqual(headers["Cache-Control"], "no-store")
|
||||
self.assertTrue(upstream.closed)
|
||||
sent = provider.calls[-1][1]
|
||||
self.assertIs(sent["stream"], True)
|
||||
self.assertIs(sent["store"], False)
|
||||
|
||||
def test_missing_upstream_content_type_requires_valid_completed_sse(self):
|
||||
expected, event = completed_response()
|
||||
for payload, expected_status in ((event, 200), (b"not an SSE response", 502)):
|
||||
with self.subTest(expected_status=expected_status):
|
||||
provider = FakeProvider([FakeResponse([payload], headers={})])
|
||||
server = self.start_server(provider)
|
||||
status, _headers, body = self.request(server, "POST", "/v1/responses", self.valid(stream=False), self.authorized())
|
||||
self.assertEqual(status, expected_status)
|
||||
if status == 200:
|
||||
self.assertEqual(json.loads(body), expected)
|
||||
else:
|
||||
self.assertIn(b"upstream_stream_interrupted", body)
|
||||
|
||||
def test_nonstream_collects_done_items_when_completed_output_is_empty(self):
|
||||
items = [
|
||||
{"type": "message", "role": "assistant", "content": [{"type": "output_text", "text": "OK"}]},
|
||||
{"type": "function_call", "call_id": "call", "name": "affine_probe", "arguments": "{}"},
|
||||
]
|
||||
_response, completed = completed_response([])
|
||||
events = [
|
||||
("data: " + json.dumps({"type": "response.output_item.done", "output_index": index, "item": item}) + "\n\n").encode()
|
||||
for index, item in enumerate(items)
|
||||
]
|
||||
provider = FakeProvider([FakeResponse(events + [completed], headers={})])
|
||||
server = self.start_server(provider)
|
||||
status, _headers, body = self.request(server, "POST", "/v1/responses", self.valid(stream=False), self.authorized())
|
||||
self.assertEqual(status, 200)
|
||||
self.assertEqual(json.loads(body)["output"], items)
|
||||
|
||||
def test_nonstream_failure_and_interruption_are_non_200_sanitized(self):
|
||||
failed = b'event: response.failed\ndata: {"type":"response.failed","response":{"status":"failed","error":{"message":"private"}}}\n\n'
|
||||
for upstream in (FakeResponse([failed]), FakeResponse([b"event: response.created\ndata: {\"type\":\"response.created\"}\n\n"])):
|
||||
with self.subTest(chunks=upstream.chunks):
|
||||
provider = FakeProvider([upstream])
|
||||
server = self.start_server(provider)
|
||||
status, _headers, body = self.request(server, "POST", "/v1/responses", self.valid(), self.authorized())
|
||||
self.assertEqual(status, 502)
|
||||
self.assertNotIn(b"private", body)
|
||||
|
||||
def test_stream_relays_complete_failure_and_interruption_without_fake_success(self):
|
||||
_response, completed = completed_response()
|
||||
failed = b'event: response.failed\ndata: {"type":"response.failed","response":{"status":"failed"}}\n\n'
|
||||
interrupted = b'event: response.output_text.delta\ndata: {"type":"response.output_text.delta","delta":"x"}\n\n'
|
||||
for payload, expected in ((completed, b"response.completed"), (failed, b"response.failed"), (interrupted, b"upstream_stream_interrupted")):
|
||||
with self.subTest(expected=expected):
|
||||
provider = FakeProvider([FakeResponse([payload])])
|
||||
server = self.start_server(provider)
|
||||
status, headers, body = self.request(server, "POST", "/v1/responses", self.valid(stream=True), self.authorized())
|
||||
self.assertEqual(status, 200)
|
||||
self.assertEqual(headers["Content-Type"], "text/event-stream")
|
||||
self.assertIn(expected, body)
|
||||
if expected != b"response.completed":
|
||||
self.assertNotIn(b"response.completed", body)
|
||||
|
||||
def test_upstream_status_and_allowlisted_code_preserved_without_body_reflection(self):
|
||||
upstream = FakeResponse(status=429, data={"error": {"code": "rate_limit_exceeded", "message": "private account detail"}})
|
||||
provider = FakeProvider([upstream])
|
||||
server = self.start_server(provider)
|
||||
status, _headers, body = self.request(server, "POST", "/v1/responses", self.valid(), self.authorized())
|
||||
self.assertEqual(status, 429)
|
||||
self.assertIn(b"rate_limit_exceeded", body)
|
||||
self.assertNotIn(b"private account detail", body)
|
||||
|
||||
def test_stream_disconnect_closes_upstream(self):
|
||||
class Endless(FakeResponse):
|
||||
def iter_content(self, chunk_size=1):
|
||||
for _index in range(10000):
|
||||
yield b'event: response.output_text.delta\ndata: {"type":"response.output_text.delta","delta":"xxxxxxxxxxxxxxxx"}\n\n'
|
||||
time.sleep(0.001)
|
||||
|
||||
upstream = Endless()
|
||||
provider = FakeProvider([upstream])
|
||||
server = self.start_server(provider)
|
||||
connection = socket.create_connection(("127.0.0.1", server.server_address[1]), timeout=2)
|
||||
body = json.dumps(self.valid(stream=True)).encode()
|
||||
connection.sendall((
|
||||
"POST /v1/responses HTTP/1.1\r\nHost: localhost\r\n"
|
||||
f"Authorization: Bearer {KEY}\r\nContent-Type: application/json\r\nContent-Length: {len(body)}\r\n\r\n"
|
||||
).encode() + body)
|
||||
connection.recv(512)
|
||||
connection.close()
|
||||
deadline = time.time() + 2
|
||||
while not upstream.closed and time.time() < deadline:
|
||||
time.sleep(0.01)
|
||||
self.assertTrue(upstream.closed)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -0,0 +1,238 @@
|
||||
diff --git a/packages/frontend/core/src/blocksuite/ai/components/ai-chat-input/ai-chat-input.ts b/packages/frontend/core/src/blocksuite/ai/components/ai-chat-input/ai-chat-input.ts
|
||||
--- a/packages/frontend/core/src/blocksuite/ai/components/ai-chat-input/ai-chat-input.ts
|
||||
+++ b/packages/frontend/core/src/blocksuite/ai/components/ai-chat-input/ai-chat-input.ts
|
||||
@@ -860,7 +860,7 @@
|
||||
control: this.trackOptions?.control,
|
||||
reasoning: this._isReasoningActive,
|
||||
toolsConfig: this.aiToolsConfigService.config.value,
|
||||
- routeTargetId: this.aiModelService.modelId.value,
|
||||
+ ...this.aiModelService.getSelection(),
|
||||
userInfo: {
|
||||
userId: userInfo?.id,
|
||||
userName: userInfo?.name,
|
||||
diff --git a/packages/frontend/core/src/blocksuite/ai/runtime/chat/runtime.ts b/packages/frontend/core/src/blocksuite/ai/runtime/chat/runtime.ts
|
||||
--- a/packages/frontend/core/src/blocksuite/ai/runtime/chat/runtime.ts
|
||||
+++ b/packages/frontend/core/src/blocksuite/ai/runtime/chat/runtime.ts
|
||||
@@ -30,6 +30,10 @@
|
||||
private createSessionPromise: Promise<
|
||||
CopilotChatHistoryFragment | null | undefined
|
||||
> | null = null;
|
||||
+ private readonly sessionSelections = new Map<
|
||||
+ string,
|
||||
+ Pick<AIChatSendOptions, 'profileId' | 'modelId' | 'routeTargetId'>
|
||||
+ >();
|
||||
private snapshot: AIChatSnapshot;
|
||||
|
||||
constructor(private readonly options: RuntimeOptions) {
|
||||
@@ -69,6 +73,7 @@
|
||||
this.createSessionPromise = null;
|
||||
this.createSessionPromiseKey = null;
|
||||
this.streamAbortController?.abort();
|
||||
+ this.sessionSelections.clear();
|
||||
this.listeners.clear();
|
||||
}
|
||||
|
||||
@@ -389,6 +394,10 @@
|
||||
this.updateScopeSelection({ syncing: false });
|
||||
}
|
||||
|
||||
+ const selection = options.profileId && options.modelId
|
||||
+ ? { profileId: options.profileId, modelId: options.modelId }
|
||||
+ : { routeTargetId: options.routeTargetId ?? this.snapshot.composer.routeTargetId };
|
||||
+ this.sessionSelections.set(session.sessionId, selection);
|
||||
const stream = (await this.options.request.executeAction('chat', {
|
||||
workspaceId: this.snapshot.scope.workspaceId,
|
||||
docId:
|
||||
@@ -407,8 +416,7 @@
|
||||
],
|
||||
reasoning: options.reasoning ?? this.snapshot.composer.reasoning,
|
||||
toolsConfig: options.toolsConfig ?? this.snapshot.composer.toolsConfig,
|
||||
- routeTargetId:
|
||||
- options.routeTargetId ?? this.snapshot.composer.routeTargetId,
|
||||
+ ...selection,
|
||||
isRootSession: options.isRootSession,
|
||||
where: options.where,
|
||||
control: options.control,
|
||||
@@ -474,6 +482,7 @@
|
||||
workspaceId: this.snapshot.scope.workspaceId,
|
||||
sessionId: this.snapshot.activeSessionId,
|
||||
liveEditorContext,
|
||||
+ ...this.sessionSelections.get(this.snapshot.activeSessionId),
|
||||
retry: true,
|
||||
stream: true,
|
||||
signal: this.streamAbortController.signal,
|
||||
diff --git a/packages/frontend/core/src/blocksuite/ai/runtime/chat/actions.ts b/packages/frontend/core/src/blocksuite/ai/runtime/chat/actions.ts
|
||||
--- a/packages/frontend/core/src/blocksuite/ai/runtime/chat/actions.ts
|
||||
+++ b/packages/frontend/core/src/blocksuite/ai/runtime/chat/actions.ts
|
||||
@@ -16,6 +16,8 @@
|
||||
reasoning?: boolean;
|
||||
toolsConfig?: unknown;
|
||||
routeTargetId?: string;
|
||||
+ profileId?: string;
|
||||
+ modelId?: string;
|
||||
userInfo?: {
|
||||
userId?: string;
|
||||
userName?: string;
|
||||
diff --git a/packages/frontend/core/src/modules/ai-button/services/models.ts b/packages/frontend/core/src/modules/ai-button/services/models.ts
|
||||
--- a/packages/frontend/core/src/modules/ai-button/services/models.ts
|
||||
+++ b/packages/frontend/core/src/modules/ai-button/services/models.ts
|
||||
@@ -1,4 +1,7 @@
|
||||
-import { getCopilotRouteOptionsQuery } from '@affine/graphql';
|
||||
+import {
|
||||
+ getCopilotRouteOptionsQuery,
|
||||
+ workspaceByokSettingsQuery,
|
||||
+} from '@affine/graphql';
|
||||
import { signal } from '@preact/signals-core';
|
||||
import { Service } from '@toeverything/infra';
|
||||
|
||||
@@ -13,7 +16,24 @@
|
||||
category: string;
|
||||
version: string;
|
||||
available: boolean;
|
||||
+ profileId?: string;
|
||||
+ modelId?: string;
|
||||
}
|
||||
+
|
||||
+export type AIModelSelection =
|
||||
+ | { routeTargetId?: undefined; profileId?: undefined; modelId?: undefined }
|
||||
+ | { routeTargetId: string; profileId?: undefined; modelId?: undefined }
|
||||
+ | { routeTargetId?: undefined; profileId: string; modelId: string };
|
||||
+
|
||||
+const isPermissionDenied = (error: unknown) =>
|
||||
+ typeof error === 'object' &&
|
||||
+ error !== null &&
|
||||
+ 'isStatus' in error &&
|
||||
+ typeof error.isStatus === 'function' &&
|
||||
+ error.isStatus(403);
|
||||
+
|
||||
+const supportsText = (capability: { input: string[]; output: string[] }) =>
|
||||
+ capability.input.includes('text') && capability.output.includes('text');
|
||||
|
||||
export class AIModelService extends Service {
|
||||
readonly modelId = signal<string | undefined>(undefined);
|
||||
@@ -31,7 +51,9 @@ export class AIModelService extends Service {
|
||||
super();
|
||||
const subscription = subscriptionService.subscription.ai$.subscribe(() => {
|
||||
if (this.workspaceId && this.routeId) {
|
||||
- this.load(this.workspaceId, this.routeId).catch(console.error);
|
||||
+ this.load(this.workspaceId, this.routeId).catch(() =>
|
||||
+ console.error('Failed to load AI models')
|
||||
+ );
|
||||
}
|
||||
});
|
||||
this.disposables.push(() => subscription.unsubscribe());
|
||||
@@ -43,13 +65,26 @@ export class AIModelService extends Service {
|
||||
this.routeId = routeId;
|
||||
this.models.value = [];
|
||||
this.modelId.value = undefined;
|
||||
- this.load(workspaceId, routeId).catch(console.error);
|
||||
+ this.load(workspaceId, routeId).catch(() =>
|
||||
+ console.error('Failed to load AI models')
|
||||
+ );
|
||||
}
|
||||
|
||||
resetModel() {
|
||||
this.setModel(undefined);
|
||||
}
|
||||
|
||||
+ getSelection(): AIModelSelection {
|
||||
+ const model = this.models.value.find(
|
||||
+ candidate => candidate.id === this.modelId.value && candidate.available
|
||||
+ );
|
||||
+ if (!model) return {};
|
||||
+ if (model.profileId && model.modelId) {
|
||||
+ return { profileId: model.profileId, modelId: model.modelId };
|
||||
+ }
|
||||
+ return { routeTargetId: model.id };
|
||||
+ }
|
||||
+
|
||||
setModel(modelId: string | undefined) {
|
||||
if (!this.workspaceId || !this.routeId) return;
|
||||
if (
|
||||
@@ -67,18 +102,42 @@
|
||||
|
||||
private async load(workspaceId: string, routeId: string) {
|
||||
const requestId = ++this.requestId;
|
||||
- const result = await this.gqlService.gql({
|
||||
- query: getCopilotRouteOptionsQuery,
|
||||
- variables: { promptName: routeId },
|
||||
- });
|
||||
+ const to = new Date();
|
||||
+ const from = new Date(to.getTime());
|
||||
+ from.setDate(from.getDate() - 30);
|
||||
+ const [managedResponse, byokResponse] = await Promise.allSettled([
|
||||
+ this.gqlService.gql({
|
||||
+ query: getCopilotRouteOptionsQuery,
|
||||
+ variables: { promptName: routeId },
|
||||
+ }),
|
||||
+ this.gqlService
|
||||
+ .gql({
|
||||
+ query: workspaceByokSettingsQuery,
|
||||
+ variables: {
|
||||
+ id: workspaceId,
|
||||
+ from: from.toISOString(),
|
||||
+ to: to.toISOString(),
|
||||
+ },
|
||||
+ })
|
||||
+ .catch(error => {
|
||||
+ if (isPermissionDenied(error)) return undefined;
|
||||
+ throw error;
|
||||
+ }),
|
||||
+ ]);
|
||||
if (requestId !== this.requestId) return;
|
||||
- const options = result.currentUser?.copilot?.routeOptions;
|
||||
- if (!options) {
|
||||
- this.models.value = [];
|
||||
- this.modelId.value = undefined;
|
||||
- return;
|
||||
- }
|
||||
- this.models.value = options.choices.map(choice => {
|
||||
+ if (byokResponse.status === 'rejected') {
|
||||
+ console.error('Failed to load workspace BYOK models');
|
||||
+ throw byokResponse.reason;
|
||||
+ }
|
||||
+ if (managedResponse.status === 'rejected') {
|
||||
+ console.error('Failed to load managed AI models');
|
||||
+ }
|
||||
+ const managedResult =
|
||||
+ managedResponse.status === 'fulfilled' ? managedResponse.value : undefined;
|
||||
+ const byokResult =
|
||||
+ byokResponse.status === 'fulfilled' ? byokResponse.value : undefined;
|
||||
+ const options = managedResult?.currentUser?.copilot?.routeOptions;
|
||||
+ const managedModels = options?.choices.map(choice => {
|
||||
const [category] = choice.displayName.split(' ');
|
||||
return {
|
||||
id: choice.id,
|
||||
@@ -87,7 +146,31 @@
|
||||
version: choice.displayName.slice(category.length + 1),
|
||||
available: choice.available,
|
||||
};
|
||||
- });
|
||||
+ }) ?? [];
|
||||
+ const settings = byokResult?.workspace?.byokSettings;
|
||||
+ const byokModels =
|
||||
+ settings?.serverEntitled && settings.policy.enabled
|
||||
+ ? settings.profiles.flatMap(profile => {
|
||||
+ if (
|
||||
+ !profile.enabled ||
|
||||
+ !settings.policy.allowedProviders.includes(profile.provider)
|
||||
+ ) {
|
||||
+ return [];
|
||||
+ }
|
||||
+ return profile.definition.models
|
||||
+ .filter(model => model.enabled && model.capabilities.some(supportsText))
|
||||
+ .map(model => ({
|
||||
+ id: `byok:${profile.profileId}:${encodeURIComponent(model.modelId)}`,
|
||||
+ name: model.modelId,
|
||||
+ category: model.modelId,
|
||||
+ version: profile.name,
|
||||
+ available: true,
|
||||
+ profileId: profile.profileId,
|
||||
+ modelId: model.modelId,
|
||||
+ }));
|
||||
+ })
|
||||
+ : [];
|
||||
+ this.models.value = [...managedModels, ...byokModels];
|
||||
const selected = this.globalStateService.globalState.get<string>(
|
||||
this.storageKey(workspaceId, routeId)
|
||||
);
|
||||
@@ -0,0 +1,323 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
stdenvNoCC,
|
||||
fetchzip,
|
||||
runCommand,
|
||||
config,
|
||||
makeWrapper,
|
||||
nodejs,
|
||||
git,
|
||||
cacert,
|
||||
yarn-berry_4,
|
||||
pkg-config,
|
||||
openssl,
|
||||
inputs,
|
||||
system,
|
||||
frontendPatches ? [ ./gitea-document-typography.patch ./byok-model-picker.patch ./self-hosted-ai-usage.patch ],
|
||||
}:
|
||||
|
||||
let
|
||||
version = "0.27.4";
|
||||
revision = "b4c8548c09da21b2898443559a5b846f0ccf5dd8";
|
||||
|
||||
src = fetchzip {
|
||||
url = "https://github.com/toeverything/AFFiNE/archive/${revision}.tar.gz";
|
||||
hash = "sha256-MuzQkiiMUrmFVzHCA5l5hzXm7wA7ChPaKzcrJtc1R3Y=";
|
||||
};
|
||||
|
||||
affinePkgs = import inputs.nixpkgs {
|
||||
inherit system config;
|
||||
overlays = [ (import inputs.affine-rust-overlay) ];
|
||||
};
|
||||
rustToolchain = affinePkgs.rust-bin.stable."1.97.1".default;
|
||||
rustPlatform = affinePkgs.makeRustPlatform {
|
||||
cargo = rustToolchain;
|
||||
rustc = rustToolchain;
|
||||
};
|
||||
|
||||
prismaEngines = affinePkgs.callPackage ./prisma-engines.nix {};
|
||||
|
||||
prismaSchemaEngine = "${prismaEngines}/bin/schema-engine";
|
||||
prismaQueryEngine = "${prismaEngines}/lib/libquery_engine.node";
|
||||
|
||||
native = rustPlatform.buildRustPackage {
|
||||
pname = "affine-server-native";
|
||||
inherit version src;
|
||||
|
||||
cargoHash = "sha256-fQY4DmkbZQljXQzWRNLzaYxdPoenWTbOtjBvqT/HFYE=";
|
||||
cargoBuildFlags = [
|
||||
"-p"
|
||||
"affine_server_native"
|
||||
];
|
||||
nativeBuildInputs = [ pkg-config ];
|
||||
buildInputs = [ openssl ];
|
||||
|
||||
env = {
|
||||
CARGO_BUILD_JOBS = "8";
|
||||
OPENSSL_NO_VENDOR = "1";
|
||||
};
|
||||
|
||||
doCheck = false;
|
||||
meta = {
|
||||
license = lib.licenses.unfree;
|
||||
platforms = [ "x86_64-linux" ];
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
install -Dm755 target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/libaffine_server_native.so \
|
||||
"$out/lib/server-native.node"
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
|
||||
yarnOfflineCache = yarn-berry_4.fetchYarnBerryDeps {
|
||||
inherit src;
|
||||
missingHashes = ./missing-hashes.json;
|
||||
hash = "sha256-3dM2b5wR2mYPn8JMBXXXJAHzlHjbLWkRdrp9uLjjV30=";
|
||||
};
|
||||
|
||||
yarnCmd = "${nodejs}/bin/node .yarn/releases/yarn-4.18.0.cjs";
|
||||
# Populate Git package archives without a second node_modules tree.
|
||||
yarnOfflineCache18 = stdenvNoCC.mkDerivation {
|
||||
pname = "affine-yarn-cache";
|
||||
inherit version src;
|
||||
|
||||
nativeBuildInputs = [ nodejs git cacert ];
|
||||
|
||||
dontConfigure = true;
|
||||
dontInstall = true;
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
export HOME=$(mktemp -d)
|
||||
export YARN_ENABLE_GLOBAL_CACHE=false
|
||||
export YARN_ENABLE_SCRIPTS=false
|
||||
export YARN_NODE_LINKER=pnp
|
||||
export YARN_CACHE_FOLDER=$PWD/.yarn/cache
|
||||
rm -rf .yarn/cache
|
||||
mkdir -p .yarn/cache
|
||||
cp -R ${yarnOfflineCache}/cache/. .yarn/cache/
|
||||
chmod -R u+w .yarn/cache
|
||||
${yarnCmd} install --immutable --mode=skip-build
|
||||
cmp yarn.lock ${src}/yarn.lock
|
||||
rm -rf node_modules .yarn/install-state.gz
|
||||
mkdir -p "$out"
|
||||
cp -R .yarn/cache "$out/cache"
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
outputHashMode = "recursive";
|
||||
outputHash = "sha256-6rE9uAZalXQY//FUYBD0f2474UnRlWm9n9KzfQj+D6s=";
|
||||
};
|
||||
|
||||
yarnConfigurePhase = ''
|
||||
runHook preConfigure
|
||||
|
||||
export HOME=$(mktemp -d)
|
||||
export YARN_ENABLE_GLOBAL_CACHE=false
|
||||
export YARN_ENABLE_NETWORK=false
|
||||
export YARN_ENABLE_TELEMETRY=false
|
||||
export YARN_CACHE_FOLDER=$PWD/.yarn/cache
|
||||
rm -rf .yarn/cache .yarn/checkouts
|
||||
mkdir -p .yarn/cache
|
||||
cp -R ${yarnOfflineCache18}/cache/. .yarn/cache/
|
||||
chmod -R u+w .yarn
|
||||
${yarnCmd} install --immutable --mode=skip-build --inline-builds
|
||||
patchShebangs node_modules
|
||||
patchShebangs tools/cli/bin
|
||||
mkdir -p .nix-bin
|
||||
makeWrapper ${nodejs}/bin/node "$PWD/.nix-bin/yarn" \
|
||||
--add-flags "$PWD/.yarn/releases/yarn-4.18.0.cjs"
|
||||
export PATH="$PWD/.nix-bin:$PWD/node_modules/.bin:$PATH"
|
||||
# Match the version stamping performed by upstream release CI.
|
||||
${yarnCmd} workspaces list --json > .nix-workspaces.json
|
||||
${nodejs}/bin/node - .nix-workspaces.json ${version} <<'JS'
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
for (const line of fs.readFileSync(process.argv[2], 'utf8').trim().split('\n')) {
|
||||
const { location } = JSON.parse(line);
|
||||
const file = path.join(location, 'package.json');
|
||||
const manifest = JSON.parse(fs.readFileSync(file, 'utf8'));
|
||||
manifest.version = process.argv[3];
|
||||
fs.writeFileSync(file, JSON.stringify(manifest, null, 2) + '\n');
|
||||
}
|
||||
JS
|
||||
${yarnCmd} affine init
|
||||
|
||||
runHook postConfigure
|
||||
'';
|
||||
|
||||
frontend = stdenv.mkDerivation ({
|
||||
pname = "affine-frontend";
|
||||
inherit version src yarnOfflineCache;
|
||||
missingHashes = ./missing-hashes.json;
|
||||
patches = frontendPatches;
|
||||
|
||||
nativeBuildInputs = [
|
||||
nodejs
|
||||
makeWrapper
|
||||
];
|
||||
|
||||
configurePhase = yarnConfigurePhase;
|
||||
|
||||
env = {
|
||||
BUILD_TYPE = "stable";
|
||||
GITHUB_SHA = revision;
|
||||
NODE_OPTIONS = "--max-old-space-size=8192";
|
||||
YARN_ENABLE_SCRIPTS = "0";
|
||||
};
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
${yarnCmd} workspace @affine/templates build
|
||||
${yarnCmd} affine @affine/web build
|
||||
${yarnCmd} affine @affine/admin build
|
||||
${yarnCmd} affine @affine/mobile build
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p "$out"
|
||||
cp -R packages/frontend/apps/web/dist "$out/web"
|
||||
cp -R packages/frontend/admin/dist "$out/admin"
|
||||
cp -R packages/frontend/apps/mobile/dist "$out/mobile"
|
||||
runHook postInstall
|
||||
'';
|
||||
} // lib.optionalAttrs (builtins.elem ./byok-model-picker.patch frontendPatches || builtins.elem ./self-hosted-ai-usage.patch frontendPatches) {
|
||||
doCheck = true;
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
${lib.optionalString (builtins.elem ./byok-model-picker.patch frontendPatches) ''AFFINE_SOURCE_DIR="$PWD" ${nodejs}/bin/node ${../../test/package/affine/test/model-picker.cjs}''}
|
||||
${lib.optionalString (builtins.elem ./self-hosted-ai-usage.patch frontendPatches) ''AFFINE_SOURCE_DIR="$PWD" ${nodejs}/bin/node ${../../test/package/affine/test/ai-usage.cjs}''}
|
||||
runHook postCheck
|
||||
'';
|
||||
});
|
||||
|
||||
frontendStatic = runCommand "affine-frontend-static-${version}" {
|
||||
inherit version;
|
||||
passthru = { inherit revision; };
|
||||
meta = {
|
||||
description = "Source-built AFFiNE web assets with typography and BYOK model selection";
|
||||
license = [ lib.licenses.mit lib.licenses.mpl20 ];
|
||||
platforms = [ "x86_64-linux" ];
|
||||
};
|
||||
} ''
|
||||
mkdir -p "$out/admin" "$out/mobile" "$out/licenses"
|
||||
cp -RL ${frontend}/web/. "$out/"
|
||||
cp -RL ${frontend}/admin/. "$out/admin/"
|
||||
cp -RL ${frontend}/mobile/. "$out/mobile/"
|
||||
cp ${src}/LICENSE ${src}/LICENSE-MIT "$out/licenses/"
|
||||
cp ${src}/packages/backend/server/LICENSE "$out/licenses/AFFINE-EE-and-MPL"
|
||||
'';
|
||||
in
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "affine";
|
||||
inherit version src yarnOfflineCache;
|
||||
missingHashes = ./missing-hashes.json;
|
||||
patches = [ ./native-loader.patch ./read-only-schema.patch ];
|
||||
|
||||
nativeBuildInputs = [
|
||||
makeWrapper
|
||||
nodejs
|
||||
];
|
||||
|
||||
configurePhase = yarnConfigurePhase;
|
||||
|
||||
env = {
|
||||
NODE_OPTIONS = "--max-old-space-size=8192";
|
||||
YARN_ENABLE_SCRIPTS = "0";
|
||||
PRISMA_SCHEMA_ENGINE_BINARY = prismaSchemaEngine;
|
||||
PRISMA_QUERY_ENGINE_LIBRARY = prismaQueryEngine;
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace packages/backend/server/schema.prisma \
|
||||
--replace-fail '["native", "debian-openssl-3.0.x", "linux-arm64-openssl-3.0.x"]' '["native"]'
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
cp ${native}/lib/server-native.node packages/backend/native/server-native.node
|
||||
${yarnCmd} affine @affine/server build
|
||||
${yarnCmd} workspaces focus @affine/server --production
|
||||
${yarnCmd} workspace @affine/server prisma generate
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
app="$out/share/affine"
|
||||
mkdir -p "$app" "$out/bin"
|
||||
cp -R packages/backend/server/dist "$app/dist"
|
||||
cp packages/backend/server/package.json packages/backend/server/schema.prisma "$app/"
|
||||
cp -R packages/backend/server/migrations "$app/migrations"
|
||||
mkdir -p "$app/scripts"
|
||||
cp packages/backend/server/scripts/self-host-predeploy.js "$app/scripts/"
|
||||
substituteInPlace "$app/scripts/self-host-predeploy.js" \
|
||||
--replace-fail 'yarn prisma' '${nodejs}/bin/node '"$app/node_modules/prisma/build/index.js" \
|
||||
--replace-fail 'yarn cli run' 'SERVER_FLAVOR=script ${nodejs}/bin/node '"$app/dist/main.js run" \
|
||||
--replace-fail 'fs.mkdirSync(SELF_HOST_CONFIG_DIR, { recursive: true });' \
|
||||
'fs.mkdirSync(SELF_HOST_CONFIG_DIR, { recursive: true, mode: 0o700 });' \
|
||||
--replace-fail "fs.writeFileSync(targetFilePath, generator(), 'utf-8');" \
|
||||
"fs.writeFileSync(targetFilePath, generator(), { encoding: 'utf-8', mode: 0o600 });"
|
||||
cp -R node_modules "$app/node_modules"
|
||||
mkdir -p "$app/packages/common" "$app/packages/backend/server"
|
||||
cp -R packages/common/s3-compat "$app/packages/common/"
|
||||
cp -R packages/backend/native "$app/packages/backend/"
|
||||
cp packages/backend/server/package.json "$app/packages/backend/server/"
|
||||
ln -s ../../../dist "$app/packages/backend/server/dist"
|
||||
ln -s ../../../schema.prisma "$app/packages/backend/server/schema.prisma"
|
||||
ln -s ../../../migrations "$app/packages/backend/server/migrations"
|
||||
mkdir -p "$out/share/doc/affine"
|
||||
cp LICENSE LICENSE-MIT "$out/share/doc/affine/"
|
||||
cp packages/backend/server/LICENSE "$out/share/doc/affine/LICENSE-backend"
|
||||
mkdir -p "$app/static/admin" "$app/static/mobile"
|
||||
cp -R ${frontend}/web/. "$app/static/"
|
||||
cp -R ${frontend}/admin/. "$app/static/admin/"
|
||||
cp -R ${frontend}/mobile/. "$app/static/mobile/"
|
||||
|
||||
makeWrapper ${nodejs}/bin/node "$out/bin/affine-server" \
|
||||
--run 'umask 077' \
|
||||
--add-flags "$app/dist/main.js" \
|
||||
--set-default NODE_ENV production \
|
||||
--set-default AFFINE_ENV production \
|
||||
--set-default DEPLOYMENT_TYPE selfhosted \
|
||||
--set-default SERVER_FLAVOR allinone \
|
||||
--set-default PRISMA_QUERY_ENGINE_LIBRARY ${prismaQueryEngine} \
|
||||
--set-default HOME /var/lib/affine-native
|
||||
|
||||
makeWrapper ${nodejs}/bin/node "$out/bin/affine-migrate" \
|
||||
--run 'umask 077' \
|
||||
--add-flags "$app/scripts/self-host-predeploy.js" \
|
||||
--chdir "$app" \
|
||||
--prefix PATH : "${lib.makeBinPath [ nodejs ]}" \
|
||||
--set-default NODE_ENV production \
|
||||
--set-default AFFINE_ENV production \
|
||||
--set-default DEPLOYMENT_TYPE selfhosted \
|
||||
--set-default PRISMA_SCHEMA_ENGINE_BINARY ${prismaSchemaEngine} \
|
||||
--set-default PRISMA_QUERY_ENGINE_LIBRARY ${prismaQueryEngine} \
|
||||
--set-default HOME /var/lib/affine-native
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
inherit frontend frontendStatic native prismaEngines prismaQueryEngine prismaSchemaEngine yarnOfflineCache18;
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "Local-first collaborative knowledge workspace";
|
||||
homepage = "https://affine.pro/";
|
||||
license = lib.licenses.unfree;
|
||||
platforms = [ "x86_64-linux" ];
|
||||
mainProgram = "affine-server";
|
||||
};
|
||||
})
|
||||
@@ -0,0 +1,142 @@
|
||||
diff --git a/blocksuite/affine/blocks/root/src/page/page-root-block.ts b/blocksuite/affine/blocks/root/src/page/page-root-block.ts
|
||||
--- a/blocksuite/affine/blocks/root/src/page/page-root-block.ts
|
||||
+++ b/blocksuite/affine/blocks/root/src/page/page-root-block.ts
|
||||
@@ -103,0 +104,138 @@ export class PageRootBlockComponent extends BlockComponent<RootBlockModel> {
|
||||
+
|
||||
+ /* Page document typography excludes canvas and database block trees. */
|
||||
+ affine-page-root
|
||||
+ .affine-page-root-block-container
|
||||
+ affine-paragraph:not(affine-edgeless-root *, affine-database *)
|
||||
+ > .affine-block-component {
|
||||
+ margin: 0 !important;
|
||||
+ }
|
||||
+
|
||||
+ affine-page-root
|
||||
+ .affine-page-root-block-container
|
||||
+ affine-list:not(affine-edgeless-root *, affine-database *)
|
||||
+ > .affine-block-component {
|
||||
+ margin: 0 0 4px !important;
|
||||
+ }
|
||||
+
|
||||
+ affine-page-root
|
||||
+ .affine-page-root-block-container
|
||||
+ affine-paragraph:not(affine-edgeless-root *, affine-database *)
|
||||
+ .affine-paragraph-rich-text-wrapper.text:not(affine-edgeless-root *, affine-database *),
|
||||
+ affine-page-root
|
||||
+ .affine-page-root-block-container
|
||||
+ affine-list:not(affine-edgeless-root *, affine-database *)
|
||||
+ .affine-list-rich-text-wrapper:not(affine-edgeless-root *, affine-database *) {
|
||||
+ line-height: 1.5;
|
||||
+ }
|
||||
+
|
||||
+ affine-page-root
|
||||
+ .affine-page-root-block-container
|
||||
+ affine-paragraph:not(affine-edgeless-root *, affine-database *)
|
||||
+ .affine-paragraph-rich-text-wrapper.text:not(affine-edgeless-root *, affine-database *) {
|
||||
+ margin: 0 0 16px;
|
||||
+ }
|
||||
+
|
||||
+ affine-page-root
|
||||
+ .affine-page-root-block-container
|
||||
+ affine-paragraph:not(affine-edgeless-root *, affine-database *)
|
||||
+ .affine-paragraph-rich-text-wrapper:not(affine-edgeless-root *, affine-database *):is(.h1, .h2, .h3, .h4, .h5, .h6) {
|
||||
+ margin: 24px 0 16px;
|
||||
+ font-weight: 600;
|
||||
+ line-height: 1.25;
|
||||
+ letter-spacing: normal;
|
||||
+ }
|
||||
+
|
||||
+ affine-page-root
|
||||
+ .affine-page-root-block-container
|
||||
+ affine-paragraph:not(affine-edgeless-root *, affine-database *)
|
||||
+ .affine-paragraph-rich-text-wrapper.h1:not(affine-edgeless-root *, affine-database *) {
|
||||
+ padding-bottom: 0.3em;
|
||||
+ font-size: calc(var(--affine-font-base) * 2);
|
||||
+ border-bottom: 1px solid var(--affine-divider-color);
|
||||
+ }
|
||||
+
|
||||
+ affine-page-root
|
||||
+ .affine-page-root-block-container
|
||||
+ affine-paragraph:not(affine-edgeless-root *, affine-database *)
|
||||
+ .affine-paragraph-rich-text-wrapper.h2:not(affine-edgeless-root *, affine-database *) {
|
||||
+ padding-bottom: 0.3em;
|
||||
+ font-size: calc(var(--affine-font-base) * 1.5);
|
||||
+ border-bottom: 1px solid var(--affine-divider-color);
|
||||
+ }
|
||||
+
|
||||
+ affine-page-root
|
||||
+ .affine-page-root-block-container
|
||||
+ affine-paragraph:not(affine-edgeless-root *, affine-database *)
|
||||
+ .affine-paragraph-rich-text-wrapper.h3:not(affine-edgeless-root *, affine-database *) {
|
||||
+ font-size: calc(var(--affine-font-base) * 1.25);
|
||||
+ }
|
||||
+
|
||||
+ affine-page-root
|
||||
+ .affine-page-root-block-container
|
||||
+ affine-paragraph:not(affine-edgeless-root *, affine-database *)
|
||||
+ .affine-paragraph-rich-text-wrapper.h4:not(affine-edgeless-root *, affine-database *) {
|
||||
+ font-size: var(--affine-font-base);
|
||||
+ }
|
||||
+
|
||||
+ affine-page-root
|
||||
+ .affine-page-root-block-container
|
||||
+ affine-paragraph:not(affine-edgeless-root *, affine-database *)
|
||||
+ .affine-paragraph-rich-text-wrapper.h5:not(affine-edgeless-root *, affine-database *) {
|
||||
+ font-size: calc(var(--affine-font-base) * 0.875);
|
||||
+ }
|
||||
+
|
||||
+ affine-page-root
|
||||
+ .affine-page-root-block-container
|
||||
+ affine-paragraph:not(affine-edgeless-root *, affine-database *)
|
||||
+ .affine-paragraph-rich-text-wrapper.h6:not(affine-edgeless-root *, affine-database *) {
|
||||
+ font-size: calc(var(--affine-font-base) * 0.85);
|
||||
+ }
|
||||
+
|
||||
+ affine-page-root
|
||||
+ .affine-page-root-block-container
|
||||
+ affine-paragraph:not(affine-edgeless-root *, affine-database *)
|
||||
+ .affine-paragraph-rich-text-wrapper:not(affine-edgeless-root *, affine-database *):is(.h1, .h2, .h3, .h4, .h5, .h6)
|
||||
+ code:not(affine-edgeless-root *, affine-database *) {
|
||||
+ font-size: inherit;
|
||||
+ }
|
||||
+
|
||||
+ affine-page-root
|
||||
+ .affine-page-root-block-container
|
||||
+ affine-paragraph:not(affine-edgeless-root *, affine-database *)
|
||||
+ .affine-paragraph-rich-text-wrapper.quote:not(affine-edgeless-root *, affine-database *) {
|
||||
+ margin: 0 0 16px;
|
||||
+ padding: 0 0 0 15px;
|
||||
+ line-height: 1.5;
|
||||
+ }
|
||||
+
|
||||
+ affine-page-root
|
||||
+ .affine-page-root-block-container
|
||||
+ affine-paragraph:not(affine-edgeless-root *, affine-database *)
|
||||
+ .affine-paragraph-rich-text-wrapper.quote:not(affine-edgeless-root *, affine-database *)::after {
|
||||
+ width: 0.25em;
|
||||
+ height: 100%;
|
||||
+ margin: 0;
|
||||
+ border-radius: 0;
|
||||
+ }
|
||||
+
|
||||
+ affine-page-root
|
||||
+ .affine-page-root-block-container
|
||||
+ affine-paragraph:not(affine-edgeless-root *, affine-database *)
|
||||
+ code:not(affine-edgeless-root *, affine-database *),
|
||||
+ affine-page-root
|
||||
+ .affine-page-root-block-container
|
||||
+ affine-list:not(affine-edgeless-root *, affine-database *)
|
||||
+ code:not(affine-edgeless-root *, affine-database *) {
|
||||
+ font-family: var(--affine-font-code-family);
|
||||
+ font-size: 85%;
|
||||
+ font-variant-ligatures: none;
|
||||
+ }
|
||||
+
|
||||
+ @container viewport (width <= 640px) {
|
||||
+ .affine-page-viewport.affine-page-viewport
|
||||
+ > div:first-child:has(> [data-affine-editor-container].page-mode):not(affine-edgeless-root *, affine-database *) {
|
||||
+ display: block !important;
|
||||
+ width: 100% !important;
|
||||
+ min-width: 0 !important;
|
||||
+ }
|
||||
+ }
|
||||
@@ -0,0 +1,410 @@
|
||||
{
|
||||
"@esbuild/aix-ppc64@npm:0.21.5": "32686b20ab425761d802ce3dd814eb3c56962df3041a9694270fedafaa5976d43eddd48d160a33da84311f4b5a6ffc5bdb3cb3310f40be0a043dd3687f5d39b9",
|
||||
"@esbuild/aix-ppc64@npm:0.25.12": "b2cc7e0cd348bc315907f6ce090ee545d4157a19fc44327ff0262ba9296f0fad19c57dd679b1b526a0a18f34f1971b128e15b41bca794c74a9b2c32238fdd537",
|
||||
"@esbuild/aix-ppc64@npm:0.27.7": "848d1a798fb9ea6aa902c9138aaf6b45d889df39a1ff737300ea9968af3afee1000f611bc00187f5bda096d300fb25f4f883c57a2dc7296e40295f2470aa57b3",
|
||||
"@esbuild/aix-ppc64@npm:0.28.1": "98a9325bec976ebe1cbbf2441fdbe895b36733919b9df7d62e7b73a1e199810affeac17d172cc5cf61196c9b1ede8073ca5d088ca52b14800b76f49bacc480b3",
|
||||
"@esbuild/android-arm64@npm:0.21.5": "8fb7c0323debff3c43382ee6e7e2de6cffc57b826917c021ed96c6b9c1bf6dc72736f0a66b261185371a4555d0c025e726b8fe395120a8d89caf392a1726a2cc",
|
||||
"@esbuild/android-arm64@npm:0.25.12": "f770937988ec42e289277abc03800ccf88902684dbda3013a8ab274bb9eca36d35619a75f0f0510e225bdb4c7cf9a426218c7d2641a98fed74287a52d60d8865",
|
||||
"@esbuild/android-arm64@npm:0.27.7": "21a57ee237e1503d92c2f818c1dbf7d6f772b100fd0dfa95ea0d24be718c0c6952e915ad1f47bcc3496bb807a0a254d35d6baadc48531b684d2236f57023f1e6",
|
||||
"@esbuild/android-arm64@npm:0.28.1": "ec3e3c62bc684a09393ca10a0f64b166938f66e4b1972f6db63bf55463bf039736549d9808e50996eb0fedea70744b466aeb816c44e78f2b5d232aeb9929e3ac",
|
||||
"@esbuild/android-arm@npm:0.21.5": "5a77e1f0f6be7d3c4890415bade90f7162946c128ae327113320fea4bae778248efa0bbba763595c84cf9c21c14d7714a6635e9763368f43e774165e162e5f53",
|
||||
"@esbuild/android-arm@npm:0.25.12": "7a5d507aa717d85470c595e11f3c03fbf4f0bffdd10d30f49e1a3f14c2553191f156b214eacd6911fa36719faef23c28be7d88ac876ec300995987964ea16e99",
|
||||
"@esbuild/android-arm@npm:0.27.7": "46a246245a024680c8b5051425fc724c846b7d36ac952cd312e71194bae07fd712aa6fa8ddd7fa648a18d665eb0bcfaf111726af7b676465cb181dff7e6a0848",
|
||||
"@esbuild/android-arm@npm:0.28.1": "cda56884826ac2aa5dd3be5df9e89834df3b46515cf14099ddfc5bcfc80122d4f8d74b3831a0ac447d87dda73ae90fba49dc4e352b11240c2b055cdca69a0a02",
|
||||
"@esbuild/android-x64@npm:0.21.5": "516ec544038a345cc87274352f94e777b0aa7a34486e0e3e29c7ae643877f31c990123da6db5d0e76823e5995e49831ba50a88c78845cd782b669ef9796ddaa7",
|
||||
"@esbuild/android-x64@npm:0.25.12": "cd459b0433b0541bae9ffafd274c57529125719a5b78f4ee92aa9f8a1f54b002a18d889bee19084a503c114412269ef4e740d21b4a2de811ec2a076e96b35f48",
|
||||
"@esbuild/android-x64@npm:0.27.7": "95c858fe95b716aabcb71a0dab9162d46859c0deb713189730ce6c2a2bc27efed2341b2d27aacc092dee7544df7b25035a12d65f30481b5b03a8358707e1a6f3",
|
||||
"@esbuild/android-x64@npm:0.28.1": "7f2ba14ba06fd3f2faff467e6fceb2466cd44d1d6039ae1c01f24336a5a1ad0f9c3721000331ded3f250587e4be5e7194d68dd33c55339dc26e1200e13e16d2d",
|
||||
"@esbuild/darwin-arm64@npm:0.21.5": "46d9832ac612d9bea79da5e1fd6bc314a37cb3ddb9874a7d15c4d665a27a664ced4e1a87c506ae57ba7eeb9f1cc81d529ef7c42b920885b0504dcb0fb2d053ce",
|
||||
"@esbuild/darwin-arm64@npm:0.25.12": "067f4588b9b64c93742c4a8cec35282dd076583006ce8089aae3095fcae5b606a2f60d86caf0527be6009be234178fb83d360af82698e2017a6f9fb9345e084d",
|
||||
"@esbuild/darwin-arm64@npm:0.27.7": "281897d55b71e222394f08ee519999f673778c26ac78e4dacc67262e449b9284e852dccac8d6293fd611e0a37d0c798f2ea18c65573ed251d5e04dcb01121f0d",
|
||||
"@esbuild/darwin-arm64@npm:0.28.1": "9798bd013921f8dc5126eb12eba4ddfce9198d11eba6ae844f66d25919d5d26be2aa46b4da8d442ad0e7673e88b2f3d9e505d71692cd030bda9a7b762921c05d",
|
||||
"@esbuild/darwin-x64@npm:0.21.5": "2959f7d48d1fed22b1d6c5d82091384c5b057e4ad057e16495a4d8de0456b1379c85fc79304931ce3da6e8f30f97ed87fa82d5f2c4560b55c4cc1b312d793b8f",
|
||||
"@esbuild/darwin-x64@npm:0.25.12": "c29947d07adacadcb29092860b69d1b668d9c5abfaf525e2a7f3ece61c3f4e72a95c1c66ad0e80fbf31d01210ae4e8330d4ae6d9c6c9ad2b8aa159eb115f9a8d",
|
||||
"@esbuild/darwin-x64@npm:0.27.7": "a6c320cda3c7c176d678c00367823259b7efc0f8638393bd0e45b4f950af15be887558c82e2d74ed9fb492a4b04f36afc1c3a3b9774aeaaa08fbf96aac6e3524",
|
||||
"@esbuild/darwin-x64@npm:0.28.1": "aaddefac25e025e309c71dc5c7074d8c295f44779e41add06dbf65d48b2a6a72b579266748e7f0ab3b2be1ed07be8d541e954f75dda2a2992f36f4c805d91fe1",
|
||||
"@esbuild/freebsd-arm64@npm:0.21.5": "76c0dfd4c834dd787d5f0d8efab080569a808425271e0df73e7ed3aafd4ad1a9605f6240ac9bd3081da7454f404e3a69c963af3444ea4f272144603aad8c72e8",
|
||||
"@esbuild/freebsd-arm64@npm:0.25.12": "c51691aeb04e41c554a59cbb5ab8d917446f352aeec70e3d5a7f25409e9115ff2db930589052df3e7d60f03eff4c298bda89db62f2408d1a49b6a70e69c5d4a0",
|
||||
"@esbuild/freebsd-arm64@npm:0.27.7": "8b546929340ebb3daf5b47ca24db6d6fdcf3c14a733c41ddd8ae960834a5aa60b22b341049aef39badfdfaad0081a8706d085ba892e2b23163d1d1ff52ca1dc3",
|
||||
"@esbuild/freebsd-arm64@npm:0.28.1": "a325b7833f978b62bf25157ea5a951e29b9b0a1db9665ee52498644c9b250977ab6f21c049137d0a271bb0442b3e6d6148c257bace84476196b46570ce837d62",
|
||||
"@esbuild/freebsd-x64@npm:0.21.5": "d9da321ea3d47065a224924bc6821caec9572d0f2d8e760ffa3946a9039bc577a416fb260660389a923c87751e48e93885b8f6a81ae4d22c11ef7b5eac56f7a2",
|
||||
"@esbuild/freebsd-x64@npm:0.25.12": "9b84c48176350811690751c34d1513005290641923a161f96cb433cbcbb8c072ecb92cef39ba641f48032071f74c6119e5f081b5788242109426c54f3ef1a01e",
|
||||
"@esbuild/freebsd-x64@npm:0.27.7": "5a4c0ccbde7fe7a6de14c8789d1f20f4cadc7980e531b090b137774b56f360ba3c50f5612f01980ab9071ae50e1bb007f44c1b04b68fd84ba07113472081e021",
|
||||
"@esbuild/freebsd-x64@npm:0.28.1": "f092ddacd0bc715f443b62382dd8ba8f85d272f62caa47f603e85b9c5b14fef67c610523006ca88cae19e2829fe41a2a0ae92b7c158ef1038c714552dea57554",
|
||||
"@esbuild/linux-arm64@npm:0.21.5": "d59dcedc7f3a1f8b84ed6c8a4a463172ecc5afa7460189ee24bf53e104fd7f9011c531cd8628c945b9332d7c2444a152005f99014aeeaf0234873a308cb0a520",
|
||||
"@esbuild/linux-arm64@npm:0.25.12": "1e9cc29569890f5944e7dbe2e597eb19d76e85fe07aef6253129b16800ccb5b33a79cea17873d7debdf681d34adf77e06ae99742fe06cab095f3db441b741b1e",
|
||||
"@esbuild/linux-arm64@npm:0.27.7": "741871bea9ce0a136367707cc509254fef167c5bf968706de6bff7db96ee7c672f02231cb69965e17ca0aedbd99d533275f5a695a3069cb3df0a9d2cd877847f",
|
||||
"@esbuild/linux-arm64@npm:0.28.1": "bfda225d3101bb3ed5a74f979d50564a17ccf3799ad65fb968c5b15c9ceb9077c105a9bb5763d42f33f1917ac709e5779cd2112e5420188963568e80ac8439f8",
|
||||
"@esbuild/linux-arm@npm:0.21.5": "d0c932e9e99600cf0ede58bbfa3465c65dc2e96f8eb866ce4008cedd8483e4004c6381e3b953d9de62e3458d98ca4801c6e23cfdfc3fd4facf7437f48e4983cf",
|
||||
"@esbuild/linux-arm@npm:0.25.12": "fcf091d6a51834c9a942ee33b568342990c7fa29d2ff338ce628a41bc415696d09bca7ef502c2b04518973010f73ab3d13e37096030db9c8d393ab29408f104b",
|
||||
"@esbuild/linux-arm@npm:0.27.7": "c2ee4ae5f6e13f8e882da4a369cc5d672ae8bf7613e35e22b54df3999e0d5aaef6d704c7dcbc473708eaeee202dd8e892c37e791bbc50a509b23ae845d18b689",
|
||||
"@esbuild/linux-arm@npm:0.28.1": "b440cf89adf6dd1079bcf7d9aa915f70f467002bbb69bda21f4a3d160c9ae93bc6d8eb73b2831c8607fb1527d8ada288d907440e36969cb60000e4df85b7c549",
|
||||
"@esbuild/linux-ia32@npm:0.21.5": "75a3b5002159c9082565fbf75d3ac59a429f60867bb41f34c27745f181dfc90ab6f9990e1ac79ceb66e0b49a5612683fe1f2b28c18ce353584024fede5ccf4f2",
|
||||
"@esbuild/linux-ia32@npm:0.25.12": "ccd563c3189e5f651b479dd80d3bebd9d5c4747ce7448bb80266c804c3141eb3514b8c70445d77301899c54c1ff8c74614f8423704fde475a5c67efe86713235",
|
||||
"@esbuild/linux-ia32@npm:0.27.7": "0933a68b0bdee3dd0fcd99da92c0472deb6d6225c454b88a3609e1b1ea7648b36f6b83be8a8cf41edc1f0d666b76006e270a66c7520050d278d7d73df171e86b",
|
||||
"@esbuild/linux-ia32@npm:0.28.1": "4329d81cf06331e537c8ebb571a9d4ca968811bee7c7cb4f975b8343c9f7649a8b2b9902b0974be0e2224656b1a0d21f3b191304db8cec52d006b80061faf4c2",
|
||||
"@esbuild/linux-loong64@npm:0.21.5": "061e056bfcb779d8448c96589978b63706545ccddaa2e973e3ac2244b3b89bfe80222191f9dcb17e0371a125559437871e008a7f7573b78183a75ae4d7ada20d",
|
||||
"@esbuild/linux-loong64@npm:0.25.12": "6df2710d99d84006ad8151a9ca26861dbb97524a15e61f56eb1a5a76786865ad03be838fe3d414a72b239262364964528f3136c2965b3c442c7ed85090b145c4",
|
||||
"@esbuild/linux-loong64@npm:0.27.7": "9609e94b603a8a68bcd60325626d0bd35cce37e75994729d4ea264fa865db201da64c3216004656d94b1edeb8587150b1c47a1eef8ee1af9dc0d3cd6baa5ab2a",
|
||||
"@esbuild/linux-loong64@npm:0.28.1": "76b4d0f2cf716576181065e3fd2d6ffa9b0d0c39987e8d3d1b8d1e8aaa2563779cd4f861c881e3e7a9302f2d03d5543b8f726a99603e6aa754c8154772d0f434",
|
||||
"@esbuild/linux-mips64el@npm:0.21.5": "69b383e28e16a90d84bb39397251b4f0ce7d427f4511bba8b53b003e178c6324f27d834c02a2cd91a6576fe2f3fd584aae24608f475adc3d1d12b8b4a2682eb8",
|
||||
"@esbuild/linux-mips64el@npm:0.25.12": "883bd8c4afd70b8e372db8a6bdb429d419ae30253a63987ff824994958d8431b6e51ead05e6372b2a233e025ea57f6f65b04ebaff8308e39acf54bfa73a5cae2",
|
||||
"@esbuild/linux-mips64el@npm:0.27.7": "74ac0fe0b857b926af9057d5fa9634fc4b0b61a6fcd9c13cc2917e0e66638e2f724b8fd82024f97d524ff54ae17d0a52a0569078639aa9907f5287514aa046b1",
|
||||
"@esbuild/linux-mips64el@npm:0.28.1": "59825a73d04187818c6fb53b22e2915a4c0e6c8fee9017d75dcafbdc66699f2765377faf801495d69952230935557f58360481a7edd78073816270aa8bd0cbee",
|
||||
"@esbuild/linux-ppc64@npm:0.21.5": "2a2440ba72107d7f6444b3621ff440cf683216f7d8f8b7d08b839fc7739f927ab759e2572f3b4f755e9d9fc0b4e467e7cf7ec5bd1bc2a0df0a34e495cb6d8244",
|
||||
"@esbuild/linux-ppc64@npm:0.25.12": "71f8544a3b99b4c95d49604b66d144e9617ae9925914c1bd5bc6731d15d4e48e7f8e9bffd85835e1c93a88c3537b53f3e99b500e4dd2533af9483055b02f9d38",
|
||||
"@esbuild/linux-ppc64@npm:0.27.7": "7d75e59ad798631b7b7f77471fc9f545e0e6d2959a52d57b77e92d4aba81c5c57dea558d22539edc6aca92ac72112f93381e163b996df193cb5c9a1da4b4230d",
|
||||
"@esbuild/linux-ppc64@npm:0.28.1": "3186d54b33d9b4849d6fe4fa2aeed4966a4117f9a27bf2d59f07f3ea651a9724a2eb9aaaf98813aac6dc726710a337bfc2472dd714262894fabf498a369fbd74",
|
||||
"@esbuild/linux-riscv64@npm:0.21.5": "c2fb957b701c5338deb58579fb01d4af1ee4907b3f8c20d49a13424fd6831c38f9ffe2ef9c005ab09e4d3b8883417b1b828620a6f2d4d9e7bf1ee3f312876e44",
|
||||
"@esbuild/linux-riscv64@npm:0.25.12": "fe8048262c5c6a040c047a9b7ab8547b0e7a32ce50f622ea8dadc3ec22065676efbc9b36896ca96959f77839757319633a2d05af5f2de7b32389a03b80f027f1",
|
||||
"@esbuild/linux-riscv64@npm:0.27.7": "6dca2a182f59d43057ef40b93788dfb265c3b9fff4738aa613d87c7c709d9c308f18c282b7cfc2a1c770fa4db78d3529dc50b8a9f30e415661d993b021b2cdcb",
|
||||
"@esbuild/linux-riscv64@npm:0.28.1": "f01572cf6398b466d44bfa68dbc5f56a37b74e645673198f7ba157d215ccba35ea46e220a2526008d5679cef47a4368dd46480d4ba4c7330a491d215fe3f649f",
|
||||
"@esbuild/linux-s390x@npm:0.21.5": "0032972091f05ed09f516d1211be7badee34950381229fab61489b1d454d4452793a86576f639d4d4088a2ef299ae1c247aa531ce02411ce036c53319960646f",
|
||||
"@esbuild/linux-s390x@npm:0.25.12": "e5c023be1dfd75c915453763f944db8ab3da4f60a00c2b0e6f3b9349bc6c51e5ac5ce928db56e8f316e910213adf2172efd1b37abe070f6cda0c28583d770bab",
|
||||
"@esbuild/linux-s390x@npm:0.27.7": "870de4b9ff155cf5cf2ccd7b3587a6b4170550a31b621ea11dc134cd48af95f4a30f4ce868d249967eade6b3dd66e7a0af0d542c6fbba0dbc473fd0f5d3299b0",
|
||||
"@esbuild/linux-s390x@npm:0.28.1": "aad20d457c0441d7bf2f6c8dbe74297d4c3a3c90cf709a971a4a19b2c70497bf91ac4a80fa6168ccf6063eb284ea0f41f2293283e8351348369af551ffe6f3cf",
|
||||
"@esbuild/linux-x64@npm:0.21.5": "50e6de2f5f14b5c7d8ef63df7590fa526b5ef8a879280039d0afe8ac4ecb05fe3c3ce3cddcaa9c5143d7a362afccc70a6fc02dcf391276992a07ef2025f4a678",
|
||||
"@esbuild/linux-x64@npm:0.25.12": "8b2c7f5e00c40058f5c150df267cd303eae5907822f196902cd8e64af70475e800a7f132ac6388aa2b77b877d6314147e67f3fb67d97c867adccd54a2a6caaf6",
|
||||
"@esbuild/linux-x64@npm:0.27.7": "47fce66247eda2d4721c1e615f7169eb7bf6e4b6105eab7271391ce933e7d350d3d4a581b3b8a61573f70b6663268eb514e624875dc514dc56dec3a37cf7cbe3",
|
||||
"@esbuild/linux-x64@npm:0.28.1": "d361ac73388af397803dc26242265c8f00fce91d9dd587b04d230c686294585c541f43dee706e23f8d56754e3a3da653b00b3f55855182d60deabc024acf19f7",
|
||||
"@esbuild/netbsd-arm64@npm:0.25.12": "19bc5a1295697aa8787929472323494302d117ea1e592f17cfae443525c1e5917a5f77e6582fc1ec9de3a11a9e296bc12749c6b12cde0aab10695b5c25f29f73",
|
||||
"@esbuild/netbsd-arm64@npm:0.27.7": "bbe0d0529fb73fd38c2cf9ebc1d1dcd5a2586b263cc4f6300d37008955f45310e842d63153e361a4447d4ca0f0a0691d62013fe60b09e4e0cd53f428ef2266f3",
|
||||
"@esbuild/netbsd-arm64@npm:0.28.1": "73e2d620958bcb61367849046397dee40dbd9bd6d0d4172bb87ef90ad644ed16e48386debd1ef0323648358fc617c0d8fae58be984774a2e8622712c7ab7f04b",
|
||||
"@esbuild/netbsd-x64@npm:0.21.5": "402903d2ed923e78379d2a59fb7c7d6be4c3c44624dbfeaa9fc49e378f420bd2560bc22974018c6af5ab51fd80623abfbc0c49ee7f6422e977c60a7350866758",
|
||||
"@esbuild/netbsd-x64@npm:0.25.12": "8eb2ff51aa39b43a021e4b51411789b6299fd0dc38b3896719684333e32fd42ed4508ab67dcc88435631e5333573a4848dbfeec12569de46c2318dcdb39ad3ab",
|
||||
"@esbuild/netbsd-x64@npm:0.27.7": "246ed4df55788aacd2d9146f51ea7fcf4715e73d32ca1b0fcb42c316fdbf21d8de03bb304205dc707942442899529e834466894faa0aa3fa40454f5622648fc6",
|
||||
"@esbuild/netbsd-x64@npm:0.28.1": "663a35913d3d3a2f566d31ec00477954cc570f386d56a5ffffa1d7bb58bccfbe241780fc429c2e41463cef5d1d422ca02fe174df970932b46d225ff0bd333b65",
|
||||
"@esbuild/openbsd-arm64@npm:0.25.12": "5ff26a012d0d35673bc3800d28f284a62c310801a68c55b2d1ed8a7e09ef7568117fb8ab2d7ec7a6e7d73ce6a9e05150ee07335fc6447ba98658469b9da1cb2e",
|
||||
"@esbuild/openbsd-arm64@npm:0.27.7": "d99927053a0f8be5158da8ecde7e8a08dd0ea580ca93f006971730979681e3738f83ada4d6564a57cdd6f412e40e5a750a92f424807aa12f97c2ead52617ad41",
|
||||
"@esbuild/openbsd-arm64@npm:0.28.1": "8add19644eca9a23cefc2a109644df802c626cc3460adef6f030ce72d1fcb127a4ff2b14a21cb51bbd68ec5a652f0bd7105c1a0d76a30f44fbf822c010096cd9",
|
||||
"@esbuild/openbsd-x64@npm:0.21.5": "730d70e764a357ba3c2696eef3bfba726368940a24180db7a47bc99259a2bf92bbcad51ddd102077a5f3edcee3a0284b13407fc85b9e930083d47d182ac7891f",
|
||||
"@esbuild/openbsd-x64@npm:0.25.12": "41dce65493548bc0dc411a6175e9fb109a93bbbf370ef444d1459698226ad2a3096ab7edd420c27eb3d15e6bbd0bc79357bd7c0a59c5527ace0fefac181638f8",
|
||||
"@esbuild/openbsd-x64@npm:0.27.7": "1480ff755c727d056e5f37e1d2be83d36b137c9f3595911aaf1659160c2cbfea846bded0557017aaefd79a0322be5e381b168ebff3eec4af684198835504b051",
|
||||
"@esbuild/openbsd-x64@npm:0.28.1": "ad12be1ed38cc61410aa6210f88b8aa8dc3e6ee717dce32dba6e7cbaa57414af6e5314e7cdf9baa4affafe2d6a88e230d361a0ddadf76d06070b63bbf0a97cb2",
|
||||
"@esbuild/openharmony-arm64@npm:0.25.12": "b3e0502067e760e5b92d3180e20372cbb2dba8267fbb56206d50bdeccd8895feb408020b98c3f17054eea0f1fba365385850cb91d1f79a25dfa3751032278825",
|
||||
"@esbuild/openharmony-arm64@npm:0.27.7": "6aa1fd102bdfa99b3c27f558f6b5d493b47f34260cc10967c47d44b86018a307377e0c70ef51b8886c592f2a0057710a8ad7781716b0eb059d0b0657b4f7ddec",
|
||||
"@esbuild/openharmony-arm64@npm:0.28.1": "5ecd637058887c8458ebc7e95c67adee2397ebd8e5f6c302c17816eeb77963b1feeaff4e3f7823c0d85f0fc10771caa96175e2f0909b00e60ca5d90d22690a15",
|
||||
"@esbuild/sunos-x64@npm:0.21.5": "0b221d990047d0fb7eba544d5e807f5d8a77c5ae527f7b161411ca8d8f2375b41fc8e1cc855a0af27ccb8d766c1972b83feefa47e23720c5ed06851cca290dcb",
|
||||
"@esbuild/sunos-x64@npm:0.25.12": "50ed9767e00ff74a1d98d94c5fe6027bc5e9e095a64735d1d0676ec72adc4b15b0095e97f5ac71602f2c5fcdcf3e9f6cfe005315e998d9d3e12ca93a2076b639",
|
||||
"@esbuild/sunos-x64@npm:0.27.7": "66bff01f90a97b989c6e6fbe6f8df77a0e5b40b57b8c4d8e6c407635546eb05553de570cd4e0d4624a5a6be8a61d7e9c6e7d8bc238f8f5773a4231361c0e8745",
|
||||
"@esbuild/sunos-x64@npm:0.28.1": "e3286191315e30471e9cc176281a5d7acf5b877a95ea2868195024548a984e08b0214ea90e504e5bb5c595f9d3da9a5b961b52f79988702036b59233378580c4",
|
||||
"@esbuild/win32-arm64@npm:0.21.5": "67c5d6e44cb3698822d0e1ff8f9050236109fdacdc7c636b1373ec454f0b5303bb04209c476f9ba87ba7269cf99d853297076fc4e63069d8139431fd3ba277ec",
|
||||
"@esbuild/win32-arm64@npm:0.25.12": "4969d20da28a0c783ada6116724f51a542fad81dab043c4f6f9b7c8f4a68be558f03beb29d75bd550ab6e63f720535ebacb9ce1760099be7a63d4e1ec8351e2b",
|
||||
"@esbuild/win32-arm64@npm:0.27.7": "eb7008345c82bbd4be30bb27ae4e17346cb5014801e9d50058984e7c5e4cb509d6eae82db3c04aab16b72d3829908b32151117222c107962fe3fb0e317e55951",
|
||||
"@esbuild/win32-arm64@npm:0.28.1": "55e83fa2b63511bc3d2138ff84091b452936072b5b8e24405a5669f04355263b3f452861c13fc0c01ad80ebeb0df069da0318631386c9d66cda8ccbeca0fa82e",
|
||||
"@esbuild/win32-ia32@npm:0.21.5": "9852288b61dcb07ad3fd8f190ffbacfb1967d3ac62cf2e49b4947e9061e0675a6a01a32a34d978919d0af98af5928bfce67cdeb24f1339677642af56a2ea56e2",
|
||||
"@esbuild/win32-ia32@npm:0.25.12": "60ce7d21c5e01c8b0c8c2c4660ff6d890a32b1acf09f5499f950a86bc5c6da17eee760c6bb7a720a0429f7633bbb38b2db517e444408d8a6ff6fc76157310980",
|
||||
"@esbuild/win32-ia32@npm:0.27.7": "b6a44b5b6bf670cbe86de063335f03faa308d5b3eabbca1f5078bba9674ea42d3d6ad9fb9601fb0c7abba65d4b4a467f20473aedb856c9544c20166c75538029",
|
||||
"@esbuild/win32-ia32@npm:0.28.1": "dcd2579f97b8b5217e807d3a069461635ff6c1f13bc6e678fb0e385db4bf569afbbfe9f54ee512f0e120c6cc2689889725b8e2efdb17e3bb1603cffb58a4b6b3",
|
||||
"@esbuild/win32-x64@npm:0.21.5": "1da60e3ecbd743a3ce0704d09904bca9c544fe38f121171cc6ee60fa33a9a6062be17b468f5796c18ea4e93e1cfd4a4ff7a1bfacc9102e9c287238fb560646d6",
|
||||
"@esbuild/win32-x64@npm:0.25.12": "bbdc69d57d85a6b8af85731c0979186aba54eb34c8d1de5eab4aa1d8fd45e3b38b5426c287cedf43228bb0794a741d9b2c55284c7db7d79335bc33dc389e7bb3",
|
||||
"@esbuild/win32-x64@npm:0.27.7": "4b91237b01e7e1a5083d2df524bb2ddb13da334197681fd33ad05975c073ccc901ea6b9395453276557608e5858cc032ed12807cc156c29f4ce7d2c63e04d5a0",
|
||||
"@esbuild/win32-x64@npm:0.28.1": "1d7e7661663e2b0d814550e461fd06b814b3ac1ffda1e84468da3b7c29a1ad8a6067a8b7dcf6e66e38918b43a440c6302052f1bdb40c48a6d49a82c616e12f2d",
|
||||
"@malept/electron-installer-flatpak@npm:0.11.4": "96d1531f0152c2feb905d019d637af21000ba518465d5336496ce969a695225f1353a972438a091149f3b951b46f7b33ea696bbfcb0511e2d31ae682e08aac9a",
|
||||
"@msgpackr-extract/msgpackr-extract-darwin-arm64@npm:3.0.4": "36305ebc03362118246cfca950745c74f761e78b584a4115197c8629416b2bf0b0c781e443b59b42aa37f59a8aaeb3fd4fccc506dd9e9d8e3f7ae5c9cc0ae9d3",
|
||||
"@msgpackr-extract/msgpackr-extract-darwin-x64@npm:3.0.4": "0f8088190afd848a029b894dd435e8e7fa901270ac6e4be34574367d283d49b87e9f55187f8fc02416d126f3d3c797dab68ba018fc2b2c5fdf716b63679f5f43",
|
||||
"@msgpackr-extract/msgpackr-extract-linux-arm64@npm:3.0.4": "efce555d0b84941ca726dfb1dfa80a8e2723dd3e6ee57ab3f9c1a1e24e973124b9f4bee61f9fcafaf84c6efc8b19da2e64b183184231f9191daffdc3db078182",
|
||||
"@msgpackr-extract/msgpackr-extract-linux-arm@npm:3.0.4": "6a0cf842aa3e9847866abd632ce070dda1f781c225d3bf5732076410a709fb1b2d8ee290832bb261177f764b8d8e7f2553349813d3ae68704c48e80dc3909dbd",
|
||||
"@msgpackr-extract/msgpackr-extract-linux-x64@npm:3.0.4": "14e67f734f034b27cf9937179471d20163b3cb49ca0771d8d5ec65287bc485b3e71d0aa4981b8e04bacd34c59afcfc68058c4806faab0e9c83151f081e6d7d82",
|
||||
"@msgpackr-extract/msgpackr-extract-win32-x64@npm:3.0.4": "382d4d9e2257a4e1b17cee7692dcd68666782211541a705971b2f3758266d6c1d2b090352265acd7fb226f745d0c15b309fc35d129ef4b8579621bc16e9f461d",
|
||||
"@napi-rs/lzma-android-arm-eabi@npm:1.4.5": "0549b9457d5182c503b3e0f3bbad6bbfbeec7dd2ddd8a5f24bb1d11224ae5e0b22725f497845fcfa00e7dff57c028f346c9c62a05cf4f5553898edfdc7f8c1ce",
|
||||
"@napi-rs/lzma-android-arm64@npm:1.4.5": "a87eadc74f5237726ec87fa4401d7f2025f26350f2d2988bfb63fad1fc15c883590ed63256fedcc4626fc32651a9990f5d065d7f82e9470a2a729f622255a178",
|
||||
"@napi-rs/lzma-darwin-arm64@npm:1.4.5": "328c24970fada9f28474f465cad52c4ac421b6e08122341bff9c7fb366aee8cbefb9a6d6d92006bba1951e092dc0fb5c1ebc9058485adfa5392fb7ef2a8058cd",
|
||||
"@napi-rs/lzma-darwin-x64@npm:1.4.5": "48a7266ded054e056c81380d84170f869d2d31e1f7b59e254bb2b09caf2796d3466340ecbeb89300631e6d4b041f5f1d4a6b1003107bc151d3295334e1810a81",
|
||||
"@napi-rs/lzma-freebsd-x64@npm:1.4.5": "eb7812975652fe7a1439881d811c91ad7f37755d552cc3c89b26a004b0a7c10ca74630b52614fcd98409799b5f65e359ecb2cd389512fb595b09fe85522079c5",
|
||||
"@napi-rs/lzma-linux-arm-gnueabihf@npm:1.4.5": "81000e35edfcdbea4227dcf53e360e518d4d6991a10f8577b0ec3e000d2ea16bd91ae884160b22c30166a9629440b4a4da3f315a20c7cf70e62e914b5e7b86fd",
|
||||
"@napi-rs/lzma-linux-arm64-gnu@npm:1.4.5": "cd5cdfa5b04aca846fa021cba4131c4d5b656afe2f57335bd75b6eb9dd782dbb29fbcd82ae98c8569743056ec3d36d4ad6b3500845444bbe2bec9139554719a7",
|
||||
"@napi-rs/lzma-linux-arm64-musl@npm:1.4.5": "ddec7c0aeb26b8431f19515997b6e4e88e913855f3e7f3700dc6815c848200b319bc33ce6d77fcd7fd8bf928951371c0b8afd182c49612d8daf659eb341f625c",
|
||||
"@napi-rs/lzma-linux-ppc64-gnu@npm:1.4.5": "ac5412fc04b4c10bae174cc69279cc5f40df5dc73237242c3922f391da5bfc004c58715c200fbe34e4ffce6d00bb75d68b7cf454c8abdafdb6ee2ba3f92274ae",
|
||||
"@napi-rs/lzma-linux-riscv64-gnu@npm:1.4.5": "2481417fe54ec420f1539196ddf67010879400f2bed4a69fba9280fb5b27641e1c9d4a8ee288fc02e0c68cfb6a8f5371fdaa3d4623e175a58b54f05fc619ae48",
|
||||
"@napi-rs/lzma-linux-s390x-gnu@npm:1.4.5": "11ccf4c294419822f4ebb499a2ea7297a38df8b7c2f5b5f8eb5a194c1e6fe10fb2828054ac179ac1f6cf570d5a46f0a953b1279e4214414e8a18e2761c514a3b",
|
||||
"@napi-rs/lzma-linux-x64-gnu@npm:1.4.5": "3681e27f088689d0aa88a89ba151c2b85bdb4a2c0b707b316cd96ed37cfbaa96191b13698cb82e01e74a795f577f57ed31adab20665d6bc409afa9d72f3fc9cd",
|
||||
"@napi-rs/lzma-linux-x64-gnu@npm:1.5.1": "f4213695edfef774b65775f7e6ca25b7588d09e1688cd06bdb1e05d6bc5f444187240cb8de1c43798df4a89c7e0d7ca4bf015dfffcbe228b32966446f66c45d0",
|
||||
"@napi-rs/lzma-linux-x64-musl@npm:1.4.5": "3f8a04a6abc507aee9c18186dd5ced1bf9c7ced3fcfad4c7355764a4d6d1b2685fd8a1f41c315d1134fa818a2443c547a0c9588b4bd327a8ae53ef71bf40e23b",
|
||||
"@napi-rs/lzma-wasm32-wasi@npm:1.4.5": "fed6ac511c3198cb167c8ce1464dd858b0e7592aed62a73b99a65d16c434b714766335e19a85a4d96ba80be1389a6552c0c255f4382fe9453899398eb7a5a3da",
|
||||
"@napi-rs/lzma-win32-arm64-msvc@npm:1.4.5": "bf67748c897266e13e1269ad9a8000311172a12deef2e09751881df3502cdf2e3bec197d6c6acf31c2619956a6765c5809b32ddd5d51eab8c3df52f74ea6649d",
|
||||
"@napi-rs/lzma-win32-ia32-msvc@npm:1.4.5": "b8ecca0c80b6541321d703ca29ffb9d310180d7d39b31608808dadd9975735f5b3f838025cf6ca25a3692611cdf37de46ad5768b2608b59a9eefd1fd04ce9e8e",
|
||||
"@napi-rs/lzma-win32-x64-msvc@npm:1.4.5": "45b1cf1b270692ca68f44f7c4e6d6bb68810330eb2c1550e6f3e143b4453eae00a7171e03b703c8615d8b9e60caddeed43b99fde35fc1718d7503707ed6a07c8",
|
||||
"@napi-rs/macos-alias-darwin-universal@npm:0.0.4": "9a6128a26aac7a8fbcad04f0658181c9d9e6b221e8277fa9daa33bb2c4e241f6cc3715c82f2c722a827b42607399e53bb75943bf7865c561d003499de4a42cf0",
|
||||
"@napi-rs/macos-alias@npm:0.0.4": "51b240631a98f97d2a02701456c19611a157ba2e895ca9b82c387371db1fa61bb0e59aec49839914d919aeed213c048991a0a400afd85bd532b5f60f1f53990f",
|
||||
"@napi-rs/nice-android-arm-eabi@npm:1.1.1": "33d4858a5cf17156d7b7a33e711db2c45a597ad7b48216d09543ea722f357930c3c76055090f507087d7cafe695ec24b5c8d90f080e16fa5464b28d631ce91f3",
|
||||
"@napi-rs/nice-android-arm64@npm:1.1.1": "4787c3fc046092f9b9e70548ba6861ba7000962ee766f016d644ce8147ea6b2ab4cbf421c19cfa3e969c53c9465ba249f3f41b3c3a7667d55216fbf674a8467a",
|
||||
"@napi-rs/nice-darwin-arm64@npm:1.1.1": "97a4f095d9cd18625566283cc55563c6867d54e501bdf0f9de9d9ab200039065b2c6e7100f408916a2cfedd03eff4846d84658d0b75ef5f2185a56edb1f90b49",
|
||||
"@napi-rs/nice-darwin-x64@npm:1.1.1": "491d47c602471c39c40a7d57865e8c74b741f426d9cfb8d1feadd79bd22987d16be915709e43df88b2f428c681c70b7bbe68558714276db41ab19ffcdcece382",
|
||||
"@napi-rs/nice-freebsd-x64@npm:1.1.1": "adc1ec4ecfe6565af4e4f0e62d757d0f6e3f7d9093df04213cbdf4e697b426f70dc25b7b37f436d8590e8d63bbbe96d4ab88d3fc9720399f20f48aaa36ecfd1a",
|
||||
"@napi-rs/nice-linux-arm-gnueabihf@npm:1.1.1": "b564855f8d926da3605e33d7af42d968e254d7568aa455ea03f6e377f05d526503d95a3680971af189fadd044a12c1ad337cfcaa342bb158534119920ff5e661",
|
||||
"@napi-rs/nice-linux-arm64-gnu@npm:1.1.1": "2476fc9152ae1d90807fe465ae39020e60e832c7496a93bb8c38fd339998fc241827a3c2c450d1c4efae9549f69e18d4c680f2c12d235e70a7c66b7805cb7824",
|
||||
"@napi-rs/nice-linux-arm64-musl@npm:1.1.1": "31525236d1a7161432f08e68eec21aba5a9942c9948372fb5c9bb56e85093f898e9adb3c527265493bc80b8f8fda1660141ec474fdb2d5fd286d9e426b8872d6",
|
||||
"@napi-rs/nice-linux-ppc64-gnu@npm:1.1.1": "14713db6f752d40536847c50b25b53dae2fdab96c8ec1bb2075a096b7fdbe58b89d865f642d9243bd48546b96ddf57a9958c201fba994e4359bd8399b05c81e6",
|
||||
"@napi-rs/nice-linux-riscv64-gnu@npm:1.1.1": "f6244e5ff5aa68dca7900bde5594f927c8fa386b1bec799dd11ebc4324e5f3649d3748cda9ef273f12a0cf506028060e413a3b7795750d63c6f8b4b36bb44596",
|
||||
"@napi-rs/nice-linux-s390x-gnu@npm:1.1.1": "c409755c5828e37110c967ac05ce692821280ecc31c0b574ed8a6cc5d0032e29b00822308c23fb14d0ccd623e3296eb4614c6ed103fc104628d96f0ffb3907d0",
|
||||
"@napi-rs/nice-linux-x64-gnu@npm:1.1.1": "ac48230959ff84626ab9deb1d9df8430c2d1ecdf0d00df4fa5713a4908f55fe14c237348f8d3b9812cc2c5343a3549733ef6d4d00142338fc74d73551a7540be",
|
||||
"@napi-rs/nice-linux-x64-musl@npm:1.1.1": "220254f81f341c8ac41df4d2b90ca77b3b470606b39696afca88c1690e63d58df436a31ada3e3fc71d6ae68499c029578acd5af936f5b4cecec3ee6ffdd2c573",
|
||||
"@napi-rs/nice-openharmony-arm64@npm:1.1.1": "290153a9d99f241a3784aa8344af208131fab347a72f4ed5feaf17fdf368982188506c3ec3debf766d8238da7eb5e7db6a6c58e24df5625bf0e107c7062ba60a",
|
||||
"@napi-rs/nice-win32-arm64-msvc@npm:1.1.1": "24a1b64d513692e7f10176a4d3edbdd96680b7b06f75ff0e14d9d1e8d840ef5b1df76149b1024be3ddec739c73e67be8df2a21499beb450f54de72f12a46b989",
|
||||
"@napi-rs/nice-win32-ia32-msvc@npm:1.1.1": "228cc9b6664e88a2bf78b6e1d766757707a30bcc211ab57df54c1456f98b63e60687590527176482fea81cadb1780232c7d8f336155ddb9b924f3a20f1c250a4",
|
||||
"@napi-rs/nice-win32-x64-msvc@npm:1.1.1": "0425b8bd6226b31b63f7fb9dc459962c8c85803e123f972c44a103b95f5eef63e324392f26f92932b319a1cb764682c926647cb73de393805f3a9ad8f7434926",
|
||||
"@napi-rs/simple-git-android-arm-eabi@npm:1.1.0": "d7721d0d80b0a3ecef63bf4358265c8a4f0651d945f82c50e092753af776ff513f8a6ae2eb3d461845cb5323d2321d245a6bac0b529006bcd70a20a2d091b9f7",
|
||||
"@napi-rs/simple-git-android-arm64@npm:1.1.0": "dc62774732f1eaf55c4554f1c0e852701d17c6ebae687bffdfd7aea856450738d16564a6bc30250366d785cd9de68c3909dad5c666d3bd099289d1fae1e2acfc",
|
||||
"@napi-rs/simple-git-darwin-arm64@npm:1.1.0": "5d4919a1cbea38626c1d52f1d20ab883754eaa819268853ef19d13bc0c08f63edf687fecd124a1c3fdf11659ac36baba5cc7fd766901bbf455854481530b51b7",
|
||||
"@napi-rs/simple-git-darwin-x64@npm:1.1.0": "73fc8b2bca6dde23e674d21d7e7a187504c86df8f4eb54090242c8f42233a704e86b1a9b4541711759d9d4135fe3f6ed8228c25c289cb083091ef409614e66c4",
|
||||
"@napi-rs/simple-git-freebsd-x64@npm:1.1.0": "40422903bbf6ce5d31105299ca31b52ed98cc1485f760abdc2ec62b92bb1365a6cc31d82baf75f51f9ea068c6601000a6ca91b1f871ee783e2e1217a8dde6c50",
|
||||
"@napi-rs/simple-git-linux-arm-gnueabihf@npm:1.1.0": "7122d9b7b2745cc05aec010ef331f7434bd28fb82bdc3d4daf9b51ed82c278952e7a4b6f39558f2a6a45d18adb78e5a258cbb5188ecc21580336f815f10d3396",
|
||||
"@napi-rs/simple-git-linux-arm64-gnu@npm:1.1.0": "18e14c425806efdc9576f276c7a1699493fc76c10fe4301dbfb84de49f86eb331c2f8f1b4df312d8967619b78063c97507992d374c00c7353bba434917269ed3",
|
||||
"@napi-rs/simple-git-linux-arm64-musl@npm:1.1.0": "e8cfa3f3705e295e4c331560334882007f39b6457f1c43931e95781cc9b60348889ef400d421b183e2427e45b0b083ccfb572e59a0c8fdec7e21421657771bcb",
|
||||
"@napi-rs/simple-git-linux-ppc64-gnu@npm:1.1.0": "42a41d0032f719e236ea92e2ff3651c1fec84db0ca064ef1bdc60b3d48d925deff394d0d4ababd0c3a9f5089cd5b38e9b571213c475376c2537cbeba5763ba50",
|
||||
"@napi-rs/simple-git-linux-s390x-gnu@npm:1.1.0": "e23db045de5fc9463b6d9dee682d1195e2b657be39906700acf3a42cc2dd3fc47aa1eb4734f7bfe5835d45abd422922fd647d70c518cbba52bff189e606d3523",
|
||||
"@napi-rs/simple-git-linux-x64-gnu@npm:1.1.0": "a5535b9faac69cd987779a15df7e6744ac796d3f1592422fa50c995813acbb7b3fa0b2d6886358113dce258a5c73bfc1f70818776ed6bf16634ed9ca98c14177",
|
||||
"@napi-rs/simple-git-linux-x64-musl@npm:1.1.0": "2462a35f72c6acdc4b6c4ed483afd0d13787892f5bd7e0f14100eb27b41bab8327f2d501cf8748315dc9c7118da0f0886ce641588ed6a03feba68b54e047223e",
|
||||
"@napi-rs/simple-git-win32-arm64-msvc@npm:1.1.0": "0a9a96da3586fde289e5949aedd740e53f5ee2434842f5964d1405c33e4027189df089ab66087c83b906402fbc3abdfb34834633bb4fc7203c9ab66791c34293",
|
||||
"@napi-rs/simple-git-win32-ia32-msvc@npm:1.1.0": "a3cfe938e65906b6a6b8e172196d70dac1538ea78cc39824812831de06699057f18159c663753168a83ed2a8d970328e293904d2a6a1065305c71652cedd897c",
|
||||
"@napi-rs/simple-git-win32-x64-msvc@npm:1.1.0": "b518b38e90884f1e166035e42e339dc847ad5fc684fccc923fc5ed627b2c43ee631de6156e471813c1fe3261b702858e8be56a3e84174405e24ddc3ce437391f",
|
||||
"@napi-rs/tar-android-arm-eabi@npm:1.1.0": "cc84995061e302eb666779e0ee581e50089a9b8d21737c09c5b93e5a7200c251c3f414d46668155e45eb2b4a8e53d5164acb7a97bfd3f9d641615b64fa65267c",
|
||||
"@napi-rs/tar-android-arm64@npm:1.1.0": "3dcf98154dcd68d3a2a8cbd97bb106fce70042d34f409419ede3baf409c5c4df7b540c1b157f67c8c4fc73aaa716b1759514e3444fc2c0bf28a50f8b64d43746",
|
||||
"@napi-rs/tar-darwin-arm64@npm:1.1.0": "321e933f9de0d63510a2b03f3a27cdb6c730118fc9b7fdf064df2d5a1d5384439e40f9ff1cbdcf61ce9554f2a3c0d16dca9117fd083b32a50a8e31985271462a",
|
||||
"@napi-rs/tar-darwin-x64@npm:1.1.0": "964691e9d53e91343c734d2cf6bbdd1cd6310f99dcaae74516989a94881052da253a8e13f677c05b42844caee93eadc30fa826394de286d934b1b3e1e154c3bf",
|
||||
"@napi-rs/tar-freebsd-x64@npm:1.1.0": "3b70cd40e9029075d659798aa8a65e0c34186938afbf10dce0ab43ce1c543bcf919ef1be3c1c855d9e7c342dd529f611d35ab47efa39ce56dae13c81d62597bd",
|
||||
"@napi-rs/tar-linux-arm-gnueabihf@npm:1.1.0": "d66af1ef1fe776284666267c28faa50fc3f929f18fa6a2bd5bc51f86752fe821edf347f0a0e3511e2d96734c52affd40de916fbc8fe4160d24f3098b916addc7",
|
||||
"@napi-rs/tar-linux-arm64-gnu@npm:1.1.0": "3e5e63b6f31cc89e5bf9778dc2847a51f8d7bc5a73ddb146d0edc5fbb572cc53b7e9a980e1effc7b26377e78f0ac8d954005688e4ffa3d8beafad0fcdd787dd0",
|
||||
"@napi-rs/tar-linux-arm64-musl@npm:1.1.0": "48f73cbde4e1d802cda67858accff9d96de73d4532199c6f4283b4e80b8ea0a3ad0321e5fc10c8266f9400befbf2a40d0f2b7bc5df9a31f68d2ca2b7acf9c0b0",
|
||||
"@napi-rs/tar-linux-ppc64-gnu@npm:1.1.0": "03dd89ace0abf2e33eb7dbfe4fa92d6d1b7662ad755e7bf7540cc78f251eb4aa97f95d6172f45e0fe43a81339a0a3c9ca5301803b0d64d70916c40a9948e997f",
|
||||
"@napi-rs/tar-linux-s390x-gnu@npm:1.1.0": "becfa0f8ea66634cd311d482640c62e22b5e998fa4f56d42fc8b2bc8c1345b0a8c7e74a612f482be4cba62cff387552d3e913581a3ee358d5738f826771b89c7",
|
||||
"@napi-rs/tar-linux-x64-gnu@npm:1.1.0": "1f8617216e2e4e6e691ffcff5f5714ef2675e6e8c5a1d97eaf4e09d70cf76939de078ae1c751cfe6d1509c5e2723ea69cc577cb81b1b127073ba05370dab3be5",
|
||||
"@napi-rs/tar-linux-x64-musl@npm:1.1.0": "f02c695735525d89a66607e89b7006ff856481aab6565be523539985fcce2a22fbdef06304f27824c3b0f6c415d843586127e0cd831d73b6f2ea9f0bff2da417",
|
||||
"@napi-rs/tar-wasm32-wasi@npm:1.1.0": "1509da76540fb527ec72a6ad663d29bf246a3ab573a5990f6c30fdf118d3f8dac656023e2581055fdbbc50ca7ad07e99567d5674df90d152860a9b0c2081856b",
|
||||
"@napi-rs/tar-win32-arm64-msvc@npm:1.1.0": "fb0bedf82ea1e7accb20ca75afb8fc6a460387073c48c04026d3eb3d8a46b54f6788cd5d87ba8e506423c1d568d59b51cc9bd9a6373e39cd9aba3e6a617f9cc0",
|
||||
"@napi-rs/tar-win32-ia32-msvc@npm:1.1.0": "cd97bf9f1e341f6a44dab95f57d368d9b4f062b638bd90eed0d5f95619cef8bd4cf05d307ae7f0f6a7a7ac2318448112f33ccc5c9ca4d01e3111332f74595498",
|
||||
"@napi-rs/tar-win32-x64-msvc@npm:1.1.0": "1c4f94bfa5a02f810a54dc7f9e7ceef5e3ceb2234e6a86abc7afe520a9866257eeb56a1d6d97f947aa748035e590c80621afa58595393b1163e615a559796953",
|
||||
"@napi-rs/wasm-tools-android-arm-eabi@npm:1.0.1": "438db31d82e473e639bebe035e516e0ab5aa4e8085c6ffb6a1a91db2ebe532cb6001b46bd02f0c312063f80bdff34e3cf6ca52c399cb97fe511d83c5dcaa2d52",
|
||||
"@napi-rs/wasm-tools-android-arm64@npm:1.0.1": "2c177eb982b2f35b828920cf2f9f121b3e079c33c92090631108cee0a6833f43b6e3b0e76f761a2a3e4cff230e7b23a8344d2025d66a7de73dea9833b60ba00f",
|
||||
"@napi-rs/wasm-tools-darwin-arm64@npm:1.0.1": "3f5482beecfc218ffbdacf52248e1a13ae61684e3bd3299e519bfdb19c549c76f8d1d97cba18420b25f1e432eb15e70aede105c31e75a5ee885a3a484971aeef",
|
||||
"@napi-rs/wasm-tools-darwin-x64@npm:1.0.1": "861fffe7282695af47791a4dc71d67a1e5cc5c9ee0630fbfbd8bc1b040e84bb05158bf86c7b96f4bf9c79e1f7f09bfb2361f33da09b2637e3dec6bc126b34416",
|
||||
"@napi-rs/wasm-tools-freebsd-x64@npm:1.0.1": "86d2b74f0851d43763dbeadca3ae3939a585b2c1fbdffbb0a7760839800f60309203f53e9f2bfe790f04e5fd3055dba1b0c185ab233d47594e7718c4b61e5d64",
|
||||
"@napi-rs/wasm-tools-linux-arm64-gnu@npm:1.0.1": "f9e1f193eaa497e20639ea4cbfa1e3849cfe3688265dfa4bc8b248c929ae5b48d7d36586c031860bb0e1fb8db0a0b31f7fd6833f731ea4512c7eb9d53668fba2",
|
||||
"@napi-rs/wasm-tools-linux-arm64-musl@npm:1.0.1": "38f643211ab23426687450824c11f82c2d9a6b00091acd8b5c74a53ac697456cb0589486de3c7864108bbc34594e8ec07b0a8d23ac3d407dcb55edcd477bc1b3",
|
||||
"@napi-rs/wasm-tools-linux-x64-gnu@npm:1.0.1": "46c720a8065e8ec82fd6960b6517a1c2aa272130d719fda2770a4da0eae611dcac850c2a9a8ec05fe2d52e76eb10cd94ef8cab9cecb56c193c77832d575a071d",
|
||||
"@napi-rs/wasm-tools-linux-x64-musl@npm:1.0.1": "561222c7328ac906837fd7638690d062c0abe9f8c9b59c4ef5f8e8cbaab0524df69555d62b8f53f904b1cf431dc3e7209f113836ed4f0e72142811a586dc3d13",
|
||||
"@napi-rs/wasm-tools-wasm32-wasi@npm:1.0.1": "1405be929fccc12888b331714e97e604ae4e94e40fbcf95b166d09a1fd04bb9fa94371312c576069f5997daeb258f92c99154bf56032fbb114a9fef7e75eea2b",
|
||||
"@napi-rs/wasm-tools-win32-arm64-msvc@npm:1.0.1": "3aa52da8ba3fd872b5ea75f1c7cb9249f60bd8442e7acd6cce2119e18bf55e4d6e758ff2fba080acb118589e271cb2f84418efa9dc74ee3eeb2226a7146ba958",
|
||||
"@napi-rs/wasm-tools-win32-ia32-msvc@npm:1.0.1": "6d4a74b16a61b383e983e2c692eac71dabbea4589829afa7592466637b0de482705203ee1a9b9c4ce0c5cb84b6b4e61e6b989e668d5e89fe45b1833f0758e7ba",
|
||||
"@napi-rs/wasm-tools-win32-x64-msvc@npm:1.0.1": "ece56b7346570ff83dcdcf779dfdea6aa2d9873b7b7d8159e7ef48a57d7601bce97f96622abaff96be7d3a61cb77a57f79e94d4b69bccba82e1b45e2f2c552c3",
|
||||
"@napi-rs/whisper-darwin-arm64@npm:0.0.4": "6878616eba511e6dd72429f8efade4cf0c788feec53008c807e5486936619dbdb2ff8a8fa6346bb095ec181004d392b405c8d0ec4eaabd1a20c318a9c9ac2cdb",
|
||||
"@napi-rs/whisper-darwin-x64@npm:0.0.4": "631cde6456f6b0752e87dcc2bf9a02a4a55c3b4f77d5edbcf788569a32684e4a27b7719db9a068f2d8a53956bebdba0036907a34def3449a5e52db5c152ea935",
|
||||
"@napi-rs/whisper-linux-x64-gnu@npm:0.0.4": "be1da0fd4357d429c89b2b2d677c90832671ee042a76eae62ba4fd73f8a42a909e609fa221d20fc79efc0a6d20551cd33255dfa1eae9649cad8dd6aaa94ad7ae",
|
||||
"@napi-rs/xattr-android-arm-eabi@npm:1.0.1": "612c025c648d6fac6ab5e0fc49ba754f22f1546a310a29cdffd0398739f0fe540cb8b777d9d2afb81ea96884865e4b8fa5b9762051965b00b59733db187a9d9d",
|
||||
"@napi-rs/xattr-android-arm64@npm:1.0.1": "e8fc2146fbf04c9c7b8d4d9ea06a2796bc7b3ffbc2082542d1d272b674397686b08126b22ef11672358c22558348914adaf9a4a9c430c3f90a2b4651585715d9",
|
||||
"@napi-rs/xattr-darwin-arm64@npm:1.0.1": "1a79134e269dee380c2c606d59a6e975accbf114599bf47fb39dc6fd4917254adc59179e188c845483d97cee46e375177294b51ca5ace27a00d8d2b7f762adb4",
|
||||
"@napi-rs/xattr-darwin-x64@npm:1.0.1": "0094bd0cc288f49a17f90fe3964d8e4dd23733ac9b108149e5c5ece56dc98cee84e33ae845d8c1ade71beca8bed3807e027582df9368f0e8e9b87fa0e4e87ddc",
|
||||
"@napi-rs/xattr-freebsd-x64@npm:1.0.1": "44bc1f90dc1df21d3965704768caf089ea6c2573c6b4836a152990d923e649c17e7122f0faf244e71f17977074f635fee22f91a4d44e3da53fc1232e54002c94",
|
||||
"@napi-rs/xattr-linux-arm-gnueabihf@npm:1.0.1": "38a681e7dbe4c8fae2c9aecac381dbf83aaa63e8de05ed1d5f8f69cf91200c0407c9e254cf610c78bd659e3cb63eb99a67515fef4f8883b28f0e8a48df744707",
|
||||
"@napi-rs/xattr-linux-arm64-gnu@npm:1.0.1": "a132259367d2a97852159de747a662c0d3ecbc23eed1876c243f32a7cf03e2544d30e21a2cff8dfcbd6a95be0822f0f26471e1bbc3747a289bc251361a76ac53",
|
||||
"@napi-rs/xattr-linux-arm64-musl@npm:1.0.1": "7751c39c91cddd4433d6367b44884bd25f922d1cf627819491caec6b321cd53b89c57cde75f6000ec960f17142c114e5c272b7534c7d6655f3effee9c1ac8e2b",
|
||||
"@napi-rs/xattr-linux-x64-gnu@npm:1.0.1": "3f39c0a9300e90c64bd25466255286edb47f6675ff1341e38faed44bb73a1ad6af8db147a6e9768cbe3169973557a9e7f9b1150fa297c1ef5ae24863e8ab908d",
|
||||
"@napi-rs/xattr-linux-x64-musl@npm:1.0.1": "4aa79db89b4cec1f14942ab5152b5fe69e2b6305976006bb469e270a2052344d612a74cb95963dd2104ff229614877fb80928b6c747cc2e2c6a642c259877f32",
|
||||
"@node-rs/argon2-android-arm-eabi@npm:2.0.2": "7f6d9b3823bc4d12cfad4fbd636c7ea68511ea68f4e32f6973a268d506b68cf9fbe498981ed067a60f3dfa50ff21e67d4b9ade2ce895bc18f0273319c529742c",
|
||||
"@node-rs/argon2-android-arm64@npm:2.0.2": "71003bfbe77cfa0389f1db33b23ada34b68740a0469d2d8716786bae6b77d744c71b5bff2e4bfc5b743a1b5aaa327d5984f26a73b31f7fde5d44db864e075454",
|
||||
"@node-rs/argon2-darwin-arm64@npm:2.0.2": "3c6d418db76ca98ede2ff5fee33f52fe884a0348c7d2a93230aba460988550e0551f2696fce89d2f7b03cf913b1cd50fde3ed44f816188b4bb37e6a6eb601eaf",
|
||||
"@node-rs/argon2-darwin-x64@npm:2.0.2": "11f69309c85aa9e9be3b26c9f75cf53061541e81fe758650c1818731e35a45115981a0e834511ec0eb238db5f9c639eaa5a2e3b65367e3823c839eb9a1ee18d5",
|
||||
"@node-rs/argon2-freebsd-x64@npm:2.0.2": "d70cf8abb14f9f9ff9f31523f9088e8d6156ed7ca01926bcdc034593aed93a3956171f5104c096ec999db09f27f1e2cbdeef507884b0895efaaca13d02179458",
|
||||
"@node-rs/argon2-linux-arm-gnueabihf@npm:2.0.2": "3580dd011a09bf52cd4211b677458fa003c15061d0d06f16cc864cc500b9950ea794ddf4d36c1765e90420d9bc8e2188160cc0d97ce6289969503fc4e9a30c1c",
|
||||
"@node-rs/argon2-linux-arm64-gnu@npm:2.0.2": "ba193451757ed9346049e83f3eeca75c266a2a653c8a4e4d827dbf7c6c1a0178842937df5628ebddcc5c5f3860dcfcb094101a17ba356655bb3144f54a9845df",
|
||||
"@node-rs/argon2-linux-arm64-musl@npm:2.0.2": "9b54bc35b8c38efe269ec941f9483ce68e945a2b31a8d4176c5638d70be7abba84ee5ef7286e76dfd60be479853d1fe14694c9b857e3e62a34fb86c83aeeb934",
|
||||
"@node-rs/argon2-linux-x64-gnu@npm:2.0.2": "405d307cf7b3945aad5a9010bbfa100fd2d230aa3d0c96526fb12fc1eb0186895ece04a46a912076f73cfc864bf54d648d911a4798676c3c21024c4b4509e260",
|
||||
"@node-rs/argon2-linux-x64-musl@npm:2.0.2": "7bee792b57d1ab8cac1ac27250b43ef89a9a18e17f2716ba4707676a33885ac290210da2cd8e474a88f909806ac5ddfdc1f270ece25407279354ac5b7f92119e",
|
||||
"@node-rs/argon2-wasm32-wasi@npm:2.0.2": "eb04d3342d7684ea73008e27c0474f7a876f37b915a4d7da06f62d5939d3198557e705d6b507bfcfcad2155e3c063249e9b6efb02c0ae07894987d2c89c8de57",
|
||||
"@node-rs/argon2-win32-arm64-msvc@npm:2.0.2": "8c9268d39b1a2a8e8d8671de3de5c949c6f002cd8ec39c56478e4882e9f66155a8800a6920dd60ea67b7aa81a1c9a877b2f1b6da9d862469ce6e781b9040f7dc",
|
||||
"@node-rs/argon2-win32-ia32-msvc@npm:2.0.2": "4c9d7378d645286015086e44e46195689ab36c2745ece102735e584ec4e07638fd91885b1189b489c035d37f36eff23d48ccd5c64a023220be5ee74d6d22543f",
|
||||
"@node-rs/argon2-win32-x64-msvc@npm:2.0.2": "ad9a9bacee251fd5d38d4c219f80b5587a888ec5e56754974c8e0dfb3bceee7cca7969f8e54a9cdfda33d9551788dbef5f7cd66fdb18fa86ac477405f14fe30c",
|
||||
"@node-rs/crc32-android-arm-eabi@npm:1.10.6": "a499d1438bc27e6540ec5e15817ffaccb8366bf062907cee05abd2ddea1e6049e79a516a972f272be35b10a33e5a63d4dfccf4c42213e8fc942de73e6bb88754",
|
||||
"@node-rs/crc32-android-arm64@npm:1.10.6": "3d1a8b500f48e8be8049439ea161130277f03ec63716aeae29dc73cc43f091ac8734405243c6f44bf71a59f194436a201cef3172ca7b93a4f3e627499ea1dfda",
|
||||
"@node-rs/crc32-darwin-arm64@npm:1.10.6": "d210071fc97efae6b20525c13577b91def09ecbc9489d6d061bc40c38fbd49b249f8f268f1d16f56581242517afdc18175e36bdec3411100994387fe88678560",
|
||||
"@node-rs/crc32-darwin-x64@npm:1.10.6": "2f70fcf61054d6210c733118a8bbfad8f464cf0f85cdc9f8ee9249b610964344306369e521804a4630829704778ec35e41c2cf93419c80962d3add672545a4fc",
|
||||
"@node-rs/crc32-freebsd-x64@npm:1.10.6": "250252cd1bde3ad5489d223f0229e13324ab6cb81a0a02644bba125c0c3c084f99bce5b265bc07c5c4c4f883bec3941fcddec6a67b91bd7d98c36960fbe96ec8",
|
||||
"@node-rs/crc32-linux-arm-gnueabihf@npm:1.10.6": "fefd763aeda918bfe3fc08a6bfac12247153b38588f5e02011b774fab4d1d4b0011554e3161f529e2511d25541b9f38f09024ef3b20802a97aa0d6c688f2ad88",
|
||||
"@node-rs/crc32-linux-arm64-gnu@npm:1.10.6": "ed947d071055500fcdc66b3adc68d52e80b6e12e2fad429efa4b6a0f63556c0bacd438bac71ad989ad90844a5138e2a92e66344a62e73791cdd4c68bec8584ac",
|
||||
"@node-rs/crc32-linux-arm64-musl@npm:1.10.6": "fe94b295661401d59866487cdca3cc9ce553e85119351c63b10f723f513ff22c0307c88842eebf14e2e841dc2c4c177ef61d506e3a6ad1b70b1aaa1a04b69b3b",
|
||||
"@node-rs/crc32-linux-x64-gnu@npm:1.10.6": "2e82bce0d59ccfd4bae7f85db7f5cf198e803c5ccb0d68efe27c588d496004e0753162578926fd9df8f5b241cc52ccfae352291ea3167d152de0e69c7fdae4be",
|
||||
"@node-rs/crc32-linux-x64-musl@npm:1.10.6": "8722d716d80f1e4dd2ebc96f6e552d9ce9091fad6c7bf1fa57033fd7129c404dbeccf9a175759fd80fcda6f50eda6fe99111865ff284edcb4d4bbd110025e6c2",
|
||||
"@node-rs/crc32-wasm32-wasi@npm:1.10.6": "8c03d8e2472937eacd3242b051bde1bc101556945cb0812a8aa319953f2bd2eecfd45fb41dc89c21987e2c646e27dc4e3f1aa523d6f83092bb5e7226ac0c5e10",
|
||||
"@node-rs/crc32-win32-arm64-msvc@npm:1.10.6": "3d4c3c0158ff8c248b8c903de79ac4f09f2961feace0d7577ecfdc0007d4ef4737822b281476042737e6ea8c7b4bb1327189f7af8ada855dfbfb53c98a4a35be",
|
||||
"@node-rs/crc32-win32-ia32-msvc@npm:1.10.6": "30d673a438a4a2fe136fa154717cec31659fea6b98234c48b307b772dd55eba95d592207293bb4f374997c116e5aa809594a98c76cd3ad54d6c8525168cdea83",
|
||||
"@node-rs/crc32-win32-x64-msvc@npm:1.10.6": "18194da0113883a94912172ec965f9d684eca02dacab1c38b7ea3eb7b91da549485a7c346a96aaab8089448f4ae231670f4a3313be48335676c42319974f9f5b",
|
||||
"@oxfmt/binding-android-arm-eabi@npm:0.63.0": "a8c32bef63e693c18a51f1c88d38721e91b3de330519f64e77ab8e41221d34401d15600783ff5e62d30789eed211a31136b8656c9bd05186d62239d197c2e468",
|
||||
"@oxfmt/binding-android-arm64@npm:0.63.0": "bfaec6e9460e06c448e19f2672b96b8ffc6d6bbe282a6d11b657c43347932328f15e7d67dc03ac1c564dd3859afa3b7a7d2aa859737fe729c46e264cad869c1e",
|
||||
"@oxfmt/binding-darwin-arm64@npm:0.63.0": "7f87d838e29ca16885c23af4aae8127116f85a61dd626c074cd9b087956af9fa76fffa56836f8649c064c618370d2e26bb6c653cce1204d54d0cf8b097ee41a5",
|
||||
"@oxfmt/binding-darwin-x64@npm:0.63.0": "417768dc48344e1c7a9f377507c5bf1f1aaa4c3c4d80434518023b36c86dd2a4223f7aa7e579b11460bf4305420ab5acea2d8cb014d401b0d51162903ebb328e",
|
||||
"@oxfmt/binding-freebsd-x64@npm:0.63.0": "49b9ca2790e4a1c652fee5580cad343ac4fdee783ee0455c569b3f30a6cecf513f86752d3fc4b14a7bbd50cfae33661ca5bfd1cafd601e0d8ad598e0d7015c63",
|
||||
"@oxfmt/binding-linux-arm-gnueabihf@npm:0.63.0": "c34ee9fe9b2a43d55336742392af495f30b10792807f2e6b6f328688933a7ec03cdffa9faabfa29cbb601c35745160f60e07e724000e27454dc620bd78320c96",
|
||||
"@oxfmt/binding-linux-arm-musleabihf@npm:0.63.0": "f1c17694572bbe3e8043bf27c92298ae0dc01919493dbec4ac80afdc77aaad699144e69bc2ba85ba931912b5b48a7f1ba1819cbf2226120c8f81e2ff16241af1",
|
||||
"@oxfmt/binding-linux-arm64-gnu@npm:0.63.0": "8b066f4fdb53c08a34d5ff176dee90066d57d2e9529d033997875135a3212a9a3e3381aaf224b11d6ad3abb8bc8068332d3434b0a4189faef1fd2f6ae1a59d9a",
|
||||
"@oxfmt/binding-linux-arm64-musl@npm:0.63.0": "bb8cf64f50ede2ab0a6f8fd23e1fb5a30a9f558ad051be214883f6c0409b95a31bcf4ae88f6d95ae55553da93e50b3eff68ac5915c3f1dc6738e068b79322e20",
|
||||
"@oxfmt/binding-linux-ppc64-gnu@npm:0.63.0": "1f598d086dffb12ae45deebdc571ad52fc8d4c96e539af4da6d13ba8d8daaa5accf2a674850c63000bbea4cf7979d3dc278b53b38a1b2829101fe3c7f5f95c58",
|
||||
"@oxfmt/binding-linux-riscv64-gnu@npm:0.63.0": "688e5a9f16183496223eb534fdd3d82109abf09d2900d5364093c6e8609dbdf7df8565ae74d78b1011c07dac2f1d0ec1c13bce809b70e9eba11a2d79b6be4385",
|
||||
"@oxfmt/binding-linux-riscv64-musl@npm:0.63.0": "0343eadd1572009d337b231a8a291268b4ba6b620e2b747256895b36b8d39b5bffb90be3628b2e2e5793dc6a7a79fb48d58dcff571941094c3c8cc6143f50f27",
|
||||
"@oxfmt/binding-linux-s390x-gnu@npm:0.63.0": "b7bcf0d4f7129d1172443c621665c5ca1bc78f1d1959911d12bdcb73c6f320d5e6db3e1ee46abb45c32df6d20d01a777b02d97e604f538dc5a430e8a9c57153d",
|
||||
"@oxfmt/binding-linux-x64-gnu@npm:0.63.0": "17ac0e722c11a0d47f78bc283773ba61df19ef9127cc8748788d053c3da67f18de28f00d068d4af4c3c4641265d9127013454f0d790028987777da71882726fd",
|
||||
"@oxfmt/binding-linux-x64-musl@npm:0.63.0": "35aff7672959001e7c8afb24a57c2f76b1ac0bd726f9c2e20a6acf13e31d27ae9b7407452b93a953c85dc7425743483e12fea620b21e9d2624d158e3302c3678",
|
||||
"@oxfmt/binding-openharmony-arm64@npm:0.63.0": "59c7ee1c5f8d28fada1561491dc599198dbf8bbd275f328c14b573295a46fb207f202c1c0661e4924d5d973f391998c39d686285e0122115d88a8b2baf8e7f88",
|
||||
"@oxfmt/binding-win32-arm64-msvc@npm:0.63.0": "a06055b57ce77bead55f257e881bbb6eddd4675703175c0612efbda3b6fbb21a2d9c288370a2a4384810f3bc4635c11d535195e75a30b0477d579920df0ba42c",
|
||||
"@oxfmt/binding-win32-ia32-msvc@npm:0.63.0": "ea43d13ce6540ab02afd06ba54290d07f1272da8543e4e1b7a05493d06ff9e5b40e78d8d6e0d17ca6d0188f526d05e1d10e047b687d4c74e2cfc02ad07dd14b7",
|
||||
"@oxfmt/binding-win32-x64-msvc@npm:0.63.0": "cf4804aa73a19cee1c2e73cb535d93dab85031d7ddf98993573be2b39cef729361df02e2e5638945078ff4a57e04195731ec6a9366f98e02103bff658b6f1337",
|
||||
"@oxlint-tsgolint/darwin-arm64@npm:7.0.2001": "081405258a5f1c72802ecb70550b553d2ed7515bc0eb6bf092dae2c286d0a83e16e2f25a8ad19c71d43c4f53e31529636b861a6724bd16f6fa866619646bc40a",
|
||||
"@oxlint-tsgolint/darwin-x64@npm:7.0.2001": "9cef65e9bad2ff577b806ab82e224830bce415968fd0709ae627ffc4f7fb2aeffcbdfa281534ace8b07c0787c7dd3f24f6b1c76a966898e276cac2f557d245b3",
|
||||
"@oxlint-tsgolint/linux-arm64@npm:7.0.2001": "e1dc489676602d6110241364e19d1f6eb6a8cac60aefdc435f8dfb6ab0552c8ef210d32756ad843994c727c6cb78fb46afdf9cebf691498f2bc7bb86a630c4d1",
|
||||
"@oxlint-tsgolint/linux-x64@npm:7.0.2001": "a647125d2d7431cf3c874439d706b9b23a7cb8e90ae9cbaa7187ac2eac08d94cc617743ae0e266b8a8cc16e3fefc7a9651b55491510fe4e961397d5606832d4b",
|
||||
"@oxlint-tsgolint/win32-arm64@npm:7.0.2001": "8bc6fc98ea2e25a4b51b78ad56309b7692831af13bdfcfde6e4c83678bb4ce1c306c26b74a8010469ab73b62dc24abff59f9d874fb4962257d5d7feaf207a888",
|
||||
"@oxlint-tsgolint/win32-x64@npm:7.0.2001": "d55636a4e9849a67d6cbd4ef390c330b9d7e46ee7340aeb6bc4e58b27274b9ffd4db0b32b4b76a83f2d845dda25d16586a254b4b53d038901b240fe20847486b",
|
||||
"@oxlint/binding-android-arm-eabi@npm:1.78.0": "b1d2dbb6c24c09709a229d7868b3322ff56f2389caa3d8ee07e239148338934f8e82e49d1c505f0179c0c6e821dbb1212a848e9541c5312e150bc3dec08c5f2e",
|
||||
"@oxlint/binding-android-arm64@npm:1.78.0": "e6d5aea1dbd6cd063d62d822856a82b8468a3f22e286540e730c0c93cb7d87e805e3d86e7ba60e547c802fe867d74347227220b1a3b734272f2949cbc1e336cb",
|
||||
"@oxlint/binding-darwin-arm64@npm:1.78.0": "721630c4ba35219910bd22aecd0316ea8ae3997fc7ffacea18a0cb4c46e84bccb902cd704163f29a3e1863170e343b5c886838826ff3d077effcfa5cea8ec31c",
|
||||
"@oxlint/binding-darwin-x64@npm:1.78.0": "7e64d292e359478020dcc19272afc90733f8965332417fd254c5d61bba4d8654edd532facaa223c9c3f88c0a4bcb233168b8a06e0bcbcfdd57bdae70e3cc53a0",
|
||||
"@oxlint/binding-freebsd-x64@npm:1.78.0": "f84a8979d5578c7173c05e2589c84e6e7b65174a621b13622dc0aab98a04f6fc8e980cbeadaea57baa1101b4f59971854313a1dfc5775d33883de492fc3f9a9f",
|
||||
"@oxlint/binding-linux-arm-gnueabihf@npm:1.78.0": "71e7f55a722a2ead21b98b9e7d6221c518bab0af2dcb814162e04ce8806f0a26c84ab2aeb3c3d4e4248ee22eed55e399a8cd512477ae187edbcca1dbcfcfc134",
|
||||
"@oxlint/binding-linux-arm-musleabihf@npm:1.78.0": "6aa7edbf8e5dfac1f0827ed9fd263cf49191f69cdfdbca6360f5443cc378478075236d244ca605fb343414d59333767c2c766698c553a2ed3d0b3ce00df4b579",
|
||||
"@oxlint/binding-linux-arm64-gnu@npm:1.78.0": "948f1cad4ea2d7e65706d666b9624412f15024e925c4655f496c0523f85874b725cbb10fad5799f1220864b23c54558d549a76f33eac9da682794b7c582ea9cd",
|
||||
"@oxlint/binding-linux-arm64-musl@npm:1.78.0": "05ebea483d9142dc560c59a47a1b32358cb65c1d839ad5b28b0bbaa4b59acfcdf47bebec7b854d0badb5d4d96cbd123ab47a8f8d479e8e2c62318c1ddab87c8c",
|
||||
"@oxlint/binding-linux-ppc64-gnu@npm:1.78.0": "68864e5df4c65f4e764aba8ed57904c506976d46a430eee7e6cdb9a0af79b09ea6b8027ba6e366eccab516a7e50eb963c7681877baed5bc6800ad075113a49ed",
|
||||
"@oxlint/binding-linux-riscv64-gnu@npm:1.78.0": "d97a93828ee6e099e6c8820360bbb6114d49019d4d85a47ff14acb2b7912e55c461f0c9e2a6ae5078d372209dbe24e32e4d7c264668c16b6e645a31f692a1245",
|
||||
"@oxlint/binding-linux-riscv64-musl@npm:1.78.0": "7d80d93ed419f364ae4162421d71df4ff3dbb11c61f470a4ab579a722556588fdcb4324f3622c6061bdc07d5ed7bace3193c310d5c786779dd1d6410b5b09bfd",
|
||||
"@oxlint/binding-linux-s390x-gnu@npm:1.78.0": "d4360bc9bab27a646d473d105c1c3c12a3e860cf56aa0ccfbdba1f68dc763ded8d4a8c2aee64d61fa0201c9238b0464dc29c2a8d0591b62695b6d0ca0e8b42ab",
|
||||
"@oxlint/binding-linux-x64-gnu@npm:1.78.0": "c953129cd0998926722d5cc118f5cd9db6ef78b97df07646008edc917b0be33bccaa45fca21c37ad27e520bcf76df87b71423fbaed3638a722199ca6556a3b23",
|
||||
"@oxlint/binding-linux-x64-musl@npm:1.78.0": "43bc6d426790e16ca109d7c5855936c1cac826518105e711eaff87ae7a36ea21a152f99adae5a31ba303314a841d553dcf36ac8ba7d0cc3368251a030f508b76",
|
||||
"@oxlint/binding-openharmony-arm64@npm:1.78.0": "1c50b7c9d9a7f4f82b5db43816e462973932096ea9583f033de6e737530f20f34afa39fa201de223bd7d006f62f967d16fe259f09affe010b0230ed0b60c8765",
|
||||
"@oxlint/binding-win32-arm64-msvc@npm:1.78.0": "ea4bcad38c44ecbe134348416cbaa515ff363c85be83caf1e6faad6ad83b8acee80ade07e3a8eb6915e695aa807745e9d9da26a1b985592524119e7d35a59e29",
|
||||
"@oxlint/binding-win32-ia32-msvc@npm:1.78.0": "192c3d532b29f8dca3298e302ab81e08a70e2307bf4e8251aa6063219a6f1ed24c8d3b5dee547a154d3f5a932e19a29f831ade071096ab5a1c36acf5a2d14d9d",
|
||||
"@oxlint/binding-win32-x64-msvc@npm:1.78.0": "88a7e9e2748b8daeb12768f580bcf6ef6609d2ae7e919a793dd7174faac4f6fa4ee75433869d5d1c5c8ac1bfc03900495a16a14bb14a96b7068f01fbe893fffc",
|
||||
"@rolldown/binding-android-arm64@npm:1.1.3": "ccbd2e914578de72def39c20318b777c17149a398ed9b1f477c9e0c14e211f5004a3af82caaf9a088a473509043c45d90653e593b4559f589ec5c1929ddeba32",
|
||||
"@rolldown/binding-darwin-arm64@npm:1.1.3": "d3bfe758c43c8a95b2edb74e169598f90c237d3c414b824bfbbb0f3124971173f5eab84de939385bec93abc600cb1ea96f25295a7980994ac63f837c10249b13",
|
||||
"@rolldown/binding-darwin-x64@npm:1.1.3": "84a6ef4949935292e1296dd1044fe7728215aba54e4d8759c5e3998da97131e752d1b1d0d07c122d8364eca7f8a06eace33d2e70a42015d9969360299d83b7f8",
|
||||
"@rolldown/binding-freebsd-x64@npm:1.1.3": "b43fb9d63ad9237ca75351e0a2e7852caf138b615fef7ae0f3aea4d9754ff6ff3a5a70cdee264e0dad1553efda848d84cf45def41d55ddd36dda157ece64d209",
|
||||
"@rolldown/binding-linux-arm-gnueabihf@npm:1.1.3": "aa2dd220e5701fc2977b32ce90db79e728af9486aca56db8c204aaa6aed650cffd81216e2d56cba9aaed8f91f3e41a9ca8f8a57df9a67cc1dddda669115136d8",
|
||||
"@rolldown/binding-linux-arm64-gnu@npm:1.1.3": "76c84c948c6dcef5312eca88e2c92b53b067a77db5fc54911b1cd82f917b2337d3c1c2019d676547b5c975f2cc14edbc7beaaf47c07012c4dcdac597917bc771",
|
||||
"@rolldown/binding-linux-arm64-musl@npm:1.1.3": "41edc56235909918daa18b03a16d8a5a88155d5fd1d42d7a467627087f3fd076c4df0fe2cdd7de22d6e13a4505519b7d9e6eac7938fd0383dcf2ea4b9eeaf9e4",
|
||||
"@rolldown/binding-linux-ppc64-gnu@npm:1.1.3": "a18db7ac742be80f82a58d9cea091e2f166c2abc1aaff5cd27b7a351c6d4feaf6236047b50b63b9d48daa6b663bc625ebc9d392b0c105cd1c0068a831c6ad5fb",
|
||||
"@rolldown/binding-linux-s390x-gnu@npm:1.1.3": "c0510a5d84736688a1a27b7752d4735215720a56c2def91685b4d0872911b6afec35e7675988e9c4ae9ada37bc8c0ffe8362816ae23853f0411bd947a034a2ec",
|
||||
"@rolldown/binding-linux-x64-gnu@npm:1.1.3": "bd86ab305f7e611e5b4f336d58397951a8594c97c4711084a34baefac26595df3fdf676633544018a06eb0a99af3b429e3bee0698ea37134c7e8cb932c184674",
|
||||
"@rolldown/binding-linux-x64-musl@npm:1.1.3": "ea4e80e4434d5a3f4d99c9cce07afb8d042607150089dcf5f09ea22b07c46ca356ee1d254e451acf8b5c61e11e56713d3eeb5dde0a1bb5728d1cb58c30ec3703",
|
||||
"@rolldown/binding-openharmony-arm64@npm:1.1.3": "5082290a8a323ec13ae4aa2157da23be4f732e3831da1a7363437ed990548a930c4da1c992862ba72aef496d6f0fd51c01f17e149ae936ad6428f6c7b0177c35",
|
||||
"@rolldown/binding-wasm32-wasi@npm:1.1.3": "b0ae15e388c669388ca926751be48003060a40f238cf9b206930de39d48ac30adc1a44e9310d6a333ae8fa01bf7bb0fcd13ee4f94fca173ea08916f8792a5009",
|
||||
"@rolldown/binding-win32-arm64-msvc@npm:1.1.3": "46239c8b64a34968702a062513f97b89f66dd65624f7d3b4ad6e97a1a9dccfb628ad4c64154ff84aa883db74ea8752cc7d67d208b0595708c1b21f1af6590cbe",
|
||||
"@rolldown/binding-win32-x64-msvc@npm:1.1.3": "0d320cfd2a5a8d20eb6a5f330d74320aa9d289f3224a4ce9ae9bfe7548c6e08be9b554d16c44edaeb57b4c66dae02acf5a2cda0b308bcf03b9f6b52992d18f6d",
|
||||
"@rollup/rollup-android-arm-eabi@npm:4.62.4": "ac4d12559bc544efa0bc2b3575c0df8bdfeb58a605b0fc4a31057fb9ef69cf0719ab12cbde73372a10871fc14990ec3cad0bde89294ed7589a1e3fc295b27a73",
|
||||
"@rollup/rollup-android-arm64@npm:4.62.4": "92240cb325002a16926ea2f9ebbe0af947abb1a16ae2d2f4ae5700aceb1863349a42ead6a14e430415d3761cb0b7ceeb7e30d524efadee47d9f05e44b8854a42",
|
||||
"@rollup/rollup-darwin-arm64@npm:4.62.4": "270b11ea91b214f44c6ebf8b682dbb94f15c1c01532e658f62edac816c2731d462985a5e2b24db2cf3a2c01681a81478f351b436a2e0676e264ba9ce24436fc3",
|
||||
"@rollup/rollup-darwin-x64@npm:4.62.4": "00e450e13eb394879b6fc8674161485c5b447acd588f68cf1ea45e03ce3fec2e95d87f201cea3de355f7ba2ef85f0be4325477b2ac825b96a91937276cc206e9",
|
||||
"@rollup/rollup-freebsd-arm64@npm:4.62.4": "bcd194385141cf3bea9f32cc2c23de16487be046fc3b65187b4a6252cbc72795af9aa44771a02c96670120783a744d7ab922e897f7f0fb0f8c5ca363c213bc85",
|
||||
"@rollup/rollup-freebsd-x64@npm:4.62.4": "5710995d4afde3740a66438e8fa8c64a2096dfbcb82de77baf9ab8f3cbd6c21e4831eba091af12954d58bb624330e4446ff7ac2330246dc6fd2c1483caba2a0e",
|
||||
"@rollup/rollup-linux-arm-gnueabihf@npm:4.62.4": "4985ac432013f1425cce6b8013dec30609eeb4ec43c57fc9e0765edbf4faf456d6589b3ea6c71e936507178f246e1d94d9988344d50c30da1eadc4e9531967c7",
|
||||
"@rollup/rollup-linux-arm-musleabihf@npm:4.62.4": "956fd204d1d8bd47499552a8d568be166638ba3c01cd2d347850b2a67b1b7bef9778f8ade5ca4f205678df53262df41c4d50f52753480279ef618813337f6ae6",
|
||||
"@rollup/rollup-linux-arm64-gnu@npm:4.62.4": "9b05df3bbc397f08dca98b1674832d632e0af4a2ae0c70f59bcf745ae106cde9e8dcd5dd1313598fda4290cee85d83809655a0b126ea283596bd71ae0be7eaac",
|
||||
"@rollup/rollup-linux-arm64-musl@npm:4.62.4": "031a0b4bf11da8b61117b34639fa3d02e82a41b691aee29acd6bde400746b03fcd0e4ce526831599a66b6a580d8d628b50edad600e969f2e08a0eafd9869b88c",
|
||||
"@rollup/rollup-linux-loong64-gnu@npm:4.62.4": "23d1e16216868e2d7f30d87b7fe1517e92da0c445b0c302688b2ea8716b221dfa0eaaed3d0195dc57e7b144ef6fee8c81a807840f6d0946c291a9949f8165992",
|
||||
"@rollup/rollup-linux-loong64-musl@npm:4.62.4": "740e88eea7fb36f9eac896b6f9e93169ee6b1bb8d6b72adeee3256f75e3783448a48cb058606f4a9254e1bdf4c117174f71d2b8225008e3c185cdaca76b0bc17",
|
||||
"@rollup/rollup-linux-ppc64-gnu@npm:4.62.4": "2e0d4408a5cb370079f73e202e9c7e302aeacbf45202f9eae56ce355dda1ae5fac52ae845e37bf4f1382a457be7e9cbbe0f5c67a0e8a0418c73672426aea990e",
|
||||
"@rollup/rollup-linux-ppc64-musl@npm:4.62.4": "fc111bff6810e32345ea3bc255ac219f1b06565161f2544ac45efb478f68545679d76f035a7a83247da827194311114121b546511a417f2e65e736a1b36322e9",
|
||||
"@rollup/rollup-linux-riscv64-gnu@npm:4.62.4": "df28edc59c779848ee917989306f67fb692e428424eb9976b88e4893771cef0d7e87d0556c1e83dde3a6333526f600624b9188d77884840872aabcecbe250bec",
|
||||
"@rollup/rollup-linux-riscv64-musl@npm:4.62.4": "3cbaf772d2756f62cfde550fcfcaaf29ca85f87bb3125545f0247ccbdfe871ec191cd32931192d77f21b572a5fa89749ee72170a9d94f87bcfaeb45af5ab35ee",
|
||||
"@rollup/rollup-linux-s390x-gnu@npm:4.62.4": "bd8cabc1c6e05afff218d086ff19c48507b88146f6e89fdc4f86cb6f90e59b667cebe7fdfde2be0e4f5945fc3f53c4e2eb71f4e11b3e039a59ebfe1ff62462ee",
|
||||
"@rollup/rollup-linux-x64-gnu@npm:4.62.4": "98e99d1b432f70378c38d4c27d640271bf4b39e68363be31092b936fa3150167734974268e516eee68ed58fcb376aefc49507010a9e9efefb615c7eea1cc67aa",
|
||||
"@rollup/rollup-linux-x64-musl@npm:4.62.4": "805d88b2294947cf4325923092031ec4a97c7149e90174673691051f934b7dcd4f5a8e02929ab62e2573eb72f2b5aa18dd438d25f9760ebec3a26baeec0fa135",
|
||||
"@rollup/rollup-openbsd-x64@npm:4.62.4": "a611c26970953d8706515ff1c71cae62aeb811a1299e44726642a10da1e0a249f788428c9e84936a5cc196d550806cccde821182f1b9b9f9ec4fd9ded7874984",
|
||||
"@rollup/rollup-openharmony-arm64@npm:4.62.4": "acaa6865613438fd4017c25b73fb5fdc0f191e83737c1af8ed99edc927c3bbd766c0a750453902892841cc5a98d26ebc19f5f1effb256d1a57f1ef86daa26fd3",
|
||||
"@rollup/rollup-win32-arm64-msvc@npm:4.62.4": "04f84472737eda2262987803c6df92e40fd245fca7c1da1d1d1e58b4a5d0c5b9c8d7e612db0864ffaa2e72a8798585dd1e7d2ad8b9aa629db9e1a50edba0d9bc",
|
||||
"@rollup/rollup-win32-ia32-msvc@npm:4.62.4": "5fdfd70563b26003d20e611e8ea28a692d00d10d7f15bb1eb04965f9b73db1c76d61aaf7f6f8008e96f7f93f43ea194d00fa7363be70684b50dc2c64021d274b",
|
||||
"@rollup/rollup-win32-x64-gnu@npm:4.62.4": "6302adba244f43c517662b214703408fd9c5ca8a5447831d75e1c31c7808885c08d28c1c9d4bad55b0f2ac96d66868055d9bc2a0e9ee1337f24fdc64b084823e",
|
||||
"@rollup/rollup-win32-x64-msvc@npm:4.62.4": "a4929342f93204ec2c0d49d4eef3579203fed089972a63ccd2129b6cf9d1b00ed197448b93105d809b5e3a87c39bf084c880d8e8fb3a92733749da7da2983a4f",
|
||||
"@rspack/binding-darwin-arm64@npm:2.0.8": "9569d096f3e4829812d6b0d2969e692d657ef801291e95bcd9ff2ee71e7f4daeb1b867e13b4739134b6ad1bcb22f445cd84e7fcce5c9dae7cfc5884f90521aad",
|
||||
"@rspack/binding-darwin-x64@npm:2.0.8": "18396e327fe68c859ce2ed809bcb2a8be5e5af426b56ecf631af5eedebe0569c5ee2ea18b429d3eaa39442aff1ed4d4f0058b542adc7901b0020579ec1096cf1",
|
||||
"@rspack/binding-linux-arm64-gnu@npm:2.0.8": "4d02691a2089473df6fe7232f96cfd506c027f57529a8943dc5f2d1380fb8cb4d2f446fc196048f3b0ecaf7650bab858d96a739eba57a8582b1d28cffb355fb9",
|
||||
"@rspack/binding-linux-arm64-musl@npm:2.0.8": "1f0d035837adc46feafdd5306e1d347f98b87a9b114e71757445fedae70c066e34384b16d2ffc308bae67fda68eb345d8ed3817d357479ec0488ebdc8b790273",
|
||||
"@rspack/binding-linux-x64-gnu@npm:2.0.8": "ac6a9ab4ef954a4d31325f0f84a419f46fcf5189e1c11b927657caa711dca05f8f3ecb1c1900be151710232fccf4e5b17ba10db0a3dd0879952bf818d7e673b6",
|
||||
"@rspack/binding-linux-x64-musl@npm:2.0.8": "5a0d2b46770741ba0927ea44b77ea8332d87a6489ba87e5d0809873c3deef977a1f5fb0d9b79b67cb0ff52fca258b7a0db12fbedfbcfa45703565c6848027710",
|
||||
"@rspack/binding-wasm32-wasi@npm:2.0.8": "439c100d52528709f5503a240c584c1f01b8c935f43325b854feeb1fbab5dcef35ffc2437c0acc0ddb6212a96dcbdbe23ce4a4cb72b87c6e0e128f683d2f9f17",
|
||||
"@rspack/binding-win32-arm64-msvc@npm:2.0.8": "4aa0a850156e1fe90b136b6d5495edb92e42d179cc59847d7a8c291e4aed3e8190167b4ff9c6c811cb22b0e7858b13a35ae4558ad3949c1cc4ddba35cbdc4e0a",
|
||||
"@rspack/binding-win32-ia32-msvc@npm:2.0.8": "cd43dbbef0f75c5540d7288afd1801fe350ba18f3ec81a76d6c0d82e9c7f94643258cd90d274f344724cbd4fb91a033a3c591994f103a4bb9d4bf5c12bbdb7b2",
|
||||
"@rspack/binding-win32-x64-msvc@npm:2.0.8": "928c46a4febda889892666cab390b0facd1b8ee7a2e4259b490f690f3d583f418cf1ec20afe0aeea9ae155c8b7dbdf032d42bbbca2a554178b1b3c9cf9a63ed8",
|
||||
"@sentry/cli-darwin@npm:2.58.6": "e279c74f28a4f7328a4ca74ba54940b711761f9f96bee8fa8cf1948d345101f76853ef4bcdebdeeee978e51f4b42b552aa9e55ff4978469b0cdb20a2371d274e",
|
||||
"@sentry/cli-linux-arm64@npm:2.58.6": "0794b88c5500063a7c4e78cc16dc57bfdcbd0b8eaeb8c6a47b73dd17da810251f22f44f7cb761f047602bda1e0b1ebdc6ee3154a027994f5748f0d2feebdfbd0",
|
||||
"@sentry/cli-linux-arm@npm:2.58.6": "5490c08489f2818150868c230ef3a95ef6fb77c77dae39ca4114ddd21bd76dd63b4aa69845bdbc09eb80b8515d2d984d01c6f227fcda480a3849cfc128b7d158",
|
||||
"@sentry/cli-linux-i686@npm:2.58.6": "d3f763b3e733786d37a4dcd6bb4b6fcff5bd5e83e99494c2d768de1b591638f379f73e86f67e26b66c3e6b565a198bb594a614704029c162dd2cec414e804ed8",
|
||||
"@sentry/cli-linux-x64@npm:2.58.6": "6a1ff2b033f686dc2b711b3e37d9f8da538103614fe4d4de53c85580c032e59c8a4cb9b902505ba49c0dcb4d7f6a3021ab4b6ebd774b6984014e8b94e48b3102",
|
||||
"@sentry/cli-win32-arm64@npm:2.58.6": "373d22988eddbc1aa0f399a7ace15d5d252a570ad98dc92e3349ed48df0c29459081d4b2732eac874481653d7cd46d86ea9968fdeb1f2072a2422e24168692c6",
|
||||
"@sentry/cli-win32-i686@npm:2.58.6": "357e4a54556763585edea00afc81b6b87f7cc8b5341753861ed3ca3a36bddfd46f433b7160f31b2d9eea5325a3fbd4f62175f84cf5ed7c7bf819509bb672f8f8",
|
||||
"@sentry/cli-win32-x64@npm:2.58.6": "012f973fa479fc167da91f1cf36757b6a57b903ad73d4af3d8af76782adc2579f6aa12e43e2a738c1641e638195ef135ece5058e945da6630535c65d83d9d0fe",
|
||||
"@swc/core-darwin-arm64@npm:1.15.24": "5175e94021acb0b6e1dc6d7c7677d7d60704dda61c52df2145ae981cf1caf025bd9f344a07f0a59cf486359efda6da78ee98c5e97d1df8802e37f05ecdc6e2dc",
|
||||
"@swc/core-darwin-x64@npm:1.15.24": "96872d7464f50f2835656e1a7fb92c7ea5488cdca79d6804c4d6cc5b66f204bfd7ac5718f418affc0bb5d3e561b569c78a077ad367ea0650023975cb4d2896e6",
|
||||
"@swc/core-linux-arm-gnueabihf@npm:1.15.24": "5a8a7d1b0ba7b93a22d1c1288d006b6c7cdec31246fd15b03287c3e787794d176b5dd49c2fed315a792fe1b5d4b4d61d7e896a8e83d838276c6d6f5349445add",
|
||||
"@swc/core-linux-arm64-gnu@npm:1.15.24": "8ebb12c867bf83770e11ccd95b208d47af8f3cc777049e2534cc8e705ea16f22373b1a82ed7708c7a83585ac05a6d4fbb10d12434641b57ae700f72b407100d5",
|
||||
"@swc/core-linux-arm64-musl@npm:1.15.24": "4ab1ed4f3c516739f540137070fa974a20bb1aae8b07a7cfce5b1a5cf55fe3d4a2c0687a4b035bb54752ccc6c1f75a7754f9aabcdd48bdb0c5d8e378896a8dbf",
|
||||
"@swc/core-linux-ppc64-gnu@npm:1.15.24": "b11084112503aaa2a32045e2120eaf35b2b1fa2463396eac049b9282bd30f6e5c807f5c87d221a04033eb8125ba7461802ef02582afd1bd6805cd656c6d3731a",
|
||||
"@swc/core-linux-s390x-gnu@npm:1.15.24": "e7c9bd715a415182a67881a1b63f5943cfed9c2463600ce6762ed4b07ae9546af42881542475ddfadb02571fc6f59dd14beea55886de2ab07d38d1e46e4da95e",
|
||||
"@swc/core-linux-x64-gnu@npm:1.15.24": "2c3d2bdeb3320bd282fa25b780d3369cc09fa52ee34cfecd2f3fe223deb8bdb436a1f7dcd873bd57447a0107095aeb8ef0fd83722f64b191c6a041a5feff56ac",
|
||||
"@swc/core-linux-x64-musl@npm:1.15.24": "9f955c0520045ddefdedc6f3b97c1e458c4862aabb8654f9b3dd71c739711d2476e26952a1597cea2cb0681a71efaaea16ba32b6b0fc6f3022a3096c8d84e234",
|
||||
"@swc/core-win32-arm64-msvc@npm:1.15.24": "48d1458066b82d4de8bf39d96a9236412947e5560ba564df39a1da36b5883f863971ff58124c31214a365225095702710d4ce9a9b45afbf6dc5a4f215e884efe",
|
||||
"@swc/core-win32-ia32-msvc@npm:1.15.24": "75ab422660be1637ba9d801e1bb35475d26438d1e64ef383e79c4288a89503d0c8019eada4672ff36c875881ab383b467f56d3cad0ea16e606de7209e2bf4647",
|
||||
"@swc/core-win32-x64-msvc@npm:1.15.24": "d937da2a9141bc3334f18df21134662c4ac17d62b4855d174100aef98bde4aa66862469dd4341ad5a7ff0f16cf4c5bd743e499c9becc77eca561c7154d53b783",
|
||||
"@tailwindcss/oxide-android-arm64@npm:4.3.0": "beec2c60127a660ef2bbeb81710f1333dcc26ac5f6a591b19e44ebba42d392558e96ce2931052c6565722809fc867d77953ae9909f1df65a869ad099033de9bd",
|
||||
"@tailwindcss/oxide-darwin-arm64@npm:4.3.0": "2398f6e5e18ec110be604ea7f083c939225ff68eee9949d2fc1275dc5c2044c21114884c959ab83ab574e71b8e569772d1ffc1df842c60b8e7882d3892fbc94a",
|
||||
"@tailwindcss/oxide-darwin-x64@npm:4.3.0": "21744d1edc31462d54ecd23005bf9968c999211b2a7661884887fb48f89dbd1a00af9eeb6d791553b466f6b0d569a158ed7db6de9e0a58b9898a44b92ea37dec",
|
||||
"@tailwindcss/oxide-freebsd-x64@npm:4.3.0": "7984c9820c587a1accb48fd74c9217c724172f5837bafde655d7fcfb4b6b0145f1f0e5efacd77ff94b4cf4b9eb3869c60d4c47fb3b1184f1cb17219af751e2cf",
|
||||
"@tailwindcss/oxide-linux-arm-gnueabihf@npm:4.3.0": "763c7b68acb57528029cc6196c023d7402f5c92bca90ec2e4710a7bd817f2808ca00741e2eaa6ce463b190f44bf7b999f62df601c53acbd81999d07c4ac56d10",
|
||||
"@tailwindcss/oxide-linux-arm64-gnu@npm:4.3.0": "bdcfb7fa05b6df68be7dbe290df7548c8a98de1cfe45aa09f06b98c5bf654db62bc4dd56251a80dee921eefb09db4f07a3195ef01301e14a0f8a2672445b8323",
|
||||
"@tailwindcss/oxide-linux-arm64-musl@npm:4.3.0": "edd51e689632ef04f6f654daca084acb9a4eb0e7e8baad862ce33ca7360141e4df7dd0b3da34c4777e16384fa9439093635b5abd05b2c3063d179f356e1b0ac3",
|
||||
"@tailwindcss/oxide-linux-x64-gnu@npm:4.3.0": "4c4b1479c0004db97add46e56cac735975a5a32cab71a3671e817087e793e31d90342d9240efcd7f4d9cc158bb639f7ef3ef3d0ad1ac7ae2fa6122edf3ba4220",
|
||||
"@tailwindcss/oxide-linux-x64-musl@npm:4.3.0": "e0d102b8beafa21a3f8a0c89ee5b4df91dc24b0e14ec702ec73ff46cdb89c8e1acea9c1a8be17fce517a400150cd3a6590f05cb8d43d3bd3be7e5e3c202cdd19",
|
||||
"@tailwindcss/oxide-wasm32-wasi@npm:4.3.0": "772d9303f17efc5aae4cfac007242c6cfcec4e910013150f53327416b21fe54eed27b143cb56227469b3c1ac04c33671212c80b7ed85c56bde9a4ff43fafc4e5",
|
||||
"@tailwindcss/oxide-win32-arm64-msvc@npm:4.3.0": "93c11411499176a1e5955595e54c7b6e62dbc5179f319970e9b66732fdc8c64ab193aabb9b620bb3d067862da5e563b8fbd3036ff226526855c4c709cd494582",
|
||||
"@tailwindcss/oxide-win32-x64-msvc@npm:4.3.0": "e16bf49fd45cdb2a0fa059d61696c1c8e16173b8ffc24b3efc985d6c5a534c5f180c8d6d53518b5928aa67cadb8bd609cee17f3365ae103eb61dd7801fc2ec95",
|
||||
"@typescript/typescript-aix-ppc64@npm:7.0.2": "1fa8bf51ad0d3af140076baeffd9bbcd2368644fab738d400975268918946a490b6a9e8ef69c0509ba982c3f941cc08027b2aaad3dd374d441e25acce5336460",
|
||||
"@typescript/typescript-darwin-arm64@npm:7.0.2": "afef125e90665ae8b651aea0134df53698c43d514ee49f2bf398003410814c64c5753e7854df229d32bfe28eec88710666cfca09869b2922e380449321efd0e5",
|
||||
"@typescript/typescript-darwin-x64@npm:7.0.2": "c55734ee5a4dd380dc188b3090ce9b5d6e00b2f5ea6495f186569dec6105452e1faa27bd3c44d8505a723e3c125d676b16ad3521c31d403f202c4bd2772af068",
|
||||
"@typescript/typescript-freebsd-arm64@npm:7.0.2": "4c971496c83cee77f1bf7674ea5b5c22267ed5aa53df3f33ad231abbe9b9d44d8508a05e08a1d0e312fae0a9f0111e7194e7a295bfb4437e02626790ab0c800e",
|
||||
"@typescript/typescript-freebsd-x64@npm:7.0.2": "28284fbcd4a4c9a670a1b398a0ac4fd9b6a3512fe2cf68da4d7501b60eefd0e7c2c6fd1e61f7e2b107a0db543b8672933aca2e8fde3c142c5ac2b757c6687198",
|
||||
"@typescript/typescript-linux-arm64@npm:7.0.2": "57dd84c98be1706777b678426924ae299f89f9e4e50e4c0ef7797a875b4536d85b1d78d09e3d9ae5ff80e25db879b92f98de6be73997f6600b8ebffe2ac50b6a",
|
||||
"@typescript/typescript-linux-arm@npm:7.0.2": "bbb0aa9f0460f9ceeea95dfd0f95b848b75061b1c1b2a8c58e877aebd80173f7d34a0abdd3bfb2c90dc34b9104608a8f9e9a66b1f058ba9d39580e5eb4548454",
|
||||
"@typescript/typescript-linux-loong64@npm:7.0.2": "f5ab39c63b4f15ea399367076663b1d193ca3f956633b4c6bc9d8a1fb99622931e31143986d72fa38829345fbdf2aa1e1bb944f947c335752cae9eb215c2525c",
|
||||
"@typescript/typescript-linux-mips64el@npm:7.0.2": "636a03f3590d154e1c4a175739fef829c3707de14798949bfaa172b124986b7d0cb101b9f44405c431c3646c4ce3a155a9f508d89ca29031ba479498903c1239",
|
||||
"@typescript/typescript-linux-ppc64@npm:7.0.2": "c3b69a9e006889792813465dcceb9ae16968b56bb28a33fc912257193f7bd7abf7dec032242d16691299f8c5befc49cc0efe5e8599473f52381307cfe5281f07",
|
||||
"@typescript/typescript-linux-riscv64@npm:7.0.2": "1f7df51582a1011adfe885b3ad28623f4c2d877774bd58d0e8d3a435dffeb7bc4772371ccbe72bff11c50017d667d50dae82f98de408b935435a3eb17612efd6",
|
||||
"@typescript/typescript-linux-s390x@npm:7.0.2": "ccf05f5e008cf7c45a0f35c89ae32e4432a52602f119daaa4bd5e4030072ee0f4b6097d889c0eed95eb34a10b92d8d7bff83c0ef3801f18e2c909f60cf66f1eb",
|
||||
"@typescript/typescript-linux-x64@npm:7.0.2": "576f37c404381f522e5103736e91988931b41b527c2c3a0c6d00b552d5a4650fd84cb7ef747b083ab12b3d50d8ec206c4d8c0a4e879d7234d0e8ff25a93f4711",
|
||||
"@typescript/typescript-netbsd-arm64@npm:7.0.2": "d5f9682bac483d971307f0f444670a52d7ef388842eb922a36c072ca8d42bc16eec0a1353c097b97a50e56f59ca6924633defe4f7eba79ecaded9a31d157deda",
|
||||
"@typescript/typescript-netbsd-x64@npm:7.0.2": "5020e056d26b81e10c94a207289ab399ace20a89e808a8c3059df8adc7d5c2e0be33bc31ee892ffae63ace500c7aaec628245899e4be8f5095a5d007879e3695",
|
||||
"@typescript/typescript-openbsd-arm64@npm:7.0.2": "a41cae1c266a33c2c906c6f7e59d0b93fe392345428ba4c5f92ea1ee4baaee2898cbe7770b7f90c48379a1c0f2ffe488723b4aba77d54cc22f70bd7e0b2aa2cd",
|
||||
"@typescript/typescript-openbsd-x64@npm:7.0.2": "ef7384181b8060bf03ab74f99489b82acdbb1efcce97fcd7c15b6c1b698dff1f288d34d05f89fbb28871bb8e7a840f9a3e9b7f93e83a07068c039f68fd6968b6",
|
||||
"@typescript/typescript-sunos-x64@npm:7.0.2": "e9ebbd23657c7344f7afb873db48a422fdec01101fabdaa6f2464f928639e7e3f46f6a7d6f09cbbbf07cda3ee042aa512b59b63dce69d44373649df973eb2114",
|
||||
"@typescript/typescript-win32-arm64@npm:7.0.2": "40144b21611c3ccc08999981cfc62ba172b8587acc0c639ef987231dd75fc26bbcd1ff5caf7fb1de6e948b1dca77d5d802a8347629c1c65cc471103d3f9a9988",
|
||||
"@typescript/typescript-win32-x64@npm:7.0.2": "8c4b740a395697f07825f2f8343ed21149f4379e858ec2fcab4a8e5f2c8c40a7586ee72404356e38380a78d637a9b7aa928376668bedc9bbb017635fc0f6648a",
|
||||
"@unrs/resolver-binding-android-arm-eabi@npm:1.11.1": "5c8769703d724915224711f718085f541d8558e95d8646c6cca5709f1f7dd00ce65d0e2d0bc03bb1c0c74d22d70d54cfc490176dbb7c6f5d06072365ec7ef6b6",
|
||||
"@unrs/resolver-binding-android-arm64@npm:1.11.1": "7ab93a01b7f4cbc99bfaf8cd35a1454f78826bb2840f0387a19491cb4835b16d81d30ca2b4b71a43643f58aaceb83a63cd89274a3f16637e35887e67a93ea21e",
|
||||
"@unrs/resolver-binding-darwin-arm64@npm:1.11.1": "f8bd59a69ca200f9590a94de5699a0cecbcba120f5b82b2295468d36f943be48d957a8ca466f3fb30466abafee4a9672831c382ff9dea4ccdaa0a92992bb41b1",
|
||||
"@unrs/resolver-binding-darwin-x64@npm:1.11.1": "423acf3a8032b6bde50fabcdeccd4c1954bbede56f8c2fc5134621fd957f931a08ad74b3690762e3e18e2f5f31f35dc93b826a1c2626031d218dc4b16d415efc",
|
||||
"@unrs/resolver-binding-freebsd-x64@npm:1.11.1": "d6b88ea9447328f4f5e373e77524daa52d5630ecc7035ca67121082e2017a91dc9e3fd7b8230e41f1307137ee7487b0bc0c8a922dda1b77b01f735202486e36f",
|
||||
"@unrs/resolver-binding-linux-arm-gnueabihf@npm:1.11.1": "d4a3248f64ab92ea680b3bd5f74c19f15c8f82eb1628e32aeaa058a7fd2efdbba4b5d4e011e453389e42e79cbf00847c79a172ef66d8c9b555feada7a2693772",
|
||||
"@unrs/resolver-binding-linux-arm-musleabihf@npm:1.11.1": "1426c4a182922d16b684cfaff9a2d1cc6ddb06eba6fbe966d8d5a88fc0ed6660f4742c7d90659dc14f9f152132fcbde4afd483b5d0c8aa22eedd1154b0f3c632",
|
||||
"@unrs/resolver-binding-linux-arm64-gnu@npm:1.11.1": "baa3911178e6462c8d682d3ec182e95fc33f308d5b50662f07108a9a5572d365c97604932887113053fada46949580fabc9ca704822c714160ba8eee0387b286",
|
||||
"@unrs/resolver-binding-linux-arm64-musl@npm:1.11.1": "cb7763961f472f201e885753c3daf72231990c65fa5112a76a996f7c5754f2e6688cdc58f1861b05b5f176dae9255e34a860c40b21401318395eb4939759e46a",
|
||||
"@unrs/resolver-binding-linux-ppc64-gnu@npm:1.11.1": "148d28b05c5d50bc4d429f5da3e675b1285387b54c8e5363d7c288b53f2f38688bf9472ac5f2e4ba7fa3c3d7f19bac19738b1815a8973ba29c6bae76990b66f7",
|
||||
"@unrs/resolver-binding-linux-riscv64-gnu@npm:1.11.1": "40ba923597ae297b7be85de1769025578e16af29def72060e7603ec3311fefe537c9608520e771291e934af7e64e3a52d74ccb5ee1f7a657ba2f2a2fcfbf3df7",
|
||||
"@unrs/resolver-binding-linux-riscv64-musl@npm:1.11.1": "193da09875cf4ce3ea9ef24a141f9235da9095808b157b4dc83ce431f97732f2d19f65d4030771187d1a8424f6843e8a50ac6ba2ab4391271f80680c1166b2d7",
|
||||
"@unrs/resolver-binding-linux-s390x-gnu@npm:1.11.1": "c376fbbfbe0909844c188f23eec33c937fbf4a1f2fe81418726aa9bab91b44d9411ec98560ed73aaf15fa2082483fb0907a335535449623e3e4a604ee18b7ac3",
|
||||
"@unrs/resolver-binding-linux-x64-gnu@npm:1.11.1": "c3011171259f4f4c5c1751e565fd6f0ec203558484234cc438279a26f6fb2ec0d4bbed72ed9bfbc9967e43351fd8e3aa716269b8e670a7c9421ff64a1a9123eb",
|
||||
"@unrs/resolver-binding-linux-x64-musl@npm:1.11.1": "27da30650ec1e6378bc47665a944913839ef95e9af1bc7892f6ad3fd7cd10468d5b4da8caa03f83e3c56e03253cae4034ba1ee64d3ceb19a3656f31d362eaabf",
|
||||
"@unrs/resolver-binding-wasm32-wasi@npm:1.11.1": "ca69e8caeed033c074d9413112264fe1c0bdaaedb4fa9e6f5bcbf3a64ee98fa8261a6b5e54c3d7b7144cf020217c9a89f308086ec64d11d78480bd5885dc2e1a",
|
||||
"@unrs/resolver-binding-win32-arm64-msvc@npm:1.11.1": "4aabb2e8c80590650bd2b46f205f24e9f345ead68e7b53c20adb219d0c3f030c605d5434f3895fde68ebfa521ea97ea6da974e342e19487086da6a16332860df",
|
||||
"@unrs/resolver-binding-win32-ia32-msvc@npm:1.11.1": "5b364708ea2985d0e59f235a00e05bf3668704a81e9d32e8929980c84fd0bd67102c2041337b08e266a8bc4883ddf618ac7cb5e1f64614d8f9861cc4e3208905",
|
||||
"@unrs/resolver-binding-win32-x64-msvc@npm:1.11.1": "92ff0d27efe168480a14c8d705c0f68624f01251bdc5f8f41bbd6c7ed8ea23effb8481f01eb93270896822397fe2fd78a427c1756ecabc3cb13a746c918b5949",
|
||||
"appdmg@npm:0.6.6": "7439a81fef5a0bee250f34a776f329d9946882aec5dff01fe3f2759a75936c371dedc3ad326c474a6362538b746009cf06736b20bf4dd379b7f29563987720c5",
|
||||
"electron-installer-debian@npm:3.2.0": "cd342223b517258551e4bc45ee84f90ef79eec405ba66da80e9332cff388936684bec33d4613550d06b41cda5a3056fab5753a6292a732d1a21c9c13303599b9",
|
||||
"lightningcss-android-arm64@npm:1.32.0": "119b578a5ce59674c45fe8dc269fdb2770d678571e7fd3f7eca763807d15542689d01f75f2836e1aa49b9ddd0caa7ab3a5301bb23b39418eaeba1efab3e85975",
|
||||
"lightningcss-darwin-arm64@npm:1.32.0": "55010ae8ee7aac61da41fbc81992e11b1ca386087bb8493deb1014ea90c2deeef1b4126621722aa5b8a1aeee039ec7e3b1b9f7779d128963d6e436743f5d23aa",
|
||||
"lightningcss-darwin-x64@npm:1.32.0": "dd74c964c85c93842576f8caaf6c31ea273545e2f39f931716fed7700668f30d7ca92516197913ded19d836f6ff1876a91cca008125f097e254c98177e67bf86",
|
||||
"lightningcss-freebsd-x64@npm:1.32.0": "29b43c1a450171da1dece9ba2a13a6dc0866178e46fa51a8cf050fe9562eb81b45f8580a3aeaf2ac97fb2fd381d8cb88d950e701774c8d012e72a355df7ac264",
|
||||
"lightningcss-linux-arm-gnueabihf@npm:1.32.0": "783e6f8bba55ffd585f17229e97056c370ed834e0123d0002884b51a7fb54d6807e97076726fd0bfd949396134983e21a0aace0d4f69b916994db679a0d8a360",
|
||||
"lightningcss-linux-arm64-gnu@npm:1.32.0": "d694a6148f86d20e23b0806e8c6366de3bfc6927925ad17d226cd86c2ff4f025b1c88ae3d214dea06b45af2aa2d356cf504b1057b2a0a7027b44bfac11dc1f4d",
|
||||
"lightningcss-linux-arm64-musl@npm:1.32.0": "ad946ead9c3ff13b43818d94426940b50cf1ff3dacd07835b8c50f0d412f64574be3c467410786dfb3524e93bc98fb789ebb73e6de845ceb1729fceb5296fe6f",
|
||||
"lightningcss-linux-x64-gnu@npm:1.32.0": "183d5cda546283523761f606032596d70383d6fd153cfca56ab348d551ef06394ee009fae7818b0732de10d9d0ee27db483cbc7e0d0899305a37a118504d609e",
|
||||
"lightningcss-linux-x64-musl@npm:1.32.0": "67079567d13d5464a2556630dcbcbb8ccd0e3188d56b0a732c651930a823a708b91faa067256a15be6f289f07f1b57ca433d38ad397a9a102fbb85d0b85b5ea0",
|
||||
"lightningcss-win32-arm64-msvc@npm:1.32.0": "6117fdfb4ef1c2d8054fb469659e406ae32adae9dc712e2e5ed3f813bf25a52f0954911e92a5d397aeeba7151bafb3370dfc50504b94e719f4018de7d3cc3687",
|
||||
"lightningcss-win32-x64-msvc@npm:1.32.0": "f4a917eebae4f3718eaa4d3a16e268a42f117180e6bda101b380939f6738d2754dbb69bd454ee412bbc6e6290e2d8446c5f6ee3a63b144c9bd6f40a93109b7ab"
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
diff --git a/packages/backend/native/index.js b/packages/backend/native/index.js
|
||||
--- a/packages/backend/native/index.js
|
||||
+++ b/packages/backend/native/index.js
|
||||
@@ -1,14 +1,2 @@
|
||||
-/** @type {import('.')} */
|
||||
-let binding;
|
||||
-try {
|
||||
- binding = require('./server-native.node');
|
||||
-} catch {
|
||||
- binding =
|
||||
- process.arch === 'arm64'
|
||||
- ? require('./server-native.arm64.node')
|
||||
- : process.arch === 'arm'
|
||||
- ? require('./server-native.armv7.node')
|
||||
- : require('./server-native.x64.node');
|
||||
-}
|
||||
-
|
||||
-module.exports = binding;
|
||||
+/** @type {import('.')} */
|
||||
+module.exports = require('./server-native.node');
|
||||
@@ -0,0 +1,54 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchzip,
|
||||
makeRustPlatform,
|
||||
rust-bin,
|
||||
pkg-config,
|
||||
openssl,
|
||||
}:
|
||||
let
|
||||
revision = "2060c79ba17c6bb9f5823312b6f6b7f4a845738e";
|
||||
toolchain = rust-bin.stable."1.86.0".minimal;
|
||||
rustPlatform = makeRustPlatform {
|
||||
cargo = toolchain;
|
||||
rustc = toolchain;
|
||||
};
|
||||
in
|
||||
rustPlatform.buildRustPackage {
|
||||
pname = "affine-prisma-engines";
|
||||
version = "6.8.2";
|
||||
src = fetchzip {
|
||||
url = "https://github.com/prisma/prisma-engines/archive/${revision}.tar.gz";
|
||||
hash = "sha256-YvP3yJQoe+q7jjpwntaYkYjxyoDzqnXcpIZa4Y+I/+E=";
|
||||
};
|
||||
cargoHash = "sha256-lRM5Ha0+f+srxYaosbCe/hhpzIPVc7f+ux4FFvISHmM=";
|
||||
cargoBuildFlags = [
|
||||
"-p" "schema-engine-cli"
|
||||
"-p" "query-engine-node-api"
|
||||
];
|
||||
nativeBuildInputs = [ pkg-config ];
|
||||
buildInputs = [ openssl ];
|
||||
env = {
|
||||
OPENSSL_NO_VENDOR = "1";
|
||||
GIT_HASH = revision;
|
||||
SQLITE_MAX_VARIABLE_NUMBER = "250000";
|
||||
SQLITE_MAX_EXPR_DEPTH = "10000";
|
||||
CARGO_BUILD_JOBS = "8";
|
||||
};
|
||||
doCheck = false;
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
install -Dm755 target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/schema-engine \
|
||||
"$out/bin/schema-engine"
|
||||
install -Dm755 target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/libquery_engine.so \
|
||||
"$out/lib/libquery_engine.node"
|
||||
runHook postInstall
|
||||
'';
|
||||
meta = {
|
||||
description = "Source-built Prisma engines matching AFFiNE's locked client";
|
||||
homepage = "https://github.com/prisma/prisma-engines";
|
||||
license = lib.licenses.asl20;
|
||||
platforms = [ "x86_64-linux" ];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
diff --git a/packages/backend/server/src/base/graphql/index.ts b/packages/backend/server/src/base/graphql/index.ts
|
||||
--- a/packages/backend/server/src/base/graphql/index.ts
|
||||
+++ b/packages/backend/server/src/base/graphql/index.ts
|
||||
@@ -1,7 +1,5 @@
|
||||
import './config';
|
||||
-
|
||||
-import { join } from 'node:path';
|
||||
-
|
||||
+
|
||||
import type { ApolloDriverConfig } from '@nestjs/apollo';
|
||||
import { ApolloDriver } from '@nestjs/apollo';
|
||||
import { Global, Module } from '@nestjs/common';
|
||||
@@ -33,12 +31,7 @@
|
||||
useGlobalPrefix: true,
|
||||
graphiql: env.NODE_ENV === NodeEnv.Development,
|
||||
sortSchema: true,
|
||||
- autoSchemaFile: join(
|
||||
- env.projectRoot,
|
||||
- env.testing
|
||||
- ? './node_modules/.cache/schema.gql'
|
||||
- : './src/schema.gql'
|
||||
- ),
|
||||
+ autoSchemaFile: true,
|
||||
path: '/graphql',
|
||||
csrfPrevention: {
|
||||
requestHeaders: ['content-type'],
|
||||
@@ -0,0 +1,190 @@
|
||||
diff --git a/packages/frontend/core/src/components/root-app-sidebar/user-info/ai-usage.tsx b/packages/frontend/core/src/components/root-app-sidebar/user-info/ai-usage.tsx
|
||||
--- a/packages/frontend/core/src/components/root-app-sidebar/user-info/ai-usage.tsx
|
||||
+++ b/packages/frontend/core/src/components/root-app-sidebar/user-info/ai-usage.tsx
|
||||
@@ -1,8 +1,10 @@
|
||||
import {
|
||||
+ ServerService,
|
||||
SubscriptionService,
|
||||
UserCopilotQuotaService,
|
||||
} from '@affine/core/modules/cloud';
|
||||
import { WorkspaceDialogService } from '@affine/core/modules/dialogs';
|
||||
+import { ServerDeploymentType } from '@affine/graphql';
|
||||
import { useI18n } from '@affine/i18n';
|
||||
import { useLiveData, useService } from '@toeverything/infra';
|
||||
import { cssVar } from '@toeverything/theme';
|
||||
@@ -15,6 +17,12 @@ import * as styles from './index.css';
|
||||
export const AIUsage = () => {
|
||||
const t = useI18n();
|
||||
const copilotQuotaService = useService(UserCopilotQuotaService);
|
||||
+ const serverService = useService(ServerService);
|
||||
+ const isSelfhosted = useLiveData(
|
||||
+ serverService.server.config$.selector(
|
||||
+ c => c.type === ServerDeploymentType.Selfhosted
|
||||
+ )
|
||||
+ );
|
||||
const subscriptionService = useService(SubscriptionService);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -49,6 +55,24 @@ export const AIUsage = () => {
|
||||
});
|
||||
}, [workspaceDialogService]);
|
||||
|
||||
+ if (isSelfhosted) {
|
||||
+ return (
|
||||
+ <div
|
||||
+ data-testid="selfhosted-ai-usage"
|
||||
+ className={clsx(styles.usageBlock, styles.cloudUsageBlock)}
|
||||
+ >
|
||||
+ <div className={styles.usageLabel}>
|
||||
+ <div className={styles.usageLabelTitle}>
|
||||
+ {t['com.affine.selfhosted-ai-usage.title']()}
|
||||
+ </div>
|
||||
+ </div>
|
||||
+ <div className={styles.usageLabel}>
|
||||
+ {t['com.affine.selfhosted-ai-usage.description']()}
|
||||
+ </div>
|
||||
+ </div>
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
if (loading) {
|
||||
if (loadError) console.error(loadError);
|
||||
return null;
|
||||
diff --git a/packages/frontend/core/src/desktop/dialogs/setting/account-setting/ai-usage-panel.tsx b/packages/frontend/core/src/desktop/dialogs/setting/account-setting/ai-usage-panel.tsx
|
||||
--- a/packages/frontend/core/src/desktop/dialogs/setting/account-setting/ai-usage-panel.tsx
|
||||
+++ b/packages/frontend/core/src/desktop/dialogs/setting/account-setting/ai-usage-panel.tsx
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
SubscriptionService,
|
||||
UserCopilotQuotaService,
|
||||
} from '@affine/core/modules/cloud';
|
||||
-import { SubscriptionPlan } from '@affine/graphql';
|
||||
+import { ServerDeploymentType, SubscriptionPlan } from '@affine/graphql';
|
||||
import { useI18n } from '@affine/i18n';
|
||||
import { track } from '@affine/track';
|
||||
import { useLiveData, useService } from '@toeverything/infra';
|
||||
@@ -26,6 +26,11 @@ export const AIUsagePanel = ({
|
||||
const hasPaymentFeature = useLiveData(
|
||||
serverService.server.features$.map(f => f?.payment)
|
||||
);
|
||||
+ const isSelfhosted = useLiveData(
|
||||
+ serverService.server.config$.selector(
|
||||
+ c => c.type === ServerDeploymentType.Selfhosted
|
||||
+ )
|
||||
+ );
|
||||
const subscriptionService = useService(SubscriptionService);
|
||||
const aiSubscription = useLiveData(subscriptionService.subscription.ai$);
|
||||
useEffect(() => {
|
||||
@@ -53,6 +58,17 @@ export const AIUsagePanel = ({
|
||||
track.$.settingsPanel.accountUsage.viewPlans({ plan: SubscriptionPlan.AI });
|
||||
}, [onChangeSettingState]);
|
||||
|
||||
+ if (isSelfhosted) {
|
||||
+ return (
|
||||
+ <SettingRow
|
||||
+ data-testid="selfhosted-ai-usage"
|
||||
+ name={t['com.affine.selfhosted-ai-usage.title']()}
|
||||
+ desc={t['com.affine.selfhosted-ai-usage.description']()}
|
||||
+ spreadCol={false}
|
||||
+ />
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
if (loading) {
|
||||
if (loadError) {
|
||||
return (
|
||||
diff --git a/packages/frontend/core/src/mobile/dialogs/setting/user-usage/index.tsx b/packages/frontend/core/src/mobile/dialogs/setting/user-usage/index.tsx
|
||||
--- a/packages/frontend/core/src/mobile/dialogs/setting/user-usage/index.tsx
|
||||
+++ b/packages/frontend/core/src/mobile/dialogs/setting/user-usage/index.tsx
|
||||
@@ -5,6 +5,8 @@ import {
|
||||
UserCopilotQuotaService,
|
||||
UserQuotaService,
|
||||
} from '@affine/core/modules/cloud';
|
||||
+import { ServerDeploymentType } from '@affine/graphql';
|
||||
+import { useI18n } from '@affine/i18n';
|
||||
import { useLiveData, useService } from '@toeverything/infra';
|
||||
import { cssVar } from '@toeverything/theme';
|
||||
import { cssVarV2 } from '@toeverything/theme/v2';
|
||||
@@ -30,16 +32,20 @@ const Progress = ({
|
||||
desc,
|
||||
color,
|
||||
children,
|
||||
+ hideBar = false,
|
||||
+ 'data-testid': testId,
|
||||
}: {
|
||||
name: ReactNode;
|
||||
desc: ReactNode;
|
||||
percent?: number;
|
||||
color?: string | null;
|
||||
children?: React.ReactNode;
|
||||
+ hideBar?: boolean;
|
||||
+ 'data-testid'?: string;
|
||||
}) => {
|
||||
return (
|
||||
- <div className={styles.progressRoot}>
|
||||
+ <div className={styles.progressRoot} data-testid={testId}>
|
||||
<div className={styles.progressInfoRow}>
|
||||
<span className={styles.progressName}>{name}</span>
|
||||
<span className={styles.progressDesc}>{desc}</span>
|
||||
</div>
|
||||
@@ -46 +52 @@ const Progress = ({
|
||||
- {children ?? (
|
||||
+ {!hideBar && (children ?? (
|
||||
@@ -56 +62 @@ const Progress = ({
|
||||
- )}
|
||||
+ ))}
|
||||
@@ -110,6 +116,13 @@ const CloudUsage = () => {
|
||||
};
|
||||
const AiUsage = () => {
|
||||
+ const t = useI18n();
|
||||
const copilotQuotaService = useService(UserCopilotQuotaService);
|
||||
+ const serverService = useService(ServerService);
|
||||
+ const isSelfhosted = useLiveData(
|
||||
+ serverService.server.config$.selector(
|
||||
+ c => c.type === ServerDeploymentType.Selfhosted
|
||||
+ )
|
||||
+ );
|
||||
|
||||
const copilotActionLimit = useLiveData(
|
||||
copilotQuotaService.copilotQuota.copilotActionLimit$
|
||||
@@ -124,6 +137,17 @@ const AiUsage = () => {
|
||||
copilotQuotaService.copilotQuota.revalidate();
|
||||
}, [copilotQuotaService]);
|
||||
|
||||
+ if (isSelfhosted) {
|
||||
+ return (
|
||||
+ <Progress
|
||||
+ data-testid="selfhosted-ai-usage"
|
||||
+ name={t['com.affine.selfhosted-ai-usage.title']()}
|
||||
+ desc={t['com.affine.selfhosted-ai-usage.description']()}
|
||||
+ hideBar
|
||||
+ />
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
if (loading || loadError) {
|
||||
return <Loading />;
|
||||
}
|
||||
diff --git a/packages/frontend/i18n/src/resources/en.json b/packages/frontend/i18n/src/resources/en.json
|
||||
--- a/packages/frontend/i18n/src/resources/en.json
|
||||
+++ b/packages/frontend/i18n/src/resources/en.json
|
||||
@@ -931,6 +931,8 @@
|
||||
"com.affine.payment.ai.usage.purchase-button-label": "Purchase",
|
||||
"com.affine.payment.ai.usage.used-caption": "Times used",
|
||||
"com.affine.payment.ai.usage.used-detail": "{{used}}/{{limit}} times",
|
||||
+ "com.affine.selfhosted-ai-usage.title": "Self-hosted AI",
|
||||
+ "com.affine.selfhosted-ai-usage.description": "Provider and server limits may apply.",
|
||||
"com.affine.payment.subscription-status.active": "Active",
|
||||
"com.affine.payment.subscription-status.past-due": "Past-due bill",
|
||||
"com.affine.payment.subscription-status.trialing": "Trialing",
|
||||
diff --git a/packages/frontend/i18n/src/resources/ru.json b/packages/frontend/i18n/src/resources/ru.json
|
||||
--- a/packages/frontend/i18n/src/resources/ru.json
|
||||
+++ b/packages/frontend/i18n/src/resources/ru.json
|
||||
@@ -848,6 +848,8 @@
|
||||
"com.affine.payment.ai.usage.purchase-button-label": "Улучшить",
|
||||
"com.affine.payment.ai.usage.used-caption": "Использовалось",
|
||||
"com.affine.payment.ai.usage.used-detail": "\n{{used}}/{{limit}} Раз",
|
||||
+ "com.affine.selfhosted-ai-usage.title": "AI на своём сервере",
|
||||
+ "com.affine.selfhosted-ai-usage.description": "Могут действовать ограничения провайдера и сервера.",
|
||||
"com.affine.payment.subscription-status.active": "Активный",
|
||||
"com.affine.payment.subscription-status.past-due": "Просроченный счёт",
|
||||
"com.affine.payment.subscription-status.trialing": "Пробный период",
|
||||
+14
-2
@@ -148,9 +148,12 @@ in {
|
||||
nix-derivation-hash = pkgs.callPackage ./nix-derivation-hash {};
|
||||
"sentinèlla" = pkgs.callPackage (./. + "/sentinèlla") {};
|
||||
deploy = pkgs.callPackage ./deploy { inherit inputs; };
|
||||
element-web = pkgs.callPackage ./element-web {};
|
||||
element-web = pkgs.callPackage ./element-web { pnpm = giteaPkgs.pnpm_10; };
|
||||
shellplot = pkgs.callPackage ./shellplot {};
|
||||
affine-chatgpt = pkgs.callPackage ./affine-chatgpt {};
|
||||
gitea-kanban-tui = pkgs.callPackage ./gitea-kanban-tui rust.commonArgs;
|
||||
routine-server = pkgs.callPackage ./routine-server rust.commonArgs;
|
||||
routine-tui = pkgs.callPackage ./routine-tui rust.commonArgs;
|
||||
which-country-rs = pkgs.callPackage ./which-country-rs {};
|
||||
onlinepubs2man = pkgs.callPackage ./onlinepubs2man {};
|
||||
migrator = pkgs.callPackage ./migrator { inherit self; };
|
||||
@@ -180,6 +183,15 @@ in {
|
||||
pg-15-ext-plsh = buildPlShExt pkgs "15";
|
||||
stable-video-diffusion-api = pkgs.callPackage ./stable-video-diffusion-api {};
|
||||
media-browser = pkgs.callPackage ./media-browser {};
|
||||
} // pkgs.lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
|
||||
} // pkgs.lib.optionalAttrs (system == "x86_64-linux") (let
|
||||
affine = pkgs.callPackage ./affine {
|
||||
inherit inputs system;
|
||||
nodejs = pkgs.nodejs_22;
|
||||
};
|
||||
in {
|
||||
inherit affine;
|
||||
affine-frontend-static = affine.frontendStatic;
|
||||
horizon = pkgs.callPackage ./horizon {};
|
||||
}) // pkgs.lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
|
||||
with-attic-cache = pkgs.callPackage ./with-attic-cache {};
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
nodejs,
|
||||
jitsi-meet,
|
||||
fetchPnpmDeps,
|
||||
pnpm_10,
|
||||
pnpm,
|
||||
pnpmConfigHook,
|
||||
faketty,
|
||||
config,
|
||||
@@ -14,7 +14,6 @@
|
||||
}:
|
||||
|
||||
let
|
||||
pnpm = pnpm_10;
|
||||
patchDir = ./patches;
|
||||
patches = if builtins.pathExists patchDir then map (name: patchDir + "/${name}") (
|
||||
builtins.filter (name: lib.hasSuffix ".patch" name) (builtins.attrNames (builtins.readDir patchDir))
|
||||
|
||||
@@ -62,7 +62,7 @@ gcr_sweep_ttl() {
|
||||
fi
|
||||
|
||||
case "$status" in
|
||||
create_pending|pending_vm|vm_active|retiring_vm|rebuild_pending|rebuild_requesting|rebuild_running) ;;
|
||||
create_pending|pending_vm|vm_active|transfer_pending|retiring_vm|rebuild_pending|rebuild_requesting|rebuild_running) ;;
|
||||
*) continue ;;
|
||||
esac
|
||||
ttl_min="$(gcr_record_field "$rec" ttl_min)"
|
||||
@@ -75,7 +75,7 @@ gcr_sweep_ttl() {
|
||||
gcr_lock_acquire "$key" || continue
|
||||
rec="$(gcr_record_get "$job_id" "$attempt")"
|
||||
case "$(gcr_record_field "$rec" status)" in
|
||||
create_pending|pending_vm|vm_active|retiring_vm|rebuild_pending|rebuild_requesting|rebuild_running) ;;
|
||||
create_pending|pending_vm|vm_active|transfer_pending|retiring_vm|rebuild_pending|rebuild_requesting|rebuild_running) ;;
|
||||
*) gcr_lock_release "$key"; continue ;;
|
||||
esac
|
||||
ttl_min="$(gcr_record_field "$rec" ttl_min)"
|
||||
@@ -522,7 +522,7 @@ gcr_sweep_stale_runners() {
|
||||
runners="$(gcr_gitea_list_runners "$repo")" || continue
|
||||
# Here-doc instead of pipe: dash runs pipe tails in a subshell, which
|
||||
# would strand gcr_event/audit writes from the caller's perspective.
|
||||
while read -r rid rname; do
|
||||
while read -r rid _rbusy _rdisabled rname; do
|
||||
[ -n "${rid:-}" ] || continue
|
||||
case "$rname" in
|
||||
gcr-*) ;;
|
||||
@@ -534,11 +534,23 @@ gcr_sweep_stale_runners() {
|
||||
jid="${rest%-*}"
|
||||
if ! gcr_record_exists_for_runner "$repo" "$rname"; then
|
||||
gcr_log warn --ns=sweep "stale repo=$repo registration id=$rid name=$rname -> retire"
|
||||
if gcr_gitea_deregister_runner_exact "$repo" "$rname"; then
|
||||
gcr_event "stale-runner-deleted" "${jid:-unknown}" "{\"repo\":\"$repo\",\"runner_id\":$rid,\"name\":\"$rname\"}"
|
||||
else
|
||||
gcr_log error --ns=sweep "failed deleting repo=$repo runner id=$rid"
|
||||
fi
|
||||
stale_status=0
|
||||
gcr_gitea_deregister_runner_exact "$repo" "$rname" \
|
||||
|| stale_status="$?"
|
||||
case "$stale_status" in
|
||||
0)
|
||||
gcr_event "stale-runner-deleted" "${jid:-unknown}" \
|
||||
"{\"repo\":\"$repo\",\"runner_id\":$rid,\"name\":\"$rname\"}"
|
||||
;;
|
||||
2|3)
|
||||
gcr_log info --ns=sweep \
|
||||
"stale runner retirement pending repo=$repo runner id=$rid"
|
||||
;;
|
||||
*)
|
||||
gcr_log error --ns=sweep \
|
||||
"failed deleting repo=$repo runner id=$rid"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done <<EOF
|
||||
$runners
|
||||
@@ -551,6 +563,108 @@ EOF
|
||||
IFS="$oldIFS"
|
||||
}
|
||||
|
||||
# Upgrade recovery for records created before runner_id persistence. Exact live
|
||||
# name lookup binds safely. Confirmed absence plus complete no-active-job scan
|
||||
# moves VM to synthetic cleanup ownership and restores origin to deferred.
|
||||
gcr_recover_legacy_runner_ids() {
|
||||
for legacy_file in $(gcr_active_records); do
|
||||
legacy_rec="$(cat "$legacy_file")"
|
||||
case "$(gcr_record_field "$legacy_rec" status)" in
|
||||
pending_vm|vm_active) ;;
|
||||
*) continue ;;
|
||||
esac
|
||||
[ "$(gcr_record_field "$legacy_rec" bootstrapped)" = true ] || continue
|
||||
[ -z "$(gcr_record_field "$legacy_rec" runner_id)" ] || continue
|
||||
legacy_job="$(gcr_record_field "$legacy_rec" job_id)"
|
||||
legacy_attempt="$(gcr_record_field "$legacy_rec" run_attempt)"
|
||||
legacy_repo="$(gcr_record_field "$legacy_rec" repo)"
|
||||
legacy_runner="$(gcr_record_field "$legacy_rec" runner_name)"
|
||||
[ -n "$legacy_repo" ] && [ -n "$legacy_runner" ] || continue
|
||||
gcr_repo_allowed "$legacy_repo" || continue
|
||||
|
||||
legacy_lookup=0
|
||||
gcr_gitea_find_runner_exact "$legacy_repo" "$legacy_runner" \
|
||||
|| legacy_lookup="$?"
|
||||
case "$legacy_lookup" in
|
||||
0)
|
||||
legacy_key="$(gcr_alloc_key "$legacy_job" "$legacy_attempt")"
|
||||
gcr_lock_acquire "$legacy_key" || continue
|
||||
legacy_rec="$(gcr_record_get "$legacy_job" "$legacy_attempt")"
|
||||
if [ -n "$legacy_rec" ] \
|
||||
&& [ -z "$(gcr_record_field "$legacy_rec" runner_id)" ] \
|
||||
&& [ "$(gcr_record_field "$legacy_rec" repo)" = "$legacy_repo" ] \
|
||||
&& [ "$(gcr_record_field "$legacy_rec" runner_name)" = "$legacy_runner" ]; then
|
||||
legacy_rec="$(printf '%s' "$legacy_rec" | jq -c \
|
||||
--arg id "$GCR_RUNNER_ID" \
|
||||
'.runner_id = ($id | tonumber)')" \
|
||||
&& gcr_record_put "$legacy_job" "$legacy_attempt" \
|
||||
"$legacy_rec" || true
|
||||
fi
|
||||
gcr_lock_release "$legacy_key"
|
||||
;;
|
||||
1)
|
||||
legacy_active=0
|
||||
gcr_gitea_repo_has_active_jobs "$legacy_repo" \
|
||||
|| legacy_active="$?"
|
||||
[ "$legacy_active" -eq 1 ] || continue
|
||||
legacy_cleanup_job="legacy-cleanup-$legacy_job"
|
||||
if gcr_transfer_begin "$legacy_job" "$legacy_attempt" \
|
||||
"$legacy_cleanup_job" "$legacy_attempt" cleanup_pending \
|
||||
legacy_cleanup; then
|
||||
gcr_event "legacy-runner-recovered" "$legacy_job" \
|
||||
"{\"repo\":\"$legacy_repo\",\"runner\":\"$legacy_runner\"}"
|
||||
fi
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
# Poll repository job history by runner ID. A unique active job takes precedence
|
||||
# over legacy terminal history; ambiguous active or terminal matches stay put.
|
||||
gcr_reconcile_runner_assignments() {
|
||||
for assignment_file in $(gcr_active_records); do
|
||||
assignment_rec="$(cat "$assignment_file")"
|
||||
case "$(gcr_record_field "$assignment_rec" status)" in
|
||||
pending_vm|vm_active) ;;
|
||||
*) continue ;;
|
||||
esac
|
||||
assignment_runner="$(gcr_record_field "$assignment_rec" runner_id)"
|
||||
case "$assignment_runner" in ''|0|*[!0-9]*) continue ;; esac
|
||||
assignment_repo="$(gcr_record_field "$assignment_rec" repo)"
|
||||
gcr_repo_allowed "$assignment_repo" || continue
|
||||
assignment_jobs="$(gcr_gitea_list_jobs "$assignment_repo")" || continue
|
||||
assignment_matches="$(printf '%s\n' "$assignment_jobs" | jq -cs \
|
||||
--arg runner "$assignment_runner" \
|
||||
'[.[] | select((.runner_id | tostring) == $runner)]
|
||||
| [.[] | select(.status == "in_progress")] as $active
|
||||
| if ($active | length) == 1 then $active
|
||||
elif ($active | length) > 1 then []
|
||||
else [.[] | select(.status == "completed")]
|
||||
| if length == 1 then . else [] end
|
||||
end')" || continue
|
||||
[ "$(printf '%s' "$assignment_matches" | jq 'length')" -eq 1 ] \
|
||||
|| continue
|
||||
assignment_job="$(printf '%s' "$assignment_matches" | jq -r '.[0].id')"
|
||||
assignment_attempt="$(printf '%s' "$assignment_matches" | jq -r '.[0].run_attempt')"
|
||||
assignment_status="$(printf '%s' "$assignment_matches" | jq -r '.[0].status')"
|
||||
assignment_conclusion="$(printf '%s' "$assignment_matches" | jq -r '.[0].conclusion')"
|
||||
assignment_name="$(printf '%s' "$assignment_matches" | jq -r '.[0].runner_name')"
|
||||
case "$assignment_status" in
|
||||
in_progress)
|
||||
gcr_apply_actual_job "$assignment_repo" "$assignment_runner" \
|
||||
"$assignment_name" "$assignment_job" "$assignment_attempt" \
|
||||
vm_active polling || true
|
||||
;;
|
||||
completed)
|
||||
gcr_apply_actual_job "$assignment_repo" "$assignment_runner" \
|
||||
"$assignment_name" "$assignment_job" "$assignment_attempt" \
|
||||
"completed:${assignment_conclusion:-unknown}" polling || true
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
# Runs SSH-push bootstrap for VMs that were created but not yet provisioned.
|
||||
# Registration token is fetched fresh per attempt (short-lived usefulness).
|
||||
gcr_bootstrap_pending() {
|
||||
@@ -616,10 +730,6 @@ gcr_bootstrap_pending() {
|
||||
continue
|
||||
fi
|
||||
|
||||
reg_token="$(gcr_gitea_registration_token "$repo")" || {
|
||||
gcr_lock_release "$key"
|
||||
continue
|
||||
}
|
||||
ttl_min="$(gcr_record_field "$rec" ttl_min)"
|
||||
known_hosts_file="$(gcr_vm_known_hosts_file \
|
||||
"$job_id" "$attempt" "$ip")" || {
|
||||
@@ -629,14 +739,59 @@ gcr_bootstrap_pending() {
|
||||
continue
|
||||
}
|
||||
|
||||
gcr_log info --ns=alloc "bootstrapping vm=$vm_id ip=$ip job=$job_id"
|
||||
if gcr_vm_bootstrap_ssh "$ip" "$label" "$reg_token" "$runner_name" \
|
||||
"$known_hosts_file"; then
|
||||
rec="$(printf '%s' "$rec" | jq -c '.bootstrapped = true | .ip = $ip' --arg ip "$ip")"
|
||||
runner_id="$(gcr_record_field "$rec" runner_id)"
|
||||
if [ -z "$runner_id" ]; then
|
||||
lookup_status=0
|
||||
gcr_gitea_find_runner_exact "$repo" "$runner_name" \
|
||||
|| lookup_status="$?"
|
||||
if [ "$lookup_status" -eq 1 ]; then
|
||||
reg_token="$(gcr_gitea_registration_token "$repo")" || {
|
||||
gcr_lock_release "$key"
|
||||
continue
|
||||
}
|
||||
gcr_log info --ns=alloc \
|
||||
"registering vm=$vm_id ip=$ip job=$job_id"
|
||||
if ! gcr_vm_bootstrap_ssh "$ip" "$label" "$reg_token" \
|
||||
"$runner_name" "$known_hosts_file" "$job_id" "$attempt" \
|
||||
"$vm_id"; then
|
||||
gcr_log warn --ns=alloc \
|
||||
"bootstrap registration failed vm=$vm_id (retry next tick)"
|
||||
gcr_lock_release "$key"
|
||||
continue
|
||||
fi
|
||||
lookup_status=0
|
||||
gcr_gitea_find_runner_exact "$repo" "$runner_name" \
|
||||
|| lookup_status="$?"
|
||||
fi
|
||||
if [ "$lookup_status" -ne 0 ] \
|
||||
|| [ "$GCR_RUNNER_DISABLED" != false ]; then
|
||||
gcr_lock_release "$key"
|
||||
continue
|
||||
fi
|
||||
runner_id="$GCR_RUNNER_ID"
|
||||
rec="$(printf '%s' "$rec" | jq -c --arg id "$runner_id" \
|
||||
--arg ip "$ip" \
|
||||
'.runner_id = ($id | tonumber) | .ip = $ip')" || {
|
||||
gcr_lock_release "$key"
|
||||
continue
|
||||
}
|
||||
gcr_record_put "$job_id" "$attempt" "$rec" || {
|
||||
gcr_lock_release "$key"
|
||||
continue
|
||||
}
|
||||
gcr_event "runner-id-persisted" "$job_id" \
|
||||
"{\"vm_id\":$vm_id,\"runner_id\":$runner_id}"
|
||||
fi
|
||||
|
||||
if gcr_vm_runner_service_pinned "$ip" "$known_hosts_file" start; then
|
||||
rec="$(printf '%s' "$rec" | jq -c \
|
||||
'.bootstrapped = true | .ip = $ip' --arg ip "$ip")"
|
||||
gcr_record_put "$job_id" "$attempt" "$rec"
|
||||
gcr_event "vm-bootstrapped" "$job_id" "{\"vm_id\":$vm_id,\"ip\":\"$ip\"}"
|
||||
gcr_event "vm-bootstrapped" "$job_id" \
|
||||
"{\"vm_id\":$vm_id,\"ip\":\"$ip\",\"runner_id\":$runner_id}"
|
||||
else
|
||||
gcr_log warn --ns=alloc "bootstrap failed vm=$vm_id (retry next tick)"
|
||||
gcr_log warn --ns=alloc \
|
||||
"runner activation failed vm=$vm_id (retry next tick)"
|
||||
fi
|
||||
gcr_lock_release "$key"
|
||||
done
|
||||
@@ -670,6 +825,18 @@ gcr_reap_finished_jobs() {
|
||||
pending_vm|vm_active) ;;
|
||||
*) gcr_lock_release "$key"; continue ;;
|
||||
esac
|
||||
runner_id="$(gcr_record_field "$rec" runner_id)"
|
||||
if [ -n "$runner_id" ]; then
|
||||
authoritative_state="$(gcr_gitea_confirm_runner_job \
|
||||
"$repo" "$runner_id" "$job_id" "$attempt")" || {
|
||||
gcr_lock_release "$key"
|
||||
continue
|
||||
}
|
||||
case "$authoritative_state" in
|
||||
completed:*) state="$authoritative_state" ;;
|
||||
*) gcr_lock_release "$key"; continue ;;
|
||||
esac
|
||||
fi
|
||||
finish_status=0
|
||||
gcr_vm_finish_terminal "$job_id" "$attempt" "$rec" "$state" reconcile \
|
||||
|| finish_status="$?"
|
||||
@@ -684,6 +851,9 @@ gcr_reap_finished_jobs() {
|
||||
}
|
||||
|
||||
gcr_tick() {
|
||||
gcr_reconcile_transfers
|
||||
gcr_recover_legacy_runner_ids
|
||||
gcr_reconcile_runner_assignments
|
||||
gcr_sweep_create_ambiguous
|
||||
gcr_sweep_cleanup_pending
|
||||
gcr_sweep_retiring_vms
|
||||
|
||||
@@ -159,10 +159,20 @@ gcr_decide() {
|
||||
|
||||
gcr_count_active() {
|
||||
count=0
|
||||
seen_vms=" "
|
||||
for f in $(gcr_active_records); do
|
||||
status="$(gcr_record_field "$(cat "$f")" status)"
|
||||
rec="$(cat "$f")"
|
||||
status="$(gcr_record_field "$rec" status)"
|
||||
case "$status" in
|
||||
create_pending|create_ambiguous|pending_vm|vm_active|retiring_vm|rebuild_pending|rebuild_requesting|rebuild_running|cleanup_pending)
|
||||
create_pending|create_ambiguous|pending_vm|vm_active|transfer_pending|retiring_vm|rebuild_pending|rebuild_requesting|rebuild_running|cleanup_pending)
|
||||
vm_id="$(gcr_record_field "$rec" vm_id)"
|
||||
case "$vm_id" in
|
||||
''|0|null) vm_identity="record:${f##*/}" ;;
|
||||
*[!0-9]*) vm_identity="record:${f##*/}" ;;
|
||||
*) vm_identity="vm:$vm_id" ;;
|
||||
esac
|
||||
case "$seen_vms" in *" $vm_identity "*) continue ;; esac
|
||||
seen_vms="$seen_vms$vm_identity "
|
||||
count=$((count + 1))
|
||||
;;
|
||||
esac
|
||||
@@ -173,13 +183,23 @@ gcr_count_active() {
|
||||
gcr_count_active_repo() {
|
||||
repo="$1"
|
||||
count=0
|
||||
seen_vms=" "
|
||||
for f in $(gcr_active_records); do
|
||||
rec="$(cat "$f")"
|
||||
case "$(gcr_record_field "$rec" status)" in
|
||||
create_pending|create_ambiguous|pending_vm|vm_active|retiring_vm|rebuild_pending|rebuild_requesting|rebuild_running|cleanup_pending) ;;
|
||||
create_pending|create_ambiguous|pending_vm|vm_active|transfer_pending|retiring_vm|rebuild_pending|rebuild_requesting|rebuild_running|cleanup_pending) ;;
|
||||
*) continue ;;
|
||||
esac
|
||||
[ "$(gcr_record_field "$rec" repo)" = "$repo" ] && count=$((count + 1))
|
||||
[ "$(gcr_record_field "$rec" repo)" = "$repo" ] || continue
|
||||
vm_id="$(gcr_record_field "$rec" vm_id)"
|
||||
case "$vm_id" in
|
||||
''|0|null) vm_identity="record:${f##*/}" ;;
|
||||
*[!0-9]*) vm_identity="record:${f##*/}" ;;
|
||||
*) vm_identity="vm:$vm_id" ;;
|
||||
esac
|
||||
case "$seen_vms" in *" $vm_identity "*) continue ;; esac
|
||||
seen_vms="$seen_vms$vm_identity "
|
||||
count=$((count + 1))
|
||||
done
|
||||
printf '%s' "$count"
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ gcr_gitea_admin_token() {
|
||||
tr -d '\n' < "$GITEA_ADMIN_TOKEN_FILE"
|
||||
}
|
||||
|
||||
# gcr_gitea_list_runners REPO — prints "id name" lines for repo runners.
|
||||
# gcr_gitea_list_runners REPO — prints "id busy disabled name" lines.
|
||||
gcr_gitea_list_runners() {
|
||||
repo="$1"
|
||||
gcr_gitea_admin_token >/dev/null || return 1
|
||||
@@ -50,10 +50,14 @@ gcr_gitea_list_runners() {
|
||||
|| return 1
|
||||
printf '%s' "$runner_page" | jq -e \
|
||||
'.runners | select(type == "array")
|
||||
| all(.[]; (.id | type) == "number" and (.name | type) == "string")' \
|
||||
| all(.[]; (.id | type) == "number"
|
||||
and (.busy | type) == "boolean"
|
||||
and (.disabled | type) == "boolean"
|
||||
and (.name | type) == "string")' \
|
||||
>/dev/null || return 1
|
||||
printf '%s' "$runner_page" \
|
||||
| jq -r '.runners[] | "\(.id) \(.name)"' || return 1
|
||||
| jq -r '.runners[] | "\(.id) \(.busy) \(.disabled) \(.name)"' \
|
||||
|| return 1
|
||||
runner_count="$(printf '%s' "$runner_page" | jq -er '.runners | length')" \
|
||||
|| return 1
|
||||
[ "$runner_count" -lt 50 ] && return 0
|
||||
@@ -61,6 +65,37 @@ gcr_gitea_list_runners() {
|
||||
done
|
||||
}
|
||||
|
||||
# Find one exact runner after a fresh list. Globals avoid command-substitution
|
||||
# subshell state loss. Exit 0 = found, 1 = absent, 2 = ambiguous/list failure.
|
||||
gcr_gitea_find_runner_exact() {
|
||||
find_runner_repo="$1"; find_runner_name="$2"
|
||||
GCR_RUNNER_ID=""
|
||||
GCR_RUNNER_DISABLED=""
|
||||
find_runner_list="$(gcr_gitea_list_runners "$find_runner_repo")" || return 2
|
||||
find_runner_count=0
|
||||
while read -r find_runner_id find_runner_busy find_runner_disabled \
|
||||
find_runner_candidate_name; do
|
||||
[ "${find_runner_candidate_name:-}" = "$find_runner_name" ] || continue
|
||||
case "$find_runner_id" in ''|*[!0-9]*) return 2 ;; esac
|
||||
case "$find_runner_busy" in true|false) ;; *) return 2 ;; esac
|
||||
case "$find_runner_disabled" in true|false) ;; *) return 2 ;; esac
|
||||
find_runner_count=$((find_runner_count + 1))
|
||||
GCR_RUNNER_ID="$find_runner_id"
|
||||
GCR_RUNNER_DISABLED="$find_runner_disabled"
|
||||
done <<EOF
|
||||
$find_runner_list
|
||||
EOF
|
||||
case "$find_runner_count" in
|
||||
0) return 1 ;;
|
||||
1) return 0 ;;
|
||||
*)
|
||||
gcr_log error --ns=gitea \
|
||||
"duplicate exact runner registrations repo=$find_runner_repo name=$find_runner_name"
|
||||
return 2
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# gcr_gitea_list_owner_repos OWNER — prints fully-qualified repository names.
|
||||
# Allowed owner globs may refer to either organizations or users. Probe the
|
||||
# organization route first, then use the user route on a confirmed 404.
|
||||
@@ -115,6 +150,121 @@ gcr_gitea_job_state() {
|
||||
| jq -r '.status + ":" + (.conclusion // "")'
|
||||
}
|
||||
|
||||
# List every repository job without a status filter. Each line is compact JSON;
|
||||
# complete pagination and strict schema validation make absence authoritative.
|
||||
gcr_gitea_list_jobs() {
|
||||
jobs_repo="$1"
|
||||
gcr_gitea_admin_token >/dev/null || return 1
|
||||
jobs_owner="${jobs_repo%%/*}"
|
||||
jobs_name="${jobs_repo#*/}"
|
||||
jobs_page=1
|
||||
while :; do
|
||||
jobs_json="$(gcr_gitea_curl -fsS \
|
||||
"$GCR_GITEA_URL/api/v1/repos/$jobs_owner/$jobs_name/actions/jobs?page=$jobs_page&limit=50")" \
|
||||
|| return 1
|
||||
printf '%s' "$jobs_json" | jq -e \
|
||||
'.jobs | select(type == "array")
|
||||
| all(.[];
|
||||
(.id | type) == "number" and .id > 0
|
||||
and (.run_attempt | type) == "number" and .run_attempt >= 0
|
||||
and (.status | type) == "string" and (.status | length) > 0
|
||||
and ((.conclusion | type) == "string" or
|
||||
(.conclusion | type) == "null")
|
||||
and ((.runner_id | type) == "number" or
|
||||
(.runner_id | type) == "null")
|
||||
and ((.runner_name | type) == "string" or
|
||||
(.runner_name | type) == "null"))' \
|
||||
>/dev/null || return 1
|
||||
printf '%s' "$jobs_json" | jq -c \
|
||||
'.jobs[] | {id, run_attempt, status,
|
||||
conclusion:(.conclusion // ""),
|
||||
runner_id:(.runner_id // null),
|
||||
runner_name:(.runner_name // "")}' || return 1
|
||||
jobs_count="$(printf '%s' "$jobs_json" | jq -er '.jobs | length')" \
|
||||
|| return 1
|
||||
[ "$jobs_count" -lt 50 ] && return 0
|
||||
jobs_page=$((jobs_page + 1))
|
||||
done
|
||||
}
|
||||
|
||||
# Exit 0 only when complete unfiltered history proves no active repository job.
|
||||
gcr_gitea_repo_has_active_jobs() {
|
||||
active_jobs="$(gcr_gitea_list_jobs "$1")" || return 2
|
||||
if printf '%s\n' "$active_jobs" \
|
||||
| jq -s -e 'any(.[]; .status == "in_progress")' >/dev/null; then
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
# Confirm the current job belonging to repository-scoped RUNNER_ID and require
|
||||
# that it is the requested job/attempt. One active match takes precedence over
|
||||
# terminal history; without an active match, exactly one terminal match is
|
||||
# required. Prints current authoritative state; event state is not trusted.
|
||||
gcr_gitea_confirm_runner_job() {
|
||||
confirm_repo="$1"; confirm_runner="$2"
|
||||
confirm_job="$3"; confirm_attempt="$4"
|
||||
case "$confirm_runner:$confirm_job:$confirm_attempt" in
|
||||
*[!0-9:]*|0:*|*:0:*|:*|*::*|*:) return 1 ;;
|
||||
esac
|
||||
confirm_jobs="$(gcr_gitea_list_jobs "$confirm_repo")" || return 1
|
||||
confirm_matches="$(printf '%s\n' "$confirm_jobs" | jq -cs \
|
||||
--arg runner "$confirm_runner" \
|
||||
'[.[] | select((.runner_id | tostring) == $runner)]')" || return 1
|
||||
confirm_selected="$(printf '%s' "$confirm_matches" | jq -ce '
|
||||
[.[] | select(.status == "in_progress")] as $active
|
||||
| if ($active | length) == 1 then $active[0]
|
||||
elif ($active | length) > 1 then empty
|
||||
else [.[] | select(.status == "completed")] as $terminal
|
||||
| if ($terminal | length) == 1 then $terminal[0] else empty end
|
||||
end')" || return 1
|
||||
printf '%s' "$confirm_selected" | jq -e --arg job "$confirm_job" \
|
||||
--arg attempt "$confirm_attempt" \
|
||||
'select((.id | tostring) == $job
|
||||
and (.run_attempt | tostring) == $attempt)' \
|
||||
>/dev/null || return 1
|
||||
confirm_status="$(printf '%s' "$confirm_selected" | jq -r '.status')"
|
||||
confirm_conclusion="$(printf '%s' "$confirm_selected" | jq -r \
|
||||
'.conclusion')"
|
||||
case "$confirm_status" in
|
||||
in_progress) printf 'vm_active' ;;
|
||||
completed) printf 'completed:%s' "${confirm_conclusion:-unknown}" ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Exit 0 when an in-progress repository job is assigned to RUNNER_ID, 1 when
|
||||
# complete pagination proves none, and 2 on API or schema uncertainty.
|
||||
gcr_gitea_runner_has_active_job() {
|
||||
active_repo="$1"; active_runner_id="$2"
|
||||
case "$active_runner_id" in ''|*[!0-9]*) return 2 ;; esac
|
||||
active_owner="${active_repo%%/*}"
|
||||
active_name="${active_repo#*/}"
|
||||
active_page=1
|
||||
while :; do
|
||||
active_jobs="$(gcr_gitea_curl -fsS \
|
||||
"$GCR_GITEA_URL/api/v1/repos/$active_owner/$active_name/actions/jobs?status=in_progress&page=$active_page&limit=50")" \
|
||||
|| return 2
|
||||
printf '%s' "$active_jobs" | jq -e \
|
||||
'.jobs | select(type == "array")
|
||||
| all(.[]; (.id | type) == "number"
|
||||
and (.status | type) == "string"
|
||||
and ((.runner_id | type) == "number" or
|
||||
(.runner_id | type) == "null"))' \
|
||||
>/dev/null || return 2
|
||||
if printf '%s' "$active_jobs" | jq -e --arg runner "$active_runner_id" \
|
||||
'.jobs | any(.[];
|
||||
.status == "in_progress" and (.runner_id | tostring) == $runner)' \
|
||||
>/dev/null; then
|
||||
return 0
|
||||
fi
|
||||
active_count="$(printf '%s' "$active_jobs" | jq -er '.jobs | length')" \
|
||||
|| return 2
|
||||
[ "$active_count" -lt 50 ] && return 1
|
||||
active_page=$((active_page + 1))
|
||||
done
|
||||
}
|
||||
|
||||
gcr_gitea_delete_runner() {
|
||||
repo="$1"; id="$2"
|
||||
gcr_gitea_admin_token >/dev/null || return 1
|
||||
@@ -129,46 +279,51 @@ gcr_gitea_delete_runner() {
|
||||
# name disappeared. Duplicate exact names fail closed for durable retry.
|
||||
gcr_gitea_deregister_runner_exact() {
|
||||
dereg_repo="$1"; dereg_name="$2"
|
||||
# Stale registrations have no allocation record for a durable barrier.
|
||||
# Their sweep already retries disable on a later pass; VM retirement
|
||||
# explicitly supplies an empty third argument to request a new barrier.
|
||||
dereg_delete_not_before="${3-0}"
|
||||
[ -n "$dereg_repo" ] && [ -n "$dereg_name" ] || return 1
|
||||
case "$dereg_delete_not_before" in *[!0-9]*) return 1 ;; esac
|
||||
|
||||
dereg_runners="$(gcr_gitea_list_runners "$dereg_repo")" || return 1
|
||||
dereg_count=0
|
||||
dereg_id=""
|
||||
while read -r dereg_candidate_id dereg_candidate_name; do
|
||||
[ "${dereg_candidate_name:-}" = "$dereg_name" ] || continue
|
||||
case "$dereg_candidate_id" in ''|*[!0-9]*) return 1 ;; esac
|
||||
dereg_count=$((dereg_count + 1))
|
||||
dereg_id="$dereg_candidate_id"
|
||||
done <<EOF
|
||||
$dereg_runners
|
||||
EOF
|
||||
|
||||
case "$dereg_count" in
|
||||
0) return 0 ;;
|
||||
1) ;;
|
||||
*)
|
||||
gcr_log error --ns=gitea \
|
||||
"duplicate exact runner registrations repo=$dereg_repo name=$dereg_name"
|
||||
return 1
|
||||
;;
|
||||
dereg_lookup=0
|
||||
gcr_gitea_find_runner_exact "$dereg_repo" "$dereg_name" \
|
||||
|| dereg_lookup="$?"
|
||||
case "$dereg_lookup" in
|
||||
0) dereg_id="$GCR_RUNNER_ID" ;;
|
||||
1) return 0 ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
|
||||
if ! gcr_gitea_set_runner_disabled "$dereg_repo" "$dereg_id" true; then
|
||||
gcr_log warn --ns=gitea \
|
||||
"failed disabling runner repo=$dereg_repo name=$dereg_name"
|
||||
return 1
|
||||
if [ "$GCR_RUNNER_DISABLED" = false ]; then
|
||||
if ! gcr_gitea_set_runner_disabled "$dereg_repo" "$dereg_id" true; then
|
||||
gcr_log warn --ns=gitea \
|
||||
"failed disabling runner repo=$dereg_repo name=$dereg_name"
|
||||
return 1
|
||||
fi
|
||||
# Caller starts the deletion barrier only after this PATCH succeeds.
|
||||
return 3
|
||||
fi
|
||||
# Legacy records without a barrier must establish one after disabled state
|
||||
# has been confirmed, never delete immediately.
|
||||
[ -n "$dereg_delete_not_before" ] || return 3
|
||||
[ "$(gcr_now_epoch)" -ge "$dereg_delete_not_before" ] || return 2
|
||||
dereg_active_status=0
|
||||
gcr_gitea_runner_has_active_job "$dereg_repo" "$dereg_id" \
|
||||
|| dereg_active_status="$?"
|
||||
case "$dereg_active_status" in
|
||||
0) return 2 ;;
|
||||
1) ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
if ! gcr_gitea_delete_runner "$dereg_repo" "$dereg_id"; then
|
||||
gcr_log warn --ns=gitea \
|
||||
"runner DELETE uncertain repo=$dereg_repo name=$dereg_name; confirming"
|
||||
fi
|
||||
dereg_runners="$(gcr_gitea_list_runners "$dereg_repo")" || return 1
|
||||
while read -r dereg_candidate_id dereg_candidate_name; do
|
||||
[ "${dereg_candidate_name:-}" != "$dereg_name" ] || return 1
|
||||
done <<EOF
|
||||
$dereg_runners
|
||||
EOF
|
||||
return 0
|
||||
dereg_lookup=0
|
||||
gcr_gitea_find_runner_exact "$dereg_repo" "$dereg_name" \
|
||||
|| dereg_lookup="$?"
|
||||
[ "$dereg_lookup" -eq 1 ]
|
||||
}
|
||||
|
||||
gcr_gitea_set_runner_disabled() {
|
||||
@@ -186,7 +341,7 @@ gcr_gitea_set_runner_disabled() {
|
||||
gcr_gitea_runner_disabled() {
|
||||
repo="$1"; runner_name="$2"; disabled="$3"
|
||||
runners="$(gcr_gitea_list_runners "$repo")" || return 1
|
||||
while read -r id name; do
|
||||
while read -r id _busy _disabled name; do
|
||||
[ "$name" = "$runner_name" ] || continue
|
||||
gcr_gitea_set_runner_disabled "$repo" "$id" "$disabled"
|
||||
return "$?"
|
||||
|
||||
@@ -32,35 +32,51 @@ gcr_vm_host_key_path() {
|
||||
printf '%s/ssh-host-keys/%s' "$GCR_STATE_DIR" "$(gcr_alloc_key "$1" "$2")"
|
||||
}
|
||||
|
||||
gcr_vm_host_key_pair_valid() {
|
||||
host_key_path="$1"
|
||||
[ -s "$host_key_path" ] && [ -s "$host_key_path.pub" ] || return 1
|
||||
derived_public="$(ssh-keygen -y -f "$host_key_path" 2>/dev/null)" || return 1
|
||||
derived_public="$(printf '%s\n' "$derived_public" | awk 'NR == 1 {print $1 " " $2}')"
|
||||
expected_public="$(awk 'NR == 1 {print $1 " " $2}' "$host_key_path.pub")"
|
||||
[ -n "$derived_public" ] && [ "$derived_public" = "$expected_public" ]
|
||||
}
|
||||
|
||||
gcr_vm_host_key_prepare() {
|
||||
host_key_path="$(gcr_vm_host_key_path "$1" "$2")"
|
||||
if [ -s "$host_key_path" ] && [ -s "$host_key_path.pub" ]; then
|
||||
if ! gcr_vm_host_key_pair_valid "$host_key_path"; then
|
||||
gcr_log error --ns=hcloud "existing SSH host-key pair is invalid job=$1 attempt=$2"
|
||||
return 1
|
||||
fi
|
||||
chmod 0600 "$host_key_path"
|
||||
chmod 0644 "$host_key_path.pub"
|
||||
return 0
|
||||
fi
|
||||
rm -f "$host_key_path" "$host_key_path.pub"
|
||||
ssh-keygen -q -t ed25519 -N '' -C '' -f "$host_key_path" || return 1
|
||||
chmod 0600 "$host_key_path"
|
||||
chmod 0644 "$host_key_path.pub"
|
||||
gcr_vm_host_key_pair_valid "$host_key_path"
|
||||
}
|
||||
|
||||
gcr_vm_host_key_userdata() {
|
||||
host_key_path="$(gcr_vm_host_key_path "$1" "$2")"
|
||||
[ -s "$host_key_path" ] && [ -s "$host_key_path.pub" ] || return 1
|
||||
host_private_b64="$(base64 < "$host_key_path" | tr -d '\n')" || return 1
|
||||
host_public_b64="$(base64 < "$host_key_path.pub" | tr -d '\n')" || return 1
|
||||
gcr_vm_host_key_pair_valid "$host_key_path" || {
|
||||
gcr_log error --ns=hcloud "SSH host-key pair is invalid job=$1 attempt=$2"
|
||||
return 1
|
||||
}
|
||||
host_public_key="$(awk 'NR == 1 {print $1 " " $2}' "$host_key_path.pub")" \
|
||||
|| return 1
|
||||
[ -n "$host_public_key" ] || return 1
|
||||
cat <<EOF
|
||||
#cloud-config
|
||||
write_files:
|
||||
- path: /etc/ssh/ssh_host_ed25519_key
|
||||
owner: root:root
|
||||
permissions: '0600'
|
||||
encoding: b64
|
||||
content: $host_private_b64
|
||||
- path: /etc/ssh/ssh_host_ed25519_key.pub
|
||||
owner: root:root
|
||||
permissions: '0644'
|
||||
encoding: b64
|
||||
content: $host_public_b64
|
||||
# Replace image keys with this VM's unique controller-generated key.
|
||||
ssh_deletekeys: true
|
||||
ssh_genkeytypes: [ed25519]
|
||||
ssh_keys:
|
||||
ed25519_private: |
|
||||
$(sed 's/^/ /' "$host_key_path")
|
||||
ed25519_public: $host_public_key
|
||||
runcmd:
|
||||
- [ sh, -c, 'systemctl restart sshd.service 2>/dev/null || systemctl restart ssh.service' ]
|
||||
EOF
|
||||
@@ -69,7 +85,10 @@ EOF
|
||||
gcr_vm_known_hosts_file() {
|
||||
known_job="$1"; known_attempt="$2"; known_ip="$3"
|
||||
known_key_path="$(gcr_vm_host_key_path "$known_job" "$known_attempt")"
|
||||
[ -s "$known_key_path.pub" ] || return 1
|
||||
gcr_vm_host_key_pair_valid "$known_key_path" || {
|
||||
gcr_log error --ns=hcloud "cannot pin invalid SSH host-key pair job=$known_job attempt=$known_attempt"
|
||||
return 1
|
||||
}
|
||||
known_type="$(cut -d' ' -f1 < "$known_key_path.pub")"
|
||||
known_key="$(cut -d' ' -f2 < "$known_key_path.pub")"
|
||||
[ -n "$known_type" ] && [ -n "$known_key" ] || return 1
|
||||
@@ -565,13 +584,18 @@ gcr_vm_rebuild_request() {
|
||||
'{image:$image, user_data:$user_data}')" || return 1
|
||||
gcr_hcloud_req POST "/servers/$rebuild_vm_id/actions/rebuild" \
|
||||
"$rebuild_payload" || return 1
|
||||
jq -er --arg vm "$rebuild_vm_id" \
|
||||
rebuild_action_id="$(jq -er --arg vm "$rebuild_vm_id" \
|
||||
'.action
|
||||
| select((.id | type) == "number")
|
||||
| select(.command == "rebuild")
|
||||
| select(.command == "rebuild_server")
|
||||
| select(.status == "running" or .status == "success")
|
||||
| select([.resources[]? | select(.type == "server") | (.id | tostring)] == [$vm])
|
||||
| .id' "$GCR_LAST_BODY"
|
||||
| .id' "$GCR_LAST_BODY")" || {
|
||||
gcr_log warn --ns=hcloud \
|
||||
"rebuild response validation failed server=$rebuild_vm_id expected_command=rebuild_server"
|
||||
return 1
|
||||
}
|
||||
printf '%s' "$rebuild_action_id"
|
||||
}
|
||||
|
||||
# Prints running or success. Provider-reported errors and malformed/mismatched
|
||||
@@ -586,11 +610,15 @@ gcr_vm_rebuild_action_status() {
|
||||
--arg action "$rebuild_action_id" \
|
||||
'.action
|
||||
| select((.id | tostring) == $action)
|
||||
| select(.command == "rebuild")
|
||||
| select(.command == "rebuild_server")
|
||||
| select([.resources[]? | select(.type == "server") | (.id | tostring)] == [$vm])
|
||||
| .status
|
||||
| select(. == "running" or . == "success" or . == "error")' \
|
||||
"$GCR_LAST_BODY")" || return 1
|
||||
"$GCR_LAST_BODY")" || {
|
||||
gcr_log warn --ns=hcloud \
|
||||
"rebuild action validation failed server=$rebuild_vm_id action=$rebuild_action_id expected_command=rebuild_server"
|
||||
return 1
|
||||
}
|
||||
[ "$rebuild_status" != error ] || return 1
|
||||
printf '%s' "$rebuild_status"
|
||||
}
|
||||
@@ -601,39 +629,52 @@ gcr_vm_verify_rebuilt() {
|
||||
verify_vm_id="$1"; verify_type="$2"; verify_location="$3"
|
||||
verify_arch="$4"; verify_image="$5"
|
||||
gcr_hcloud_req GET "/servers/$verify_vm_id" || return 1
|
||||
jq -er --arg vm "$verify_vm_id" --arg type "$verify_type" \
|
||||
verify_ip="$(jq -er --arg vm "$verify_vm_id" --arg type "$verify_type" \
|
||||
--arg location "$verify_location" --arg arch "$verify_arch" \
|
||||
--arg image "$verify_image" \
|
||||
'.server
|
||||
| select((.id | tostring) == $vm)
|
||||
| select(.status == "running")
|
||||
| select((.server_type.name // "") == $type)
|
||||
| select((.server_type.architecture // "") == $arch)
|
||||
| select((.datacenter.location.name // "") == $location)
|
||||
| select((.server_type.architecture
|
||||
| if . == "x86" then "amd64"
|
||||
elif . == "arm" then "arm64"
|
||||
else . end) == $arch)
|
||||
| select((.location.name // .datacenter.location.name // "") == $location)
|
||||
| select((.image.id | tostring) == $image)
|
||||
| .public_net.ipv4.ip
|
||||
| select(type == "string" and length > 0)' "$GCR_LAST_BODY"
|
||||
| select(type == "string" and length > 0)' "$GCR_LAST_BODY")" || {
|
||||
gcr_log warn --ns=hcloud \
|
||||
"rebuilt server validation failed server=$verify_vm_id expected_type=$verify_type expected_location=$verify_location expected_arch=$verify_arch expected_image=$verify_image"
|
||||
return 1
|
||||
}
|
||||
printf '%s' "$verify_ip"
|
||||
}
|
||||
|
||||
# Stop idle runners so Gitea cannot schedule work before atomic reuse claim.
|
||||
# The controller starts the service only after the claim record is written.
|
||||
gcr_vm_runner_service() {
|
||||
vm_id="$1"; action="$2"
|
||||
ip="$(gcr_vm_public_ip "$vm_id")" || return 1
|
||||
[ -n "$ip" ] || return 1
|
||||
gcr_vm_runner_service_pinned "$ip" \
|
||||
"${GCR_SSH_KNOWN_HOSTS_FILE:-}" "$action"
|
||||
}
|
||||
|
||||
gcr_vm_runner_service_pinned() {
|
||||
ip="$1"; known_hosts_file="$2"; action="$3"
|
||||
case "$action" in
|
||||
start|stop) service_command="systemctl $action gitea-runner.service" ;;
|
||||
health) service_command="systemctl is-active --quiet gitea-runner.service" ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
ip="$(gcr_vm_public_ip "$vm_id")" || return 1
|
||||
[ -n "$ip" ] || return 1
|
||||
test -n "${GCR_SSH_PRIVKEY_FILE:-}" && test -r "$GCR_SSH_PRIVKEY_FILE" || return 1
|
||||
test -n "${GCR_SSH_KNOWN_HOSTS_FILE:-}" \
|
||||
&& test -r "$GCR_SSH_KNOWN_HOSTS_FILE" || return 1
|
||||
test -n "$known_hosts_file" && test -r "$known_hosts_file" || return 1
|
||||
key_tmp="$(mktemp "${TMPDIR:-/tmp}/gcr-runner-sshkey.XXXXXX")"
|
||||
cat "$GCR_SSH_PRIVKEY_FILE" > "$key_tmp"
|
||||
printf '\n' >> "$key_tmp"
|
||||
chmod 0600 "$key_tmp"
|
||||
ssh_opts="-i $key_tmp -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes -o UserKnownHostsFile=$GCR_SSH_KNOWN_HOSTS_FILE -o ConnectTimeout=5 -o BatchMode=yes"
|
||||
ssh_opts="-i $key_tmp -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes -o UserKnownHostsFile=$known_hosts_file -o ConnectTimeout=5 -o BatchMode=yes"
|
||||
if timeout 30 ssh $ssh_opts "root@$ip" "$service_command"; then
|
||||
rm -f "$key_tmp"
|
||||
return 0
|
||||
@@ -681,6 +722,7 @@ gcr_vm_collect_diagnostics() {
|
||||
printf "== kernel failure signals ==\n"; dmesg -T 2>/dev/null | grep -Ei "out of memory|oom-kill|killed process|no space|I/O error|EXT4-fs error|xfs.*error|nvme.*error" | tail -n 80
|
||||
printf "== runner service ==\n"; systemctl show gitea-runner.service -p ActiveState -p SubState -p Result -p ExecMainStatus -p ExecMainCode -p NRestarts 2>/dev/null
|
||||
printf "== bootstrap service ==\n"; systemctl show gcr-bootstrap.service -p ActiveState -p SubState -p Result -p ExecMainStatus -p ExecMainCode 2>/dev/null
|
||||
printf "== cloud-init ==\n"; if command -v cloud-init >/dev/null 2>&1; then cloud-init status --long 2>/dev/null | head -n 20; else printf "cloud-init unavailable\\n"; fi
|
||||
printf "== process sample ==\n"; ps -eo pid,ppid,stat,etime,comm 2>/dev/null | head -n 80' \
|
||||
> "$diag_out" 2>&1; then
|
||||
gcr_redact < "$diag_out" >&2
|
||||
@@ -693,6 +735,44 @@ gcr_vm_collect_diagnostics() {
|
||||
return 0
|
||||
}
|
||||
|
||||
gcr_ssh_error_category() {
|
||||
error_text="$(cat "$1")"
|
||||
case "$error_text" in
|
||||
*"REMOTE HOST IDENTIFICATION HAS CHANGED"*|*"Host key verification failed"*)
|
||||
printf 'host-key-verification'
|
||||
;;
|
||||
*"Permission denied"*|*"Too many authentication failures"*)
|
||||
printf 'authentication'
|
||||
;;
|
||||
*"Connection refused"*|*"Connection timed out"*|*"Operation timed out"*|\
|
||||
*"No route to host"*|*"Network is unreachable"*|*"Connection reset"*|\
|
||||
*"Could not resolve hostname"*|*"Name or service not known"*)
|
||||
printf 'connectivity-or-sshd'
|
||||
;;
|
||||
*"Bad configuration option"*|*"Could not open"*|*"Load key"*)
|
||||
printf 'ssh-client-error'
|
||||
;;
|
||||
*)
|
||||
printf 'unknown'
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
gcr_ssh_run_captured() {
|
||||
captured_error_file="$1"; shift
|
||||
(
|
||||
if ! ulimit -f 8; then
|
||||
exit 125
|
||||
fi
|
||||
"$@"
|
||||
) 2>"$captured_error_file"
|
||||
}
|
||||
|
||||
gcr_ssh_temp_cleanup() {
|
||||
[ -z "${1:-}" ] || rm -f "$1"
|
||||
[ -z "${2:-}" ] || rm -f "$2"
|
||||
}
|
||||
|
||||
# Retry durable repository-runner retirement. Generic idle is written only
|
||||
# after exact-name absence is confirmed and the persisted VM profile is valid.
|
||||
gcr_vm_retire_pending() {
|
||||
@@ -708,8 +788,7 @@ gcr_vm_retire_pending() {
|
||||
esac
|
||||
retire_now="$(gcr_now_epoch)"
|
||||
retire_hard_expires="$((retire_created + retire_ttl * 60))"
|
||||
if [ "$retire_now" -ge "$retire_expires" ] \
|
||||
|| [ "$retire_now" -ge "$retire_hard_expires" ]; then
|
||||
if [ "$retire_now" -ge "$retire_hard_expires" ]; then
|
||||
gcr_vm_cleanup_start "$retire_job" "$retire_attempt" "$retire_rec" \
|
||||
retirement-expired false
|
||||
return "$?"
|
||||
@@ -717,16 +796,54 @@ gcr_vm_retire_pending() {
|
||||
|
||||
retire_repo="$(gcr_record_field "$retire_rec" retirement_repo)"
|
||||
retire_runner="$(gcr_record_field "$retire_rec" retirement_runner_name)"
|
||||
if ! gcr_gitea_deregister_runner_exact "$retire_repo" "$retire_runner"; then
|
||||
gcr_log warn --ns=gitea \
|
||||
"runner retirement pending job=$retire_job repo=$retire_repo name=$retire_runner"
|
||||
return 2
|
||||
retire_delete_not_before="$(gcr_record_field \
|
||||
"$retire_rec" retirement_delete_not_before)"
|
||||
case "$retire_delete_not_before" in *[!0-9]*) return 1 ;; esac
|
||||
retire_status=0
|
||||
gcr_gitea_deregister_runner_exact "$retire_repo" "$retire_runner" \
|
||||
"$retire_delete_not_before" \
|
||||
|| retire_status="$?"
|
||||
case "$retire_status" in
|
||||
0) ;;
|
||||
2)
|
||||
gcr_log info --ns=gitea \
|
||||
"busy runner retirement pending job=$retire_job repo=$retire_repo name=$retire_runner"
|
||||
return 2
|
||||
;;
|
||||
3)
|
||||
retire_delay="${GCR_RECONCILE_INTERVAL_SEC:-60}"
|
||||
case "$retire_delay" in ''|0|*[!0-9]*) return 1 ;; esac
|
||||
retire_barrier_now="$(gcr_now_epoch)"
|
||||
case "$retire_barrier_now" in ''|*[!0-9]*) return 1 ;; esac
|
||||
retire_delete_not_before="$((retire_barrier_now + retire_delay))"
|
||||
retire_rec="$(printf '%s' "$retire_rec" | jq -c \
|
||||
--arg not_before "$retire_delete_not_before" \
|
||||
'.retirement_delete_not_before = ($not_before | tonumber)')" \
|
||||
|| return 1
|
||||
gcr_record_put "$retire_job" "$retire_attempt" "$retire_rec" \
|
||||
|| return 1
|
||||
gcr_log info --ns=gitea \
|
||||
"disabled runner retirement pending job=$retire_job repo=$retire_repo name=$retire_runner"
|
||||
return 2
|
||||
;;
|
||||
*)
|
||||
gcr_log warn --ns=gitea \
|
||||
"runner retirement pending job=$retire_job repo=$retire_repo name=$retire_runner"
|
||||
return 2
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "$retire_now" -ge "$retire_expires" ]; then
|
||||
gcr_vm_cleanup_start "$retire_job" "$retire_attempt" "$retire_rec" \
|
||||
retirement-expired false
|
||||
return "$?"
|
||||
fi
|
||||
retire_idle="$(printf '%s' "$retire_rec" | jq -c \
|
||||
'.status = "idle_vm"
|
||||
| .repo = "" | .label = "" | .runner_name = ""
|
||||
| .bootstrapped = false
|
||||
| del(.retirement_repo, .retirement_runner_name)')" || return 1
|
||||
| del(.retirement_repo, .retirement_runner_name,
|
||||
.retirement_delete_not_before)')" || return 1
|
||||
gcr_record_put "$retire_job" "$retire_attempt" "$retire_idle" || return 1
|
||||
gcr_event "vm-idle" "$retire_job" \
|
||||
"{\"vm_id\":$retire_vm_id,\"expires_at\":$retire_expires}"
|
||||
@@ -906,8 +1023,9 @@ token_file=/run/gcr-registration-token
|
||||
umask 077
|
||||
printf '%s' '$reg_token_b64' | base64 -d > "\$token_file"
|
||||
trap 'rm -f "\$token_file"' EXIT HUP INT TERM
|
||||
systemctl disable --now gitea-runner.service 2>/dev/null || true
|
||||
if [ ! -s /var/lib/gitea-runner/.runner ]; then
|
||||
/usr/local/bin/gitea-runner register --no-interactive \
|
||||
/usr/local/bin/gitea-runner register --no-interactive --ephemeral \
|
||||
--instance '$GCR_GITEA_URL' --token "\$(cat "\$token_file")" \
|
||||
--name '$runner_name' --labels '$label:host' \
|
||||
--config /etc/gitea-runner/config.yaml
|
||||
@@ -915,14 +1033,20 @@ fi
|
||||
rm -f "\$token_file"
|
||||
trap - EXIT HUP INT TERM
|
||||
systemctl daemon-reload
|
||||
systemctl enable --now gitea-runner.service
|
||||
BSEOF
|
||||
}
|
||||
|
||||
# gcr_vm_bootstrap_ssh IP LABEL REG_TOKEN — blocking; returns ssh exit status.
|
||||
gcr_vm_bootstrap_ssh() {
|
||||
# gcr_vm_bootstrap_ssh IP LABEL REG_TOKEN RUNNER_NAME KNOWN_HOSTS JOB ATTEMPT VM
|
||||
# Waits for strict-pinned SSH readiness, then installs and registers without
|
||||
# starting the daemon. Controller persists exact runner ID before activation.
|
||||
gcr_vm_bootstrap_ssh() (
|
||||
ip="$1"; label="$2"; reg_token="$3"; runner_name="$4"
|
||||
known_hosts_file="${5:-${GCR_SSH_KNOWN_HOSTS_FILE:-}}"
|
||||
job_id="${6:-}"; attempt="${7:-}"; vm_id="${8:-}"
|
||||
key_tmp=""
|
||||
ssh_error_file=""
|
||||
trap 'gcr_ssh_temp_cleanup "${key_tmp:-}" "${ssh_error_file:-}"' EXIT
|
||||
trap 'exit 1' HUP INT TERM
|
||||
test -n "${GCR_SSH_PRIVKEY_FILE:-}" && test -r "$GCR_SSH_PRIVKEY_FILE" || {
|
||||
gcr_log error --ns=hcloud "GCR_SSH_PRIVKEY_FILE missing or unreadable"
|
||||
return 1
|
||||
@@ -937,12 +1061,22 @@ gcr_vm_bootstrap_ssh() {
|
||||
chmod 0600 "$key_tmp"
|
||||
SSH_OPTS="-i $key_tmp -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes -o UserKnownHostsFile=$known_hosts_file -o ConnectTimeout=5 -o BatchMode=yes"
|
||||
|
||||
ssh_error_file="$(mktemp "${TMPDIR:-/tmp}/gcr-ssh-error.XXXXXX")"
|
||||
chmod 0600 "$ssh_error_file"
|
||||
waited=0
|
||||
until ssh $SSH_OPTS "root@$ip" true 2>/dev/null; do
|
||||
ssh_status=0
|
||||
while :; do
|
||||
if gcr_ssh_run_captured "$ssh_error_file" \
|
||||
ssh $SSH_OPTS "root@$ip" true; then
|
||||
break
|
||||
else
|
||||
ssh_status="$?"
|
||||
fi
|
||||
waited=$((waited + 5))
|
||||
[ "$waited" -ge 900 ] && {
|
||||
gcr_log warn --ns=hcloud "sshd never came up on $ip"
|
||||
rm -f "$key_tmp"
|
||||
ssh_category="$(gcr_ssh_error_category "$ssh_error_file")"
|
||||
gcr_log warn --ns=hcloud \
|
||||
"SSH readiness failed stage=ssh-readiness category=$ssh_category exit=$ssh_status after=${waited}s ip=$ip"
|
||||
return 1
|
||||
}
|
||||
sleep 5
|
||||
@@ -950,10 +1084,28 @@ gcr_vm_bootstrap_ssh() {
|
||||
|
||||
ttl_min="$(printf '%s' "$(gcr_label_profile "$label")" | awk '{print $2}')"
|
||||
script="$(gcr_bootstrap_script "$label" "$reg_token" "$ttl_min" "$runner_name")"
|
||||
if printf '%s' "$script" | ssh $SSH_OPTS "root@$ip" sh -s; then
|
||||
rm -f "$key_tmp"
|
||||
if printf '%s' "$script" | gcr_ssh_run_captured "$ssh_error_file" \
|
||||
ssh $SSH_OPTS "root@$ip" sh -s; then
|
||||
return 0
|
||||
else
|
||||
ssh_status="$?"
|
||||
fi
|
||||
ssh_category="$(gcr_ssh_error_category "$ssh_error_file")"
|
||||
if [ "$ssh_status" -eq 255 ]; then
|
||||
diagnostics_reason=bootstrap-transport-failed
|
||||
if [ "$ssh_category" = unknown ]; then
|
||||
ssh_category=ssh-client-error
|
||||
fi
|
||||
gcr_log warn --ns=hcloud \
|
||||
"SSH bootstrap failed stage=ssh-transport category=$ssh_category exit=$ssh_status ip=$ip"
|
||||
else
|
||||
diagnostics_reason=bootstrap-command-failed
|
||||
gcr_log warn --ns=hcloud \
|
||||
"SSH bootstrap failed stage=remote-bootstrap-command category=remote-bootstrap-command-failed exit=$ssh_status ip=$ip"
|
||||
fi
|
||||
if [ -n "$job_id" ] && [ -n "$attempt" ] && [ -n "$vm_id" ]; then
|
||||
gcr_vm_collect_diagnostics "$vm_id" "$ip" "$job_id" \
|
||||
"$diagnostics_reason" "$attempt" || true
|
||||
fi
|
||||
rm -f "$key_tmp"
|
||||
return 1
|
||||
}
|
||||
)
|
||||
|
||||
@@ -119,6 +119,421 @@ gcr_record_del() {
|
||||
"$GCR_STATE_DIR/ssh-host-keys/$(gcr_alloc_key "$1" "$2").known_hosts"
|
||||
}
|
||||
|
||||
# Acquire two allocation locks in lexical order. A failed second acquisition
|
||||
# releases the first, so webhook and reconcile paths cannot deadlock.
|
||||
gcr_pair_lock_acquire() {
|
||||
gcr_pair_a="$1"; gcr_pair_b="$2"
|
||||
if [ "$gcr_pair_a" = "$gcr_pair_b" ]; then
|
||||
GCR_PAIR_FIRST="$gcr_pair_a"
|
||||
GCR_PAIR_SECOND=""
|
||||
else
|
||||
GCR_PAIR_FIRST="$(printf '%s\n%s\n' "$gcr_pair_a" "$gcr_pair_b" \
|
||||
| LC_ALL=C sort | sed -n '1p')"
|
||||
if [ "$GCR_PAIR_FIRST" = "$gcr_pair_a" ]; then
|
||||
GCR_PAIR_SECOND="$gcr_pair_b"
|
||||
else
|
||||
GCR_PAIR_SECOND="$gcr_pair_a"
|
||||
fi
|
||||
fi
|
||||
gcr_lock_acquire "$GCR_PAIR_FIRST" || return 1
|
||||
if [ -n "$GCR_PAIR_SECOND" ] \
|
||||
&& ! gcr_lock_acquire "$GCR_PAIR_SECOND"; then
|
||||
gcr_lock_release "$GCR_PAIR_FIRST"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
gcr_pair_lock_release() {
|
||||
[ -z "${GCR_PAIR_SECOND:-}" ] || gcr_lock_release "$GCR_PAIR_SECOND"
|
||||
[ -z "${GCR_PAIR_FIRST:-}" ] || gcr_lock_release "$GCR_PAIR_FIRST"
|
||||
}
|
||||
|
||||
gcr_transfer_key_base() {
|
||||
printf '%s/ssh-host-keys/%s' "$GCR_STATE_DIR" "$(gcr_alloc_key "$1" "$2")"
|
||||
}
|
||||
|
||||
# New transfer intent is written only when target key namespace is empty.
|
||||
# Source private/public pair must be complete when present; known_hosts is
|
||||
# optional because it is derived after IP discovery.
|
||||
gcr_transfer_keys_preflight() {
|
||||
gcr_keys_source="$(gcr_transfer_key_base "$1" "$2")"
|
||||
gcr_keys_target="$(gcr_transfer_key_base "$3" "$4")"
|
||||
[ "$gcr_keys_source" != "$gcr_keys_target" ] || return 0
|
||||
for gcr_keys_suffix in '' .pub .known_hosts; do
|
||||
[ ! -e "$gcr_keys_target$gcr_keys_suffix" ] || return 1
|
||||
done
|
||||
if [ -e "$gcr_keys_source" ] || [ -e "$gcr_keys_source.pub" ]; then
|
||||
[ -s "$gcr_keys_source" ] && [ -s "$gcr_keys_source.pub" ] || return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Caller holds both allocation locks. Per-file rename is replayable: intent
|
||||
# distinguishes an interrupted move from a preexisting target-key conflict.
|
||||
gcr_transfer_keys_locked() {
|
||||
gcr_keys_source_job="$1"; gcr_keys_source_attempt="$2"
|
||||
gcr_keys_target_job="$3"; gcr_keys_target_attempt="$4"
|
||||
gcr_keys_rec="$5"
|
||||
gcr_keys_phase="$(gcr_record_field "$gcr_keys_rec" transfer_key_state)"
|
||||
case "$gcr_keys_phase" in source|target) ;; *) return 1 ;; esac
|
||||
gcr_keys_source="$(gcr_transfer_key_base \
|
||||
"$gcr_keys_source_job" "$gcr_keys_source_attempt")"
|
||||
gcr_keys_target="$(gcr_transfer_key_base \
|
||||
"$gcr_keys_target_job" "$gcr_keys_target_attempt")"
|
||||
|
||||
if [ "$gcr_keys_phase" = target ]; then
|
||||
for gcr_keys_suffix in '' .pub .known_hosts; do
|
||||
[ ! -e "$gcr_keys_source$gcr_keys_suffix" ] || return 1
|
||||
done
|
||||
printf '%s' "$gcr_keys_rec"
|
||||
return 0
|
||||
fi
|
||||
|
||||
for gcr_keys_suffix in '' .pub .known_hosts; do
|
||||
gcr_keys_src="$gcr_keys_source$gcr_keys_suffix"
|
||||
gcr_keys_dst="$gcr_keys_target$gcr_keys_suffix"
|
||||
if [ -e "$gcr_keys_src" ]; then
|
||||
if [ -e "$gcr_keys_dst" ]; then
|
||||
cmp -s "$gcr_keys_src" "$gcr_keys_dst" || return 1
|
||||
rm -f "$gcr_keys_src" || return 1
|
||||
else
|
||||
mv "$gcr_keys_src" "$gcr_keys_dst" || return 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
for gcr_keys_suffix in '' .pub .known_hosts; do
|
||||
[ ! -e "$gcr_keys_source$gcr_keys_suffix" ] || return 1
|
||||
done
|
||||
gcr_keys_rec="$(printf '%s' "$gcr_keys_rec" \
|
||||
| jq -c '.transfer_key_state = "target"')" || return 1
|
||||
gcr_record_put "$gcr_keys_source_job" "$gcr_keys_source_attempt" \
|
||||
"$gcr_keys_rec" || return 1
|
||||
printf '%s' "$gcr_keys_rec"
|
||||
}
|
||||
|
||||
# Print the unique active record key bound to repository-scoped runner ID.
|
||||
# Duplicate identities are corruption and fail closed.
|
||||
gcr_record_find_runner_id() {
|
||||
gcr_find_repo="$1"; gcr_find_runner_id="$2"
|
||||
case "$gcr_find_runner_id" in ''|0|*[!0-9]*) return 1 ;; esac
|
||||
gcr_find_count=0
|
||||
gcr_find_result=""
|
||||
for gcr_find_file in $(gcr_active_records); do
|
||||
gcr_find_rec="$(cat "$gcr_find_file")"
|
||||
[ "$(gcr_record_field "$gcr_find_rec" repo)" = "$gcr_find_repo" ] \
|
||||
|| continue
|
||||
[ "$(gcr_record_field "$gcr_find_rec" runner_id)" = "$gcr_find_runner_id" ] \
|
||||
|| continue
|
||||
gcr_find_count=$((gcr_find_count + 1))
|
||||
gcr_find_result="$(gcr_record_field "$gcr_find_rec" job_id) $(gcr_record_field "$gcr_find_rec" run_attempt)"
|
||||
done
|
||||
[ "$gcr_find_count" -eq 1 ] || return 1
|
||||
printf '%s' "$gcr_find_result"
|
||||
}
|
||||
|
||||
gcr_record_find_legacy_runner_name() {
|
||||
gcr_find_repo="$1"; gcr_find_runner_name="$2"
|
||||
[ -n "$gcr_find_runner_name" ] || return 1
|
||||
gcr_find_count=0
|
||||
gcr_find_result=""
|
||||
for gcr_find_file in $(gcr_active_records); do
|
||||
gcr_find_rec="$(cat "$gcr_find_file")"
|
||||
[ "$(gcr_record_field "$gcr_find_rec" repo)" = "$gcr_find_repo" ] \
|
||||
|| continue
|
||||
[ -z "$(gcr_record_field "$gcr_find_rec" runner_id)" ] || continue
|
||||
[ "$(gcr_record_field "$gcr_find_rec" runner_name)" \
|
||||
= "$gcr_find_runner_name" ] || continue
|
||||
case "$(gcr_record_field "$gcr_find_rec" status)" in
|
||||
pending_vm|vm_active) ;;
|
||||
*) continue ;;
|
||||
esac
|
||||
gcr_find_count=$((gcr_find_count + 1))
|
||||
gcr_find_result="$(gcr_record_field "$gcr_find_rec" job_id) $(gcr_record_field "$gcr_find_rec" run_attempt)"
|
||||
done
|
||||
[ "$gcr_find_count" -eq 1 ] || return 1
|
||||
printf '%s' "$gcr_find_result"
|
||||
}
|
||||
|
||||
# Resolve repository-scoped runner identity. Legacy name fallback is accepted
|
||||
# only while the live exact registration maps that name to the supplied ID.
|
||||
gcr_record_resolve_runner() {
|
||||
gcr_resolve_repo="$1"; gcr_resolve_id="$2"; gcr_resolve_name="${3:-}"
|
||||
gcr_repo_allowed "$gcr_resolve_repo" || return 1
|
||||
case "$gcr_resolve_id" in ''|0|*[!0-9]*) return 1 ;; esac
|
||||
gcr_resolved="$(gcr_record_find_runner_id \
|
||||
"$gcr_resolve_repo" "$gcr_resolve_id")" && {
|
||||
printf '%s' "$gcr_resolved"
|
||||
return 0
|
||||
}
|
||||
[ -n "$gcr_resolve_name" ] || return 1
|
||||
gcr_resolve_lookup=0
|
||||
gcr_gitea_find_runner_exact "$gcr_resolve_repo" "$gcr_resolve_name" \
|
||||
|| gcr_resolve_lookup="$?"
|
||||
[ "$gcr_resolve_lookup" -eq 0 ] \
|
||||
&& [ "$GCR_RUNNER_ID" = "$gcr_resolve_id" ] || return 1
|
||||
gcr_resolved="$(gcr_record_find_legacy_runner_name \
|
||||
"$gcr_resolve_repo" "$gcr_resolve_name")" || return 1
|
||||
set -- $gcr_resolved
|
||||
gcr_resolve_job="$1"; gcr_resolve_attempt="$2"
|
||||
gcr_resolve_key="$(gcr_alloc_key "$gcr_resolve_job" "$gcr_resolve_attempt")"
|
||||
gcr_lock_acquire "$gcr_resolve_key" || return 1
|
||||
gcr_resolve_rec="$(gcr_record_get \
|
||||
"$gcr_resolve_job" "$gcr_resolve_attempt")"
|
||||
if [ "$(gcr_record_field "$gcr_resolve_rec" repo)" \
|
||||
!= "$gcr_resolve_repo" ] \
|
||||
|| [ "$(gcr_record_field "$gcr_resolve_rec" runner_name)" \
|
||||
!= "$gcr_resolve_name" ] \
|
||||
|| [ -n "$(gcr_record_field "$gcr_resolve_rec" runner_id)" ]; then
|
||||
gcr_lock_release "$gcr_resolve_key"
|
||||
return 1
|
||||
fi
|
||||
gcr_resolve_rec="$(printf '%s' "$gcr_resolve_rec" | jq -c \
|
||||
--arg id "$gcr_resolve_id" '.runner_id = ($id | tonumber)')" || {
|
||||
gcr_lock_release "$gcr_resolve_key"
|
||||
return 1
|
||||
}
|
||||
gcr_record_put "$gcr_resolve_job" "$gcr_resolve_attempt" \
|
||||
"$gcr_resolve_rec" || {
|
||||
gcr_lock_release "$gcr_resolve_key"
|
||||
return 1
|
||||
}
|
||||
gcr_lock_release "$gcr_resolve_key"
|
||||
printf '%s %s' "$gcr_resolve_job" "$gcr_resolve_attempt"
|
||||
}
|
||||
|
||||
# Bind lifecycle only after current API history proves one exact runner/job
|
||||
# assignment. Event state is syntax-checked but authoritative status wins.
|
||||
gcr_apply_actual_job() {
|
||||
gcr_actual_repo="$1"; gcr_actual_runner_id="$2"
|
||||
gcr_actual_runner_name="$3"; gcr_actual_job="$4"
|
||||
gcr_actual_attempt="$5"; gcr_actual_state="$6"
|
||||
gcr_actual_via="${7:-webhook}"
|
||||
case "$gcr_actual_job:$gcr_actual_attempt" in
|
||||
*[!0-9:]*|0:*|:*|*::*|*:) return 1 ;;
|
||||
esac
|
||||
case "$gcr_actual_state" in vm_active|completed:*) ;; *) return 1 ;; esac
|
||||
gcr_actual_state="$(gcr_gitea_confirm_runner_job "$gcr_actual_repo" \
|
||||
"$gcr_actual_runner_id" "$gcr_actual_job" "$gcr_actual_attempt")" \
|
||||
|| return 1
|
||||
gcr_actual_source="$(gcr_record_resolve_runner "$gcr_actual_repo" \
|
||||
"$gcr_actual_runner_id" "$gcr_actual_runner_name")" || return 1
|
||||
set -- $gcr_actual_source
|
||||
gcr_actual_source_job="$1"; gcr_actual_source_attempt="$2"
|
||||
|
||||
if [ "$gcr_actual_source_job" != "$gcr_actual_job" ] \
|
||||
|| [ "$gcr_actual_source_attempt" != "$gcr_actual_attempt" ]; then
|
||||
gcr_transfer_begin "$gcr_actual_source_job" \
|
||||
"$gcr_actual_source_attempt" "$gcr_actual_job" \
|
||||
"$gcr_actual_attempt" vm_active assignment || return 1
|
||||
fi
|
||||
|
||||
gcr_actual_key="$(gcr_alloc_key "$gcr_actual_job" "$gcr_actual_attempt")"
|
||||
gcr_lock_acquire "$gcr_actual_key" || return 1
|
||||
gcr_actual_rec="$(gcr_record_get "$gcr_actual_job" "$gcr_actual_attempt")"
|
||||
if [ "$(gcr_record_field "$gcr_actual_rec" repo)" != "$gcr_actual_repo" ] \
|
||||
|| [ "$(gcr_record_field "$gcr_actual_rec" runner_id)" \
|
||||
!= "$gcr_actual_runner_id" ]; then
|
||||
gcr_lock_release "$gcr_actual_key"
|
||||
return 1
|
||||
fi
|
||||
case "$gcr_actual_state" in
|
||||
vm_active)
|
||||
case "$(gcr_record_field "$gcr_actual_rec" status)" in
|
||||
pending_vm|vm_active)
|
||||
gcr_actual_rec="$(printf '%s' "$gcr_actual_rec" \
|
||||
| jq -c '.status = "vm_active"')"
|
||||
gcr_record_put "$gcr_actual_job" "$gcr_actual_attempt" \
|
||||
"$gcr_actual_rec" || {
|
||||
gcr_lock_release "$gcr_actual_key"
|
||||
return 1
|
||||
}
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
completed:*)
|
||||
case "$(gcr_record_field "$gcr_actual_rec" status)" in
|
||||
pending_vm|vm_active)
|
||||
gcr_vm_finish_terminal "$gcr_actual_job" \
|
||||
"$gcr_actual_attempt" "$gcr_actual_rec" \
|
||||
"$gcr_actual_state" "$gcr_actual_via"
|
||||
gcr_actual_finish="$?"
|
||||
gcr_lock_release "$gcr_actual_key"
|
||||
case "$gcr_actual_finish" in 0|2) return 0 ;; esac
|
||||
return "$gcr_actual_finish"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
gcr_lock_release "$gcr_actual_key"
|
||||
}
|
||||
|
||||
# Persist transfer intent before publishing a second owner. MODE=assignment
|
||||
# moves lifecycle to the actual job; MODE=legacy_cleanup creates a durable
|
||||
# synthetic cleanup owner before restoring the original queued job.
|
||||
gcr_transfer_begin() {
|
||||
gcr_transfer_source_job="$1"; gcr_transfer_source_attempt="$2"
|
||||
gcr_transfer_target_job="$3"; gcr_transfer_target_attempt="$4"
|
||||
gcr_transfer_target_status="$5"; gcr_transfer_mode="${6:-assignment}"
|
||||
gcr_transfer_source_key="$(gcr_alloc_key \
|
||||
"$gcr_transfer_source_job" "$gcr_transfer_source_attempt")"
|
||||
gcr_transfer_target_key="$(gcr_alloc_key \
|
||||
"$gcr_transfer_target_job" "$gcr_transfer_target_attempt")"
|
||||
gcr_pair_lock_acquire "$gcr_transfer_source_key" \
|
||||
"$gcr_transfer_target_key" || return 1
|
||||
|
||||
gcr_transfer_source="$(gcr_record_get \
|
||||
"$gcr_transfer_source_job" "$gcr_transfer_source_attempt")"
|
||||
case "$(gcr_record_field "$gcr_transfer_source" status)" in
|
||||
pending_vm|vm_active|transfer_pending) ;;
|
||||
*) gcr_pair_lock_release; return 1 ;;
|
||||
esac
|
||||
if [ "$(gcr_record_field "$gcr_transfer_source" status)" != transfer_pending ]; then
|
||||
gcr_transfer_keys_preflight "$gcr_transfer_source_job" \
|
||||
"$gcr_transfer_source_attempt" "$gcr_transfer_target_job" \
|
||||
"$gcr_transfer_target_attempt" || {
|
||||
gcr_pair_lock_release
|
||||
return 1
|
||||
}
|
||||
gcr_transfer_source="$(printf '%s' "$gcr_transfer_source" | jq -c \
|
||||
--arg target_job "$gcr_transfer_target_job" \
|
||||
--arg target_attempt "$gcr_transfer_target_attempt" \
|
||||
--arg target_status "$gcr_transfer_target_status" \
|
||||
--arg mode "$gcr_transfer_mode" \
|
||||
'.status = "transfer_pending"
|
||||
| .transfer_target_job_id = $target_job
|
||||
| .transfer_target_run_attempt = $target_attempt
|
||||
| .transfer_target_status = $target_status
|
||||
| .transfer_mode = $mode
|
||||
| .transfer_key_state = "source"')" || {
|
||||
gcr_pair_lock_release
|
||||
return 1
|
||||
}
|
||||
gcr_record_put "$gcr_transfer_source_job" \
|
||||
"$gcr_transfer_source_attempt" "$gcr_transfer_source" || {
|
||||
gcr_pair_lock_release
|
||||
return 1
|
||||
}
|
||||
fi
|
||||
gcr_transfer_complete_locked "$gcr_transfer_source_job" \
|
||||
"$gcr_transfer_source_attempt" "$gcr_transfer_source"
|
||||
gcr_transfer_result="$?"
|
||||
gcr_pair_lock_release
|
||||
return "$gcr_transfer_result"
|
||||
}
|
||||
|
||||
# Caller holds source and target locks.
|
||||
gcr_transfer_complete_locked() {
|
||||
gcr_transfer_source_job="$1"; gcr_transfer_source_attempt="$2"
|
||||
gcr_transfer_source="$3"
|
||||
gcr_transfer_target_job="$(gcr_record_field \
|
||||
"$gcr_transfer_source" transfer_target_job_id)"
|
||||
gcr_transfer_target_attempt="$(gcr_record_field \
|
||||
"$gcr_transfer_source" transfer_target_run_attempt)"
|
||||
gcr_transfer_target_status="$(gcr_record_field \
|
||||
"$gcr_transfer_source" transfer_target_status)"
|
||||
gcr_transfer_mode="$(gcr_record_field "$gcr_transfer_source" transfer_mode)"
|
||||
[ -n "$gcr_transfer_target_job" ] \
|
||||
&& [ -n "$gcr_transfer_target_attempt" ] || return 1
|
||||
|
||||
gcr_transfer_target="$(gcr_record_get \
|
||||
"$gcr_transfer_target_job" "$gcr_transfer_target_attempt")"
|
||||
if [ -n "$gcr_transfer_target" ]; then
|
||||
gcr_transfer_existing_source="$(gcr_record_field \
|
||||
"$gcr_transfer_target" transfer_source_job_id)"
|
||||
if [ "$gcr_transfer_existing_source" != "$gcr_transfer_source_job" ] \
|
||||
|| [ "$(gcr_record_field "$gcr_transfer_target" transfer_source_run_attempt)" \
|
||||
!= "$gcr_transfer_source_attempt" ] \
|
||||
|| [ "$(gcr_record_field "$gcr_transfer_target" vm_id)" \
|
||||
!= "$(gcr_record_field "$gcr_transfer_source" vm_id)" ]; then
|
||||
case "$(gcr_record_field "$gcr_transfer_target" status)" in
|
||||
deferred)
|
||||
[ "$(gcr_record_field "$gcr_transfer_target" repo)" \
|
||||
= "$(gcr_record_field "$gcr_transfer_source" repo)" ] \
|
||||
|| return 1
|
||||
[ "$(gcr_record_field "$gcr_transfer_target" label)" \
|
||||
= "$(gcr_record_field "$gcr_transfer_source" label)" ] \
|
||||
|| return 1
|
||||
;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
gcr_transfer_target=""
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$gcr_transfer_target" ]; then
|
||||
if [ "$gcr_transfer_mode" = legacy_cleanup ]; then
|
||||
gcr_transfer_target="$(printf '%s' "$gcr_transfer_source" | jq -c \
|
||||
--arg job "$gcr_transfer_target_job" \
|
||||
--arg attempt "$gcr_transfer_target_attempt" \
|
||||
--arg source_job "$gcr_transfer_source_job" \
|
||||
--arg source_attempt "$gcr_transfer_source_attempt" \
|
||||
'.job_id = $job | .run_attempt = $attempt
|
||||
| .status = "cleanup_pending"
|
||||
| .cleanup_reason = "legacy-runner-absent"
|
||||
| .cleanup_refund_budget = false
|
||||
| .cleanup_vm_destroyed = false
|
||||
| .cleanup_budget_released = false
|
||||
| .transfer_source_job_id = $source_job
|
||||
| .transfer_source_run_attempt = $source_attempt
|
||||
| del(.transfer_target_job_id, .transfer_target_run_attempt,
|
||||
.transfer_target_status, .transfer_mode,
|
||||
.transfer_key_state)')" || return 1
|
||||
else
|
||||
gcr_transfer_target="$(printf '%s' "$gcr_transfer_source" | jq -c \
|
||||
--arg job "$gcr_transfer_target_job" \
|
||||
--arg attempt "$gcr_transfer_target_attempt" \
|
||||
--arg status "$gcr_transfer_target_status" \
|
||||
--arg source_job "$gcr_transfer_source_job" \
|
||||
--arg source_attempt "$gcr_transfer_source_attempt" \
|
||||
'.job_id = $job | .run_attempt = $attempt | .status = $status
|
||||
| .allocation_job_id = $source_job
|
||||
| .allocation_run_attempt = $source_attempt
|
||||
| .allocation_repo = .repo | .allocation_label = .label
|
||||
| .transfer_source_job_id = $source_job
|
||||
| .transfer_source_run_attempt = $source_attempt
|
||||
| del(.transfer_target_job_id, .transfer_target_run_attempt,
|
||||
.transfer_target_status, .transfer_mode,
|
||||
.transfer_key_state)')" || return 1
|
||||
fi
|
||||
gcr_record_put "$gcr_transfer_target_job" \
|
||||
"$gcr_transfer_target_attempt" "$gcr_transfer_target" || return 1
|
||||
fi
|
||||
|
||||
gcr_transfer_source="$(gcr_transfer_keys_locked \
|
||||
"$gcr_transfer_source_job" "$gcr_transfer_source_attempt" \
|
||||
"$gcr_transfer_target_job" "$gcr_transfer_target_attempt" \
|
||||
"$gcr_transfer_source")" || return 1
|
||||
|
||||
gcr_transfer_deferred="$(printf '%s' "$gcr_transfer_source" | jq -c \
|
||||
--arg job "$gcr_transfer_source_job" \
|
||||
--arg attempt "$gcr_transfer_source_attempt" \
|
||||
'.job_id = $job | .run_attempt = $attempt | .status = "deferred"
|
||||
| .ttl_min = null | .vm_id = "" | .vm_name = ""
|
||||
| .runner_name = "" | .runner_id = "" | .bootstrapped = false
|
||||
| del(.server_type, .budget_rate, .location, .arch, .image_id,
|
||||
.ip, .transfer_target_job_id, .transfer_target_run_attempt,
|
||||
.transfer_target_status, .transfer_mode,
|
||||
.transfer_key_state,
|
||||
.transfer_source_job_id, .transfer_source_run_attempt)')" \
|
||||
|| return 1
|
||||
gcr_record_put "$gcr_transfer_source_job" \
|
||||
"$gcr_transfer_source_attempt" "$gcr_transfer_deferred"
|
||||
}
|
||||
|
||||
gcr_reconcile_transfers() {
|
||||
for gcr_transfer_file in $(gcr_active_records); do
|
||||
gcr_transfer_rec="$(cat "$gcr_transfer_file")"
|
||||
[ "$(gcr_record_field "$gcr_transfer_rec" status)" = transfer_pending ] \
|
||||
|| continue
|
||||
gcr_transfer_job="$(gcr_record_field "$gcr_transfer_rec" job_id)"
|
||||
gcr_transfer_attempt="$(gcr_record_field "$gcr_transfer_rec" run_attempt)"
|
||||
gcr_transfer_begin "$gcr_transfer_job" "$gcr_transfer_attempt" \
|
||||
"$(gcr_record_field "$gcr_transfer_rec" transfer_target_job_id)" \
|
||||
"$(gcr_record_field "$gcr_transfer_rec" transfer_target_run_attempt)" \
|
||||
"$(gcr_record_field "$gcr_transfer_rec" transfer_target_status)" \
|
||||
"$(gcr_record_field "$gcr_transfer_rec" transfer_mode)" || true
|
||||
done
|
||||
}
|
||||
|
||||
gcr_record_field() {
|
||||
printf '%s' "$1" | jq -r --arg f "$2" 'if has($f) then .[$f] else "" end'
|
||||
}
|
||||
@@ -167,6 +582,7 @@ gcr_record_retiring_json() {
|
||||
| .bootstrapped = false
|
||||
| .retirement_repo = $repo
|
||||
| .retirement_runner_name = $runner
|
||||
| del(.retirement_delete_not_before)
|
||||
| .idle_since = ($now | tonumber)
|
||||
| .idle_expires_at = ($expires | tonumber)'
|
||||
}
|
||||
@@ -270,9 +686,10 @@ gcr_claim_idle() {
|
||||
--arg runner "gcr-${gcr_claim_job}-${gcr_claim_attempt}" \
|
||||
--arg image "$gcr_claim_image" \
|
||||
--arg now "$gcr_claim_now" \
|
||||
'.job_id = $job | .run_attempt = $attempt
|
||||
| .repo = $repo | .label = $label | .runner_name = $runner
|
||||
| .status = "rebuild_pending"
|
||||
'.job_id = $job | .run_attempt = $attempt
|
||||
| .repo = $repo | .label = $label | .runner_name = $runner
|
||||
| .runner_id = ""
|
||||
| .status = "rebuild_pending"
|
||||
| .bootstrapped = false
|
||||
| .rebuild_image_id = $image
|
||||
| .rebuild_action_id = ""
|
||||
@@ -313,8 +730,8 @@ gcr_record_exists_for_vm_owner() {
|
||||
[ -n "$gcr_owner_rec" ] || return 1
|
||||
[ "$(gcr_record_field "$gcr_owner_rec" vm_name)" = "$gcr_owner_vm_name" ] \
|
||||
|| return 1
|
||||
case "$(gcr_record_field "$gcr_owner_rec" status)" in
|
||||
create_pending|create_ambiguous|pending_vm|vm_active|retiring_vm|idle_vm|rebuild_pending|rebuild_requesting|rebuild_running|cleanup_pending)
|
||||
case "$(gcr_record_field "$gcr_owner_rec" status)" in
|
||||
create_pending|create_ambiguous|pending_vm|vm_active|transfer_pending|retiring_vm|idle_vm|rebuild_pending|rebuild_requesting|rebuild_running|cleanup_pending)
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
@@ -330,7 +747,7 @@ gcr_record_exists_for_runner() {
|
||||
gcr_lookup_owner_repo="$(gcr_record_field "$gcr_lookup_rec" retirement_repo)"
|
||||
gcr_lookup_owner_runner="$(gcr_record_field "$gcr_lookup_rec" retirement_runner_name)"
|
||||
;;
|
||||
create_pending|pending_vm|vm_active|rebuild_pending|rebuild_requesting|rebuild_running)
|
||||
create_pending|pending_vm|vm_active|transfer_pending|rebuild_pending|rebuild_requesting|rebuild_running)
|
||||
gcr_lookup_owner_repo="$(gcr_record_field "$gcr_lookup_rec" repo)"
|
||||
gcr_lookup_owner_runner="$(gcr_record_field "$gcr_lookup_rec" runner_name)"
|
||||
;;
|
||||
@@ -530,5 +947,5 @@ gcr_budget_refund_once() {
|
||||
}
|
||||
|
||||
gcr_active_records() {
|
||||
grep -El '"status"[[:space:]]*:[[:space:]]*"(create_pending|create_ambiguous|pending_vm|vm_active|retiring_vm|idle_vm|rebuild_pending|rebuild_requesting|rebuild_running|deferred|cleanup_pending)"' "$GCR_STATE_DIR"/jobs/*.json 2>/dev/null || true
|
||||
grep -El '"status"[[:space:]]*:[[:space:]]*"(create_pending|create_ambiguous|pending_vm|vm_active|transfer_pending|retiring_vm|idle_vm|rebuild_pending|rebuild_requesting|rebuild_running|deferred|cleanup_pending)"' "$GCR_STATE_DIR"/jobs/*.json 2>/dev/null || true
|
||||
}
|
||||
|
||||
@@ -321,6 +321,8 @@ gcr_handle_webhook() {
|
||||
conclusion="$(printf '%s' "$gcr_body" | jq -r '.workflow_job.conclusion // ""')"
|
||||
repo="$(printf '%s' "$gcr_body" | jq -r '.repository.full_name // ""')"
|
||||
labels_json="$(printf '%s' "$gcr_body" | jq -c '.workflow_job.labels // []')"
|
||||
runner_id="$(printf '%s' "$gcr_body" | jq -r '.workflow_job.runner_id // ""')"
|
||||
runner_name="$(printf '%s' "$gcr_body" | jq -r '.workflow_job.runner_name // ""')"
|
||||
|
||||
[ -n "$action" ] && [ -n "$repo" ] \
|
||||
|| { gcr_respond 400 "malformed payload"; exit 0; }
|
||||
@@ -336,12 +338,25 @@ gcr_handle_webhook() {
|
||||
gcr_log info --ns=alloc "queued job=$job_id repo=$repo code=$RESPONSE_CODE $RESPONSE_BODY"
|
||||
;;
|
||||
in_progress)
|
||||
gcr_mark_in_progress "$job_id" "$attempt" "$repo"
|
||||
case "$runner_id" in
|
||||
''|0|*[!0-9]*) gcr_respond 400 "malformed runner identity"; exit 0 ;;
|
||||
esac
|
||||
if ! gcr_apply_actual_job "$repo" "$runner_id" "$runner_name" \
|
||||
"$job_id" "$attempt" vm_active webhook; then
|
||||
gcr_log warn --ns=alloc \
|
||||
"unresolved in-progress assignment job=$job_id repo=$repo runner_id=$runner_id"
|
||||
fi
|
||||
RESPONSE_CODE=204
|
||||
;;
|
||||
completed)
|
||||
gcr_deallocate "$job_id" "$attempt" \
|
||||
"completed:${conclusion:-unknown}" "$repo"
|
||||
case "$runner_id" in
|
||||
''|0|*[!0-9]*) gcr_respond 400 "malformed runner identity"; exit 0 ;;
|
||||
esac
|
||||
if ! gcr_apply_actual_job "$repo" "$runner_id" "$runner_name" \
|
||||
"$job_id" "$attempt" "completed:${conclusion:-unknown}" webhook; then
|
||||
gcr_log warn --ns=alloc \
|
||||
"unresolved terminal assignment job=$job_id repo=$repo runner_id=$runner_id"
|
||||
fi
|
||||
RESPONSE_CODE=204
|
||||
;;
|
||||
*)
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
{
|
||||
autoPatchelfHook,
|
||||
coreutils,
|
||||
fetchurl,
|
||||
lib,
|
||||
runtimeShell,
|
||||
stdenv,
|
||||
stdenvNoCC,
|
||||
}:
|
||||
let
|
||||
version = "nightly-2026-11-01";
|
||||
in
|
||||
stdenvNoCC.mkDerivation {
|
||||
pname = "horizon";
|
||||
inherit version;
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/horizon-rust/horizon/releases/download/${version}/horizon-server-linux-x86_64.tar.gz";
|
||||
hash = "sha256-IRy9uxndb7UyDqZaBiuOc8qJ9t+Z/8r0eeCNWFCKR1k=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ autoPatchelfHook ];
|
||||
buildInputs = [ stdenv.cc.cc.lib ];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p \
|
||||
"$out/bin" \
|
||||
"$out/libexec/horizon" \
|
||||
"$out/share/horizon/prepare-root/mods/horizon/src/test/java/dev/horizonlab" \
|
||||
"$out/share/licenses/horizon"
|
||||
install -m 0755 horizon-server horizon-engine horizon-prepare "$out/libexec/horizon/"
|
||||
install -m 0644 LICENSE "$out/share/licenses/horizon/LICENSE"
|
||||
install -m 0644 research-lock.json "$out/share/horizon/prepare-root/research-lock.json"
|
||||
cp -R exporters "$out/share/horizon/prepare-root/exporters"
|
||||
cp -R \
|
||||
mods/horizon/src/test/java/dev/horizonlab/parity \
|
||||
"$out/share/horizon/prepare-root/mods/horizon/src/test/java/dev/horizonlab/parity"
|
||||
for binary in horizon-server horizon-engine; do
|
||||
ln -s "$out/libexec/horizon/$binary" "$out/bin/$binary"
|
||||
done
|
||||
cat > "$out/bin/horizon-prepare" <<'EOF'
|
||||
#!${runtimeShell}
|
||||
set -eu
|
||||
|
||||
executable=$(${coreutils}/bin/readlink -f "$0")
|
||||
package_root=$(${coreutils}/bin/dirname "$executable")
|
||||
package_root=$(${coreutils}/bin/dirname "$package_root")
|
||||
support_root="$package_root/share/horizon/prepare-root"
|
||||
preparer="$package_root/libexec/horizon/horizon-prepare"
|
||||
root=""
|
||||
saw_root=false
|
||||
want_root=false
|
||||
|
||||
for argument do
|
||||
case "$argument" in
|
||||
-h|--help|-V|--version)
|
||||
exec "$preparer" "$@"
|
||||
;;
|
||||
esac
|
||||
if "$want_root"; then
|
||||
root=$argument
|
||||
want_root=false
|
||||
continue
|
||||
fi
|
||||
case "$argument" in
|
||||
--root)
|
||||
saw_root=true
|
||||
want_root=true
|
||||
;;
|
||||
--root=*)
|
||||
saw_root=true
|
||||
root=''${argument#--root=}
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if "$want_root" || { "$saw_root" && [ -z "$root" ]; }; then
|
||||
exec "$preparer" "$@"
|
||||
fi
|
||||
if ! "$saw_root"; then
|
||||
cache_home=''${XDG_CACHE_HOME:-''${HOME:?HOME is unset}/.cache}
|
||||
root="$cache_home/horizon/prepare-root-${version}"
|
||||
set -- --root "$root" "$@"
|
||||
fi
|
||||
|
||||
marker="$root/.hearth-${version}"
|
||||
if [ ! -f "$marker" ]; then
|
||||
${coreutils}/bin/mkdir -p "$root"
|
||||
${coreutils}/bin/cp -R "$support_root/." "$root/"
|
||||
${coreutils}/bin/chmod -R u+w \
|
||||
"$root/research-lock.json" "$root/exporters" "$root/mods"
|
||||
${coreutils}/bin/touch "$marker"
|
||||
fi
|
||||
exec "$preparer" "$@"
|
||||
EOF
|
||||
chmod 0755 "$out/bin/horizon-prepare"
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
doInstallCheck = true;
|
||||
installCheckPhase = ''
|
||||
runHook preInstallCheck
|
||||
"$out/bin/horizon-server" --help >/dev/null
|
||||
"$out/bin/horizon-server" --version | grep -F '${version}' >/dev/null
|
||||
"$out/bin/horizon-engine" --help >/dev/null
|
||||
"$out/bin/horizon-prepare" --help >/dev/null
|
||||
"$out/bin/horizon-prepare" --version | grep -F '${version}' >/dev/null
|
||||
test -f "$out/share/horizon/prepare-root/research-lock.json"
|
||||
test -f "$out/share/horizon/prepare-root/exporters/manifest.json"
|
||||
test -f "$out/share/horizon/prepare-root/mods/horizon/src/test/java/dev/horizonlab/parity/PrepareWorker.java"
|
||||
|
||||
set +e
|
||||
check_output=$(XDG_CACHE_HOME="$TMPDIR/cache" \
|
||||
"$out/bin/horizon-prepare" --check --output "$TMPDIR/missing" 2>&1)
|
||||
check_status=$?
|
||||
set -e
|
||||
test "$check_status" -eq 1
|
||||
printf '%s\n' "$check_output" | grep -F 'is not prepared: horizon-prepare --prepare' >/dev/null
|
||||
test -f "$TMPDIR/cache/horizon/prepare-root-${version}/research-lock.json"
|
||||
|
||||
set +e
|
||||
check_output=$("$out/bin/horizon-prepare" \
|
||||
--root "$TMPDIR/custom-root" --check --output "$TMPDIR/missing" 2>&1)
|
||||
check_status=$?
|
||||
set -e
|
||||
test "$check_status" -eq 1
|
||||
printf '%s\n' "$check_output" | grep -F 'is not prepared: horizon-prepare --prepare' >/dev/null
|
||||
test -f "$TMPDIR/custom-root/exporters/manifest.json"
|
||||
runHook postInstallCheck
|
||||
'';
|
||||
|
||||
passthru.sourceRevision = "4aa6854a886183440256f4f4a4a9d1ed853227a1";
|
||||
|
||||
meta = {
|
||||
description = "Native Horizon server for Minecraft Java Edition 26.3";
|
||||
homepage = "https://github.com/horizon-rust/horizon";
|
||||
license = lib.licenses.mit;
|
||||
mainProgram = "horizon-server";
|
||||
platforms = [ "x86_64-linux" ];
|
||||
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
|
||||
};
|
||||
}
|
||||
Generated
+1097
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,14 @@
|
||||
[package]
|
||||
name = "routine-server"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
description = "Small HTTP server for daily, weekly, and monthly routines"
|
||||
license = "MIT"
|
||||
|
||||
[dependencies]
|
||||
chrono = { version = "=0.4.38", default-features = false, features = ["clock", "serde"] }
|
||||
minreq = { version = "=2.12.0", default-features = false, features = ["https-rustls"] }
|
||||
postgres = { version = "=0.19.8", features = ["with-chrono-0_4", "with-serde_json-1"] }
|
||||
serde = { version = "=1.0.210", features = ["derive"] }
|
||||
serde_json = "=1.0.128"
|
||||
tiny_http = "=0.12.0"
|
||||
@@ -0,0 +1,87 @@
|
||||
# routine-server
|
||||
|
||||
Small PostgreSQL-backed HTTP service for one-off tasks and daily, weekly, or
|
||||
monthly routine tasks. The server generates future task occurrences and can
|
||||
send due reminders through the Telegram Bot API.
|
||||
|
||||
The server stores an obligatory public title, an optional client-encrypted
|
||||
payload, and the public age recipients of registered devices. It never receives
|
||||
an age identity and Telegram always uses the public title.
|
||||
|
||||
## Configuration
|
||||
|
||||
| Variable | Default | Purpose |
|
||||
| --- | --- | --- |
|
||||
| `ROUTINE_BIND` | `127.0.0.1:8090` | HTTP listen address |
|
||||
| `ROUTINE_DATABASE_URL` | local `routine-server` database | PostgreSQL/libpq connection string |
|
||||
| `ROUTINE_API_TOKEN` | unset | Optional bearer token for every route except `/health` |
|
||||
| `ROUTINE_GENERATION_DAYS` | `62` | Number of future days to materialize |
|
||||
| `ROUTINE_WORKER_INTERVAL_SECONDS` | `60` | Generation/reminder polling interval |
|
||||
| `ROUTINE_TELEGRAM_BOT_TOKEN` | unset | Telegram bot token |
|
||||
| `ROUTINE_TELEGRAM_CHAT_ID` | unset | Telegram target chat |
|
||||
|
||||
Telegram delivery is enabled only when both Telegram variables are present.
|
||||
Times use the service's local timezone and `HH:MM` format.
|
||||
|
||||
## API
|
||||
|
||||
Create a weekly routine:
|
||||
|
||||
```sh
|
||||
curl -X POST http://127.0.0.1:8090/v1/routines \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"public_title": "Exercise",
|
||||
"section": "evening",
|
||||
"priority": "should",
|
||||
"schedule": {"kind": "weekly", "weekdays": [1, 3, 5]},
|
||||
"reminder_time": "18:00"
|
||||
}'
|
||||
```
|
||||
|
||||
Create a monthly routine that moves day 31 to a shorter month's final day:
|
||||
|
||||
```json
|
||||
{
|
||||
"public_title": "Review finances",
|
||||
"section": "work",
|
||||
"priority": "must",
|
||||
"schedule": {
|
||||
"kind": "monthly",
|
||||
"days": [31],
|
||||
"clamp_to_last_day": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Routes:
|
||||
|
||||
```text
|
||||
GET /health
|
||||
GET /v1/tasks?date=YYYY-MM-DD
|
||||
GET /v1/tasks/overdue?before=YYYY-MM-DD
|
||||
GET /v1/tasks/archived
|
||||
POST /v1/tasks
|
||||
PUT /v1/tasks/{id}
|
||||
POST /v1/tasks/{id}/complete
|
||||
POST /v1/tasks/{id}/archive
|
||||
POST /v1/tasks/{id}/restore
|
||||
POST /v1/tasks/{id}/reschedule
|
||||
DELETE /v1/tasks/{id} (archived tasks only)
|
||||
GET /v1/routines
|
||||
POST /v1/routines
|
||||
GET /v1/encryption/devices
|
||||
GET /v1/encryption/recipients
|
||||
POST /v1/encryption/devices
|
||||
POST /v1/encryption/devices/{id}/revoke
|
||||
```
|
||||
|
||||
Weekly days use ISO numbers: Monday is `1`, Sunday is `7`.
|
||||
|
||||
When private data is present, `encrypted_payload`, `encryption_version`, and
|
||||
`content_id` must all be set. `encrypted_payload` is an ASCII-armored age file
|
||||
containing the client's versioned JSON document.
|
||||
|
||||
Only active device recipients are returned for encryption. Revocation affects
|
||||
new payloads; it cannot make ciphertext that a device already received
|
||||
unreadable.
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
cargoToml,
|
||||
lib,
|
||||
nativeBuildInputs,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
cargo = cargoToml ./Cargo.toml;
|
||||
in
|
||||
pkgs.rustPlatform.buildRustPackage {
|
||||
pname = cargo.package.name;
|
||||
version = cargo.package.version;
|
||||
src = ./.;
|
||||
|
||||
inherit nativeBuildInputs;
|
||||
cargoLock.lockFile = ./Cargo.lock;
|
||||
doCheck = true;
|
||||
|
||||
meta = {
|
||||
description = cargo.package.description;
|
||||
license = lib.licenses.mit;
|
||||
mainProgram = "routine-server";
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
pub mod model;
|
||||
pub mod server;
|
||||
pub mod store;
|
||||
pub mod telegram;
|
||||
@@ -0,0 +1,96 @@
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
|
||||
use chrono::Local;
|
||||
use routine_server::server;
|
||||
use routine_server::store::Store;
|
||||
use routine_server::telegram::Telegram;
|
||||
|
||||
struct Config {
|
||||
bind: String,
|
||||
database_url: String,
|
||||
api_token: Option<String>,
|
||||
generation_days: u64,
|
||||
worker_interval: Duration,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
if let Err(error) = run() {
|
||||
eprintln!("routine-server: {error}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
fn run() -> Result<(), String> {
|
||||
let config = Config::from_env()?;
|
||||
let store = Store::new(&config.database_url);
|
||||
store.migrate()?;
|
||||
store.generate(Local::now().date_naive(), config.generation_days)?;
|
||||
|
||||
let worker_store = store.clone();
|
||||
let worker_days = config.generation_days;
|
||||
let worker_interval = config.worker_interval;
|
||||
let telegram = Telegram::from_env();
|
||||
thread::spawn(move || loop {
|
||||
if let Err(error) = worker_tick(&worker_store, worker_days, telegram.as_ref()) {
|
||||
eprintln!("background worker failed: {error}");
|
||||
}
|
||||
thread::sleep(worker_interval);
|
||||
});
|
||||
|
||||
server::serve(&config.bind, store, config.api_token)
|
||||
}
|
||||
|
||||
fn worker_tick(
|
||||
store: &Store,
|
||||
generation_days: u64,
|
||||
telegram: Option<&Telegram>,
|
||||
) -> Result<(), String> {
|
||||
let now = Local::now();
|
||||
store.generate(now.date_naive(), generation_days)?;
|
||||
|
||||
let Some(telegram) = telegram else {
|
||||
return Ok(());
|
||||
};
|
||||
let date = now.date_naive().to_string();
|
||||
let time = now.format("%H:%M").to_string();
|
||||
while let Some(notification) = store.next_due_notification(&date, &time)? {
|
||||
let text = format!(
|
||||
"Routine reminder: {} [{} / {}]",
|
||||
notification.public_title, notification.section, notification.priority
|
||||
);
|
||||
telegram.send_message(&text)?;
|
||||
store.mark_notification_sent(notification.task_id)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
impl Config {
|
||||
fn from_env() -> Result<Self, String> {
|
||||
let generation_days = parse_env("ROUTINE_GENERATION_DAYS", 62)?;
|
||||
let worker_interval_seconds = parse_env("ROUTINE_WORKER_INTERVAL_SECONDS", 60)?;
|
||||
if worker_interval_seconds == 0 {
|
||||
return Err("ROUTINE_WORKER_INTERVAL_SECONDS must be positive".to_owned());
|
||||
}
|
||||
Ok(Self {
|
||||
bind: std::env::var("ROUTINE_BIND").unwrap_or_else(|_| "127.0.0.1:8090".to_owned()),
|
||||
database_url: std::env::var("ROUTINE_DATABASE_URL").unwrap_or_else(|_| {
|
||||
"host=/run/postgresql dbname=routine-server user=routine-server".to_owned()
|
||||
}),
|
||||
api_token: std::env::var("ROUTINE_API_TOKEN")
|
||||
.ok()
|
||||
.filter(|token| !token.is_empty()),
|
||||
generation_days,
|
||||
worker_interval: Duration::from_secs(worker_interval_seconds),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_env(name: &str, default: u64) -> Result<u64, String> {
|
||||
match std::env::var(name) {
|
||||
Ok(value) => value
|
||||
.parse()
|
||||
.map_err(|_| format!("{name} must be an unsigned integer")),
|
||||
Err(_) => Ok(default),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum Section {
|
||||
Morning,
|
||||
Work,
|
||||
Evening,
|
||||
}
|
||||
|
||||
impl Section {
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
match self {
|
||||
Self::Morning => "morning",
|
||||
Self::Work => "work",
|
||||
Self::Evening => "evening",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum Priority {
|
||||
Must,
|
||||
Should,
|
||||
Optional,
|
||||
}
|
||||
|
||||
impl Priority {
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
match self {
|
||||
Self::Must => "must",
|
||||
Self::Should => "should",
|
||||
Self::Optional => "optional",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
#[serde(tag = "kind", rename_all = "snake_case")]
|
||||
pub enum Schedule {
|
||||
Daily,
|
||||
Weekly {
|
||||
/// ISO weekday numbers: Monday = 1, Sunday = 7.
|
||||
weekdays: Vec<u32>,
|
||||
},
|
||||
Monthly {
|
||||
days: Vec<u32>,
|
||||
#[serde(default = "default_true")]
|
||||
clamp_to_last_day: bool,
|
||||
},
|
||||
}
|
||||
|
||||
fn default_true() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct CreateTask {
|
||||
pub public_title: String,
|
||||
#[serde(default)]
|
||||
pub encrypted_payload: Option<String>,
|
||||
#[serde(default)]
|
||||
pub encryption_version: Option<i16>,
|
||||
#[serde(default)]
|
||||
pub content_id: Option<String>,
|
||||
pub section: Section,
|
||||
pub priority: Priority,
|
||||
pub scheduled_date: String,
|
||||
#[serde(default)]
|
||||
pub reminder_time: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct RescheduleTask {
|
||||
pub scheduled_date: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub struct Task {
|
||||
pub id: i64,
|
||||
pub routine_id: Option<i64>,
|
||||
pub public_title: String,
|
||||
pub encrypted_payload: Option<String>,
|
||||
pub encryption_version: Option<i16>,
|
||||
pub content_id: Option<String>,
|
||||
pub section: String,
|
||||
pub priority: String,
|
||||
pub scheduled_date: String,
|
||||
pub reminder_time: Option<String>,
|
||||
pub status: String,
|
||||
pub completed_at: Option<i64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct CreateRoutine {
|
||||
pub public_title: String,
|
||||
#[serde(default)]
|
||||
pub encrypted_payload: Option<String>,
|
||||
#[serde(default)]
|
||||
pub encryption_version: Option<i16>,
|
||||
#[serde(default)]
|
||||
pub content_id: Option<String>,
|
||||
pub section: Section,
|
||||
pub priority: Priority,
|
||||
pub schedule: Schedule,
|
||||
#[serde(default)]
|
||||
pub reminder_time: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub struct Routine {
|
||||
pub id: i64,
|
||||
pub public_title: String,
|
||||
pub encrypted_payload: Option<String>,
|
||||
pub encryption_version: Option<i16>,
|
||||
pub content_id: Option<String>,
|
||||
pub section: String,
|
||||
pub priority: String,
|
||||
pub schedule: Schedule,
|
||||
pub reminder_time: Option<String>,
|
||||
pub enabled: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct DueNotification {
|
||||
pub task_id: i64,
|
||||
pub public_title: String,
|
||||
pub section: String,
|
||||
pub priority: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct CreateEncryptionDevice {
|
||||
pub name: String,
|
||||
pub age_recipient: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub struct EncryptionDevice {
|
||||
pub id: i64,
|
||||
pub name: String,
|
||||
pub age_recipient: String,
|
||||
pub status: String,
|
||||
pub created_at: i64,
|
||||
pub revoked_at: Option<i64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub struct EncryptionRecipient {
|
||||
pub id: i64,
|
||||
pub name: String,
|
||||
pub age_recipient: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct IdResponse {
|
||||
pub id: i64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct StatusResponse {
|
||||
pub status: &'static str,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct ErrorResponse<'a> {
|
||||
pub error: &'a str,
|
||||
}
|
||||
@@ -0,0 +1,244 @@
|
||||
use chrono::Local;
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde::Serialize;
|
||||
use tiny_http::{Header, Method, Request, Response, Server, StatusCode};
|
||||
|
||||
use crate::model::{
|
||||
CreateEncryptionDevice, CreateRoutine, CreateTask, ErrorResponse, IdResponse, RescheduleTask,
|
||||
StatusResponse,
|
||||
};
|
||||
use crate::store::Store;
|
||||
|
||||
pub fn serve(bind: &str, store: Store, api_token: Option<String>) -> Result<(), String> {
|
||||
let server = Server::http(bind).map_err(|error| format!("failed to bind {bind}: {error}"))?;
|
||||
eprintln!("routine-server listening on {bind}");
|
||||
|
||||
for request in server.incoming_requests() {
|
||||
handle(request, &store, api_token.as_deref());
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn handle(mut request: Request, store: &Store, api_token: Option<&str>) {
|
||||
let (path, query) = split_url(request.url());
|
||||
if path == "/health" && request.method() == &Method::Get {
|
||||
respond_json(request, 200, &StatusResponse { status: "ok" });
|
||||
return;
|
||||
}
|
||||
|
||||
if !authorized(&request, api_token) {
|
||||
respond_error(request, 401, "missing or invalid bearer token");
|
||||
return;
|
||||
}
|
||||
|
||||
match (request.method(), path.as_str()) {
|
||||
(&Method::Get, "/v1/tasks") => {
|
||||
let date = query_parameter(&query, "date")
|
||||
.unwrap_or_else(|| Local::now().date_naive().to_string());
|
||||
match store.list_tasks(&date) {
|
||||
Ok(tasks) => respond_json(request, 200, &tasks),
|
||||
Err(error) => respond_failure(request, &error),
|
||||
}
|
||||
}
|
||||
(&Method::Get, "/v1/tasks/overdue") => {
|
||||
let before = query_parameter(&query, "before")
|
||||
.unwrap_or_else(|| Local::now().date_naive().to_string());
|
||||
match store.list_overdue_tasks(&before) {
|
||||
Ok(tasks) => respond_json(request, 200, &tasks),
|
||||
Err(error) => respond_failure(request, &error),
|
||||
}
|
||||
}
|
||||
(&Method::Post, "/v1/tasks") => {
|
||||
let result =
|
||||
parse_json::<CreateTask>(&mut request).and_then(|input| store.create_task(input));
|
||||
respond_created(request, result);
|
||||
}
|
||||
(&Method::Get, "/v1/tasks/archived") => match store.list_archived_tasks() {
|
||||
Ok(tasks) => respond_json(request, 200, &tasks),
|
||||
Err(error) => respond_failure(request, &error),
|
||||
},
|
||||
(&Method::Get, "/v1/routines") => match store.list_routines() {
|
||||
Ok(routines) => respond_json(request, 200, &routines),
|
||||
Err(error) => respond_failure(request, &error),
|
||||
},
|
||||
(&Method::Post, "/v1/routines") => {
|
||||
let result = parse_json::<CreateRoutine>(&mut request)
|
||||
.and_then(|input| store.create_routine(input))
|
||||
.and_then(|id| {
|
||||
store.generate(Local::now().date_naive(), 62)?;
|
||||
Ok(id)
|
||||
});
|
||||
respond_created(request, result);
|
||||
}
|
||||
(&Method::Get, "/v1/encryption/devices") => match store.list_encryption_devices() {
|
||||
Ok(devices) => respond_json(request, 200, &devices),
|
||||
Err(error) => respond_failure(request, &error),
|
||||
},
|
||||
(&Method::Get, "/v1/encryption/recipients") => match store.list_encryption_recipients() {
|
||||
Ok(recipients) => respond_json(request, 200, &recipients),
|
||||
Err(error) => respond_failure(request, &error),
|
||||
},
|
||||
(&Method::Post, "/v1/encryption/devices") => {
|
||||
let result = parse_json::<CreateEncryptionDevice>(&mut request)
|
||||
.and_then(|input| store.create_encryption_device(input));
|
||||
respond_created(request, result);
|
||||
}
|
||||
_ if path.starts_with("/v1/encryption/devices/") => {
|
||||
handle_device_action(request, store, &path)
|
||||
}
|
||||
_ => handle_task_action(request, store, &path),
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_device_action(request: Request, store: &Store, path: &str) {
|
||||
let segments: Vec<_> = path.trim_matches('/').split('/').collect();
|
||||
if segments.len() != 5
|
||||
|| segments[0] != "v1"
|
||||
|| segments[1] != "encryption"
|
||||
|| segments[2] != "devices"
|
||||
|| segments[4] != "revoke"
|
||||
|| request.method() != &Method::Post
|
||||
{
|
||||
respond_error(request, 404, "route not found");
|
||||
return;
|
||||
}
|
||||
let id = match segments[3].parse::<i64>() {
|
||||
Ok(id) => id,
|
||||
Err(_) => {
|
||||
respond_error(request, 400, "device id must be an integer");
|
||||
return;
|
||||
}
|
||||
};
|
||||
match store.revoke_encryption_device(id) {
|
||||
Ok(true) => respond_json(request, 200, &StatusResponse { status: "ok" }),
|
||||
Ok(false) => respond_error(request, 404, "active device not found"),
|
||||
Err(error) => respond_failure(request, &error),
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_task_action(mut request: Request, store: &Store, path: &str) {
|
||||
let segments: Vec<_> = path.trim_matches('/').split('/').collect();
|
||||
if segments.len() < 3 || segments[0] != "v1" || segments[1] != "tasks" {
|
||||
respond_error(request, 404, "route not found");
|
||||
return;
|
||||
}
|
||||
let id = segments[2]
|
||||
.parse::<i64>()
|
||||
.map_err(|_| "task id must be an integer".to_owned());
|
||||
let id = match id {
|
||||
Ok(id) => id,
|
||||
Err(error) => {
|
||||
respond_error(request, 400, &error);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
let changed = match (request.method(), segments.get(3).copied()) {
|
||||
(&Method::Put, None) if segments.len() == 3 => {
|
||||
parse_json::<CreateTask>(&mut request).and_then(|input| store.update_task(id, input))
|
||||
}
|
||||
(&Method::Post, Some("complete")) if segments.len() == 4 => store.complete_task(id),
|
||||
(&Method::Post, Some("archive")) if segments.len() == 4 => store.archive_task(id),
|
||||
(&Method::Post, Some("restore")) if segments.len() == 4 => store.restore_task(id),
|
||||
(&Method::Post, Some("reschedule")) if segments.len() == 4 => {
|
||||
parse_json::<RescheduleTask>(&mut request)
|
||||
.and_then(|input| store.reschedule_task(id, &input.scheduled_date))
|
||||
}
|
||||
(&Method::Delete, None) if segments.len() == 3 => store.delete_archived_task(id),
|
||||
_ => {
|
||||
respond_error(request, 404, "route not found");
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
match changed {
|
||||
Ok(true) => respond_json(request, 200, &StatusResponse { status: "ok" }),
|
||||
Ok(false) => respond_error(request, 404, "task not found or action not allowed"),
|
||||
Err(error) => respond_failure(request, &error),
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_json<T: DeserializeOwned>(request: &mut Request) -> Result<T, String> {
|
||||
if request.body_length().unwrap_or(0) > 64 * 1024 {
|
||||
return Err("request body is too large".to_owned());
|
||||
}
|
||||
let mut body = String::new();
|
||||
request
|
||||
.as_reader()
|
||||
.read_to_string(&mut body)
|
||||
.map_err(|error| format!("failed to read request: {error}"))?;
|
||||
serde_json::from_str(&body).map_err(|error| format!("invalid JSON: {error}"))
|
||||
}
|
||||
|
||||
fn authorized(request: &Request, api_token: Option<&str>) -> bool {
|
||||
let Some(api_token) = api_token else {
|
||||
return true;
|
||||
};
|
||||
let expected = format!("Bearer {api_token}");
|
||||
request
|
||||
.headers()
|
||||
.iter()
|
||||
.find(|header| header.field.equiv("Authorization"))
|
||||
.map(|header| header.value.as_str() == expected)
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
fn split_url(url: &str) -> (String, String) {
|
||||
match url.split_once('?') {
|
||||
Some((path, query)) => (path.to_owned(), query.to_owned()),
|
||||
None => (url.to_owned(), String::new()),
|
||||
}
|
||||
}
|
||||
|
||||
fn query_parameter(query: &str, key: &str) -> Option<String> {
|
||||
query.split('&').find_map(|part| {
|
||||
let (candidate, value) = part.split_once('=')?;
|
||||
(candidate == key).then(|| value.to_owned())
|
||||
})
|
||||
}
|
||||
|
||||
fn respond_json<T: Serialize>(request: Request, status: u16, value: &T) {
|
||||
let body = serde_json::to_string(value)
|
||||
.unwrap_or_else(|_| "{\"error\":\"serialization failed\"}".to_owned());
|
||||
let content_type =
|
||||
Header::from_bytes("Content-Type", "application/json").expect("static header is valid");
|
||||
let response = Response::from_string(body)
|
||||
.with_status_code(StatusCode(status))
|
||||
.with_header(content_type);
|
||||
if let Err(error) = request.respond(response) {
|
||||
eprintln!("failed to write response: {error}");
|
||||
}
|
||||
}
|
||||
|
||||
fn respond_error(request: Request, status: u16, error: &str) {
|
||||
respond_json(request, status, &ErrorResponse { error });
|
||||
}
|
||||
|
||||
fn respond_created(request: Request, result: Result<i64, String>) {
|
||||
match result {
|
||||
Ok(id) => respond_json(request, 201, &IdResponse { id }),
|
||||
Err(error) => respond_failure(request, &error),
|
||||
}
|
||||
}
|
||||
|
||||
fn respond_failure(request: Request, error: &str) {
|
||||
if error.starts_with("database error:") {
|
||||
eprintln!("request failed: {error}");
|
||||
respond_error(request, 500, "database operation failed");
|
||||
} else {
|
||||
respond_error(request, 400, error);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn extracts_query_parameter() {
|
||||
assert_eq!(
|
||||
query_parameter("date=2026-10-14&unused=1", "date").as_deref(),
|
||||
Some("2026-10-14")
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,715 @@
|
||||
use chrono::{Datelike, Days, NaiveDate, NaiveTime};
|
||||
use postgres::{Client, NoTls};
|
||||
|
||||
use crate::model::{
|
||||
CreateEncryptionDevice, CreateRoutine, CreateTask, DueNotification, EncryptionDevice,
|
||||
EncryptionRecipient, Routine, Schedule, Task,
|
||||
};
|
||||
|
||||
pub type Result<T> = std::result::Result<T, String>;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Store {
|
||||
database_url: String,
|
||||
}
|
||||
|
||||
impl Store {
|
||||
pub fn new(database_url: impl Into<String>) -> Self {
|
||||
Self {
|
||||
database_url: database_url.into(),
|
||||
}
|
||||
}
|
||||
|
||||
fn connect(&self) -> Result<Client> {
|
||||
Client::connect(&self.database_url, NoTls).map_err(db_error)
|
||||
}
|
||||
|
||||
pub fn migrate(&self) -> Result<()> {
|
||||
let mut client = self.connect()?;
|
||||
client
|
||||
.batch_execute(
|
||||
"CREATE TABLE IF NOT EXISTS routines (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
public_title TEXT NOT NULL,
|
||||
encrypted_payload TEXT,
|
||||
encryption_version SMALLINT,
|
||||
content_id TEXT,
|
||||
section TEXT NOT NULL,
|
||||
priority TEXT NOT NULL,
|
||||
schedule_json JSONB NOT NULL,
|
||||
reminder_time TIME,
|
||||
enabled BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
CHECK ((encrypted_payload IS NULL AND encryption_version IS NULL AND content_id IS NULL)
|
||||
OR (encrypted_payload IS NOT NULL AND encryption_version IS NOT NULL AND content_id IS NOT NULL))
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS tasks (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
routine_id BIGINT REFERENCES routines(id),
|
||||
public_title TEXT NOT NULL,
|
||||
encrypted_payload TEXT,
|
||||
encryption_version SMALLINT,
|
||||
content_id TEXT,
|
||||
section TEXT NOT NULL,
|
||||
priority TEXT NOT NULL,
|
||||
scheduled_date DATE NOT NULL,
|
||||
reminder_time TIME,
|
||||
status TEXT NOT NULL DEFAULT 'pending',
|
||||
status_before_archive TEXT,
|
||||
completed_at TIMESTAMPTZ,
|
||||
archived_at TIMESTAMPTZ,
|
||||
notification_sent_at TIMESTAMPTZ,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
UNIQUE(routine_id, scheduled_date),
|
||||
CHECK ((encrypted_payload IS NULL AND encryption_version IS NULL AND content_id IS NULL)
|
||||
OR (encrypted_payload IS NOT NULL AND encryption_version IS NOT NULL AND content_id IS NOT NULL))
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS tasks_by_date
|
||||
ON tasks(scheduled_date, status);
|
||||
CREATE INDEX IF NOT EXISTS tasks_due_notification
|
||||
ON tasks(scheduled_date, reminder_time, notification_sent_at);
|
||||
ALTER TABLE tasks
|
||||
ADD COLUMN IF NOT EXISTS status_before_archive TEXT;
|
||||
ALTER TABLE tasks
|
||||
ADD COLUMN IF NOT EXISTS archived_at TIMESTAMPTZ;
|
||||
CREATE TABLE IF NOT EXISTS encryption_devices (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
name TEXT NOT NULL,
|
||||
age_recipient TEXT NOT NULL UNIQUE,
|
||||
status TEXT NOT NULL DEFAULT 'active',
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
revoked_at TIMESTAMPTZ,
|
||||
CHECK (status IN ('active', 'revoked')),
|
||||
CHECK ((status = 'active' AND revoked_at IS NULL)
|
||||
OR (status = 'revoked' AND revoked_at IS NOT NULL))
|
||||
);",
|
||||
)
|
||||
.map_err(db_error)
|
||||
}
|
||||
|
||||
pub fn list_encryption_devices(&self) -> Result<Vec<EncryptionDevice>> {
|
||||
let mut client = self.connect()?;
|
||||
let rows = client
|
||||
.query(
|
||||
"SELECT id, name, age_recipient, status,
|
||||
EXTRACT(EPOCH FROM created_at)::BIGINT,
|
||||
EXTRACT(EPOCH FROM revoked_at)::BIGINT
|
||||
FROM encryption_devices
|
||||
ORDER BY status, id",
|
||||
&[],
|
||||
)
|
||||
.map_err(db_error)?;
|
||||
Ok(rows
|
||||
.into_iter()
|
||||
.map(|row| EncryptionDevice {
|
||||
id: row.get(0),
|
||||
name: row.get(1),
|
||||
age_recipient: row.get(2),
|
||||
status: row.get(3),
|
||||
created_at: row.get(4),
|
||||
revoked_at: row.get(5),
|
||||
})
|
||||
.collect())
|
||||
}
|
||||
|
||||
pub fn list_encryption_recipients(&self) -> Result<Vec<EncryptionRecipient>> {
|
||||
let mut client = self.connect()?;
|
||||
let rows = client
|
||||
.query(
|
||||
"SELECT id, name, age_recipient
|
||||
FROM encryption_devices
|
||||
WHERE status = 'active'
|
||||
ORDER BY id",
|
||||
&[],
|
||||
)
|
||||
.map_err(db_error)?;
|
||||
Ok(rows
|
||||
.into_iter()
|
||||
.map(|row| EncryptionRecipient {
|
||||
id: row.get(0),
|
||||
name: row.get(1),
|
||||
age_recipient: row.get(2),
|
||||
})
|
||||
.collect())
|
||||
}
|
||||
|
||||
pub fn create_encryption_device(&self, device: CreateEncryptionDevice) -> Result<i64> {
|
||||
let name = device.name.trim();
|
||||
let recipient = device.age_recipient.trim();
|
||||
validate_device(name, recipient)?;
|
||||
let mut client = self.connect()?;
|
||||
let row = client
|
||||
.query_one(
|
||||
"INSERT INTO encryption_devices (name, age_recipient)
|
||||
VALUES ($1, $2)
|
||||
RETURNING id",
|
||||
&[&name, &recipient],
|
||||
)
|
||||
.map_err(db_error)?;
|
||||
Ok(row.get(0))
|
||||
}
|
||||
|
||||
pub fn revoke_encryption_device(&self, id: i64) -> Result<bool> {
|
||||
let mut client = self.connect()?;
|
||||
client
|
||||
.execute(
|
||||
"UPDATE encryption_devices
|
||||
SET status = 'revoked', revoked_at = now()
|
||||
WHERE id = $1 AND status = 'active'",
|
||||
&[&id],
|
||||
)
|
||||
.map(|changed| changed == 1)
|
||||
.map_err(db_error)
|
||||
}
|
||||
|
||||
pub fn create_task(&self, task: CreateTask) -> Result<i64> {
|
||||
validate_public_title(&task.public_title)?;
|
||||
validate_encrypted_fields(
|
||||
task.encrypted_payload.as_deref(),
|
||||
task.encryption_version,
|
||||
task.content_id.as_deref(),
|
||||
)?;
|
||||
let scheduled_date = parse_date(&task.scheduled_date)?;
|
||||
let reminder_time = parse_reminder(task.reminder_time.as_deref())?;
|
||||
|
||||
let mut client = self.connect()?;
|
||||
let row = client
|
||||
.query_one(
|
||||
"INSERT INTO tasks (
|
||||
public_title, encrypted_payload, encryption_version, content_id,
|
||||
section, priority, scheduled_date, reminder_time
|
||||
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
|
||||
RETURNING id",
|
||||
&[
|
||||
&task.public_title.trim(),
|
||||
&task.encrypted_payload,
|
||||
&task.encryption_version,
|
||||
&task.content_id,
|
||||
&task.section.as_str(),
|
||||
&task.priority.as_str(),
|
||||
&scheduled_date,
|
||||
&reminder_time,
|
||||
],
|
||||
)
|
||||
.map_err(db_error)?;
|
||||
Ok(row.get(0))
|
||||
}
|
||||
|
||||
pub fn update_task(&self, id: i64, task: CreateTask) -> Result<bool> {
|
||||
validate_public_title(&task.public_title)?;
|
||||
validate_encrypted_fields(
|
||||
task.encrypted_payload.as_deref(),
|
||||
task.encryption_version,
|
||||
task.content_id.as_deref(),
|
||||
)?;
|
||||
let scheduled_date = parse_date(&task.scheduled_date)?;
|
||||
let reminder_time = parse_reminder(task.reminder_time.as_deref())?;
|
||||
|
||||
let mut client = self.connect()?;
|
||||
client
|
||||
.execute(
|
||||
"UPDATE tasks
|
||||
SET public_title = $1,
|
||||
encrypted_payload = $2,
|
||||
encryption_version = $3,
|
||||
content_id = $4,
|
||||
section = $5,
|
||||
priority = $6,
|
||||
scheduled_date = $7,
|
||||
reminder_time = $8,
|
||||
notification_sent_at = NULL
|
||||
WHERE id = $9 AND status != 'archived'",
|
||||
&[
|
||||
&task.public_title.trim(),
|
||||
&task.encrypted_payload,
|
||||
&task.encryption_version,
|
||||
&task.content_id,
|
||||
&task.section.as_str(),
|
||||
&task.priority.as_str(),
|
||||
&scheduled_date,
|
||||
&reminder_time,
|
||||
&id,
|
||||
],
|
||||
)
|
||||
.map(|changed| changed == 1)
|
||||
.map_err(db_error)
|
||||
}
|
||||
|
||||
pub fn list_tasks(&self, date: &str) -> Result<Vec<Task>> {
|
||||
let date = parse_date(date)?;
|
||||
let mut client = self.connect()?;
|
||||
let rows = client
|
||||
.query(
|
||||
"SELECT id, routine_id, public_title, encrypted_payload,
|
||||
encryption_version, content_id, section, priority,
|
||||
scheduled_date, reminder_time, status,
|
||||
EXTRACT(EPOCH FROM completed_at)::BIGINT
|
||||
FROM tasks
|
||||
WHERE scheduled_date = $1
|
||||
AND status != 'archived'
|
||||
ORDER BY
|
||||
CASE section
|
||||
WHEN 'morning' THEN 0
|
||||
WHEN 'work' THEN 1
|
||||
ELSE 2
|
||||
END,
|
||||
CASE priority
|
||||
WHEN 'must' THEN 0
|
||||
WHEN 'should' THEN 1
|
||||
ELSE 2
|
||||
END,
|
||||
id",
|
||||
&[&date],
|
||||
)
|
||||
.map_err(db_error)?;
|
||||
Ok(rows.into_iter().map(task_from_row).collect())
|
||||
}
|
||||
|
||||
pub fn list_overdue_tasks(&self, before: &str) -> Result<Vec<Task>> {
|
||||
let before = parse_date(before)?;
|
||||
let mut client = self.connect()?;
|
||||
let rows = client
|
||||
.query(
|
||||
"SELECT id, routine_id, public_title, encrypted_payload,
|
||||
encryption_version, content_id, section, priority,
|
||||
scheduled_date, reminder_time, status,
|
||||
EXTRACT(EPOCH FROM completed_at)::BIGINT
|
||||
FROM tasks
|
||||
WHERE scheduled_date < $1
|
||||
AND status = 'pending'
|
||||
ORDER BY scheduled_date,
|
||||
CASE section
|
||||
WHEN 'morning' THEN 0
|
||||
WHEN 'work' THEN 1
|
||||
ELSE 2
|
||||
END,
|
||||
CASE priority
|
||||
WHEN 'must' THEN 0
|
||||
WHEN 'should' THEN 1
|
||||
ELSE 2
|
||||
END,
|
||||
id",
|
||||
&[&before],
|
||||
)
|
||||
.map_err(db_error)?;
|
||||
Ok(rows.into_iter().map(task_from_row).collect())
|
||||
}
|
||||
|
||||
pub fn list_archived_tasks(&self) -> Result<Vec<Task>> {
|
||||
let mut client = self.connect()?;
|
||||
let rows = client
|
||||
.query(
|
||||
"SELECT id, routine_id, public_title, encrypted_payload,
|
||||
encryption_version, content_id, section, priority,
|
||||
scheduled_date, reminder_time, status,
|
||||
EXTRACT(EPOCH FROM completed_at)::BIGINT
|
||||
FROM tasks
|
||||
WHERE status = 'archived'
|
||||
ORDER BY archived_at DESC, id DESC",
|
||||
&[],
|
||||
)
|
||||
.map_err(db_error)?;
|
||||
Ok(rows.into_iter().map(task_from_row).collect())
|
||||
}
|
||||
|
||||
pub fn complete_task(&self, id: i64) -> Result<bool> {
|
||||
let mut client = self.connect()?;
|
||||
client
|
||||
.execute(
|
||||
"UPDATE tasks
|
||||
SET status = 'completed', completed_at = now()
|
||||
WHERE id = $1 AND status NOT IN ('completed', 'archived')",
|
||||
&[&id],
|
||||
)
|
||||
.map(|changed| changed == 1)
|
||||
.map_err(db_error)
|
||||
}
|
||||
|
||||
pub fn reschedule_task(&self, id: i64, date: &str) -> Result<bool> {
|
||||
let date = parse_date(date)?;
|
||||
let mut client = self.connect()?;
|
||||
client
|
||||
.execute(
|
||||
"UPDATE tasks
|
||||
SET scheduled_date = $1, notification_sent_at = NULL
|
||||
WHERE id = $2 AND status != 'archived'",
|
||||
&[&date, &id],
|
||||
)
|
||||
.map(|changed| changed == 1)
|
||||
.map_err(db_error)
|
||||
}
|
||||
|
||||
pub fn archive_task(&self, id: i64) -> Result<bool> {
|
||||
let mut client = self.connect()?;
|
||||
client
|
||||
.execute(
|
||||
"UPDATE tasks
|
||||
SET status_before_archive = status,
|
||||
status = 'archived',
|
||||
archived_at = now()
|
||||
WHERE id = $1 AND status != 'archived'",
|
||||
&[&id],
|
||||
)
|
||||
.map(|changed| changed == 1)
|
||||
.map_err(db_error)
|
||||
}
|
||||
|
||||
pub fn restore_task(&self, id: i64) -> Result<bool> {
|
||||
let mut client = self.connect()?;
|
||||
client
|
||||
.execute(
|
||||
"UPDATE tasks
|
||||
SET status = COALESCE(status_before_archive, 'pending'),
|
||||
status_before_archive = NULL,
|
||||
archived_at = NULL
|
||||
WHERE id = $1 AND status = 'archived'",
|
||||
&[&id],
|
||||
)
|
||||
.map(|changed| changed == 1)
|
||||
.map_err(db_error)
|
||||
}
|
||||
|
||||
pub fn delete_archived_task(&self, id: i64) -> Result<bool> {
|
||||
let mut client = self.connect()?;
|
||||
client
|
||||
.execute(
|
||||
"DELETE FROM tasks WHERE id = $1 AND status = 'archived'",
|
||||
&[&id],
|
||||
)
|
||||
.map(|changed| changed == 1)
|
||||
.map_err(db_error)
|
||||
}
|
||||
|
||||
pub fn create_routine(&self, routine: CreateRoutine) -> Result<i64> {
|
||||
validate_public_title(&routine.public_title)?;
|
||||
validate_encrypted_fields(
|
||||
routine.encrypted_payload.as_deref(),
|
||||
routine.encryption_version,
|
||||
routine.content_id.as_deref(),
|
||||
)?;
|
||||
validate_schedule(&routine.schedule)?;
|
||||
let reminder_time = parse_reminder(routine.reminder_time.as_deref())?;
|
||||
let schedule_json = serde_json::to_value(&routine.schedule).map_err(json_error)?;
|
||||
|
||||
let mut client = self.connect()?;
|
||||
let row = client
|
||||
.query_one(
|
||||
"INSERT INTO routines (
|
||||
public_title, encrypted_payload, encryption_version, content_id,
|
||||
section, priority, schedule_json, reminder_time
|
||||
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
|
||||
RETURNING id",
|
||||
&[
|
||||
&routine.public_title.trim(),
|
||||
&routine.encrypted_payload,
|
||||
&routine.encryption_version,
|
||||
&routine.content_id,
|
||||
&routine.section.as_str(),
|
||||
&routine.priority.as_str(),
|
||||
&schedule_json,
|
||||
&reminder_time,
|
||||
],
|
||||
)
|
||||
.map_err(db_error)?;
|
||||
Ok(row.get(0))
|
||||
}
|
||||
|
||||
pub fn list_routines(&self) -> Result<Vec<Routine>> {
|
||||
let mut client = self.connect()?;
|
||||
let rows = client
|
||||
.query(
|
||||
"SELECT id, public_title, encrypted_payload, encryption_version,
|
||||
content_id, section, priority, schedule_json,
|
||||
reminder_time, enabled
|
||||
FROM routines ORDER BY id",
|
||||
&[],
|
||||
)
|
||||
.map_err(db_error)?;
|
||||
rows.into_iter()
|
||||
.map(|row| {
|
||||
let schedule_json: serde_json::Value = row.get(7);
|
||||
let schedule = serde_json::from_value(schedule_json).map_err(json_error)?;
|
||||
let reminder_time: Option<NaiveTime> = row.get(8);
|
||||
Ok(Routine {
|
||||
id: row.get(0),
|
||||
public_title: row.get(1),
|
||||
encrypted_payload: row.get(2),
|
||||
encryption_version: row.get(3),
|
||||
content_id: row.get(4),
|
||||
section: row.get(5),
|
||||
priority: row.get(6),
|
||||
schedule,
|
||||
reminder_time: reminder_time.map(|time| time.format("%H:%M").to_string()),
|
||||
enabled: row.get(9),
|
||||
})
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn generate(&self, start: NaiveDate, horizon_days: u64) -> Result<usize> {
|
||||
let routines = self.list_routines()?;
|
||||
let mut client = self.connect()?;
|
||||
let mut inserted = 0_u64;
|
||||
|
||||
for offset in 0..=horizon_days {
|
||||
let date = start
|
||||
.checked_add_days(Days::new(offset))
|
||||
.ok_or_else(|| "generation date overflow".to_owned())?;
|
||||
for routine in routines.iter().filter(|routine| routine.enabled) {
|
||||
if !schedule_matches(&routine.schedule, date)? {
|
||||
continue;
|
||||
}
|
||||
let reminder_time = parse_reminder(routine.reminder_time.as_deref())?;
|
||||
inserted += client
|
||||
.execute(
|
||||
"INSERT INTO tasks (
|
||||
routine_id, public_title, encrypted_payload,
|
||||
encryption_version, content_id, section, priority,
|
||||
scheduled_date, reminder_time
|
||||
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)
|
||||
ON CONFLICT (routine_id, scheduled_date) DO NOTHING",
|
||||
&[
|
||||
&routine.id,
|
||||
&routine.public_title,
|
||||
&routine.encrypted_payload,
|
||||
&routine.encryption_version,
|
||||
&routine.content_id,
|
||||
&routine.section,
|
||||
&routine.priority,
|
||||
&date,
|
||||
&reminder_time,
|
||||
],
|
||||
)
|
||||
.map_err(db_error)?;
|
||||
}
|
||||
}
|
||||
usize::try_from(inserted).map_err(|_| "generated task count overflow".to_owned())
|
||||
}
|
||||
|
||||
pub fn next_due_notification(&self, date: &str, time: &str) -> Result<Option<DueNotification>> {
|
||||
let date = parse_date(date)?;
|
||||
let time = parse_reminder(Some(time))?.expect("provided reminder is present");
|
||||
let mut client = self.connect()?;
|
||||
let row = client
|
||||
.query_opt(
|
||||
"SELECT id, public_title, section, priority
|
||||
FROM tasks
|
||||
WHERE scheduled_date = $1
|
||||
AND reminder_time IS NOT NULL
|
||||
AND reminder_time <= $2
|
||||
AND notification_sent_at IS NULL
|
||||
AND status = 'pending'
|
||||
ORDER BY reminder_time, id
|
||||
LIMIT 1",
|
||||
&[&date, &time],
|
||||
)
|
||||
.map_err(db_error)?;
|
||||
Ok(row.map(|row| DueNotification {
|
||||
task_id: row.get(0),
|
||||
public_title: row.get(1),
|
||||
section: row.get(2),
|
||||
priority: row.get(3),
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn mark_notification_sent(&self, task_id: i64) -> Result<()> {
|
||||
let mut client = self.connect()?;
|
||||
client
|
||||
.execute(
|
||||
"UPDATE tasks SET notification_sent_at = now() WHERE id = $1",
|
||||
&[&task_id],
|
||||
)
|
||||
.map_err(db_error)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn task_from_row(row: postgres::Row) -> Task {
|
||||
let scheduled_date: NaiveDate = row.get(8);
|
||||
let reminder_time: Option<NaiveTime> = row.get(9);
|
||||
Task {
|
||||
id: row.get(0),
|
||||
routine_id: row.get(1),
|
||||
public_title: row.get(2),
|
||||
encrypted_payload: row.get(3),
|
||||
encryption_version: row.get(4),
|
||||
content_id: row.get(5),
|
||||
section: row.get(6),
|
||||
priority: row.get(7),
|
||||
scheduled_date: scheduled_date.to_string(),
|
||||
reminder_time: reminder_time.map(|time| time.format("%H:%M").to_string()),
|
||||
status: row.get(10),
|
||||
completed_at: row.get(11),
|
||||
}
|
||||
}
|
||||
|
||||
fn validate_public_title(title: &str) -> Result<()> {
|
||||
if title.trim().is_empty() {
|
||||
Err("title must not be empty".to_owned())
|
||||
} else if title.len() > 300 {
|
||||
Err("title must be at most 300 bytes".to_owned())
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn validate_device(name: &str, recipient: &str) -> Result<()> {
|
||||
if name.is_empty() {
|
||||
return Err("device name must not be empty".to_owned());
|
||||
}
|
||||
if name.len() > 100 {
|
||||
return Err("device name must be at most 100 bytes".to_owned());
|
||||
}
|
||||
if recipient.is_empty() {
|
||||
return Err("age recipient must not be empty".to_owned());
|
||||
}
|
||||
if recipient.len() > 4096 || recipient.contains('\n') || recipient.contains('\r') {
|
||||
return Err("age recipient must be a single line of at most 4096 bytes".to_owned());
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn validate_encrypted_fields(
|
||||
payload: Option<&str>,
|
||||
version: Option<i16>,
|
||||
content_id: Option<&str>,
|
||||
) -> Result<()> {
|
||||
if payload.map(str::len).unwrap_or(0) > 128 * 1024 {
|
||||
return Err("encrypted_payload must be at most 128 KiB".to_owned());
|
||||
}
|
||||
if content_id.map(str::len).unwrap_or(0) > 128 {
|
||||
return Err("content_id must be at most 128 bytes".to_owned());
|
||||
}
|
||||
if payload.is_some() == version.is_some() && version.is_some() == content_id.is_some() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err("encrypted_payload, encryption_version, and content_id must be set together".to_owned())
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_date(date: &str) -> Result<NaiveDate> {
|
||||
NaiveDate::parse_from_str(date, "%Y-%m-%d").map_err(|_| "date must use YYYY-MM-DD".to_owned())
|
||||
}
|
||||
|
||||
fn parse_reminder(reminder: Option<&str>) -> Result<Option<NaiveTime>> {
|
||||
reminder
|
||||
.map(|value| {
|
||||
NaiveTime::parse_from_str(value, "%H:%M")
|
||||
.map_err(|_| "reminder_time must use HH:MM".to_owned())
|
||||
})
|
||||
.transpose()
|
||||
}
|
||||
|
||||
fn validate_schedule(schedule: &Schedule) -> Result<()> {
|
||||
match schedule {
|
||||
Schedule::Daily => Ok(()),
|
||||
Schedule::Weekly { weekdays } => {
|
||||
if weekdays.is_empty() || weekdays.iter().any(|day| !(1..=7).contains(day)) {
|
||||
Err("weekly weekdays must contain ISO values 1 through 7".to_owned())
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Schedule::Monthly { days, .. } => {
|
||||
if days.is_empty() || days.iter().any(|day| !(1..=31).contains(day)) {
|
||||
Err("monthly days must contain values 1 through 31".to_owned())
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn schedule_matches(schedule: &Schedule, date: NaiveDate) -> Result<bool> {
|
||||
match schedule {
|
||||
Schedule::Daily => Ok(true),
|
||||
Schedule::Weekly { weekdays } => {
|
||||
Ok(weekdays.contains(&date.weekday().number_from_monday()))
|
||||
}
|
||||
Schedule::Monthly {
|
||||
days,
|
||||
clamp_to_last_day,
|
||||
} => {
|
||||
let last_day = last_day_of_month(date)?;
|
||||
Ok(days.iter().any(|requested| {
|
||||
date.day() == *requested
|
||||
|| (*clamp_to_last_day && *requested > last_day && date.day() == last_day)
|
||||
}))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn last_day_of_month(date: NaiveDate) -> Result<u32> {
|
||||
let (year, month) = if date.month() == 12 {
|
||||
(date.year() + 1, 1)
|
||||
} else {
|
||||
(date.year(), date.month() + 1)
|
||||
};
|
||||
let first_next = NaiveDate::from_ymd_opt(year, month, 1)
|
||||
.ok_or_else(|| "invalid month boundary".to_owned())?;
|
||||
let last = first_next
|
||||
.pred_opt()
|
||||
.ok_or_else(|| "invalid month boundary".to_owned())?;
|
||||
Ok(last.day())
|
||||
}
|
||||
|
||||
fn db_error(error: postgres::Error) -> String {
|
||||
format!("database error: {error}")
|
||||
}
|
||||
|
||||
fn json_error(error: serde_json::Error) -> String {
|
||||
format!("JSON error: {error}")
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn weekly_schedule_uses_iso_weekdays() {
|
||||
let monday = NaiveDate::from_ymd_opt(2026, 10, 19).unwrap();
|
||||
assert!(schedule_matches(
|
||||
&Schedule::Weekly {
|
||||
weekdays: vec![1, 3],
|
||||
},
|
||||
monday
|
||||
)
|
||||
.unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn monthly_day_clamps_to_end_of_short_month() {
|
||||
let february_end = NaiveDate::from_ymd_opt(2027, 2, 28).unwrap();
|
||||
assert!(schedule_matches(
|
||||
&Schedule::Monthly {
|
||||
days: vec![31],
|
||||
clamp_to_last_day: true,
|
||||
},
|
||||
february_end,
|
||||
)
|
||||
.unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn monthly_day_does_not_clamp_when_disabled() {
|
||||
let february_end = NaiveDate::from_ymd_opt(2027, 2, 28).unwrap();
|
||||
assert!(!schedule_matches(
|
||||
&Schedule::Monthly {
|
||||
days: vec![31],
|
||||
clamp_to_last_day: false,
|
||||
},
|
||||
february_end,
|
||||
)
|
||||
.unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn validates_encryption_device_fields() {
|
||||
assert!(validate_device("Laptop", "age1example").is_ok());
|
||||
assert_eq!(
|
||||
validate_device("", "age1example").unwrap_err(),
|
||||
"device name must not be empty"
|
||||
);
|
||||
assert!(validate_device("Laptop", "age1example\nother").is_err());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
use serde_json::{json, Value};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Telegram {
|
||||
bot_token: String,
|
||||
chat_id: String,
|
||||
}
|
||||
|
||||
impl Telegram {
|
||||
pub fn from_env() -> Option<Self> {
|
||||
let bot_token = std::env::var("ROUTINE_TELEGRAM_BOT_TOKEN").ok()?;
|
||||
let chat_id = std::env::var("ROUTINE_TELEGRAM_CHAT_ID").ok()?;
|
||||
Some(Self { bot_token, chat_id })
|
||||
}
|
||||
|
||||
pub fn send_message(&self, text: &str) -> Result<(), String> {
|
||||
let url = format!("https://api.telegram.org/bot{}/sendMessage", self.bot_token);
|
||||
let payload = json!({
|
||||
"chat_id": self.chat_id,
|
||||
"text": text,
|
||||
})
|
||||
.to_string();
|
||||
let response = minreq::post(&url)
|
||||
.with_header("Content-Type", "application/json")
|
||||
.with_body(payload)
|
||||
.send()
|
||||
.map_err(|_| "Telegram request failed".to_owned())?;
|
||||
let body: Value = serde_json::from_str(
|
||||
response
|
||||
.as_str()
|
||||
.map_err(|_| "Telegram returned a non-UTF-8 response".to_owned())?,
|
||||
)
|
||||
.map_err(|_| "Telegram returned invalid JSON".to_owned())?;
|
||||
if body.get("ok").and_then(Value::as_bool) == Some(true) {
|
||||
Ok(())
|
||||
} else {
|
||||
Err("Telegram rejected the message".to_owned())
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+943
@@ -0,0 +1,943 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "allocator-api2"
|
||||
version = "0.2.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
|
||||
|
||||
[[package]]
|
||||
name = "android-tzdata"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
|
||||
|
||||
[[package]]
|
||||
name = "android_system_properties"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.13.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.20.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
|
||||
|
||||
[[package]]
|
||||
name = "cassowary"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53"
|
||||
|
||||
[[package]]
|
||||
name = "castaway"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a"
|
||||
dependencies = [
|
||||
"rustversion",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6651c9ed80effdc7db0ff72512157f901af5e3549e341e24b1dd4887d836d838"
|
||||
dependencies = [
|
||||
"find-msvc-tools",
|
||||
"shlex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
|
||||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.38"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401"
|
||||
dependencies = [
|
||||
"android-tzdata",
|
||||
"iana-time-zone",
|
||||
"num-traits",
|
||||
"serde",
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "compact_str"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7fd622ebbb56a5b2ccb651b32b911cdeb2a9b4b11776b2473bf26a26a286244e"
|
||||
dependencies = [
|
||||
"castaway",
|
||||
"cfg-if",
|
||||
"itoa",
|
||||
"rustversion",
|
||||
"ryu",
|
||||
"static_assertions",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation-sys"
|
||||
version = "0.8.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
|
||||
|
||||
[[package]]
|
||||
name = "crossterm"
|
||||
version = "0.28.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"crossterm_winapi",
|
||||
"mio",
|
||||
"parking_lot",
|
||||
"rustix",
|
||||
"signal-hook",
|
||||
"signal-hook-mio",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossterm_winapi"
|
||||
version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be"
|
||||
|
||||
[[package]]
|
||||
name = "equivalent"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826"
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.3.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "find-msvc-tools"
|
||||
version = "0.1.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aedcfb3409746eddb02b9e19ebda1c3394f759a152e48ee875a0844d1b955484"
|
||||
|
||||
[[package]]
|
||||
name = "foldhash"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
|
||||
|
||||
[[package]]
|
||||
name = "futures-core"
|
||||
version = "0.3.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e"
|
||||
|
||||
[[package]]
|
||||
name = "futures-task"
|
||||
version = "0.3.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd"
|
||||
|
||||
[[package]]
|
||||
name = "futures-util"
|
||||
version = "0.3.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-task",
|
||||
"pin-project-lite",
|
||||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"wasi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.15.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
|
||||
dependencies = [
|
||||
"allocator-api2",
|
||||
"equivalent",
|
||||
"foldhash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||
|
||||
[[package]]
|
||||
name = "iana-time-zone"
|
||||
version = "0.1.65"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470"
|
||||
dependencies = [
|
||||
"android_system_properties",
|
||||
"core-foundation-sys",
|
||||
"iana-time-zone-haiku",
|
||||
"js-sys",
|
||||
"log",
|
||||
"wasm-bindgen",
|
||||
"windows-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iana-time-zone-haiku"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indoc"
|
||||
version = "2.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a37b2691796cffeb8a8cd305ac66e65841559f147f4e63231d0eafa4db5384d1"
|
||||
dependencies = [
|
||||
"rustversion",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "instability"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b23a0c8dfe501baac4adf6ebbfa6eddf8f0c07f56b058cc1288017e32397846c"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn 2.0.119",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
|
||||
dependencies = [
|
||||
"either",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.106"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"futures-util",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.190"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce5d3ddc6d3fa000eb1536d85e147bfe31aacaba692ed6a876f95cb7c855be78"
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.4.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965"
|
||||
dependencies = [
|
||||
"scopeguard",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6"
|
||||
|
||||
[[package]]
|
||||
name = "lru"
|
||||
version = "0.12.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38"
|
||||
dependencies = [
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
|
||||
|
||||
[[package]]
|
||||
name = "minreq"
|
||||
version = "2.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "763d142cdff44aaadd9268bebddb156ef6c65a0e13486bb81673cf2d8739f9b0"
|
||||
dependencies = [
|
||||
"log",
|
||||
"once_cell",
|
||||
"rustls",
|
||||
"rustls-webpki",
|
||||
"webpki-roots",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "1.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1788edb87fdc09c7e26304471e2f5be8cdefb1b6930d6e3985fc02ff53bf86ee"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
"wasi",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.21.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.12.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"
|
||||
dependencies = [
|
||||
"lock_api",
|
||||
"parking_lot_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot_core"
|
||||
version = "0.9.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"smallvec",
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "paste"
|
||||
version = "1.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.107"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.47"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ratatui"
|
||||
version = "0.29.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eabd94c2f37801c20583fc49dd5cd6b0ba68c716787c2dd6ed18571e1e63117b"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cassowary",
|
||||
"compact_str",
|
||||
"crossterm",
|
||||
"indoc",
|
||||
"instability",
|
||||
"itertools",
|
||||
"lru",
|
||||
"paste",
|
||||
"strum",
|
||||
"unicode-segmentation",
|
||||
"unicode-truncate",
|
||||
"unicode-width 0.2.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.5.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ring"
|
||||
version = "0.17.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"cfg-if",
|
||||
"getrandom",
|
||||
"libc",
|
||||
"untrusted",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "routine-tui"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"crossterm",
|
||||
"instability",
|
||||
"minreq",
|
||||
"ratatui",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"unicode-segmentation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.38.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls"
|
||||
version = "0.21.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e"
|
||||
dependencies = [
|
||||
"log",
|
||||
"ring",
|
||||
"rustls-webpki",
|
||||
"sct",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls-webpki"
|
||||
version = "0.101.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765"
|
||||
dependencies = [
|
||||
"ring",
|
||||
"untrusted",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustversion"
|
||||
version = "1.0.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f"
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||
|
||||
[[package]]
|
||||
name = "sct"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414"
|
||||
dependencies = [
|
||||
"ring",
|
||||
"untrusted",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.210"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.210"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.119",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.128"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"memchr",
|
||||
"ryu",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "shlex"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
|
||||
|
||||
[[package]]
|
||||
name = "signal-hook"
|
||||
version = "0.3.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d881a16cf4426aa584979d30bd82cb33429027e42122b169753d6ef1085ed6e2"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"signal-hook-registry",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "signal-hook-mio"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b75a19a7a740b25bc7944bdee6172368f988763b744e3d4dfe753f6b4ece40cc"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"mio",
|
||||
"signal-hook",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "signal-hook-registry"
|
||||
version = "1.4.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b"
|
||||
dependencies = [
|
||||
"errno",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "slab"
|
||||
version = "0.4.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.16.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b3dc8af474f516a851ff4bd12db780f948b9250ad37211e4eec0bccea54e01b"
|
||||
|
||||
[[package]]
|
||||
name = "static_assertions"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||
|
||||
[[package]]
|
||||
name = "strum"
|
||||
version = "0.26.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06"
|
||||
dependencies = [
|
||||
"strum_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strum_macros"
|
||||
version = "0.26.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rustversion",
|
||||
"syn 2.0.119",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.119"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "3.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-segmentation"
|
||||
version = "1.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-truncate"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b3644627a5af5fa321c95b9b235a72fd24cd29c648c2c379431e6628655627bf"
|
||||
dependencies = [
|
||||
"itertools",
|
||||
"unicode-segmentation",
|
||||
"unicode-width 0.1.14",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.1.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd"
|
||||
|
||||
[[package]]
|
||||
name = "untrusted"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.11.1+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.129"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
"rustversion",
|
||||
"wasm-bindgen-macro",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.129"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.129"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 3.0.9",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.129"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webpki-roots"
|
||||
version = "0.25.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu",
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "windows-core"
|
||||
version = "0.62.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"
|
||||
dependencies = [
|
||||
"windows-implement",
|
||||
"windows-interface",
|
||||
"windows-link",
|
||||
"windows-result",
|
||||
"windows-strings",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-implement"
|
||||
version = "0.60.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.119",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-interface"
|
||||
version = "0.59.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.119",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-link"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
||||
|
||||
[[package]]
|
||||
name = "windows-result"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-strings"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.59.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.61.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_gnullvm",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user