diff options
Diffstat (limited to 'web/README.md')
| -rw-r--r-- | web/README.md | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/web/README.md b/web/README.md new file mode 100644 index 0000000..3c6ee08 --- /dev/null +++ b/web/README.md | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | # Download page | ||
| 2 | |||
| 3 | `index.php` scans `bin/client` and `bin/server` on every request and renders | ||
| 4 | whatever builds it finds, with version, size and SHA-256. No database, no | ||
| 5 | JavaScript, no dependencies. PHP 8.0+. | ||
| 6 | |||
| 7 | ## Layout | ||
| 8 | |||
| 9 | ``` | ||
| 10 | web/ | ||
| 11 | index.php | ||
| 12 | bin/client/ served at /bin/client/... | ||
| 13 | bin/server/ served at /bin/server/... | ||
| 14 | ``` | ||
| 15 | |||
| 16 | Serve `web/` as the document root. Binaries in `bin/` are gitignored. | ||
| 17 | |||
| 18 | ## Naming | ||
| 19 | |||
| 20 | The page only lists files that match the release pattern; anything else in | ||
| 21 | those directories is ignored. | ||
| 22 | |||
| 23 | ``` | ||
| 24 | zagan-bet-client-<version>-<platform>-<arch>[.exe] | ||
| 25 | zagan-bet-server-<version>-<platform>-<arch> | ||
| 26 | ``` | ||
| 27 | |||
| 28 | `<version>` is `MAJOR.MINOR.PATCH`, `<platform>` is `linux`, `windows` or | ||
| 29 | `macos`, `<arch>` is `x86_64`, `i686` or `aarch64`. | ||
| 30 | |||
| 31 | ## Publishing a build | ||
| 32 | |||
| 33 | From the repository root, with the version taken from `Cargo.toml`: | ||
| 34 | |||
| 35 | ```sh | ||
| 36 | V=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1) | ||
| 37 | |||
| 38 | cargo build --release --target x86_64-unknown-linux-gnu | ||
| 39 | cargo build --release --bin client --no-default-features --target i686-unknown-linux-gnu | ||
| 40 | cargo build --release --bin client --target x86_64-pc-windows-gnu | ||
| 41 | |||
| 42 | cp "target/x86_64-unknown-linux-gnu/release/server" "web/bin/server/zagan-bet-server-$V-linux-x86_64" | ||
| 43 | cp "target/x86_64-unknown-linux-gnu/release/client" "web/bin/client/zagan-bet-client-$V-linux-x86_64" | ||
| 44 | cp "target/i686-unknown-linux-gnu/release/client" "web/bin/client/zagan-bet-client-$V-linux-i686" | ||
| 45 | cp "target/x86_64-pc-windows-gnu/release/client.exe" "web/bin/client/zagan-bet-client-$V-windows-x86_64.exe" | ||
| 46 | ``` | ||
| 47 | |||
| 48 | `--no-default-features` drops the server's OpenSSL dependency, which is what | ||
| 49 | the 32-bit client build would otherwise fail on. | ||
| 50 | |||
| 51 | ## Preview locally | ||
| 52 | |||
| 53 | ```sh | ||
| 54 | php -S 127.0.0.1:8899 -t web | ||
| 55 | ``` | ||
| 56 | |||
| 57 | Then open <http://127.0.0.1:8899/>. | ||
| 58 | |||
| 59 | ## Notes | ||
| 60 | |||
| 61 | - Hashes are computed per request with `hash_file()`. That is fine for a | ||
| 62 | handful of builds; add an mtime-keyed cache if the directory grows. | ||
| 63 | - The page lists every build it finds, newest version first, so old releases | ||
| 64 | stay downloadable until you remove them from `bin/`. | ||
