Author SHA1 Message Date
faumaray f78004e822 Release: use independent component repositories
Container CI / release-build (push) Successful in 16m22s
Nightly release / publish-nightly (push) Successful in 16m6s
2026-07-28 21:24:30 +03:00
faumaray 8c69efc56f FIX: update VoidTeamspeak rev and framepointer 2026-07-27 19:26:03 +03:00
faumaray 870a803bd2 Release: change api version
Container CI / release-build (push) Successful in 33m59s
Signed release / publish (push) Successful in 34m1s
Nightly release / publish-nightly (push) Successful in 16m4s
2026-07-26 18:11:44 +03:00
faumaray a2c6dd4c2c Runtime: reset stale Core baseline on upgrade 2026-07-26 18:11:28 +03:00
faumaray fb8fb69532 Release: fix portable runtime and updater
Container CI / release-build (push) Successful in 34m0s
Signed release / publish (push) Successful in 34m10s
2026-07-26 16:48:53 +03:00
49 changed files with 1185 additions and 115 deletions

No files matched your search

+34 -6
View File
@@ -47,7 +47,7 @@ Never work around a rotation by disabling strict host-key checking.
The Docker-capable runner executes only protected `main` pushes, manual runs, The Docker-capable runner executes only protected `main` pushes, manual runs,
scheduled nightlies, and signed release tags. The container CI workflow does scheduled nightlies, and signed release tags. The container CI workflow does
not run for pull requests because contributor-controlled scripts must not not run for pull requests because contributor-controlled scripts must not
receive a privileged Docker socket or the private-submodule checkout key. If receive a privileged Docker socket or release checkout credentials. If
pre-merge CI is required, register a separate ephemeral `echoion-pr` runner pre-merge CI is required, register a separate ephemeral `echoion-pr` runner
without release secrets or host-level Docker access and give it a dedicated without release secrets or host-level Docker access and give it a dedicated
workflow. A global runner such as the default installation shown in Gitea must workflow. A global runner such as the default installation shown in Gitea must
@@ -58,14 +58,42 @@ Enable Actions and add these repository secrets:
| Secret | Purpose | | Secret | Purpose |
| --- | --- | | --- | --- |
| `RELEASE_CHECKOUT_SSH_KEY` | Read-only deploy key that can clone every private nested repository in `.gitmodules`. | | `RELEASE_CHECKOUT_SSH_KEY` | Read-only key used for the root checkout. |
| `RELEASE_BOT_TOKEN` | PAT owned by a dedicated bot, limited to writing releases, tags, and the `release-feed` branch in this repository. | | `RELEASE_BOT_TOKEN` | PAT owned by a dedicated bot. It needs read access to the component repositories plus release/tag and `release-feed` write access in this repository. |
| `RELEASE_TAG_ALLOWED_SIGNERS` | Complete OpenSSH `allowed_signers` lines for maintainers allowed to publish `v*` tags. | | `RELEASE_TAG_ALLOWED_SIGNERS` | Complete OpenSSH `allowed_signers` lines for maintainers allowed to publish `v*` tags. |
| `RELEASE_FEED_ED25519_PRIVATE_KEY` | PEM private key matching `release-keys/echoion-release-2026-07.pub.pem`. Preserve its newlines. | | `RELEASE_FEED_ED25519_PRIVATE_KEY` | PEM private key matching `release-keys/echoion-release-2026-07.pub.pem`. Preserve its newlines. |
The release PAT must not be shared with checkout of nested repositories. The Component checkouts use the release PAT with `persist-credentials: false`, so
feed signing key must not be stored in Git, runner images, Actions variables, the credential is removed before repository scripts run. The feed signing key
or release assets. must not be stored in Git, runner images, Actions variables, or release assets.
## Independent component repositories
Echoion does not use Git submodules. `components.lock.json` is the immutable
checkout manifest for `EchoionApi`, `EchoionCore`, and `EchoionDesktop`. CMake
uses a component already present beside the root checkout; otherwise it fetches
the locked revision. All three Gitea workflows check out those revisions as
ordinary repositories before entering Docker.
For a new developer checkout:
```bash
python3 scripts/sync-components.py
```
After changing a component, commit and push that component first, then refresh
and commit the root lock:
```bash
python3 scripts/sync-components.py --record
git add components.lock.json
```
`--record` refuses dirty component repositories, so a lock can never point at
uncommitted source. `--update` moves existing clean component checkouts to the
locked revisions. Product version changes are separate: edit only
`project(Echoion VERSION ...)` in root `CMakeLists.txt`; orchestrated component
builds and release overrides inherit that value.
Create an orphan `release-feed` branch containing a tracked `feeds/` Create an orphan `release-feed` branch containing a tracked `feeds/`
directory, then protect it so only the release bot can push. Protect the `v*` directory, then protect it so only the release bot can push. Protect the `v*`
+53 -2
View File
@@ -22,17 +22,68 @@ jobs:
docker version docker version
docker info docker info
- name: Check out source and nested repositories - name: Check out source
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262 uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with: with:
fetch-depth: 0 fetch-depth: 0
submodules: recursive
ssh-key: ${{ secrets.RELEASE_CHECKOUT_SSH_KEY }} ssh-key: ${{ secrets.RELEASE_CHECKOUT_SSH_KEY }}
ssh-user: gitea ssh-user: gitea
ssh-known-hosts: >- ssh-known-hosts: >-
git.faumaray.ru ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCzZEz9JLrzk6oLiloSbueAN28vYL58Y/dTHBgRuBMMib9IJ1aDJShhr3kwC9sfOT0AzK0uwcMAqCAIkwJwttde8dIg0Mee0cmB/1JkoqFF4X3MUGD1r3nk8SSZNhIiPqo16hDF9Hf3FkovztIlBVntkyP9Iy9hYfP818Tiq3yRXROGdHjR7IfY4jR2QGfGrd/RtvPGExVqusxidy141240A8aRAwMFUqFdEvmXWjizrtCUqcrL/k1GEh0yJzbCdNOVUI6OuWd8tPluSBvmmeoNpKnCSl4Mkg36HObbOyrsme0asZqjcj0od65WYWApMPN0pUqhNu2CP83Nfor2VFwkdPRwe7cAZ0OD/8wyT6Hz5q1wWgf82y4tYDoDRYsd8JU86eebkJ07T5nCrEeC4Sj+qT4S5xv/kECAhxyP4QGnunORnY2fYsdNGzpPvbMN7gHe9UcIcQdOIgV3wrR1qpMVNcd8AEC2A3TRv/jzMCHSjmGGpgiy1Db2CZAjp5+PcjNmjvoPNN0NiA9X4rIVSeTfflWnDRmeNRJeZa73StjpU17EcAf97COUQPGWJQDgpJqINSpYU50fuaLBfzKnIRuiHjKQmyKe/zgRSmulnYFYM3AJfn8Ykg2VvkUQGvCt1+fqYiUa1iVFuwPP3ZigYF1mOZRpPnos5kaNmlB01q2sZw== git.faumaray.ru ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCzZEz9JLrzk6oLiloSbueAN28vYL58Y/dTHBgRuBMMib9IJ1aDJShhr3kwC9sfOT0AzK0uwcMAqCAIkwJwttde8dIg0Mee0cmB/1JkoqFF4X3MUGD1r3nk8SSZNhIiPqo16hDF9Hf3FkovztIlBVntkyP9Iy9hYfP818Tiq3yRXROGdHjR7IfY4jR2QGfGrd/RtvPGExVqusxidy141240A8aRAwMFUqFdEvmXWjizrtCUqcrL/k1GEh0yJzbCdNOVUI6OuWd8tPluSBvmmeoNpKnCSl4Mkg36HObbOyrsme0asZqjcj0od65WYWApMPN0pUqhNu2CP83Nfor2VFwkdPRwe7cAZ0OD/8wyT6Hz5q1wWgf82y4tYDoDRYsd8JU86eebkJ07T5nCrEeC4Sj+qT4S5xv/kECAhxyP4QGnunORnY2fYsdNGzpPvbMN7gHe9UcIcQdOIgV3wrR1qpMVNcd8AEC2A3TRv/jzMCHSjmGGpgiy1Db2CZAjp5+PcjNmjvoPNN0NiA9X4rIVSeTfflWnDRmeNRJeZa73StjpU17EcAf97COUQPGWJQDgpJqINSpYU50fuaLBfzKnIRuiHjKQmyKe/zgRSmulnYFYM3AJfn8Ykg2VvkUQGvCt1+fqYiUa1iVFuwPP3ZigYF1mOZRpPnos5kaNmlB01q2sZw==
persist-credentials: false persist-credentials: false
- name: Read locked component repositories
id: components
shell: bash
run: |
set -euo pipefail
python3 - "$GITHUB_OUTPUT" <<'PY'
import json
import pathlib
import sys
lock = json.loads(pathlib.Path("components.lock.json").read_text())
with pathlib.Path(sys.argv[1]).open("a") as output:
for component, key in (
("EchoionApi", "api"),
("EchoionCore", "core"),
("EchoionDesktop", "desktop"),
):
entry = lock["components"][component]
print(f"{key}_repository={entry['repository']}", file=output)
print(f"{key}_revision={entry['revision']}", file=output)
PY
- name: Check out EchoionApi
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
repository: ${{ steps.components.outputs.api_repository }}
ref: ${{ steps.components.outputs.api_revision }}
path: EchoionApi
fetch-depth: 1
token: ${{ secrets.RELEASE_BOT_TOKEN }}
persist-credentials: false
- name: Check out EchoionCore
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
repository: ${{ steps.components.outputs.core_repository }}
ref: ${{ steps.components.outputs.core_revision }}
path: EchoionCore
fetch-depth: 1
token: ${{ secrets.RELEASE_BOT_TOKEN }}
persist-credentials: false
- name: Check out EchoionDesktop
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
repository: ${{ steps.components.outputs.desktop_repository }}
ref: ${{ steps.components.outputs.desktop_revision }}
path: EchoionDesktop
fetch-depth: 1
token: ${{ secrets.RELEASE_BOT_TOKEN }}
persist-credentials: false
- name: Build, test, and package without starting Echoion - name: Build, test, and package without starting Echoion
env: env:
CI_VERSION: 0.0.0-ci.${{ gitea.run_number }}.${{ gitea.run_attempt }} CI_VERSION: 0.0.0-ci.${{ gitea.run_number }}.${{ gitea.run_attempt }}
+59 -2
View File
@@ -21,18 +21,69 @@ jobs:
docker version docker version
docker info docker info
- name: Check out main and nested repositories - name: Check out main
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262 uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with: with:
ref: main ref: main
fetch-depth: 0 fetch-depth: 0
submodules: recursive
ssh-key: ${{ secrets.RELEASE_CHECKOUT_SSH_KEY }} ssh-key: ${{ secrets.RELEASE_CHECKOUT_SSH_KEY }}
ssh-user: gitea ssh-user: gitea
ssh-known-hosts: >- ssh-known-hosts: >-
git.faumaray.ru ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCzZEz9JLrzk6oLiloSbueAN28vYL58Y/dTHBgRuBMMib9IJ1aDJShhr3kwC9sfOT0AzK0uwcMAqCAIkwJwttde8dIg0Mee0cmB/1JkoqFF4X3MUGD1r3nk8SSZNhIiPqo16hDF9Hf3FkovztIlBVntkyP9Iy9hYfP818Tiq3yRXROGdHjR7IfY4jR2QGfGrd/RtvPGExVqusxidy141240A8aRAwMFUqFdEvmXWjizrtCUqcrL/k1GEh0yJzbCdNOVUI6OuWd8tPluSBvmmeoNpKnCSl4Mkg36HObbOyrsme0asZqjcj0od65WYWApMPN0pUqhNu2CP83Nfor2VFwkdPRwe7cAZ0OD/8wyT6Hz5q1wWgf82y4tYDoDRYsd8JU86eebkJ07T5nCrEeC4Sj+qT4S5xv/kECAhxyP4QGnunORnY2fYsdNGzpPvbMN7gHe9UcIcQdOIgV3wrR1qpMVNcd8AEC2A3TRv/jzMCHSjmGGpgiy1Db2CZAjp5+PcjNmjvoPNN0NiA9X4rIVSeTfflWnDRmeNRJeZa73StjpU17EcAf97COUQPGWJQDgpJqINSpYU50fuaLBfzKnIRuiHjKQmyKe/zgRSmulnYFYM3AJfn8Ykg2VvkUQGvCt1+fqYiUa1iVFuwPP3ZigYF1mOZRpPnos5kaNmlB01q2sZw== git.faumaray.ru ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCzZEz9JLrzk6oLiloSbueAN28vYL58Y/dTHBgRuBMMib9IJ1aDJShhr3kwC9sfOT0AzK0uwcMAqCAIkwJwttde8dIg0Mee0cmB/1JkoqFF4X3MUGD1r3nk8SSZNhIiPqo16hDF9Hf3FkovztIlBVntkyP9Iy9hYfP818Tiq3yRXROGdHjR7IfY4jR2QGfGrd/RtvPGExVqusxidy141240A8aRAwMFUqFdEvmXWjizrtCUqcrL/k1GEh0yJzbCdNOVUI6OuWd8tPluSBvmmeoNpKnCSl4Mkg36HObbOyrsme0asZqjcj0od65WYWApMPN0pUqhNu2CP83Nfor2VFwkdPRwe7cAZ0OD/8wyT6Hz5q1wWgf82y4tYDoDRYsd8JU86eebkJ07T5nCrEeC4Sj+qT4S5xv/kECAhxyP4QGnunORnY2fYsdNGzpPvbMN7gHe9UcIcQdOIgV3wrR1qpMVNcd8AEC2A3TRv/jzMCHSjmGGpgiy1Db2CZAjp5+PcjNmjvoPNN0NiA9X4rIVSeTfflWnDRmeNRJeZa73StjpU17EcAf97COUQPGWJQDgpJqINSpYU50fuaLBfzKnIRuiHjKQmyKe/zgRSmulnYFYM3AJfn8Ykg2VvkUQGvCt1+fqYiUa1iVFuwPP3ZigYF1mOZRpPnos5kaNmlB01q2sZw==
persist-credentials: false persist-credentials: false
- name: Read locked component repositories
id: components
shell: bash
run: |
set -euo pipefail
python3 - "$GITHUB_OUTPUT" <<'PY'
import json
import pathlib
import sys
lock = json.loads(pathlib.Path("components.lock.json").read_text())
with pathlib.Path(sys.argv[1]).open("a") as output:
for component, key in (
("EchoionApi", "api"),
("EchoionCore", "core"),
("EchoionDesktop", "desktop"),
):
entry = lock["components"][component]
print(f"{key}_repository={entry['repository']}", file=output)
print(f"{key}_revision={entry['revision']}", file=output)
PY
- name: Check out EchoionApi
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
repository: ${{ steps.components.outputs.api_repository }}
ref: ${{ steps.components.outputs.api_revision }}
path: EchoionApi
fetch-depth: 1
token: ${{ secrets.RELEASE_BOT_TOKEN }}
persist-credentials: false
- name: Check out EchoionCore
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
repository: ${{ steps.components.outputs.core_repository }}
ref: ${{ steps.components.outputs.core_revision }}
path: EchoionCore
fetch-depth: 1
token: ${{ secrets.RELEASE_BOT_TOKEN }}
persist-credentials: false
- name: Check out EchoionDesktop
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
repository: ${{ steps.components.outputs.desktop_repository }}
ref: ${{ steps.components.outputs.desktop_revision }}
path: EchoionDesktop
fetch-depth: 1
token: ${{ secrets.RELEASE_BOT_TOKEN }}
persist-credentials: false
- name: Derive the nightly identity - name: Derive the nightly identity
shell: bash shell: bash
env: env:
@@ -160,6 +211,12 @@ jobs:
python3 scripts/aggregate_update_feed.py \ python3 scripts/aggregate_update_feed.py \
--new-payload \ --new-payload \
"dist/echoion-${RELEASE_VERSION}-linux-x86_64.update-payload.json" \ "dist/echoion-${RELEASE_VERSION}-linux-x86_64.update-payload.json" \
--new-payload \
"dist/echoion-core-${RELEASE_VERSION}-linux-x86_64.update-payload.json" \
--new-payload \
"dist/url-shortener-internal-${RELEASE_VERSION}-linux-x86_64.update-payload.json" \
--new-payload \
"dist/url-shortener-external-${RELEASE_VERSION}-linux-x86_64.update-payload.json" \
"${existing[@]}" \ "${existing[@]}" \
--public-key \ --public-key \
.gitea/release-keys/echoion-release-2026-07.pub.pem \ .gitea/release-keys/echoion-release-2026-07.pub.pem \
+58 -1
View File
@@ -26,13 +26,64 @@ jobs:
with: with:
ref: ${{ gitea.ref }} ref: ${{ gitea.ref }}
fetch-depth: 0 fetch-depth: 0
submodules: recursive
ssh-key: ${{ secrets.RELEASE_CHECKOUT_SSH_KEY }} ssh-key: ${{ secrets.RELEASE_CHECKOUT_SSH_KEY }}
ssh-user: gitea ssh-user: gitea
ssh-known-hosts: >- ssh-known-hosts: >-
git.faumaray.ru ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCzZEz9JLrzk6oLiloSbueAN28vYL58Y/dTHBgRuBMMib9IJ1aDJShhr3kwC9sfOT0AzK0uwcMAqCAIkwJwttde8dIg0Mee0cmB/1JkoqFF4X3MUGD1r3nk8SSZNhIiPqo16hDF9Hf3FkovztIlBVntkyP9Iy9hYfP818Tiq3yRXROGdHjR7IfY4jR2QGfGrd/RtvPGExVqusxidy141240A8aRAwMFUqFdEvmXWjizrtCUqcrL/k1GEh0yJzbCdNOVUI6OuWd8tPluSBvmmeoNpKnCSl4Mkg36HObbOyrsme0asZqjcj0od65WYWApMPN0pUqhNu2CP83Nfor2VFwkdPRwe7cAZ0OD/8wyT6Hz5q1wWgf82y4tYDoDRYsd8JU86eebkJ07T5nCrEeC4Sj+qT4S5xv/kECAhxyP4QGnunORnY2fYsdNGzpPvbMN7gHe9UcIcQdOIgV3wrR1qpMVNcd8AEC2A3TRv/jzMCHSjmGGpgiy1Db2CZAjp5+PcjNmjvoPNN0NiA9X4rIVSeTfflWnDRmeNRJeZa73StjpU17EcAf97COUQPGWJQDgpJqINSpYU50fuaLBfzKnIRuiHjKQmyKe/zgRSmulnYFYM3AJfn8Ykg2VvkUQGvCt1+fqYiUa1iVFuwPP3ZigYF1mOZRpPnos5kaNmlB01q2sZw== git.faumaray.ru ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCzZEz9JLrzk6oLiloSbueAN28vYL58Y/dTHBgRuBMMib9IJ1aDJShhr3kwC9sfOT0AzK0uwcMAqCAIkwJwttde8dIg0Mee0cmB/1JkoqFF4X3MUGD1r3nk8SSZNhIiPqo16hDF9Hf3FkovztIlBVntkyP9Iy9hYfP818Tiq3yRXROGdHjR7IfY4jR2QGfGrd/RtvPGExVqusxidy141240A8aRAwMFUqFdEvmXWjizrtCUqcrL/k1GEh0yJzbCdNOVUI6OuWd8tPluSBvmmeoNpKnCSl4Mkg36HObbOyrsme0asZqjcj0od65WYWApMPN0pUqhNu2CP83Nfor2VFwkdPRwe7cAZ0OD/8wyT6Hz5q1wWgf82y4tYDoDRYsd8JU86eebkJ07T5nCrEeC4Sj+qT4S5xv/kECAhxyP4QGnunORnY2fYsdNGzpPvbMN7gHe9UcIcQdOIgV3wrR1qpMVNcd8AEC2A3TRv/jzMCHSjmGGpgiy1Db2CZAjp5+PcjNmjvoPNN0NiA9X4rIVSeTfflWnDRmeNRJeZa73StjpU17EcAf97COUQPGWJQDgpJqINSpYU50fuaLBfzKnIRuiHjKQmyKe/zgRSmulnYFYM3AJfn8Ykg2VvkUQGvCt1+fqYiUa1iVFuwPP3ZigYF1mOZRpPnos5kaNmlB01q2sZw==
persist-credentials: false persist-credentials: false
- name: Read locked component repositories
id: components
shell: bash
run: |
set -euo pipefail
python3 - "$GITHUB_OUTPUT" <<'PY'
import json
import pathlib
import sys
lock = json.loads(pathlib.Path("components.lock.json").read_text())
with pathlib.Path(sys.argv[1]).open("a") as output:
for component, key in (
("EchoionApi", "api"),
("EchoionCore", "core"),
("EchoionDesktop", "desktop"),
):
entry = lock["components"][component]
print(f"{key}_repository={entry['repository']}", file=output)
print(f"{key}_revision={entry['revision']}", file=output)
PY
- name: Check out EchoionApi
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
repository: ${{ steps.components.outputs.api_repository }}
ref: ${{ steps.components.outputs.api_revision }}
path: EchoionApi
fetch-depth: 1
token: ${{ secrets.RELEASE_BOT_TOKEN }}
persist-credentials: false
- name: Check out EchoionCore
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
repository: ${{ steps.components.outputs.core_repository }}
ref: ${{ steps.components.outputs.core_revision }}
path: EchoionCore
fetch-depth: 1
token: ${{ secrets.RELEASE_BOT_TOKEN }}
persist-credentials: false
- name: Check out EchoionDesktop
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
repository: ${{ steps.components.outputs.desktop_repository }}
ref: ${{ steps.components.outputs.desktop_revision }}
path: EchoionDesktop
fetch-depth: 1
token: ${{ secrets.RELEASE_BOT_TOKEN }}
persist-credentials: false
- name: Verify protected annotated SSH tag - name: Verify protected annotated SSH tag
shell: bash shell: bash
env: env:
@@ -168,6 +219,12 @@ jobs:
python3 scripts/aggregate_update_feed.py \ python3 scripts/aggregate_update_feed.py \
--new-payload \ --new-payload \
"dist/echoion-${RELEASE_VERSION}-linux-x86_64.update-payload.json" \ "dist/echoion-${RELEASE_VERSION}-linux-x86_64.update-payload.json" \
--new-payload \
"dist/echoion-core-${RELEASE_VERSION}-linux-x86_64.update-payload.json" \
--new-payload \
"dist/url-shortener-internal-${RELEASE_VERSION}-linux-x86_64.update-payload.json" \
--new-payload \
"dist/url-shortener-external-${RELEASE_VERSION}-linux-x86_64.update-payload.json" \
"${existing[@]}" \ "${existing[@]}" \
--public-key \ --public-key \
.gitea/release-keys/echoion-release-2026-07.pub.pem \ .gitea/release-keys/echoion-release-2026-07.pub.pem \
+6
View File
@@ -10,3 +10,9 @@ __pycache__/
AGENTS.md AGENTS.md
.vscode .vscode
.opencode/ .opencode/
# Independently cloned component repositories. Their immutable release
# revisions are recorded in components.lock.json.
/EchoionApi/
/EchoionCore/
/EchoionDesktop/
-9
View File
@@ -1,9 +0,0 @@
[submodule "EchoionApi"]
path = EchoionApi
url = ssh://gitea@git.faumaray.ru/void/echoionapi.git
[submodule "EchoionCore"]
path = EchoionCore
url = ssh://gitea@git.faumaray.ru/void/echoioncore.git
[submodule "EchoionDesktop"]
path = EchoionDesktop
url = ssh://gitea@git.faumaray.ru/void/echoiondesktop.git
+20 -3
View File
@@ -4,6 +4,20 @@ project(Echoion VERSION 1.0.7 LANGUAGES CXX)
include(GNUInstallDirs) include(GNUInstallDirs)
include(cmake/DependencyLock.cmake) include(cmake/DependencyLock.cmake)
# The root product version is the only manually edited version. Every
# component project consumes this value when orchestrated by Echoion; their
# standalone fallback is intentionally 0.0.0 and is never used for a product
# release.
if(DEFINED ECHOION_RELEASE_VERSION AND
NOT ECHOION_RELEASE_VERSION STREQUAL "")
set(ECHOION_COMPONENT_VERSION "${ECHOION_RELEASE_VERSION}")
string(REGEX REPLACE "[-+].*$" ""
ECHOION_PRODUCT_VERSION "${ECHOION_RELEASE_VERSION}")
else()
set(ECHOION_PRODUCT_VERSION "${PROJECT_VERSION}")
set(ECHOION_COMPONENT_VERSION "${PROJECT_VERSION}")
endif()
# Default to a Release build when the developer/CI did not pick a config. # Default to a Release build when the developer/CI did not pick a config.
# Without this, single-config generators leave CMAKE_BUILD_TYPE empty and GCC # Without this, single-config generators leave CMAKE_BUILD_TYPE empty and GCC
# falls back to -O0, so "production" builds shipped unoptimised. Set this before # falls back to -O0, so "production" builds shipped unoptimised. Set this before
@@ -82,6 +96,7 @@ file(
EXPECTED_HASH SHA256=78ba32abdf798bc616bab7c73aac32a17bbd7b06ad9e26a6add69de8f3ae4791 EXPECTED_HASH SHA256=78ba32abdf798bc616bab7c73aac32a17bbd7b06ad9e26a6add69de8f3ae4791
) )
include(${CMAKE_CURRENT_BINARY_DIR}/cmake/CPM.cmake) include(${CMAKE_CURRENT_BINARY_DIR}/cmake/CPM.cmake)
include(cmake/EchoionComponents.cmake)
# Include PackageProject.cmake # Include PackageProject.cmake
CPMAddPackage( CPMAddPackage(
@@ -131,6 +146,8 @@ set(CXX_SCAN_FOR_MODULES OFF)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16) if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16)
# Guard to C++ only — vendored C dependencies (quickjs) must not see it. # Guard to C++ only — vendored C dependencies (quickjs) must not see it.
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-freflection>) add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-freflection>)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fno-omit-frame-pointer>)
endif() endif()
# Link-time optimisation for Release configs only (keeps Debug builds fast). # Link-time optimisation for Release configs only (keeps Debug builds fast).
@@ -181,7 +198,7 @@ find_package(Threads REQUIRED)
# Add subdirectories # Add subdirectories
if(BUILD_API) if(BUILD_API)
add_subdirectory(EchoionApi) echoion_add_component(EchoionApi)
endif() endif()
if(BUILD_FIRST_PARTY_PLUGINS) if(BUILD_FIRST_PARTY_PLUGINS)
@@ -193,7 +210,7 @@ if(BUILD_STANDALONE)
endif() endif()
if(BUILD_CORE) if(BUILD_CORE)
add_subdirectory(EchoionCore) echoion_add_component(EchoionCore)
endif() endif()
# EchoionWeb is added after Core so it can reuse the single Boost header # EchoionWeb is added after Core so it can reuse the single Boost header
@@ -224,7 +241,7 @@ if(BUILD_STANDALONE)
endif() endif()
if(BUILD_DESKTOP) if(BUILD_DESKTOP)
add_subdirectory(EchoionDesktop) echoion_add_component(EchoionDesktop)
endif() endif()
# The release install component is deliberately runtime-only. Nested projects # The release install component is deliberately runtime-only. Nested projects
Submodule EchoionApi deleted from caac928923.
Submodule EchoionCore deleted from 7975f2b38e.
Submodule EchoionDesktop deleted from 2aa44fae9e.
+4 -1
View File
@@ -1,5 +1,8 @@
cmake_minimum_required(VERSION 4.0.0) cmake_minimum_required(VERSION 4.0.0)
project(EchoionHost VERSION 1.0.0 LANGUAGES CXX) if(NOT DEFINED ECHOION_PRODUCT_VERSION)
set(ECHOION_PRODUCT_VERSION 0.0.0)
endif()
project(EchoionHost VERSION "${ECHOION_PRODUCT_VERSION}" LANGUAGES CXX)
add_library(EchoionHost STATIC add_library(EchoionHost STATIC
src/CoreLoader.cpp src/CoreLoader.cpp
+7 -2
View File
@@ -4,7 +4,10 @@
# and implements IPluginInterface with the reusable VoidTeamspeak client. # and implements IPluginInterface with the reusable VoidTeamspeak client.
cmake_minimum_required(VERSION 4.0.0) cmake_minimum_required(VERSION 4.0.0)
project(EchoionStandalone VERSION 1.0.7 LANGUAGES CXX) if(NOT DEFINED ECHOION_PRODUCT_VERSION)
set(ECHOION_PRODUCT_VERSION 0.0.0)
endif()
project(EchoionStandalone VERSION "${ECHOION_PRODUCT_VERSION}" LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 26) set(CMAKE_CXX_STANDARD 26)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -105,7 +108,7 @@ set_target_properties(EchoionStandalone PROPERTIES
install(TARGETS EchoionStandalone RUNTIME DESTINATION bin) install(TARGETS EchoionStandalone RUNTIME DESTINATION bin)
if(BUILD_TESTS) if(BUILD_TESTS AND TARGET EchoionCore)
add_executable(echoion_core_loader_reload_tests add_executable(echoion_core_loader_reload_tests
tests/test_core_loader_reload.cpp) tests/test_core_loader_reload.cpp)
target_link_libraries(echoion_core_loader_reload_tests PRIVATE target_link_libraries(echoion_core_loader_reload_tests PRIVATE
@@ -116,7 +119,9 @@ if(BUILD_TESTS)
add_dependencies(echoion_core_loader_reload_tests EchoionCore) add_dependencies(echoion_core_loader_reload_tests EchoionCore)
add_test(NAME echoion_core_loader_reload_tests add_test(NAME echoion_core_loader_reload_tests
COMMAND echoion_core_loader_reload_tests) COMMAND echoion_core_loader_reload_tests)
endif()
if(BUILD_TESTS)
add_executable(echoion_standalone_message_tests add_executable(echoion_standalone_message_tests
tests/test_message_chunker.cpp tests/test_message_chunker.cpp
src/MessageChunker.cpp src/MessageChunker.cpp
@@ -32,6 +32,9 @@ namespace Echoion::Standalone
const std::filesystem::path& installRoot, const std::filesystem::path& installRoot,
const std::filesystem::path& executableDirectory); const std::filesystem::path& executableDirectory);
[[nodiscard]] std::optional<std::filesystem::path>
bundledCertificateBundle(const std::filesystem::path& installRoot);
[[nodiscard]] std::expected<std::filesystem::path, std::string> [[nodiscard]] std::expected<std::filesystem::path, std::string>
resolveAvatarCacheDirectory( resolveAvatarCacheDirectory(
const std::filesystem::path& configuredDirectory, const std::filesystem::path& configuredDirectory,
@@ -5,10 +5,27 @@
#include <filesystem> #include <filesystem>
#include <functional> #include <functional>
#include <memory> #include <memory>
#include <optional>
#include <string> #include <string>
#include <string_view>
namespace Echoion::Standalone namespace Echoion::Standalone
{ {
struct ManagedCoreStartupSelection {
std::filesystem::path corePath;
std::optional<std::filesystem::path> archivedStore;
bool runtimeBaselineChanged = false;
};
// Installed runtime releases own their bundled Core baseline. A runtime
// version change archives the previous managed store; Core-only updates
// remain active across ordinary restarts of the same runtime.
[[nodiscard]] Api::Result<ManagedCoreStartupSelection>
selectManagedCoreForStartup(
const std::filesystem::path& stateDirectory,
const std::filesystem::path& bundledCore,
std::optional<std::string_view> installedRuntimeVersion);
// Roll back any uncommitted managed-plugin activation before Core loads and // Roll back any uncommitted managed-plugin activation before Core loads and
// discovers plugin `current` links. This must run before PluginHost // discovers plugin `current` links. This must run before PluginHost
// startup. // startup.
@@ -80,4 +97,14 @@ namespace Echoion::Standalone
class Impl; class Impl;
std::unique_ptr<Impl> impl_; std::unique_ptr<Impl> impl_;
}; };
using UpdateControlHandler = std::function<Api::Result<std::string>(
const std::string&, const std::string&)>;
// Keep the service alive for the complete duration of an in-flight host
// control request. StandaloneClientInterface intentionally invokes a copied
// handler outside its mutex, so clearing the registered handler cannot
// cancel a callback which has already started.
[[nodiscard]] UpdateControlHandler
bindUpdateService(std::shared_ptr<UpdateService> service);
} // namespace Echoion::Standalone } // namespace Echoion::Standalone
+17 -1
View File
@@ -120,7 +120,10 @@ namespace Echoion::Standalone
if (std::filesystem::is_regular_file( if (std::filesystem::is_regular_file(
packagedDirectory / "web" / "index.html", error) && packagedDirectory / "web" / "index.html", error) &&
!error) { !error) {
return packagedDirectory; // Installed config paths are rooted at the release prefix (for
// example ./share/echoion/web), so the working directory must be
// the installation root rather than share/echoion itself.
return installRoot;
} }
error.clear(); error.clear();
@@ -132,6 +135,19 @@ namespace Echoion::Standalone
return std::nullopt; return std::nullopt;
} }
std::optional<std::filesystem::path>
bundledCertificateBundle(const std::filesystem::path& installRoot)
{
const auto bundle =
installRoot / "share" / "echoion" / "certs" / "ca-certificates.crt";
std::error_code error;
if (!std::filesystem::is_regular_file(bundle, error) || error ||
std::filesystem::file_size(bundle, error) == 0 || error) {
return std::nullopt;
}
return bundle.lexically_normal();
}
std::expected<std::filesystem::path, std::string> std::expected<std::filesystem::path, std::string>
resolveAvatarCacheDirectory( resolveAvatarCacheDirectory(
const std::filesystem::path& configuredDirectory, const std::filesystem::path& configuredDirectory,
+210
View File
@@ -3162,6 +3162,216 @@ namespace Echoion::Standalone
return impl_->handle(method, requestJson); return impl_->handle(method, requestJson);
} }
UpdateControlHandler bindUpdateService(std::shared_ptr<UpdateService> service)
{
return [service = std::move(service)](
const std::string& method,
const std::string& requestJson) {
return service->handle(method, requestJson);
};
}
Api::Result<ManagedCoreStartupSelection>
selectManagedCoreForStartup(const std::filesystem::path& stateDirectory,
const std::filesystem::path& bundledCore,
const std::optional<std::string_view>
installedRuntimeVersion)
{
const auto components = stateDirectory / "updates" / "components";
const auto storeRoot = components / "core";
const auto markerPath = components / "core-runtime-version";
const auto selectCurrent =
[&]() -> Api::Result<ManagedCoreStartupSelection> {
Void::Update::VersionStore store(storeRoot);
if (auto initialized = store.initialize(); !initialized) {
return Api::fail(Api::ErrorCode::UnknownError,
initialized.error().message());
}
if (auto reconciled = store.reconcile(); !reconciled) {
return Api::fail(Api::ErrorCode::UnknownError,
reconciled.error().message());
}
auto current = store.currentVersion();
if (!current) {
return Api::fail(Api::ErrorCode::UnknownError,
current.error().message());
}
if (!*current) {
return ManagedCoreStartupSelection{
.corePath = bundledCore,
.archivedStore = std::nullopt,
.runtimeBaselineChanged = false};
}
const auto managed =
store.versionPath(**current) / bundledCore.filename();
std::error_code error;
const auto status = std::filesystem::symlink_status(managed, error);
if (!error && std::filesystem::is_regular_file(status) &&
!std::filesystem::is_symlink(status)) {
return ManagedCoreStartupSelection{
.corePath = managed,
.archivedStore = std::nullopt,
.runtimeBaselineChanged = false};
}
if (error != std::errc::no_such_file_or_directory && error) {
return Api::fail(
Api::ErrorCode::PermissionDenied,
std::format("cannot inspect managed Core '{}': {}",
managed.string(), error.message()));
}
return ManagedCoreStartupSelection{.corePath = bundledCore,
.archivedStore = std::nullopt,
.runtimeBaselineChanged = false};
};
// Development trees do not have a release manifest and retain the
// historical behavior: the current managed Core, if any, wins.
if (!installedRuntimeVersion) {
return selectCurrent();
}
if (installedRuntimeVersion->empty() ||
!safeIdentifier(*installedRuntimeVersion)) {
return Api::fail(Api::ErrorCode::InvalidArgument,
"installed runtime version is not a safe "
"identifier");
}
std::error_code error;
std::filesystem::create_directories(components, error);
if (error) {
return Api::fail(
Api::ErrorCode::PermissionDenied,
std::format("cannot prepare managed Core directory '{}': {}",
components.string(), error.message()));
}
std::optional<std::string> recordedRuntime;
const auto markerStatus =
std::filesystem::symlink_status(markerPath, error);
if (!error &&
markerStatus.type() != std::filesystem::file_type::not_found) {
if (!std::filesystem::is_regular_file(markerStatus) ||
std::filesystem::is_symlink(markerStatus)) {
return Api::fail(
Api::ErrorCode::PermissionDenied,
"managed Core runtime marker must be a regular file");
}
auto marker = Void::FileSystem::read_file(markerPath);
if (!marker) {
return Api::fail(Api::ErrorCode::PermissionDenied,
marker.error().message());
}
while (!marker->empty() &&
(marker->back() == '\n' || marker->back() == '\r')) {
marker->pop_back();
}
if (!marker->empty() && !safeIdentifier(*marker)) {
return Api::fail(Api::ErrorCode::ParseError,
"managed Core runtime marker is invalid");
}
recordedRuntime = std::move(*marker);
} else if (error != std::errc::no_such_file_or_directory && error) {
return Api::fail(
Api::ErrorCode::PermissionDenied,
std::format("cannot inspect managed Core runtime marker: {}",
error.message()));
}
if (recordedRuntime && *recordedRuntime == *installedRuntimeVersion) {
return selectCurrent();
}
std::optional<std::filesystem::path> archivedStore;
error.clear();
const auto storeStatus =
std::filesystem::symlink_status(storeRoot, error);
if (!error &&
storeStatus.type() != std::filesystem::file_type::not_found) {
if (!std::filesystem::is_directory(storeStatus) ||
std::filesystem::is_symlink(storeStatus)) {
return Api::fail(Api::ErrorCode::PermissionDenied,
"managed Core store must be a real directory");
}
const auto archiveRoot = components / "core-archives";
std::filesystem::create_directories(archiveRoot, error);
if (error) {
return Api::fail(
Api::ErrorCode::PermissionDenied,
std::format("cannot prepare managed Core archive: {}",
error.message()));
}
const auto archiveStatus =
std::filesystem::symlink_status(archiveRoot, error);
if (error || !std::filesystem::is_directory(archiveStatus) ||
std::filesystem::is_symlink(archiveStatus)) {
return Api::fail(
Api::ErrorCode::PermissionDenied,
"managed Core archive root must be a real directory");
}
const auto label =
recordedRuntime && safeIdentifier(*recordedRuntime)
? *recordedRuntime
: std::string{"legacy"};
for (std::uint32_t suffix = 0; suffix < 10000; ++suffix) {
auto candidate =
archiveRoot /
(suffix == 0 ? label : std::format("{}.{}", label, suffix));
error.clear();
const auto candidateStatus =
std::filesystem::symlink_status(candidate, error);
if (error == std::errc::no_such_file_or_directory ||
candidateStatus.type() ==
std::filesystem::file_type::not_found) {
error.clear();
std::filesystem::rename(storeRoot, candidate, error);
if (error) {
return Api::fail(
Api::ErrorCode::PermissionDenied,
std::format(
"cannot archive the previous managed Core "
"store: {}",
error.message()));
}
archivedStore = std::move(candidate);
break;
}
if (error) {
return Api::fail(
Api::ErrorCode::PermissionDenied,
std::format("cannot inspect managed Core archive: {}",
error.message()));
}
}
if (!archivedStore) {
return Api::fail(Api::ErrorCode::AlreadyExists,
"managed Core archive namespace is exhausted");
}
} else if (error != std::errc::no_such_file_or_directory && error) {
return Api::fail(
Api::ErrorCode::PermissionDenied,
std::format("cannot inspect managed Core store: {}",
error.message()));
}
Void::Update::VersionStore freshStore(storeRoot);
if (auto initialized = freshStore.initialize(); !initialized) {
return Api::fail(Api::ErrorCode::UnknownError,
initialized.error().message());
}
if (auto written = Void::FileSystem::atomic_write(
markerPath, std::string{*installedRuntimeVersion});
!written) {
return Api::fail(Api::ErrorCode::PermissionDenied,
written.error().message());
}
return ManagedCoreStartupSelection{.corePath = bundledCore,
.archivedStore =
std::move(archivedStore),
.runtimeBaselineChanged = true};
}
Api::Result<void> reconcileManagedPluginUpdates( Api::Result<void> reconcileManagedPluginUpdates(
const std::filesystem::path& stateDirectory) const std::filesystem::path& stateDirectory)
{ {
+44 -34
View File
@@ -17,7 +17,6 @@
#include <Void/System/Process.hpp> #include <Void/System/Process.hpp>
#include <Void/System/SignalWatcher.hpp> #include <Void/System/SignalWatcher.hpp>
#include <Void/TeamSpeak/Identity.hpp> #include <Void/TeamSpeak/Identity.hpp>
#include <Void/Update/Update.hpp>
#include <algorithm> #include <algorithm>
#include <array> #include <array>
@@ -245,30 +244,6 @@ namespace
return std::nullopt; return std::nullopt;
} }
[[nodiscard]] std::filesystem::path
reconcileManagedCore(const std::filesystem::path& stateDirectory,
const std::filesystem::path& fallback)
{
Void::Update::VersionStore store(stateDirectory / "updates" /
"components" / "core");
if (auto initialized = store.initialize(); !initialized) {
Void::Log::warn("main", "Cannot initialize managed Core store: {}",
initialized.error().message());
return fallback;
}
if (auto reconciled = store.reconcile(); !reconciled) {
Void::Log::warn("main", "Cannot reconcile managed Core store: {}",
reconciled.error().message());
return fallback;
}
auto current = store.currentVersion();
if (!current || !*current) {
return fallback;
}
const auto managed = store.versionPath(**current) / fallback.filename();
return std::filesystem::is_regular_file(managed) ? managed : fallback;
}
[[nodiscard]] Echoion::Api::Result<std::string> [[nodiscard]] Echoion::Api::Result<std::string>
invokeRuntimeHelper(const std::filesystem::path& helper, invokeRuntimeHelper(const std::filesystem::path& helper,
const std::filesystem::path& root, const std::filesystem::path& root,
@@ -558,6 +533,16 @@ int main(int argc, char** argv)
std::cerr << "Cannot export ECHOION_HOME\n"; std::cerr << "Cannot export ECHOION_HOME\n";
return 2; return 2;
} }
if (!environmentPath("SSL_CERT_FILE")) {
if (const auto certificateBundle =
Echoion::Standalone::bundledCertificateBundle(installRoot)) {
const auto bundleString = certificateBundle->string();
if (::setenv("SSL_CERT_FILE", bundleString.c_str(), 0) != 0) {
std::cerr << "Cannot export bundled TLS certificate store\n";
return 2;
}
}
}
for (const std::string_view requiredValue : {"--config", "--state-dir"}) { for (const std::string_view requiredValue : {"--config", "--state-dir"}) {
if (hasArgument(argc, argv, requiredValue) && if (hasArgument(argc, argv, requiredValue) &&
!optionalArgumentPath(argc, argv, requiredValue)) { !optionalArgumentPath(argc, argv, requiredValue)) {
@@ -651,10 +636,38 @@ int main(int argc, char** argv)
configuredCoreOverride && configuredCoreOverride &&
absolutePath(*configuredCoreOverride) != absolutePath(*configuredCoreOverride) !=
absolutePath(installRoot / "lib" / "Echoion.ts"); absolutePath(installRoot / "lib" / "Echoion.ts");
const auto corePathResolved = auto corePathResolved = configuredCorePath;
customCoreOverride if (!customCoreOverride) {
? configuredCorePath const auto installedRuntimeVersion =
: reconcileManagedCore(stateDirectory, configuredCorePath); runningManifest ? std::optional<std::string_view>{runtimeVersion}
: std::nullopt;
auto selection = Echoion::Standalone::selectManagedCoreForStartup(
stateDirectory, configuredCorePath, installedRuntimeVersion);
if (!selection) {
Void::Log::warn(
"main",
"Cannot reconcile managed Core startup state; using the "
"bundled Core: {}",
selection.error().message);
} else {
corePathResolved = selection->corePath;
if (selection->runtimeBaselineChanged) {
if (selection->archivedStore) {
Void::Log::info(
"main",
"Runtime {} selected its bundled Core and archived "
"the previous managed Core store at {}",
runtimeVersion,
selection->archivedStore->string());
} else {
Void::Log::info(
"main",
"Runtime {} selected its bundled Core baseline",
runtimeVersion);
}
}
}
}
if (const auto workingDirectory = if (const auto workingDirectory =
Echoion::Standalone::runtimeWorkingDirectory(installRoot, Echoion::Standalone::runtimeWorkingDirectory(installRoot,
executableDirectory)) { executableDirectory)) {
@@ -707,7 +720,7 @@ int main(int argc, char** argv)
const auto updaterExecutable = const auto updaterExecutable =
runningExecutable->parent_path() / "echoion-updater"; runningExecutable->parent_path() / "echoion-updater";
auto updateService = std::make_unique<Echoion::Standalone::UpdateService>( auto updateService = std::make_shared<Echoion::Standalone::UpdateService>(
Echoion::Standalone::UpdateService::Options{ Echoion::Standalone::UpdateService::Options{
.configPath = cfgPath, .configPath = cfgPath,
.stateDirectory = stateDirectory, .stateDirectory = stateDirectory,
@@ -771,10 +784,7 @@ int main(int argc, char** argv)
updateService.reset(); updateService.reset();
} else { } else {
interface->setHostControlHandler( interface->setHostControlHandler(
[service = updateService.get()](const std::string& method, Echoion::Standalone::bindUpdateService(updateService));
const std::string& request) {
return service->handle(method, request);
});
} }
core->triggerAutoConnect(); core->triggerAutoConnect();
@@ -1,6 +1,7 @@
#include "echoion/host/CoreLoader.hpp" #include "echoion/host/CoreLoader.hpp"
#include <cstdlib> #include <cstdlib>
#include <ctime>
#include <filesystem> #include <filesystem>
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
@@ -34,11 +35,17 @@ int main()
::setenv("HOME", root.c_str(), 1); ::setenv("HOME", root.c_str(), 1);
const auto stateDirectory = root / "runtime-state"; const auto stateDirectory = root / "runtime-state";
::setenv("ECHOION_STATE_DIR", stateDirectory.c_str(), 1); ::setenv("ECHOION_STATE_DIR", stateDirectory.c_str(), 1);
const auto ytDlp = root / ".local/share/echoion/yt-dlp/yt-dlp"; const auto dataDirectory = stateDirectory / "data";
::setenv("XDG_DATA_HOME", dataDirectory.c_str(), 1);
const auto ytDlp = dataDirectory / "echoion" / "yt-dlp" / "yt-dlp";
std::filesystem::create_directories(ytDlp.parent_path()); std::filesystem::create_directories(ytDlp.parent_path());
{ {
std::ofstream output{ytDlp}; std::ofstream output{ytDlp};
output << "#!/bin/sh\necho 2026.01.01\n"; output << "#!/bin/sh\necho 9999.01.01\n";
}
{
std::ofstream output{ytDlp.parent_path() / ".last_update"};
output << std::time(nullptr);
} }
std::filesystem::permissions(ytDlp, std::filesystem::permissions(ytDlp,
std::filesystem::perms::owner_read | std::filesystem::perms::owner_read |
+13 -5
View File
@@ -101,11 +101,19 @@ int main()
const auto packagedIndex = const auto packagedIndex =
installRoot / "share" / "echoion" / "web" / "index.html"; installRoot / "share" / "echoion" / "web" / "index.html";
check(writeFile(packagedIndex), "failed to create packaged web fixture"); check(writeFile(packagedIndex), "failed to create packaged web fixture");
check( check(Echoion::Standalone::runtimeWorkingDirectory(
Echoion::Standalone::runtimeWorkingDirectory(installRoot, installRoot, executableDirectory) == installRoot,
executableDirectory) == "packaged web root did not select the installation root as working "
installRoot / "share" / "echoion", "directory");
"packaged web root did not select share/echoion as working directory"); const auto bundledCertificates =
installRoot / "share" / "echoion" / "certs" / "ca-certificates.crt";
check(!Echoion::Standalone::bundledCertificateBundle(installRoot),
"missing bundled certificate store was accepted");
check(writeFile(bundledCertificates),
"failed to create bundled certificate store fixture");
check(Echoion::Standalone::bundledCertificateBundle(installRoot) ==
bundledCertificates,
"bundled certificate store was not resolved from the install root");
std::filesystem::remove_all(installRoot / "share"); std::filesystem::remove_all(installRoot / "share");
const auto developmentIndex = executableDirectory / "web" / "index.html"; const auto developmentIndex = executableDirectory / "web" / "index.html";
check(writeFile(developmentIndex), check(writeFile(developmentIndex),
@@ -14,6 +14,7 @@ mkdir -p -- \
"$bundle/bin" \ "$bundle/bin" \
"$bundle/lib" \ "$bundle/lib" \
"$bundle/service" \ "$bundle/service" \
"$bundle/share/echoion/certs" \
"$bundle/share/echoion/tools" \ "$bundle/share/echoion/tools" \
"$bundle/share/echoion/web" "$bundle/share/echoion/web"
printf '#!/bin/sh\necho "echoiond must not run during release staging" >&2\nexit 97\n' \ printf '#!/bin/sh\necho "echoiond must not run during release staging" >&2\nexit 97\n' \
@@ -27,6 +28,7 @@ install -m 0644 -- \
"$service_templates/echoion-updater.timer.in" \ "$service_templates/echoion-updater.timer.in" \
"$bundle/service/" "$bundle/service/"
printf '{"webRoot":"./web"}\n' > "$bundle/share/echoion/config.example.json" printf '{"webRoot":"./web"}\n' > "$bundle/share/echoion/config.example.json"
printf 'test trust bundle\n' > "$bundle/share/echoion/certs/ca-certificates.crt"
install -m 0755 -- "$manifest_validator" \ install -m 0755 -- "$manifest_validator" \
"$bundle/share/echoion/tools/validate-release-manifest.py" "$bundle/share/echoion/tools/validate-release-manifest.py"
printf '<!doctype html>\n' > "$bundle/share/echoion/web/index.html" printf '<!doctype html>\n' > "$bundle/share/echoion/web/index.html"
@@ -250,6 +250,76 @@ int main()
}; };
TemporaryTree tree; TemporaryTree tree;
{
auto ownedService =
std::make_shared<Echoion::Standalone::UpdateService>(
Echoion::Standalone::UpdateService::Options{},
Echoion::Standalone::UpdateService::Hooks{});
std::weak_ptr<Echoion::Standalone::UpdateService> observedService =
ownedService;
auto handler =
Echoion::Standalone::bindUpdateService(ownedService);
ownedService.reset();
check(!observedService.expired(),
"host control handler did not retain UpdateService");
check(handler("updates.getStatus", "{}").has_value(),
"retained UpdateService handler could not serve status");
handler = {};
check(observedService.expired(),
"cleared host control handler retained UpdateService");
}
const auto startupState = tree.path() / "startup-state";
const auto bundledStartupCore =
tree.path() / "startup-runtime" / "lib" / "Echoion.ts";
check(writeFile(bundledStartupCore, "runtime-core"),
"failed to write startup Core fixture");
const auto startupStore = startupState / "updates" / "components" / "core";
check(publishHistoricalVersion(startupStore, "1.1.0", "Echoion.ts",
"stale-managed-core"),
"failed to publish stale managed Core fixture");
check(activatePublishedVersion(startupStore, "1.1.0"),
"failed to activate stale managed Core fixture");
auto firstRuntimeSelection =
Echoion::Standalone::selectManagedCoreForStartup(
startupState, bundledStartupCore, std::string_view{"2.0.0"});
check(firstRuntimeSelection.has_value(),
"runtime Core baseline selection failed");
if (firstRuntimeSelection) {
check(firstRuntimeSelection->corePath == bundledStartupCore,
"new runtime did not prefer its bundled Core");
check(firstRuntimeSelection->runtimeBaselineChanged,
"new runtime did not report a Core baseline change");
check(firstRuntimeSelection->archivedStore.has_value() &&
std::filesystem::is_regular_file(
*firstRuntimeSelection->archivedStore / "versions" /
"1.1.0" / "Echoion.ts"),
"stale managed Core store was not archived");
}
check(publishHistoricalVersion(startupStore, "1.1.0", "Echoion.ts",
"runtime-core"),
"failed to seed the new runtime Core store");
check(activatePublishedVersion(startupStore, "1.1.0"),
"failed to activate the new runtime Core baseline");
auto sameRuntimeSelection =
Echoion::Standalone::selectManagedCoreForStartup(
startupState, bundledStartupCore, std::string_view{"2.0.0"});
check(sameRuntimeSelection.has_value() &&
sameRuntimeSelection->corePath ==
startupStore / "versions" / "1.1.0" / "Echoion.ts" &&
!sameRuntimeSelection->runtimeBaselineChanged,
"same runtime did not retain its managed Core selection");
auto nextRuntimeSelection =
Echoion::Standalone::selectManagedCoreForStartup(
startupState, bundledStartupCore, std::string_view{"2.1.0"});
check(nextRuntimeSelection.has_value() &&
nextRuntimeSelection->corePath == bundledStartupCore &&
nextRuntimeSelection->runtimeBaselineChanged,
"next runtime did not invalidate the prior managed Core baseline");
const auto state = tree.path() / "state"; const auto state = tree.path() / "state";
const auto incoming = tree.path() / "incoming"; const auto incoming = tree.path() / "incoming";
const auto currentCore = tree.path() / "installed" / "Echoion.ts"; const auto currentCore = tree.path() / "installed" / "Echoion.ts";
+4 -1
View File
@@ -1,5 +1,8 @@
cmake_minimum_required(VERSION 4.0.0) cmake_minimum_required(VERSION 4.0.0)
project(EchoionWeb VERSION 1.0.0 LANGUAGES CXX) if(NOT DEFINED ECHOION_PRODUCT_VERSION)
set(ECHOION_PRODUCT_VERSION 0.0.0)
endif()
project(EchoionWeb VERSION "${ECHOION_PRODUCT_VERSION}" LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 26) set(CMAKE_CXX_STANDARD 26)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_EXTENSIONS OFF)
@@ -4,6 +4,7 @@ import type { RpcMethodName } from '../lib/rpc';
import { confirmDialog, promptDialog } from '../lib/dialog'; import { confirmDialog, promptDialog } from '../lib/dialog';
import { EmptyRow } from './TrackRow'; import { EmptyRow } from './TrackRow';
import { t, tf } from '../i18n'; import { t, tf } from '../i18n';
import { teamSpeakChannelDisplayName } from '../lib/teamspeak';
interface AdminClient { interface AdminClient {
id: number; id: number;
@@ -281,10 +282,17 @@ export function TeamSpeakAdmin() {
} }
function Channel({ channel, depth = 0 }: { channel: AdminChannel; depth?: number }) { function Channel({ channel, depth = 0 }: { channel: AdminChannel; depth?: number }) {
const displayName = teamSpeakChannelDisplayName(channel.name);
return ( return (
<div className="ts-admin-channel" style={{ marginLeft: depth * 16 }}> <div className="ts-admin-channel" style={{ marginLeft: depth * 16 }}>
<div className="ts-admin-channel-head"> <div className="ts-admin-channel-head">
<strong>{channel.name}</strong> <strong
className={displayName.spacer ? 'ts-admin-spacer' : undefined}
title={channel.name}
>
{displayName.label}
</strong>
<span className="muted">#{channel.id}</span> <span className="muted">#{channel.id}</span>
<span className="ts-capacity"> <span className="ts-capacity">
{channel.currentClients}/{channel.maxClients || '∞'} {channel.currentClients}/{channel.maxClients || '∞'}
@@ -0,0 +1,33 @@
import { describe, expect, it } from 'vitest';
import { teamSpeakChannelDisplayName } from './teamspeak';
describe('TeamSpeak channel display names', () => {
it('leaves ordinary channel names unchanged', () => {
expect(teamSpeakChannelDisplayName('Minecraft')).toEqual({
label: 'Minecraft',
spacer: false,
alignment: 'left',
});
});
it('removes spacer control prefixes and preserves alignment', () => {
expect(teamSpeakChannelDisplayName('[cspacer0]Гамесы')).toEqual({
label: 'Гамесы',
spacer: true,
alignment: 'center',
});
expect(teamSpeakChannelDisplayName('[rspacer12]Подвал')).toEqual({
label: 'Подвал',
spacer: true,
alignment: 'right',
});
});
it('recognizes repeating spacer channels', () => {
expect(teamSpeakChannelDisplayName('[*spacer3]—')).toEqual({
label: '—',
spacer: true,
alignment: 'repeat',
});
});
});
+33
View File
@@ -0,0 +1,33 @@
export type TeamSpeakSpacerAlignment = 'left' | 'center' | 'right' | 'repeat';
export interface TeamSpeakChannelDisplayName {
label: string;
spacer: boolean;
alignment: TeamSpeakSpacerAlignment;
}
const SPACER_NAME = /^\[([clr]|\*)?spacer\d*\](.*)$/i;
export function teamSpeakChannelDisplayName(
name: string
): TeamSpeakChannelDisplayName {
const match = SPACER_NAME.exec(name);
if (!match) {
return { label: name, spacer: false, alignment: 'left' };
}
const alignment =
match[1]?.toLowerCase() === 'c'
? 'center'
: match[1]?.toLowerCase() === 'r'
? 'right'
: match[1] === '*'
? 'repeat'
: 'left';
return {
label: match[2].trim(),
spacer: true,
alignment,
};
}
+34
View File
@@ -579,6 +579,39 @@ select:focus:not(:focus-visible) { outline: none; }
.ts-channel-row:hover, .ts-client-row:hover { background: rgba(255, 255, 255, 0.035); } .ts-channel-row:hover, .ts-client-row:hover { background: rgba(255, 255, 255, 0.035); }
.ts-channel-caret { width: 14px; color: var(--faint); text-align: center; } .ts-channel-caret { width: 14px; color: var(--faint); text-align: center; }
.ts-channel-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 650; } .ts-channel-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 650; }
.ts-channel-row.ts-spacer {
margin: 4px 0 3px;
padding-inline: 5px;
background: linear-gradient(90deg, rgba(124, 92, 255, 0.06), transparent);
}
.ts-channel-row.ts-spacer:hover {
background: linear-gradient(90deg, rgba(124, 92, 255, 0.11), transparent);
}
.ts-channel-row.ts-spacer .ts-channel-caret {
order: 2;
margin-left: auto;
}
.ts-channel-row.ts-spacer .ts-channel-name {
display: flex;
flex: 1;
align-items: center;
gap: 10px;
color: var(--text-2);
letter-spacing: 0.015em;
}
.ts-channel-row.ts-spacer .ts-channel-name::before,
.ts-channel-row.ts-spacer .ts-channel-name::after {
content: '';
flex: 1;
border-top: 1px solid rgba(124, 92, 255, 0.3);
}
.ts-channel-row.ts-spacer-left .ts-channel-name::before,
.ts-channel-row.ts-spacer-repeat .ts-channel-name::before {
display: none;
}
.ts-channel-row.ts-spacer-right .ts-channel-name::after {
display: none;
}
.ts-capacity { margin-left: auto; color: var(--faint); font: 11px var(--font-mono); } .ts-capacity { margin-left: auto; color: var(--faint); font: 11px var(--font-mono); }
.ts-tag { .ts-tag {
padding: 2px 6px; border-radius: 999px; color: var(--muted-2); padding: 2px 6px; border-radius: 999px; color: var(--muted-2);
@@ -620,6 +653,7 @@ select:focus:not(:focus-visible) { outline: none; }
display: flex; align-items: center; gap: 7px; flex-wrap: wrap; display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
min-height: 34px; min-height: 34px;
} }
.ts-admin-spacer { color: var(--accent-text); letter-spacing: 0.02em; }
.ts-admin-channel-head .ts-capacity { margin-left: 0; margin-right: auto; } .ts-admin-channel-head .ts-capacity { margin-left: 0; margin-right: auto; }
.ts-admin-client { .ts-admin-client {
display: grid; grid-template-columns: minmax(180px, 0.8fr) minmax(250px, 1.2fr) auto; display: grid; grid-template-columns: minmax(180px, 0.8fr) minmax(250px, 1.2fr) auto;
@@ -16,6 +16,7 @@ import {
} from '../components/icons'; } from '../components/icons';
import { t, tf } from '../i18n'; import { t, tf } from '../i18n';
import type { PublicDashboardChannel } from '../lib/types'; import type { PublicDashboardChannel } from '../lib/types';
import { teamSpeakChannelDisplayName } from '../lib/teamspeak';
const DASHBOARD_VIDEO_PREF_KEY = 'echoion.npVideo'; const DASHBOARD_VIDEO_PREF_KEY = 'echoion.npVideo';
@@ -32,26 +33,37 @@ function ChannelNode({
channel: PublicDashboardChannel; channel: PublicDashboardChannel;
depth?: number; depth?: number;
}) { }) {
const displayName = teamSpeakChannelDisplayName(channel.name);
const rowClassName = displayName.spacer
? `ts-channel-row ts-spacer ts-spacer-${displayName.alignment}`
: 'ts-channel-row';
return ( return (
<div <div
className="ts-channel" className="ts-channel"
style={{ '--tree-depth': depth } as CSSProperties} style={{ '--tree-depth': depth } as CSSProperties}
> >
<div className="ts-channel-row"> <div className={rowClassName}>
<span className="ts-channel-caret" aria-hidden="true"> <span className="ts-channel-caret" aria-hidden="true">
{channel.channels.length || channel.clients.length ? '⌄' : '·'} {channel.channels.length || channel.clients.length ? '⌄' : '·'}
</span> </span>
<span className="ts-channel-name">{channel.name}</span> <span className="ts-channel-name" title={channel.name}>
{channel.default && <span className="ts-tag">{t('default')}</span>} {displayName.label}
{channel.password && ( </span>
{!displayName.spacer && channel.default && (
<span className="ts-tag">{t('default')}</span>
)}
{!displayName.spacer && channel.password && (
<span className="ts-tag" title={t('Password protected')}> <span className="ts-tag" title={t('Password protected')}>
{t('locked')} {t('locked')}
</span> </span>
)} )}
<span className="ts-capacity"> {!displayName.spacer && (
{channel.currentClients}/ <span className="ts-capacity">
{channel.maxClients > 0 ? channel.maxClients : '∞'} {channel.currentClients}/
</span> {channel.maxClients > 0 ? channel.maxClients : '∞'}
</span>
)}
</div> </div>
{channel.clients.map((client, index) => ( {channel.clients.map((client, index) => (
<div <div
Vendored
+5 -1
View File
@@ -25,7 +25,11 @@ pipeline {
stage('Checkout') { stage('Checkout') {
steps { steps {
checkout scm checkout scm
sh 'git submodule update --init --recursive' // Components are independent repositories pinned by immutable
// revisions in components.lock.json. Configure HTTPS
// credentials for git.faumaray.ru on the agent when the
// repositories are private.
sh 'python3 scripts/sync-components.py --update'
} }
} }
+1 -1
View File
@@ -4,5 +4,5 @@ set(ECHOION_VOID_REVISION
"053ee5b296d1f41b0653b4301bbea1e857be2279" "053ee5b296d1f41b0653b4301bbea1e857be2279"
CACHE STRING "VoidLibrary commit used by Echoion") CACHE STRING "VoidLibrary commit used by Echoion")
set(ECHOION_VOID_TEAMSPEAK_REVISION set(ECHOION_VOID_TEAMSPEAK_REVISION
"cb43116da643fb6584f91f108f384cc5e3cb658c" "cd4e303259ed32fee1fa77b387d3c675b5e672cd"
CACHE STRING "VoidTeamspeak commit used by Echoion") CACHE STRING "VoidTeamspeak commit used by Echoion")
+46
View File
@@ -0,0 +1,46 @@
include_guard(GLOBAL)
set(ECHOION_COMPONENT_LOCK
"${CMAKE_CURRENT_LIST_DIR}/../components.lock.json"
CACHE FILEPATH "Echoion component repository lock file")
if(NOT EXISTS "${ECHOION_COMPONENT_LOCK}")
message(FATAL_ERROR
"Echoion component lock does not exist: ${ECHOION_COMPONENT_LOCK}")
endif()
file(READ "${ECHOION_COMPONENT_LOCK}" _echoionComponentLockJson)
string(JSON _echoionComponentLockSchema ERROR_VARIABLE _echoionLockError
GET "${_echoionComponentLockJson}" schemaVersion)
if(_echoionLockError OR NOT _echoionComponentLockSchema EQUAL 1)
message(FATAL_ERROR
"Unsupported Echoion component lock: ${ECHOION_COMPONENT_LOCK}")
endif()
function(echoion_add_component component)
string(JSON repository ERROR_VARIABLE repositoryError
GET "${_echoionComponentLockJson}" components "${component}" url)
string(JSON revision ERROR_VARIABLE revisionError
GET "${_echoionComponentLockJson}" components "${component}" revision)
if(repositoryError OR revisionError OR repository STREQUAL "" OR
revision STREQUAL "")
message(FATAL_ERROR
"Component ${component} is incomplete in "
"${ECHOION_COMPONENT_LOCK}")
endif()
# A workspace created by scripts/sync-components.py or by the Gitea
# workflow wins over network fetching. This keeps private credentials out
# of Docker while a clean public checkout can still resolve through CPM.
set(localSource "${CMAKE_SOURCE_DIR}/${component}")
if(EXISTS "${localSource}/CMakeLists.txt")
set("CPM_${component}_SOURCE" "${localSource}" CACHE PATH
"Local ${component} source directory")
endif()
CPMAddPackage(
NAME "${component}"
GIT_REPOSITORY "${repository}"
GIT_TAG "${revision}"
)
endfunction()
+20
View File
@@ -0,0 +1,20 @@
{
"schemaVersion": 1,
"components": {
"EchoionApi": {
"repository": "Void/EchoionApi",
"url": "https://git.faumaray.ru/void/echoionapi.git",
"revision": "06e06b7622c72fe27a6b65654d62a1536acffbe9"
},
"EchoionCore": {
"repository": "Void/EchoionCore",
"url": "https://git.faumaray.ru/void/echoioncore.git",
"revision": "9637f1eef75dbe79ed8dff564233a57db64bc32f"
},
"EchoionDesktop": {
"repository": "Void/EchoionDesktop",
"url": "https://git.faumaray.ru/void/echoiondesktop.git",
"revision": "1fc5aaecfe888e1c480bcb31d7d3b64986c84e1d"
}
}
}
+9
View File
@@ -197,6 +197,15 @@
} }
}, },
"logging": {
"_section": "Rolling process logs (the active file is archived on every start)",
"console": true,
"level": "debug",
"fileName": "echoion.log",
"maxFileSizeBytes": 10485760,
"maxFiles": 10
},
"advanced": { "advanced": {
"_section": "Advanced Settings (Modify with caution)", "_section": "Advanced Settings (Modify with caution)",
"_cache": "Local audio track cache (files reused across plays and restarts)", "_cache": "Local audio track cache (files reused across plays and restarts)",
+7 -2
View File
@@ -23,7 +23,7 @@ The default installed tree is:
bin/ echoiond and echoion-updater bin/ echoiond and echoion-updater
lib/ Core and dynamic dependency closure lib/ Core and dynamic dependency closure
service/ service templates service/ service templates
share/echoion/ web, config template, licenses, validation tool share/echoion/ web, config template, CA trust store, licenses, tools
bootstrap-plugins/ immutable first-party plugin artifacts bootstrap-plugins/ immutable first-party plugin artifacts
manifest.json manifest.json
libexec/updater/<installer-version>/ libexec/updater/<installer-version>/
@@ -61,7 +61,12 @@ or plugin data. The
operation is idempotent and participates in installer rollback. The service and operation is idempotent and participates in installer rollback. The service and
portable launcher expose only the active release's bundled shared-library portable launcher expose only the active release's bundled shared-library
directory through `LD_LIBRARY_PATH`; release builds keep `BUILD_SHARED_LIBS=ON` directory through `LD_LIBRARY_PATH`; release builds keep `BUILD_SHARED_LIBS=ON`
and `ECHOION_STATIC_LINK=OFF`. Installed configurations use the relocatable and `ECHOION_STATIC_LINK=OFF`. Plugin RUNPATHs also resolve the active
`current/lib` closure from managed, portable/manual, and immutable bootstrap
locations, with `$ORIGIN/lib` reserved for plugin-private dependencies.
The daemon selects the bundled CA trust store when `SSL_CERT_FILE` is unset, so
HTTPS feeds remain verified on hosts without the builder distribution's
OpenSSL directory layout. Installed configurations use the relocatable
`./share/echoion/web` asset path; systemd units and the portable launcher set `./share/echoion/web` asset path; systemd units and the portable launcher set
the active release as their working directory. An upgrade rewrites only the the active release as their working directory. An upgrade rewrites only the
exact legacy installer default `./web`; custom web roots remain untouched and exact legacy installer default `./web`; custom web roots remain untouched and
+3 -1
View File
@@ -59,7 +59,7 @@ assert_not_contains() {
make_payload() { make_payload() {
local root=$1 local root=$1
install -d -- "$root/bin" "$root/lib" "$root/share/echoion/web" \ install -d -- "$root/bin" "$root/lib" "$root/share/echoion/web" \
"$root/share/echoion/tools" "$root/service" \ "$root/share/echoion/tools" "$root/share/echoion/certs" "$root/service" \
"$root/share/echoion/bootstrap-plugins/url-shortener-internal/1.0.0" \ "$root/share/echoion/bootstrap-plugins/url-shortener-internal/1.0.0" \
"$root/share/echoion/bootstrap-plugins/url-shortener-external/1.0.0" "$root/share/echoion/bootstrap-plugins/url-shortener-external/1.0.0"
install -m 0755 -- "$PACKAGING_DIR/install.sh" "$root/install.sh" install -m 0755 -- "$PACKAGING_DIR/install.sh" "$root/install.sh"
@@ -107,6 +107,8 @@ EOF
} }
EOF EOF
printf '<!doctype html>\n' > "$root/share/echoion/web/index.html" printf '<!doctype html>\n' > "$root/share/echoion/web/index.html"
printf 'test trust bundle\n' \
>"$root/share/echoion/certs/ca-certificates.crt"
printf 'fake internal shortener plugin 1.0.0\n' > \ printf 'fake internal shortener plugin 1.0.0\n' > \
"$root/share/echoion/bootstrap-plugins/url-shortener-internal/1.0.0/url-shortener-internal.so" "$root/share/echoion/bootstrap-plugins/url-shortener-internal/1.0.0/url-shortener-internal.so"
printf 'fake external shortener plugin 1.0.0\n' > \ printf 'fake external shortener plugin 1.0.0\n' > \
+4 -1
View File
@@ -21,7 +21,8 @@ make_release() {
local destination=$1 local destination=$1
local version=$2 local version=$2
mkdir -p "$destination/bin" "$destination/lib" "$destination/service" \ mkdir -p "$destination/bin" "$destination/lib" "$destination/service" \
"$destination/share/echoion/web" "$destination/share/echoion/tools" "$destination/share/echoion/web" "$destination/share/echoion/tools" \
"$destination/share/echoion/certs"
install -m 0755 /bin/true "$destination/bin/echoiond" install -m 0755 /bin/true "$destination/bin/echoiond"
install -m 0755 "$updater" "$destination/bin/echoion-updater" install -m 0755 "$updater" "$destination/bin/echoion-updater"
printf 'core %s\n' "$version" >"$destination/lib/Echoion.ts" printf 'core %s\n' "$version" >"$destination/lib/Echoion.ts"
@@ -35,6 +36,8 @@ make_release() {
"$destination/share/echoion/tools/validate-release-manifest.py" "$destination/share/echoion/tools/validate-release-manifest.py"
printf '{}\n' >"$destination/share/echoion/config.example.json" printf '{}\n' >"$destination/share/echoion/config.example.json"
printf '<!doctype html>\n' >"$destination/share/echoion/web/index.html" printf '<!doctype html>\n' >"$destination/share/echoion/web/index.html"
printf 'test trust bundle\n' \
>"$destination/share/echoion/certs/ca-certificates.crt"
python3 "$source_root/scripts/generate-release-manifest.py" \ python3 "$source_root/scripts/generate-release-manifest.py" \
--root "$destination" --version "$version" --root "$destination" --version "$version"
} }
+1
View File
@@ -1431,6 +1431,7 @@ namespace Echoion::Updater
{"lib/Echoion.ts", "file"}, {"lib/Echoion.ts", "file"},
{"share/echoion/web/index.html", "file"}, {"share/echoion/web/index.html", "file"},
{"share/echoion/config.example.json", "file"}, {"share/echoion/config.example.json", "file"},
{"share/echoion/certs/ca-certificates.crt", "file"},
{"share/echoion/tools/validate-release-manifest.py", "file"}, {"share/echoion/tools/validate-release-manifest.py", "file"},
{"service/echoion.service.in", "file"}, {"service/echoion.service.in", "file"},
{"service/echoion-updater.service.in", "file"}, {"service/echoion-updater.service.in", "file"},
+2 -2
View File
@@ -1,5 +1,5 @@
set(ECHOION_URL_SHORTENER_INTERNAL_VERSION "1.0.0") set(ECHOION_URL_SHORTENER_INTERNAL_VERSION "${ECHOION_COMPONENT_VERSION}")
set(ECHOION_URL_SHORTENER_EXTERNAL_VERSION "1.0.0") set(ECHOION_URL_SHORTENER_EXTERNAL_VERSION "${ECHOION_COMPONENT_VERSION}")
find_package(OpenSSL REQUIRED COMPONENTS Crypto) find_package(OpenSSL REQUIRED COMPONENTS Crypto)
find_package(Boost REQUIRED COMPONENTS url) find_package(Boost REQUIRED COMPONENTS url)
@@ -52,6 +52,11 @@ namespace Echoion::Plugins::ShortUrl
std::size_t maximumConcurrency{4}; std::size_t maximumConcurrency{4};
}; };
// Missing endpoint means this optional provider is intentionally dormant.
// Malformed or partially-present configuration still counts as configured
// so plugin activation rejects it instead of silently ignoring it.
[[nodiscard]] bool hasExternalConfiguration(std::string_view payload);
[[nodiscard]] std::expected<ExternalConfig, std::string> [[nodiscard]] std::expected<ExternalConfig, std::string>
parseExternalConfig(std::string_view payload); parseExternalConfig(std::string_view payload);
@@ -615,6 +615,18 @@ namespace Echoion::Plugins::ShortUrl
} }
} // namespace } // namespace
bool hasExternalConfiguration(const std::string_view payload)
{
if (payload.empty()) {
return false;
}
auto root = Void::Json::parse(payload);
if (!root || !root->is_object()) {
return true;
}
return settingsObject(*root).find("endpoint") != nullptr;
}
std::expected<ExternalConfig, std::string> std::expected<ExternalConfig, std::string>
parseExternalConfig(const std::string_view payload) parseExternalConfig(const std::string_view payload)
{ {
+24 -7
View File
@@ -41,6 +41,11 @@ namespace Echoion::Plugins::ShortUrl
{ {
shortener_.reset(); shortener_.reset();
activationError_.clear(); activationError_.clear();
dormant_ = !hasExternalConfiguration(configPayload_);
if (dormant_) {
activationError_ = "plugin is not configured";
return;
}
auto config = parseExternalConfig(configPayload_); auto config = parseExternalConfig(configPayload_);
if (!config) { if (!config) {
activationError_ = std::move(config).error(); activationError_ = std::move(config).error();
@@ -56,6 +61,11 @@ namespace Echoion::Plugins::ShortUrl
void on_unload() override { shortener_.reset(); } void on_unload() override { shortener_.reset(); }
[[nodiscard]] bool ready() const noexcept
{
return dormant_ || shortener_ != nullptr;
}
[[nodiscard]] Void::ShortUrl::Health health() const override [[nodiscard]] Void::ShortUrl::Health health() const override
{ {
if (shortener_ != nullptr) { if (shortener_ != nullptr) {
@@ -73,10 +83,16 @@ namespace Echoion::Plugins::ShortUrl
shorten(const Void::ShortUrl::ShortenRequest& request) override shorten(const Void::ShortUrl::ShortenRequest& request) override
{ {
if (shortener_ == nullptr) { if (shortener_ == nullptr) {
return {.error = { return {
.short_url = {},
.key = {},
.expires_at_unix_seconds = 0,
.error =
{
.code = Void::ShortUrl::ErrorCode::unavailable, .code = Void::ShortUrl::ErrorCode::unavailable,
.message = "external shortener is unavailable", .message = "external shortener is unavailable",
}}; },
};
} }
return shortener_->shorten(request); return shortener_->shorten(request);
} }
@@ -86,6 +102,7 @@ namespace Echoion::Plugins::ShortUrl
std::string configPayload_; std::string configPayload_;
std::string activationError_; std::string activationError_;
std::unique_ptr<ExternalShortener> shortener_; std::unique_ptr<ExternalShortener> shortener_;
bool dormant_ = false;
}; };
} // namespace Echoion::Plugins::ShortUrl } // namespace Echoion::Plugins::ShortUrl
@@ -124,11 +141,11 @@ void void_plugin_configure(void* instance, const char* config)
int void_plugin_ready(void* instance) int void_plugin_ready(void* instance)
{ {
const auto health = return static_cast<Echoion::Plugins::ShortUrl::ExternalShortenerPlugin*>(
static_cast<Echoion::Plugins::ShortUrl::ExternalShortenerPlugin*>( instance)
instance) ->ready()
->health(); ? 0
return health.status == Void::ShortUrl::HealthStatus::healthy ? 0 : 1; : 1;
} }
Void::Service::IService* void_plugin_service(void* instance) Void::Service::IService* void_plugin_service(void* instance)
@@ -34,6 +34,7 @@ namespace
int main() int main()
{ {
using Echoion::Plugins::ShortUrl::ExternalShortener; using Echoion::Plugins::ShortUrl::ExternalShortener;
using Echoion::Plugins::ShortUrl::hasExternalConfiguration;
using Echoion::Plugins::ShortUrl::parseExternalConfig; using Echoion::Plugins::ShortUrl::parseExternalConfig;
int failures{}; int failures{};
@@ -46,6 +47,15 @@ int main()
}; };
EnvironmentVariable token{"ECHOION_SHORTENER_TEST_TOKEN", "test secret"}; EnvironmentVariable token{"ECHOION_SHORTENER_TEST_TOKEN", "test secret"};
check(!hasExternalConfiguration(
R"JSON({"settings":{},"_host":{"stateDirectory":"/tmp"}})JSON"),
"empty host envelope did not keep the optional provider dormant");
check(
hasExternalConfiguration(R"JSON({"settings":{"endpoint":false}})JSON"),
"partially configured provider was incorrectly treated as dormant");
check(hasExternalConfiguration("{"),
"malformed provider configuration was incorrectly treated as "
"dormant");
const auto jsonConfig = R"JSON({ const auto jsonConfig = R"JSON({
"endpoint":"https://short.example/api", "endpoint":"https://short.example/api",
"method":"POST", "method":"POST",
+25 -7
View File
@@ -320,7 +320,9 @@ def atomic_write(path: Path, content: bytes, mode: int = 0o644) -> None:
def main() -> None: def main() -> None:
parser = argparse.ArgumentParser(description=__doc__) parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--new-payload", type=Path, required=True) parser.add_argument(
"--new-payload", type=Path, action="append", required=True
)
parser.add_argument("--existing-envelope", type=Path) parser.add_argument("--existing-envelope", type=Path)
parser.add_argument("--public-key", type=Path, required=True) parser.add_argument("--public-key", type=Path, required=True)
parser.add_argument("--private-key", type=Path, required=True) parser.add_argument("--private-key", type=Path, required=True)
@@ -346,7 +348,9 @@ def main() -> None:
fail("--valid-days must be between 1 and 365") fail("--valid-days must be between 1 and 365")
if arguments.nightly_retention < 1: if arguments.nightly_retention < 1:
fail("--nightly-retention must be positive") fail("--nightly-retention must be positive")
new_payload_path = regular_file(arguments.new_payload, "new payload") new_payload_paths = [
regular_file(path, "new payload") for path in arguments.new_payload
]
public_key = regular_file(arguments.public_key, "Ed25519 public key") public_key = regular_file(arguments.public_key, "Ed25519 public key")
private_key = regular_file( private_key = regular_file(
arguments.private_key, "Ed25519 private key", private=True arguments.private_key, "Ed25519 private key", private=True
@@ -368,8 +372,17 @@ def main() -> None:
if previous is not None and previous != key_path: if previous is not None and previous != key_path:
fail(f"conflicting public keys for key id: {key_id}") fail(f"conflicting public keys for key id: {key_id}")
trusted_existing_keys[key_id] = key_path trusted_existing_keys[key_id] = key_path
new_document = load_json_bytes(new_payload_path.read_bytes(), "new feed payload") new_documents = [
new_releases = validate_payload(new_document, "new feed payload") load_json_bytes(path.read_bytes(), "new feed payload")
for path in new_payload_paths
]
new_document = new_documents[0]
new_releases: list[dict[str, Any]] = []
for document in new_documents:
releases = validate_payload(document, "new feed payload")
if document["feedId"] != new_document["feedId"]:
fail("new feed identifiers differ")
new_releases.extend(releases)
existing_document: dict[str, Any] | None = None existing_document: dict[str, Any] | None = None
existing_payload_bytes = b"" existing_payload_bytes = b""
@@ -389,7 +402,7 @@ def main() -> None:
output_payload = arguments.output_payload.resolve() output_payload = arguments.output_payload.resolve()
output_envelope = arguments.output_envelope.resolve() output_envelope = arguments.output_envelope.resolve()
inputs = { inputs = {
new_payload_path, *new_payload_paths,
private_key, private_key,
*trusted_existing_keys.values(), *trusted_existing_keys.values(),
} }
@@ -422,7 +435,10 @@ def main() -> None:
) )
generated = max( generated = max(
generated, generated,
parse_timestamp(new_document["generatedAt"], "new feed generatedAt"), max(
parse_timestamp(document["generatedAt"], "new feed generatedAt")
for document in new_documents
),
) )
if existing_document is not None: if existing_document is not None:
generated = max( generated = max(
@@ -431,7 +447,9 @@ def main() -> None:
existing_document["generatedAt"], "existing feed generatedAt" existing_document["generatedAt"], "existing feed generatedAt"
), ),
) )
minimum_sequence = int(new_document["sequence"]) minimum_sequence = max(
int(document["sequence"]) for document in new_documents
)
if existing_document is not None: if existing_document is not None:
minimum_sequence = max(minimum_sequence, int(existing_document["sequence"]) + 1) minimum_sequence = max(minimum_sequence, int(existing_document["sequence"]) + 1)
sequence = arguments.sequence sequence = arguments.sequence
+82 -7
View File
@@ -341,6 +341,7 @@ configure_args=(
-DBUILD_SHARED_LIBS=ON -DBUILD_SHARED_LIBS=ON
-DECHOION_STATIC_LINK=OFF -DECHOION_STATIC_LINK=OFF
-DECHOION_REPRODUCIBLE_BUILD=ON -DECHOION_REPRODUCIBLE_BUILD=ON
"-DECHOION_RELEASE_VERSION=$version"
"-DECHOION_RUNTIME_VERSION=$version" "-DECHOION_RUNTIME_VERSION=$version"
) )
official_update_keys="$source_dir/.gitea/release-keys/official-update-keys.json" official_update_keys="$source_dir/.gitea/release-keys/official-update-keys.json"
@@ -382,6 +383,12 @@ cmake --install "$build_dir" \
--component Runtime \ --component Runtime \
--prefix "$stage" --prefix "$stage"
certificate_bundle=${ECHOION_CA_BUNDLE:-/etc/ssl/certs/ca-certificates.crt}
[[ -s $certificate_bundle ]] ||
die "TLS certificate bundle is missing or empty: $certificate_bundle"
install -D -m 0644 -- "$certificate_bundle" \
"$stage/share/echoion/certs/ca-certificates.crt"
mapfile -t library_directories < <( mapfile -t library_directories < <(
find "$build_dir" -type f \( -name '*.so' -o -name '*.so.*' -o -name '*.ts' \) \ find "$build_dir" -type f \( -name '*.so' -o -name '*.so.*' -o -name '*.ts' \) \
-printf '%h\n' | LC_ALL=C sort -u -printf '%h\n' | LC_ALL=C sort -u
@@ -420,11 +427,12 @@ cmake \
-P "$source_dir/cmake/BundleRuntimeDependencies.cmake" -P "$source_dir/cmake/BundleRuntimeDependencies.cmake"
# Bootstrap plugins are copied into writable managed-plugin state by the # Bootstrap plugins are copied into writable managed-plugin state by the
# installer. Services and the portable launcher point the loader at current/lib; # installer. Search the active release closure from managed, portable/manual,
# this relative path also keeps the immutable source artifact directly usable. # and immutable bootstrap locations, then allow plugin-private dependencies.
# shellcheck disable=SC2016 # Dynamic linker token, not a shell variable.
plugin_runpath='$ORIGIN/../../../../../../current/lib:$ORIGIN/../../current/lib:$ORIGIN/lib'
for plugin_library in "${resolver_libraries[@]:1}"; do for plugin_library in "${resolver_libraries[@]:1}"; do
# shellcheck disable=SC2016 # Dynamic linker token, not a shell variable. patchelf --set-rpath "$plugin_runpath" "$plugin_library"
patchelf --set-rpath '$ORIGIN/../../../../../lib' "$plugin_library"
done done
dependency_report="$build_dir/dependency-report.txt" dependency_report="$build_dir/dependency-report.txt"
@@ -513,6 +521,12 @@ collect_licenses() {
-printf '%f\n' | LC_ALL=C sort -u -printf '%f\n' | LC_ALL=C sort -u
) )
fi fi
candidate=/usr/share/doc/ca-certificates/copyright
if [[ -f $candidate ]]; then
install -m 0644 -- "$candidate" \
"$destination/ca-certificates--copyright"
fi
} }
collect_licenses "$stage/share/echoion/licenses" collect_licenses "$stage/share/echoion/licenses"
@@ -537,10 +551,19 @@ installer="$dist_dir/$artifact_base.run"
external_manifest="$dist_dir/$artifact_base.manifest.json" external_manifest="$dist_dir/$artifact_base.manifest.json"
external_report="$dist_dir/$artifact_base.dependencies.txt" external_report="$dist_dir/$artifact_base.dependencies.txt"
feed_payload="$dist_dir/$artifact_base.update-payload.json" feed_payload="$dist_dir/$artifact_base.update-payload.json"
core_artifact="$dist_dir/echoion-core-${version}-linux-x86_64.so"
core_feed_payload="$dist_dir/echoion-core-${version}-linux-x86_64.update-payload.json"
internal_plugin_artifact="$dist_dir/url-shortener-internal-${version}-linux-x86_64.so"
internal_plugin_feed_payload="$dist_dir/url-shortener-internal-${version}-linux-x86_64.update-payload.json"
external_plugin_artifact="$dist_dir/url-shortener-external-${version}-linux-x86_64.so"
external_plugin_feed_payload="$dist_dir/url-shortener-external-${version}-linux-x86_64.update-payload.json"
rm -f -- \ rm -f -- \
"$archive" "$archive.tmp" \ "$archive" "$archive.tmp" \
"$installer" "$installer.tmp" \ "$installer" "$installer.tmp" \
"$external_manifest" "$external_report" "$feed_payload" \ "$external_manifest" "$external_report" "$feed_payload" \
"$core_artifact" "$core_feed_payload" \
"$internal_plugin_artifact" "$internal_plugin_feed_payload" \
"$external_plugin_artifact" "$external_plugin_feed_payload" \
"$dist_dir/SHA256SUMS" "$dist_dir/SHA256SUMS"
bash "$source_dir/scripts/package-release-payload.sh" \ bash "$source_dir/scripts/package-release-payload.sh" \
@@ -549,6 +572,13 @@ bash "$source_dir/scripts/package-release-payload.sh" \
install -m 0644 "$stage/manifest.json" "$external_manifest" install -m 0644 "$stage/manifest.json" "$external_manifest"
install -m 0644 "$dependency_report" "$external_report" install -m 0644 "$dependency_report" "$external_report"
install -m 0644 "$stage/lib/Echoion.ts" "$core_artifact"
install -m 0644 \
"$stage/share/echoion/bootstrap-plugins/url-shortener-internal/$version/url-shortener-internal.so" \
"$internal_plugin_artifact"
install -m 0644 \
"$stage/share/echoion/bootstrap-plugins/url-shortener-external/$version/url-shortener-external.so" \
"$external_plugin_artifact"
if [[ -n $update_url ]]; then if [[ -n $update_url ]]; then
feed_args=( feed_args=(
--artifact "$archive" --artifact "$archive"
@@ -563,6 +593,35 @@ if [[ -n $update_url ]]; then
[[ -z $update_sequence ]] || [[ -z $update_sequence ]] ||
feed_args+=(--sequence "$update_sequence") feed_args+=(--sequence "$update_sequence")
python3 "$source_dir/scripts/generate-update-feed.py" "${feed_args[@]}" python3 "$source_dir/scripts/generate-update-feed.py" "${feed_args[@]}"
artifact_url_root=${update_url%/*}
component_feed_args=(
--version "$version"
--channel "$update_channel"
--feed-id "$update_feed_id"
--valid-days "$update_valid_days"
)
[[ -z $update_sequence ]] ||
component_feed_args+=(--sequence "$update_sequence")
python3 "$source_dir/scripts/generate-update-feed.py" \
--artifact "$core_artifact" \
--component core \
--url "$artifact_url_root/$(basename "$core_artifact")" \
--output-payload "$core_feed_payload" \
"${component_feed_args[@]}"
python3 "$source_dir/scripts/generate-update-feed.py" \
--artifact "$internal_plugin_artifact" \
--component plugin \
--artifact-id url-shortener-internal \
--url "$artifact_url_root/$(basename "$internal_plugin_artifact")" \
--output-payload "$internal_plugin_feed_payload" \
"${component_feed_args[@]}"
python3 "$source_dir/scripts/generate-update-feed.py" \
--artifact "$external_plugin_artifact" \
--component plugin \
--artifact-id url-shortener-external \
--url "$artifact_url_root/$(basename "$external_plugin_artifact")" \
--output-payload "$external_plugin_feed_payload" \
"${component_feed_args[@]}"
fi fi
( (
cd "$dist_dir" cd "$dist_dir"
@@ -570,9 +629,17 @@ fi
"$(basename "$archive")" \ "$(basename "$archive")" \
"$(basename "$installer")" \ "$(basename "$installer")" \
"$(basename "$external_manifest")" \ "$(basename "$external_manifest")" \
"$(basename "$external_report")" "$(basename "$external_report")" \
"$(basename "$core_artifact")" \
"$(basename "$internal_plugin_artifact")" \
"$(basename "$external_plugin_artifact")"
)
[[ -z $update_url ]] || checksum_files+=(
"$(basename "$feed_payload")"
"$(basename "$core_feed_payload")"
"$(basename "$internal_plugin_feed_payload")"
"$(basename "$external_plugin_feed_payload")"
) )
[[ -z $update_url ]] || checksum_files+=("$(basename "$feed_payload")")
sha256sum "${checksum_files[@]}" >SHA256SUMS sha256sum "${checksum_files[@]}" >SHA256SUMS
) )
@@ -581,5 +648,13 @@ echo " $archive"
echo " $installer" echo " $installer"
echo " $external_manifest" echo " $external_manifest"
echo " $external_report" echo " $external_report"
[[ -z $update_url ]] || echo " $feed_payload" echo " $core_artifact"
echo " $internal_plugin_artifact"
echo " $external_plugin_artifact"
if [[ -n $update_url ]]; then
echo " $feed_payload"
echo " $core_feed_payload"
echo " $internal_plugin_feed_payload"
echo " $external_plugin_feed_payload"
fi
echo " $dist_dir/SHA256SUMS" echo " $dist_dir/SHA256SUMS"
+87
View File
@@ -0,0 +1,87 @@
#!/usr/bin/env python3
"""Clone the independently versioned Echoion component repositories."""
from __future__ import annotations
import argparse
import json
import subprocess
from pathlib import Path
def run(*args: str, cwd: Path | None = None) -> None:
subprocess.run(args, cwd=cwd, check=True)
def output(*args: str, cwd: Path) -> str:
return subprocess.check_output(args, cwd=cwd, text=True).strip()
def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument(
"--update",
action="store_true",
help="fetch and check out locked revisions in existing clean repositories",
)
parser.add_argument(
"--record",
action="store_true",
help="record the current clean component HEADs in components.lock.json",
)
args = parser.parse_args()
if args.update and args.record:
parser.error("--update and --record are mutually exclusive")
root = Path(__file__).resolve().parents[1]
lock_path = root / "components.lock.json"
lock = json.loads(lock_path.read_text())
if lock.get("schemaVersion") != 1:
raise SystemExit("unsupported components.lock.json schema")
if args.record:
for name, component in lock["components"].items():
destination = root / name
if not (destination / ".git").exists():
raise SystemExit(f"component repository is missing: {destination}")
if output("git", "status", "--porcelain", cwd=destination):
raise SystemExit(
f"refusing to record dirty repository: {destination}"
)
component["revision"] = output(
"git", "rev-parse", "HEAD", cwd=destination
)
temporary = lock_path.with_suffix(".json.tmp")
temporary.write_text(json.dumps(lock, indent=2) + "\n")
temporary.replace(lock_path)
return 0
for name, component in lock["components"].items():
destination = root / name
revision = component["revision"]
if not destination.exists():
run(
"git",
"clone",
"--no-checkout",
component["url"],
str(destination),
)
run("git", "fetch", "--depth=1", "origin", revision, cwd=destination)
run("git", "checkout", "--detach", "FETCH_HEAD", cwd=destination)
continue
if not (destination / ".git").exists():
raise SystemExit(f"{destination} exists but is not a Git repository")
if not args.update:
continue
if output("git", "status", "--porcelain", cwd=destination):
raise SystemExit(f"refusing to update dirty repository: {destination}")
run("git", "fetch", "origin", revision, cwd=destination)
run("git", "checkout", "--detach", revision, cwd=destination)
return 0
if __name__ == "__main__":
raise SystemExit(main())
+4
View File
@@ -63,6 +63,7 @@ mkdir -p \
"$bundle/bin" \ "$bundle/bin" \
"$bundle/lib" \ "$bundle/lib" \
"$bundle/service" \ "$bundle/service" \
"$bundle/share/echoion/certs" \
"$bundle/share/echoion/web" \ "$bundle/share/echoion/web" \
"$bundle/share/echoion/tools" "$bundle/share/echoion/tools"
install -m 0755 /bin/true "$bundle/bin/echoiond" install -m 0755 /bin/true "$bundle/bin/echoiond"
@@ -74,6 +75,8 @@ printf '%s\n' '[Service]' >"$bundle/service/echoion.service.in"
printf '%s\n' '[Service]' >"$bundle/service/echoion-updater.service.in" printf '%s\n' '[Service]' >"$bundle/service/echoion-updater.service.in"
printf '%s\n' '[Timer]' >"$bundle/service/echoion-updater.timer.in" printf '%s\n' '[Timer]' >"$bundle/service/echoion-updater.timer.in"
printf '%s\n' '{}' >"$bundle/share/echoion/config.example.json" printf '%s\n' '{}' >"$bundle/share/echoion/config.example.json"
printf '%s\n' 'test trust bundle' \
>"$bundle/share/echoion/certs/ca-certificates.crt"
install -m 0755 "$source_root/scripts/validate-release-manifest.py" \ install -m 0755 "$source_root/scripts/validate-release-manifest.py" \
"$bundle/share/echoion/tools/validate-release-manifest.py" "$bundle/share/echoion/tools/validate-release-manifest.py"
ln -s Echoion.ts "$bundle/lib/Echoion-current.ts" ln -s Echoion.ts "$bundle/lib/Echoion-current.ts"
@@ -117,6 +120,7 @@ assert manifest["core"] == "lib/Echoion.ts"
paths = [entry["path"] for entry in manifest["files"]] paths = [entry["path"] for entry in manifest["files"]]
assert paths == sorted(paths) assert paths == sorted(paths)
assert "share/echoion/web/index.html" in paths assert "share/echoion/web/index.html" in paths
assert "share/echoion/certs/ca-certificates.crt" in paths
link = next(entry for entry in manifest["files"] if entry["path"].endswith("current.ts")) link = next(entry for entry in manifest["files"] if entry["path"].endswith("current.ts"))
assert link == { assert link == {
"path": "lib/Echoion-current.ts", "path": "lib/Echoion-current.ts",
+35 -4
View File
@@ -7,7 +7,7 @@ if [[ $# != 1 ]]; then
fi fi
source_root=$(realpath -e -- "$1") source_root=$(realpath -e -- "$1")
for command_name in cmake patchelf readelf python3; do for command_name in cmake ldd patchelf readelf python3; do
command -v "$command_name" >/dev/null || { command -v "$command_name" >/dev/null || {
echo "missing test command: $command_name" >&2 echo "missing test command: $command_name" >&2
exit 2 exit 2
@@ -147,7 +147,8 @@ cmake \
"-DBUNDLE_SEED_FILES=$seed_lib/libstdc++.so.6" \ "-DBUNDLE_SEED_FILES=$seed_lib/libstdc++.so.6" \
"-DPATCHELF_EXECUTABLE=$(command -v patchelf)" \ "-DPATCHELF_EXECUTABLE=$(command -v patchelf)" \
-P "$source_root/cmake/BundleRuntimeDependencies.cmake" -P "$source_root/cmake/BundleRuntimeDependencies.cmake"
patchelf --set-rpath "\$ORIGIN/../../../../../lib" "$bundle_plugin" plugin_runpath="\$ORIGIN/../../../../../../current/lib:\$ORIGIN/../../current/lib:\$ORIGIN/lib"
patchelf --set-rpath "$plugin_runpath" "$bundle_plugin"
python3 - "$source_root/scripts/validate-release-elf.py" <<'PY' python3 - "$source_root/scripts/validate-release-elf.py" <<'PY'
import importlib.util import importlib.util
@@ -230,8 +231,38 @@ if python3 "$source_root/scripts/validate-release-elf.py" \
fi fi
grep -F $'NEEDED\tlib/Echoion.ts\tlibechoion-dependency.so.1\tbundled' "$report" grep -F $'NEEDED\tlib/Echoion.ts\tlibechoion-dependency.so.1\tbundled' "$report"
grep -F $'NEEDED\tbin/echoiond\tlibc.so.6\tsystem' "$report" grep -F $'NEEDED\tbin/echoiond\tlibc.so.6\tsystem' "$report"
grep -F $'ELF\tshare/echoion/bootstrap-plugins/fixture-shortener/1.0.0/fixture-shortener.so\tRUNPATH=$ORIGIN/../../../../../lib' "$report" grep -F \
$'ELF\tshare/echoion/bootstrap-plugins/fixture-shortener/1.0.0/fixture-shortener.so\tRUNPATH=$ORIGIN/../../../../../../current/lib:$ORIGIN/../../current/lib:$ORIGIN/lib' \
"$report"
grep -F $'NEEDED\tshare/echoion/bootstrap-plugins/fixture-shortener/1.0.0/fixture-shortener.so\tlibechoion-dependency.so.1\tbundled' "$report" grep -F $'NEEDED\tshare/echoion/bootstrap-plugins/fixture-shortener/1.0.0/fixture-shortener.so\tlibechoion-dependency.so.1\tbundled' "$report"
installed="$temporary/installed"
managed_plugin="$installed/state/plugins/.managed/fixture-shortener/versions/1.0.0/fixture-shortener.so"
portable_plugin="$installed/state/plugins/fixture-shortener.so"
mkdir -p "$installed/current/lib" "$(dirname -- "$managed_plugin")" \
"$(dirname -- "$portable_plugin")"
cp -a "$bundle/lib/." "$installed/current/lib/"
cp "$bundle_plugin" "$managed_plugin"
cp "$bundle_plugin" "$portable_plugin"
for installed_plugin in "$managed_plugin" "$portable_plugin"; do
ldd_report="$temporary/$(basename -- "$(dirname -- "$installed_plugin")").ldd"
env -u LD_LIBRARY_PATH ldd "$installed_plugin" >"$ldd_report" 2>&1
resolved_dependency=$(awk '
$1 == "libechoion-dependency.so.1" && $2 == "=>" {
print $3
exit
}
' "$ldd_report")
[[ -n $resolved_dependency ]]
[[ $(realpath -e -- "$resolved_dependency") == \
$(realpath -e -- "$installed/current/lib/libechoion-dependency.so.1") ]]
if grep -Fq 'not found' "$ldd_report"; then
echo "installed plugin did not resolve its bundled dependency closure" >&2
cat "$ldd_report" >&2
exit 1
fi
done
if python3 "$source_root/scripts/validate-release-elf.py" \ if python3 "$source_root/scripts/validate-release-elf.py" \
--root "$bundle" \ --root "$bundle" \
--forbid-content-prefix /tmp/echoion-plugin-forbidden-build-path \ --forbid-content-prefix /tmp/echoion-plugin-forbidden-build-path \
@@ -266,7 +297,7 @@ if python3 "$source_root/scripts/validate-release-elf.py" \
echo "incorrect bootstrap plugin RUNPATH unexpectedly passed validation" >&2 echo "incorrect bootstrap plugin RUNPATH unexpectedly passed validation" >&2
exit 1 exit 1
fi fi
patchelf --set-rpath "\$ORIGIN/../../../../../lib" "$bundle_plugin" patchelf --set-rpath "$plugin_runpath" "$bundle_plugin"
patchelf --set-rpath /tmp/unsafe-build-path "$bundle/lib/Echoion.ts" patchelf --set-rpath /tmp/unsafe-build-path "$bundle/lib/Echoion.ts"
if python3 "$source_root/scripts/validate-release-elf.py" \ if python3 "$source_root/scripts/validate-release-elf.py" \
@@ -178,6 +178,34 @@ class AggregateUpdateFeedTest(unittest.TestCase):
self.assertNotEqual(collision.returncode, 0) self.assertNotEqual(collision.returncode, 0)
self.assertIn("immutable release identity", collision.stderr) self.assertIn("immutable release identity", collision.stderr)
def test_multiple_component_payloads_are_signed_together(self) -> None:
runtime_payload = self.root / "runtime.json"
core_payload = self.root / "core.json"
runtime_release = release("1.2.3", "stable")
core_release = {
**release("1.2.3", "stable"),
"component": "core",
"url": "https://updates.example.invalid/echoion-core-1.2.3.so",
"packageType": "shared-library",
}
core_release.pop("releaseManifestSha256")
payload(runtime_payload, [runtime_release], 100)
payload(core_payload, [core_release], 100)
output = self.root / "components-output.json"
self.run_script(
runtime_payload,
output,
self.root / "components-envelope.json",
"--new-payload",
os.fspath(core_payload),
)
releases = json.loads(output.read_text(encoding="utf-8"))["releases"]
self.assertEqual(
{(item["component"], item["version"]) for item in releases},
{("runtime", "1.2.3"), ("core", "1.2.3")},
)
def test_tampered_existing_envelope_is_rejected(self) -> None: def test_tampered_existing_envelope_is_rejected(self) -> None:
first = self.root / "first.json" first = self.root / "first.json"
first_output = self.root / "first-output.json" first_output = self.root / "first-output.json"
+5 -1
View File
@@ -44,7 +44,11 @@ PLUGIN_VERSION_PATTERN = re.compile(
r"(?:-(?:0|[1-9][0-9]*|[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*)" r"(?:-(?:0|[1-9][0-9]*|[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*)"
r"(?:\.(?:0|[1-9][0-9]*|[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*))*)?$" r"(?:\.(?:0|[1-9][0-9]*|[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*))*)?$"
) )
PLUGIN_RUNPATH = "$ORIGIN/../../../../../lib" PLUGIN_RUNPATH = (
"$ORIGIN/../../../../../../current/lib:"
"$ORIGIN/../../current/lib:"
"$ORIGIN/lib"
)
def parse_version(value: str) -> tuple[int, ...]: def parse_version(value: str) -> tuple[int, ...]:
+1
View File
@@ -172,6 +172,7 @@ def load_and_validate(root: Path, expected_version: str | None = None) -> dict:
"core": "lib/Echoion.ts", "core": "lib/Echoion.ts",
"web dashboard": "share/echoion/web/index.html", "web dashboard": "share/echoion/web/index.html",
"configuration template": "share/echoion/config.example.json", "configuration template": "share/echoion/config.example.json",
"TLS trust bundle": "share/echoion/certs/ca-certificates.crt",
"manifest validator": "share/echoion/tools/validate-release-manifest.py", "manifest validator": "share/echoion/tools/validate-release-manifest.py",
"service template": "service/echoion.service.in", "service template": "service/echoion.service.in",
"updater service template": "service/echoion-updater.service.in", "updater service template": "service/echoion-updater.service.in",