mirror of
https://github.com/burrow-dev/burrow-client.git
synced 2026-11-18 17:37:50 -05:00
Brought up to date with the private repository (6630f7f)
This commit is contained in:
commit
c8178dce98
26 files changed
+6314
No files matched your search
@@ -0,0 +1,64 @@
|
||||
#!/bin/bash
|
||||
# makes the macOS disk image players get: dist/Burrow-macos.dmg, Burrow beside a
|
||||
# shortcut to Applications to drag it onto. run it on a Mac (BUILDING.md).
|
||||
#
|
||||
# tools/build-mac.sh [--server https://play.burrow.moe] [--flash /path/to/PepperFlashPlayer.plugin]
|
||||
#
|
||||
# not yet run by anyone: written on linux from electron's layout.
|
||||
set -euo pipefail
|
||||
|
||||
here=$(cd "$(dirname "$0")/.." && pwd)
|
||||
version=11.5.0
|
||||
server="https://play.burrow.moe" # --server for another (http://127.0.0.1:8080 to try a build here)
|
||||
flash=$here/flash/PepperFlashPlayer.plugin
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--server) server=$2; shift 2 ;;
|
||||
--flash) flash=$2; shift 2 ;;
|
||||
*) echo "unknown argument: $1" >&2; exit 2 ;;
|
||||
esac
|
||||
done
|
||||
[ -d "$flash" ] || { echo "no flash plugin at $flash (BUILDING.md says where to get it)" >&2; exit 1; }
|
||||
|
||||
dist=$here/dist
|
||||
work=$(mktemp -d)
|
||||
mkdir -p "$dist"
|
||||
cd "$work"
|
||||
|
||||
base=https://github.com/electron/electron/releases/download/v$version
|
||||
zip=electron-v$version-darwin-x64.zip
|
||||
curl -fLO "$base/$zip"
|
||||
curl -fLO "$base/SHASUMS256.txt"
|
||||
grep " \*$zip\$" SHASUMS256.txt | shasum -a 256 -c -
|
||||
|
||||
# ditto keeps the symlinks inside the frameworks, which unzip may not
|
||||
ditto -x -k "$zip" .
|
||||
mv Electron.app Burrow.app
|
||||
res=Burrow.app/Contents/Resources
|
||||
rm -f "$res/default_app.asar"
|
||||
cp -R "$here/app" "$res/app"
|
||||
mkdir "$res/flash"
|
||||
cp -R "$flash" "$res/flash/PepperFlashPlayer.plugin"
|
||||
if [ -n "$server" ]; then
|
||||
printf '{"server": "%s"}\n' "$server" > "$res/app/build.json"
|
||||
fi
|
||||
|
||||
plist=Burrow.app/Contents/Info.plist
|
||||
/usr/libexec/PlistBuddy -c "Set :CFBundleName Burrow" -c "Set :CFBundleDisplayName Burrow" -c "Set :CFBundleIdentifier software.burrow.client" "$plist"
|
||||
|
||||
mkdir icon.iconset
|
||||
for size in 16 32 128 256; do
|
||||
sips -z $size $size "$here/app/icon.png" --out icon.iconset/icon_${size}x${size}.png >/dev/null
|
||||
sips -z $((size * 2)) $((size * 2)) "$here/app/icon.png" --out icon.iconset/icon_${size}x${size}@2x.png >/dev/null
|
||||
done
|
||||
iconutil -c icns icon.iconset -o "$res/electron.icns"
|
||||
|
||||
# unsigned by a developer; an ad-hoc signature at least keeps the bundle whole
|
||||
codesign --force --deep --sign - Burrow.app
|
||||
|
||||
mkdir image
|
||||
mv Burrow.app image/
|
||||
ln -s /Applications image/Applications
|
||||
rm -f "$dist/Burrow-macos.dmg"
|
||||
hdiutil create -volname Burrow -srcfolder image -ov -format UDZO "$dist/Burrow-macos.dmg"
|
||||
shasum -a 256 "$dist/Burrow-macos.dmg"
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
#!/usr/bin/env bash
|
||||
# makes the installers players get, into dist/:
|
||||
# Burrow-Setup.exe (windows), Burrow-x86_64.AppImage, burrow_amd64.deb, burrow.x86_64.rpm (linux)
|
||||
#
|
||||
# tools/build.sh [--server https://play.burrow.moe] [linux] [windows]
|
||||
#
|
||||
# needs electron/, electron-win/ and flash/ beside app/, tools/bin/rcedit-x64.exe,
|
||||
# installer/node_modules (npm install in installer/) and rpmbuild (BUILDING.md).
|
||||
# the windows wizard is installer/burrow.nsi; the linux packages, installer/builder.config.js.
|
||||
# the macOS one is tools/build-mac.sh, run on a Mac.
|
||||
set -euo pipefail
|
||||
|
||||
here=$(cd "$(dirname "$0")/.." && pwd)
|
||||
server="https://play.burrow.moe" # --server for another (http://127.0.0.1:8080 to try a build here)
|
||||
targets=()
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--server) server=$2; shift 2 ;;
|
||||
linux|windows) targets+=("$1"); shift ;;
|
||||
*) echo "unknown argument: $1" >&2; exit 2 ;;
|
||||
esac
|
||||
done
|
||||
[ ${#targets[@]} -gt 0 ] || targets=(linux windows)
|
||||
if [ -n "$server" ] && ! [[ $server =~ ^https?://[^[:space:]]+$ ]]; then
|
||||
echo "--server wants an http(s) address" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
need() {
|
||||
[ -e "$1" ] || { echo "missing $1 (BUILDING.md)" >&2; exit 1; }
|
||||
}
|
||||
need "$here/installer/node_modules/.bin/electron-builder"
|
||||
|
||||
version=$(sed -n 's/.*"version": *"\([^"]*\)".*/\1/p' "$here/app/package.json")
|
||||
dist=$here/dist
|
||||
work=$(mktemp -d)
|
||||
trap 'rm -rf "$work"' EXIT
|
||||
mkdir -p "$dist"
|
||||
|
||||
# the app as players get it, with the server's address
|
||||
cp -r "$here/app" "$work/app"
|
||||
if [ -n "$server" ]; then
|
||||
printf '{"server": "%s"}\n' "$server" > "$work/app/build.json"
|
||||
fi
|
||||
|
||||
# electron.exe gets the logo and the name Burrow before electron-builder
|
||||
# renames it. rcedit is a windows program: run through wsl, or wine elsewhere.
|
||||
stamp() {
|
||||
local rcedit=$here/tools/bin/rcedit-x64.exe exe=$1 ico=$here/tools/icon.ico
|
||||
need "$rcedit"
|
||||
local run=("$rcedit")
|
||||
if grep -qi microsoft /proc/version 2>/dev/null; then
|
||||
exe=$(wslpath -w "$exe")
|
||||
ico=$(wslpath -w "$ico")
|
||||
elif command -v wine >/dev/null; then
|
||||
run=(wine "$rcedit")
|
||||
else
|
||||
echo "setting Burrow.exe's icon needs WSL or wine" >&2
|
||||
exit 1
|
||||
fi
|
||||
"${run[@]}" "$exe" --set-icon "$ico" --set-file-version "$version" --set-product-version "$version" \
|
||||
--set-version-string ProductName Burrow --set-version-string FileDescription Burrow \
|
||||
--set-version-string InternalName Burrow --set-version-string OriginalFilename Burrow.exe \
|
||||
--set-version-string CompanyName Burrow --set-version-string LegalCopyright ""
|
||||
}
|
||||
|
||||
# electron-builder makes the linux packages
|
||||
builder() {
|
||||
(cd "$here/installer" && BURROW_APP="$work/app" BURROW_OUT="$work/out" BURROW_ELECTRON="$1" BURROW_HOMEPAGE="$server" \
|
||||
npx --no-install electron-builder --config builder.config.js "${@:2}")
|
||||
}
|
||||
|
||||
for target in "${targets[@]}"; do
|
||||
case "$target" in
|
||||
windows)
|
||||
need "$here/electron-win/electron.exe"
|
||||
need "$here/flash/pepflashplayer.dll"
|
||||
win=$work/windows
|
||||
cp -r "$here/electron-win" "$win"
|
||||
rm -f "$win/resources/default_app.asar"
|
||||
cp -r "$work/app" "$win/resources/app"
|
||||
mkdir -p "$win/resources/flash"
|
||||
cp "$here/flash/pepflashplayer.dll" "$win/resources/flash/"
|
||||
mv "$win/electron.exe" "$win/Burrow.exe"
|
||||
stamp "$win/Burrow.exe"
|
||||
# what the uninstaller takes away: the files and folders put there, by name
|
||||
(cd "$win" && for name in *; do
|
||||
if [ -d "$name" ]; then printf 'RMDir /r "$INSTDIR\\%s"\n' "$name"; else printf 'Delete "$INSTDIR\\%s"\n' "$name"; fi
|
||||
done) > "$work/files.nsh"
|
||||
# electron-builder's own copy of the nsis compiler, fetched and checked by it
|
||||
nsis=$(cd "$here/installer" && node -e 'require("app-builder-lib/out/toolsets/windows.js").getMakeNsisPath().then(r => console.log(r.path))')
|
||||
NSISDIR=$(dirname "$(dirname "$nsis")") "$nsis" -V2 -DVERSION="$version" -DSOURCE="$win" -DOUTFILE="$dist/Burrow-Setup.exe" \
|
||||
-DICON="$here/tools/icon.ico" -DFILES="$work/files.nsh" "$here/installer/burrow.nsi"
|
||||
;;
|
||||
linux)
|
||||
need "$here/electron/electron"
|
||||
need "$here/flash/libpepflashplayer.so"
|
||||
command -v rpmbuild >/dev/null || { echo "missing rpmbuild (sudo pacman -S rpm-tools)" >&2; exit 1; }
|
||||
cp -r "$here/electron" "$work/electron"
|
||||
chmod 755 "$work/electron/electron" "$work/electron/chrome-sandbox"
|
||||
builder "$work/electron" --linux --x64
|
||||
cp "$work/out/Burrow-x86_64.AppImage" "$work/out/burrow_amd64.deb" "$work/out/burrow.x86_64.rpm" "$dist/"
|
||||
;;
|
||||
esac
|
||||
rm -rf "$work/out"
|
||||
done
|
||||
|
||||
(cd "$dist" && sha256sum Burrow-Setup.exe Burrow-x86_64.AppImage burrow_amd64.deb burrow.x86_64.rpm Burrow-macos.dmg 2>/dev/null) > "$dist/SHA256SUMS" || true
|
||||
ls -lh "$dist"
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 55 KiB |
@@ -0,0 +1,85 @@
|
||||
#!/usr/bin/env node
|
||||
"use strict";
|
||||
|
||||
// makes an update for the clients already installed (app/updater.js): app/
|
||||
// as it is, minus build.json, gzipped and signed, plus the latest.json that
|
||||
// names it. both go to the server's client-updates/ folder, which it serves
|
||||
// at /client/; committing and pushing the server is what hands it out.
|
||||
//
|
||||
// tools/make-update.js [--out <folder>] [--key <file>]
|
||||
//
|
||||
// raise "version" in app/package.json first: an update must be newer than
|
||||
// the one published. the key is ~/.config/burrow/update-key.pem; without it
|
||||
// no update can be signed that installed clients accept (BUILDING.md).
|
||||
|
||||
const crypto = require("crypto");
|
||||
const fs = require("fs");
|
||||
const os = require("os");
|
||||
const path = require("path");
|
||||
const zlib = require("zlib");
|
||||
|
||||
const root = path.join(__dirname, "..");
|
||||
const args = process.argv.slice(2);
|
||||
const option = (name, fallback) => (args.includes(name) ? args[args.indexOf(name) + 1] : fallback);
|
||||
const out = path.resolve(option("--out", path.join(os.homedir(), "ajc-private-server", "client-updates")));
|
||||
const keyFile = option("--key", path.join(os.homedir(), ".config", "burrow", "update-key.pem"));
|
||||
|
||||
const fail = message => {
|
||||
console.error(message);
|
||||
process.exit(1);
|
||||
};
|
||||
|
||||
const newer = (one, other) => {
|
||||
const a = String(one).split(".").map(Number);
|
||||
const b = String(other).split(".").map(Number);
|
||||
for (let i = 0; i < 3; i++) {
|
||||
if ((a[i] || 0) !== (b[i] || 0)) {
|
||||
return (a[i] || 0) > (b[i] || 0);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
const app = path.join(root, "app");
|
||||
const {version} = JSON.parse(fs.readFileSync(path.join(app, "package.json"), "utf8"));
|
||||
const shellMatch = /^const SHELL = (\d+);$/m.exec(fs.readFileSync(path.join(app, "boot.js"), "utf8"));
|
||||
if (!/^\d+\.\d+\.\d+$/.test(version) || !shellMatch) {
|
||||
fail("app/package.json needs a version like 1.2.3, and app/boot.js its SHELL");
|
||||
}
|
||||
if (!fs.existsSync(keyFile)) {
|
||||
fail(`no signing key at ${keyFile}`);
|
||||
}
|
||||
fs.mkdirSync(out, {recursive: true});
|
||||
const published = path.join(out, "latest.json");
|
||||
if (fs.existsSync(published)) {
|
||||
const before = JSON.parse(fs.readFileSync(published, "utf8")).version;
|
||||
if (!newer(version, before)) {
|
||||
fail(`${before} is published already: raise "version" in app/package.json above it`);
|
||||
}
|
||||
}
|
||||
|
||||
const files = {};
|
||||
const walk = folder => {
|
||||
for (const entry of fs.readdirSync(folder, {withFileTypes: true})) {
|
||||
const full = path.join(folder, entry.name);
|
||||
const name = path.relative(app, full).split(path.sep).join("/");
|
||||
if (entry.isDirectory()) {
|
||||
walk(full);
|
||||
}
|
||||
else if (name !== "build.json") {
|
||||
files[name] = fs.readFileSync(full).toString("base64");
|
||||
}
|
||||
}
|
||||
};
|
||||
walk(app);
|
||||
|
||||
const shell = Number(shellMatch[1]);
|
||||
const bundle = zlib.gzipSync(JSON.stringify({version, shell, files}), {level: 9});
|
||||
const signature = crypto.sign(null, bundle, crypto.createPrivateKey(fs.readFileSync(keyFile)));
|
||||
const file = `app-${version}.burrow`;
|
||||
for (const old of fs.readdirSync(out).filter(name => /^app-.*\.burrow$/.test(name))) {
|
||||
fs.unlinkSync(path.join(out, old));
|
||||
}
|
||||
fs.writeFileSync(path.join(out, file), bundle);
|
||||
fs.writeFileSync(published, `${JSON.stringify({version, shell, file, signature: signature.toString("base64")}, null, 2)}\n`);
|
||||
console.log(`${file}: ${Object.keys(files).length} files, ${Math.round(bundle.length / 1024)} KB, in ${out}`);
|
||||
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env bash
|
||||
# copies this repository as it stands at its last commit, minus what stays
|
||||
# private, into the public one and pushes it:
|
||||
#
|
||||
# tools/publish-public.sh [--no-push]
|
||||
#
|
||||
# no markdown file of any kind goes public. the public repository has a
|
||||
# history of its own: nothing of this one's
|
||||
# history goes there, so a file that was ever committed here and is private
|
||||
# never shows up in an old public commit. its .gitignore names the private
|
||||
# paths too, so they are not added there by hand either.
|
||||
set -euo pipefail
|
||||
|
||||
name=burrow-client
|
||||
remote=[email protected]:burrow-dev/$name.git
|
||||
# what stays private: nothing beyond what .gitignore keeps out already
|
||||
# (Electron, the Flash plugin, the builds)
|
||||
private=()
|
||||
|
||||
here=$(cd "$(dirname "$0")/.." && pwd)
|
||||
public=${BURROW_PUBLIC_DIR:-$HOME/burrow-public/$name}
|
||||
push=1
|
||||
[ "${1:-}" = "--no-push" ] && push=0
|
||||
|
||||
cd "$here"
|
||||
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
|
||||
echo "commit first: the public copy is made from the last commit" >&2
|
||||
exit 1
|
||||
fi
|
||||
source=$(git rev-parse --short HEAD)
|
||||
ssh_command=$(git config --get core.sshCommand || true)
|
||||
|
||||
if [ ! -d "$public/.git" ]; then
|
||||
mkdir -p "$public"
|
||||
git -C "$public" init -q -b main
|
||||
git -C "$public" remote add origin "$remote"
|
||||
fi
|
||||
git -C "$public" config user.name "$(git config user.name)"
|
||||
git -C "$public" config user.email "$(git config user.email)"
|
||||
[ -n "$ssh_command" ] && git -C "$public" config core.sshCommand "$ssh_command"
|
||||
|
||||
work=$(mktemp -d)
|
||||
trap 'rm -rf "$work"' EXIT
|
||||
git archive HEAD | tar -x -C "$work"
|
||||
for path in "${private[@]+"${private[@]}"}"; do
|
||||
rm -rf "${work:?}/$path"
|
||||
done
|
||||
# no markdown file goes public, of any kind (the owner's rule)
|
||||
find "$work" -name '*.md' -delete
|
||||
|
||||
# a last look before anything leaves: none of the game's code or SWFs
|
||||
leaked=$(find "$work" \( -name '*.swf' -o -name '*.as' -o -name '*.pem' -o -name '*.md' \) -print)
|
||||
if [ -n "$leaked" ]; then
|
||||
echo "refused: these would have gone public:" >&2
|
||||
echo "$leaked" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
{
|
||||
cat "$work/.gitignore"
|
||||
printf '\n# kept in the private repository, never here\n'
|
||||
printf '*.md\n'
|
||||
for path in "${private[@]+"${private[@]}"}"; do
|
||||
printf '/%s\n' "$path"
|
||||
done
|
||||
} > "$work/.gitignore.public"
|
||||
mv "$work/.gitignore.public" "$work/.gitignore"
|
||||
|
||||
# the public tree becomes exactly this
|
||||
find "$public" -mindepth 1 -maxdepth 1 ! -name .git -exec rm -rf {} +
|
||||
cp -a "$work/." "$public/"
|
||||
cd "$public"
|
||||
git add -A
|
||||
if git diff --cached --quiet; then
|
||||
echo "the public copy is already up to date"
|
||||
exit 0
|
||||
fi
|
||||
git commit -q -m "Brought up to date with the private repository ($source)"
|
||||
echo "committed in $public: $(git log -1 --format='%h %s')"
|
||||
if [ "$push" = 1 ]; then
|
||||
git push -q -u origin main
|
||||
echo "pushed to $remote"
|
||||
fi
|
||||
Reference in new issue
Block a user