WordPress makes two assumptions this project cannot accept: that identity comes from an email address, and that a site lives at one server. Both are things somebody else can take away — a mailbox is rented from a provider who can close it or be compelled to open it, and a server is one seizure from being gone. Sirius Press replaces the first and hedges the second. Signing in means signing a challenge with the key that controls a CashAddress. The address is recovered from the signature, so nothing is typed but the signature itself, and the result is an ordinary WordPress session cookie — roles, capabilities, nonces and the REST API never learn the login was different. Three ways to produce one: a wallet the browser already exposes, a phrase used once in the page and wiped, or a signature pasted in from any BIP-137 wallet, which needs no JavaScript and lets the key stay on a machine that never touches the web. There is no password reset, and the recovery page says so plainly rather than offering a form that cannot work. A reset mechanism is by construction a way to take an account from its owner, and it is always easier to attack than the cryptography it bypasses. Publishing a post also exports it as static HTML to the name's storage on Sia, signed by the key that owns the name, so the site keeps answering when the server does not. Email as a feature is untouched. wp_mail() still works, SMTP still sends, and contact forms still deliver to addresses real people typed. Only mail to the site's own unroutable placeholder addresses is diverted to an in-app inbox. The objection was to email as identity, not to email. Core is pinned and patched rather than vendored. WordPress 7.1.1 is 149 MB and 5,008 files; the fork's entire core diff is 75 lines in wp-admin/install.php. Carrying the former to express the latter would bury the patch where nobody reviews it and make every clone of the monorepo pay for it. Upstream releases still merge through tools/update-wordpress.sh, which reapplies the series and says exactly which hunk needs a human. The cryptography is implemented twice — PHP on the server, JavaScript in the page — because the server must verify and the browser must sign. Both are pinned against libauth, the library the Sirius portal wallet and the BNS gateway already use, so a disagreement of one byte fails the test suite rather than presenting as a rejected login at three in the morning. 132 checks, no framework, about a second.
141 lines
5.1 KiB
Bash
141 lines
5.1 KiB
Bash
#!/usr/bin/env bash
|
|
# publish-release.sh — put a built release on both mirrors.
|
|
#
|
|
# tools/publish-release.sh # build, then publish
|
|
# tools/publish-release.sh --dry-run # say what would happen
|
|
#
|
|
# A Silent Mode release is not shipped until it exists in both places:
|
|
#
|
|
# silentmode.st over scp, served by nginx on the VPS
|
|
# silentmode.bch on Sia, reached through any BCNR resolver
|
|
#
|
|
# Publishing to only one is the recurring mistake this script exists to
|
|
# prevent. A release on silentmode.st alone is a release that disappears when
|
|
# the VPS does, which rather undercuts the argument the project is making.
|
|
|
|
set -euo pipefail
|
|
|
|
here="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
cd "$here"
|
|
|
|
SSH_HOST="${SIRIUS_SSH_HOST:-silentmode}"
|
|
WEB_ROOT="${SIRIUS_WEB_ROOT:-/opt/silent-mode/site/sirius-press}"
|
|
S3_ENDPOINT="${SIRIUS_S3_ENDPOINT:-https://s3.silentmode.st:8600}"
|
|
S3_PREFIX="${SIRIUS_S3_PREFIX:-s3://bns/silentmode/sirius-press}"
|
|
AWS_PROFILE_NAME="${SIRIUS_AWS_PROFILE:-sia-storage}"
|
|
DRY=0
|
|
|
|
for arg in "$@"; do
|
|
case "$arg" in
|
|
--dry-run) DRY=1 ;;
|
|
*) echo "unknown option: $arg" >&2; exit 2 ;;
|
|
esac
|
|
done
|
|
|
|
say() { printf '\033[1m→\033[0m %s\n' "$*"; }
|
|
warn() { printf '\033[33mwarning:\033[0m %s\n' "$*" >&2; }
|
|
die() { printf '\033[31merror:\033[0m %s\n' "$*" >&2; exit 1; }
|
|
run() { if [ "$DRY" -eq 1 ]; then printf ' would run: %s\n' "$*"; else "$@"; fi; }
|
|
|
|
VERSION="$(grep -m1 "^ \* Version:" plugins/sirius-press-core/sirius-press-core.php | awk '{print $3}')"
|
|
[ -n "$VERSION" ] || die "could not read the version out of sirius-press-core.php"
|
|
|
|
ARCHIVE="dist/sirius-press-${VERSION}.zip"
|
|
|
|
# ------------------------------------------------------------------- build
|
|
|
|
if [ ! -f "$ARCHIVE" ]; then
|
|
say "building $VERSION"
|
|
[ "$DRY" -eq 1 ] && { echo " would run: tools/build.sh --zip"; } || tools/build.sh --zip
|
|
fi
|
|
[ "$DRY" -eq 1 ] || [ -f "$ARCHIVE" ] || die "$ARCHIVE was not produced"
|
|
|
|
if [ -f "$ARCHIVE" ]; then
|
|
SHA="$(cat "${ARCHIVE}.sha256" 2>/dev/null || sha256sum "$ARCHIVE" | cut -d' ' -f1)"
|
|
say "$(basename "$ARCHIVE") — $(du -h "$ARCHIVE" | cut -f1), sha256 ${SHA}"
|
|
else
|
|
SHA="(not built)"
|
|
fi
|
|
|
|
# ---------------------------------------------------------------- manifest
|
|
|
|
MANIFEST="dist/releases.json"
|
|
say "writing $(basename "$MANIFEST")"
|
|
if [ "$DRY" -eq 0 ]; then
|
|
cat > "$MANIFEST" <<EOF
|
|
{
|
|
"product": "sirius-press",
|
|
"latest": "${VERSION}",
|
|
"updated": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
|
|
"releases": [
|
|
{
|
|
"version": "${VERSION}",
|
|
"zip": "sirius-press-${VERSION}.zip",
|
|
"sha256": "${SHA}",
|
|
"wordpress": "$(grep -m1 '^WP_VERSION=' tools/wordpress.lock | cut -d= -f2)",
|
|
"install": "https://silentmode.st/sirius-press/install.sh"
|
|
}
|
|
]
|
|
}
|
|
EOF
|
|
fi
|
|
|
|
# --------------------------------------------------------- mirror 1: the VPS
|
|
|
|
say "publishing to silentmode.st"
|
|
command -v ssh >/dev/null || die "ssh is required"
|
|
run ssh "$SSH_HOST" "mkdir -p ${WEB_ROOT}"
|
|
run scp "$ARCHIVE" "${SSH_HOST}:${WEB_ROOT}/"
|
|
run scp "${ARCHIVE}.sha256" "${SSH_HOST}:${WEB_ROOT}/"
|
|
run scp "$MANIFEST" "${SSH_HOST}:${WEB_ROOT}/releases.json"
|
|
run scp install.sh "${SSH_HOST}:${WEB_ROOT}/install.sh"
|
|
|
|
# --------------------------------------------------------- mirror 2: Sia
|
|
|
|
say "publishing to silentmode.bch"
|
|
if ! command -v aws >/dev/null; then
|
|
warn "the aws CLI is not installed, so the Sia mirror was skipped.
|
|
This release is NOT shipped until it is on both. Install awscli and run:
|
|
aws --profile ${AWS_PROFILE_NAME} --endpoint-url ${S3_ENDPOINT} s3 cp ${ARCHIVE} ${S3_PREFIX}/"
|
|
else
|
|
run aws --profile "$AWS_PROFILE_NAME" --endpoint-url "$S3_ENDPOINT" \
|
|
s3 cp "$ARCHIVE" "${S3_PREFIX}/" --only-show-errors
|
|
run aws --profile "$AWS_PROFILE_NAME" --endpoint-url "$S3_ENDPOINT" \
|
|
s3 cp "${ARCHIVE}.sha256" "${S3_PREFIX}/" --only-show-errors
|
|
run aws --profile "$AWS_PROFILE_NAME" --endpoint-url "$S3_ENDPOINT" \
|
|
s3 cp "$MANIFEST" "${S3_PREFIX}/releases.json" --only-show-errors
|
|
run aws --profile "$AWS_PROFILE_NAME" --endpoint-url "$S3_ENDPOINT" \
|
|
s3 cp install.sh "${S3_PREFIX}/install.sh" --only-show-errors
|
|
fi
|
|
|
|
# ------------------------------------------------------------------ verify
|
|
|
|
if [ "$DRY" -eq 0 ]; then
|
|
say "checking both mirrors actually have it"
|
|
st_code="$(curl -fsS -o /dev/null -w '%{http_code}' --max-time 20 \
|
|
"https://silentmode.st/sirius-press/$(basename "$ARCHIVE")" 2>/dev/null || echo 000)"
|
|
[ "$st_code" = "200" ] \
|
|
&& echo " ok silentmode.st" \
|
|
|| warn "silentmode.st returned ${st_code} for the archive"
|
|
|
|
if command -v aws >/dev/null; then
|
|
aws --profile "$AWS_PROFILE_NAME" --endpoint-url "$S3_ENDPOINT" \
|
|
s3 ls "${S3_PREFIX}/$(basename "$ARCHIVE")" >/dev/null 2>&1 \
|
|
&& echo " ok silentmode.bch" \
|
|
|| warn "the archive is not listed on the Sia mirror"
|
|
fi
|
|
fi
|
|
|
|
cat <<EOF
|
|
|
|
Sirius Press ${VERSION} published.
|
|
|
|
https://silentmode.st/sirius-press/
|
|
silentmode.bch/sirius-press/
|
|
|
|
Still to do by hand:
|
|
- tag the forge repo: git tag -a v${VERSION} -m "Sirius Press ${VERSION}"
|
|
- attach $(basename "$ARCHIVE") to the release on
|
|
https://code.silentmode.st/silentmode/sirius-press/releases
|
|
|
|
EOF
|