update SPLServer

This commit is contained in:
Daniella / Tove 2024-10-14 01:25:40 +02:00
parent c3e4bc1197
commit 2458bcdb0f
Signed by: TudbuT
GPG key ID: B3CF345217F202D3
3 changed files with 63 additions and 11 deletions

View file

@ -0,0 +1,39 @@
on:
workflow_dispatch:
push:
branches-ignore:
- "!release"
paths:
- ".forgejo/workflows/build-simpleserver.yml"
- "scripts/**"
- "SimpleServer/**"
jobs:
make:
name: Build BaseBand SimpleServer
runs-on: 'docker'
steps:
- name: Setup Java
uses: https://github.com/actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 8
- name: Checkout
uses: actions/checkout@v4
- name: Notify Action Start
run: bash scripts/webhook.sh "**(SPLServer)** Build Action Started"
- name: Push to Prod Server
env:
SSH_PRIVATEKEY: ${{ secrets.SSH_PRIVATEKEY }}
GPG_PRIVATEKEY: ${{ secrets.GPG_PRIVATEKEY }}
BB_HOST: ${{ vars.BB_HOST }}
BB_PORT: ${{ vars.BB_PORT }}
BB_PATH: ${{ vars.BB_PATH }}
run: |
bash scripts/push_file.sh SimpleServer/*
- name: Notify Action Completion
if: always()
run: bash scripts/webhook.sh "**(SPLServer)** Build Action Completed"

View file

@ -17,5 +17,5 @@
<h2>Version information</h2>
<a href="/latest">/latest</a>
<a href="/branches">/branches</a>
</body>

View file

@ -5,18 +5,29 @@
use net:http:Server
1048576 net:http:server:=bufsize
construct Latest {
release
construct Branch {
name
commit
;
construct { this | with name commit this ;
name this:=name
commit this:=commit
this
}
}
construct Branches {
main
release
loader
;
construct { this | with this ;
func read-commit { s | with file ;
[ "unzip" "-p" file "commit" ] StreamTypes:cmd:create:read-to-end<32>:to-str
}
"BaseBand-release.jar" read-commit this:=release
"BaseBand-main.jar" read-commit this:=main
"BaseBand-Loader.jar" read-commit this:=loader
"Loader" "BaseBand-Loader.jar" read-commit Branch:new this:=loader
"Broadway" "BaseBand-release.jar" read-commit Branch:new this:=release
"Iceland" "BaseBand-main.jar" read-commit Branch:new this:=main
this properties props-to-json
}
}
@ -40,6 +51,9 @@ construct Refreshed {
}
func props-to-json { | with props ;
props:last:get<1> dup null eq not if {
"\"" swap _str :replace<"\\" "\\\\">:replace<"\"" "\\\""> concat "\"" concat 2 stop
} pop
"{"
props
:iter
@ -48,9 +62,8 @@ func props-to-json { | with props ;
:to-stack with key value ;
"\""
key :replace<"\\" "\\\\">:replace<"\"" "\\\""> concat
"\": \"" concat
value _str :replace<"\\" "\\\\">:replace<"\"" "\\\""> concat
"\"" concat
"\": " concat
value properties props-to-json concat
}>
:join<", "> concat
"}" concat
@ -71,8 +84,8 @@ func handle-client { | with client ;
"BaseBand-main.jar" "/download/client/main" client:serve-file-cached;<"application/octet-stream">
"BaseBand-Loader.jar" "/download/loader" client:serve-file-cached;<"application/octet-stream">
"/latest" client:path eq if {
Latest:new client:write-ok:write-content-type<"application/json">:write-str-body:finish;
"/branches" client:path eq if {
Branches:new client:write-ok:write-content-type<"application/json">:write-str-body:finish;
}
"/refresh" client:path eq if {