diff --git a/.forgejo/workflows/build-simpleserver.yml b/.forgejo/workflows/build-simpleserver.yml new file mode 100644 index 0000000..9202577 --- /dev/null +++ b/.forgejo/workflows/build-simpleserver.yml @@ -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" diff --git a/SimpleServer/index.html b/SimpleServer/index.html index d0ab4b2..2c85099 100644 --- a/SimpleServer/index.html +++ b/SimpleServer/index.html @@ -17,5 +17,5 @@

Version information

- /latest + /branches diff --git a/SimpleServer/server.spl b/SimpleServer/server.spl index 7b13cdf..e4f7ab2 100644 --- a/SimpleServer/server.spl +++ b/SimpleServer/server.spl @@ -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 {