build / windows (push) Skipped
build / other_os (push) Skipped
build / mac_amd64 (push) Skipped
build / mac_arm64 (push) Skipped
build / linux (push) Skipped
build / go1.26 (push) Skipped
build / linux_386 (push) Skipped
build / lint (push) Skipped
build / android-all (push) Skipped
Build & Push Docker Images / Build Docker Image for linux/386 (push) Skipped
Build & Push Docker Images / Build Docker Image for linux/amd64 (push) Skipped
Build & Push Docker Images / Build Docker Image for linux/arm/v6 (push) Skipped
Build & Push Docker Images / Build Docker Image for linux/arm/v7 (push) Skipped
Build & Push Docker Images / Build Docker Image for linux/arm64 (push) Skipped
Build & Push Docker Images / Merge & Push Final Docker Image (push) Waiting for needed jobs
Replace Proton-API-Bridge and go-proton-api with a client in backend/protondrive written against Proton's current Drive API, following the behaviour of Proton's official Drive SDK: - volume-based and v2 routes only - upload block verification, signed manifests and extended attributes - current content encryption (v4 node keys, v6 PKESK, SEIPDv2) - browser (session fork) sign-in, with username and password still supported - the volume's change events, used to keep the metadata cache current and for ChangeNotify, polled at most every 30 s - an in-memory fake Proton server (protontest) so the tests run without an account Uses ProtonMail/gopenpgp/v3 and ProtonMail/go-srp directly; no cgo. Written with heavy AI assistance (Claude Code). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
82 lines
2.4 KiB
Bash
Executable File
82 lines
2.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Start the fake Proton Drive server (backend/protondrive/protontest).
|
|
#
|
|
# protonfake mints a signed in session when it starts and prints it as
|
|
# key=value lines on stdout, so the script builds it, captures that
|
|
# output and passes it on. Every user of the server shares the session.
|
|
|
|
set -e
|
|
|
|
NAME=TestProtonDriveFake
|
|
IP=127.0.0.1
|
|
PORT=28642
|
|
|
|
# This script lives in fstest/testserver/init.d; it is run from each
|
|
# test package's directory, so find the repository from here.
|
|
REPO_ROOT=$(cd "$(dirname "$0")/../../.." && pwd)
|
|
|
|
start() {
|
|
local bin="${RUN_STATE}/protonfake"
|
|
local out="${RUN_STATE}/protonfake.out"
|
|
# A built binary, not "go run", so the pid is the server's own.
|
|
(cd "${REPO_ROOT}" && go build -o "${bin}" ./backend/protondrive/protontest/cmd/protonfake) >&2
|
|
: > "${out}"
|
|
nohup "${bin}" -addr "${IP}:${PORT}" > "${out}" 2>> "${RUN_STATE}/protonfake.log" </dev/null &
|
|
local pid=$!
|
|
echo "${pid}" > "${RUN_STATE}/pid"
|
|
disown "${pid}"
|
|
|
|
# protonfake prints its config, type= last, once it is listening.
|
|
local _
|
|
for _ in $(seq 1 100); do
|
|
if grep -q '^type=' "${out}"; then
|
|
cat "${out}"
|
|
echo "_connect=${IP}:${PORT}"
|
|
return 0
|
|
fi
|
|
if ! kill -0 "${pid}" 2>/dev/null; then
|
|
echo "protonfake exited: $(cat "${RUN_STATE}/protonfake.log")" >&2
|
|
return 1
|
|
fi
|
|
sleep 0.1
|
|
done
|
|
echo "protonfake printed no config within 10s" >&2
|
|
stop
|
|
return 1
|
|
}
|
|
|
|
stop() {
|
|
if status; then
|
|
local pid
|
|
pid=$(cat "${RUN_STATE}/pid")
|
|
kill "${pid}"
|
|
# protonfake finishes its requests on SIGTERM; wait so the port
|
|
# is free for the next start, and kill it if it takes over 10s.
|
|
local _
|
|
for _ in $(seq 1 100); do
|
|
kill -0 "${pid}" 2>/dev/null || break
|
|
sleep 0.1
|
|
done
|
|
if kill -0 "${pid}" 2>/dev/null; then
|
|
echo "${NAME} didn't stop within 10s: killing it" >&2
|
|
kill -9 "${pid}" 2>/dev/null || true
|
|
fi
|
|
rm -f "${RUN_STATE}/pid"
|
|
echo "${NAME} stopped"
|
|
fi
|
|
}
|
|
|
|
status() {
|
|
if [ -e "${RUN_STATE}/pid" ]; then
|
|
if kill -0 "$(cat "${RUN_STATE}/pid")" >/dev/null 2>&1; then
|
|
return 0
|
|
fi
|
|
rm -f "${RUN_STATE}/pid"
|
|
fi
|
|
return 1
|
|
}
|
|
|
|
# shellcheck disable=SC1091
|
|
. "$(dirname "$0")/run.bash"
|