From 67adfc65fdd5238f8a1dd43d180e63892f2d250f Mon Sep 17 00:00:00 2001 From: TudbuT Date: Mon, 14 Oct 2024 02:51:18 +0200 Subject: [PATCH] move SPLServer to other repo --- .forgejo/workflows/build-simpleserver.yml | 40 --------- SimpleServer/index.html | 21 ----- SimpleServer/server.spl | 102 ---------------------- 3 files changed, 163 deletions(-) delete mode 100644 .forgejo/workflows/build-simpleserver.yml delete mode 100644 SimpleServer/index.html delete mode 100644 SimpleServer/server.spl diff --git a/.forgejo/workflows/build-simpleserver.yml b/.forgejo/workflows/build-simpleserver.yml deleted file mode 100644 index 7831162..0000000 --- a/.forgejo/workflows/build-simpleserver.yml +++ /dev/null @@ -1,40 +0,0 @@ -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/index.html - bash scripts/push_file.sh SimpleServer/server.spl - - 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 deleted file mode 100644 index 2c85099..0000000 --- a/SimpleServer/index.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - BaseBand download server - - -

BaseBand downloads

- - This website serves the version information and downloads of BaseBand. - -

Artifacts

- - -

Version information

- - /branches - diff --git a/SimpleServer/server.spl b/SimpleServer/server.spl deleted file mode 100644 index e4f7ab2..0000000 --- a/SimpleServer/server.spl +++ /dev/null @@ -1,102 +0,0 @@ - -"#httpserver/base.spl" import -"#httpserver/static.spl" import - -use net:http:Server -1048576 net:http:server:=bufsize - -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 - } - "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 - } -} - -construct Object404 { - error - ; - construct { this | with this ; - "Endpoint not found" this:=error - this properties props-to-json - } -} - -construct Refreshed { - ok - ; - construct { this | with this ; - "true" this:=ok - this properties props-to-json - } -} - -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 - :filter<{ b | :to-stack pop with key ; key ":" eq not key ";" eq not and }> - :map<{ s | - :to-stack with key value ; - "\"" - key :replace<"\\" "\\\\">:replace<"\"" "\\\""> concat - "\": " concat - value properties props-to-json concat - }> - :join<", "> concat - "}" concat -} - -func main { exitcode | with args ; - def server Server:new<"::0" 40002> =server - while { 1 } { - server:accept &handle-client fork; - } -} - -func handle-client { | with client ; - client:read; - "index.html" "/" client:serve-html-cached; - - "BaseBand-release.jar" "/download/client/release" client:serve-file-cached;<"application/octet-stream"> - "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"> - - "/branches" client:path eq if { - Branches:new client:write-ok:write-content-type<"application/json">:write-str-body:finish; - } - - "/refresh" client:path eq if { - "refresh" println; - client:server:cached-files if { - client:server:cached-files:clear; - } - Refreshed:new client:write-ok:write-content-type<"application/json">:write-str-body:finish; - } - - client:wrote-body not if { - Object404:new client:write-head<404 "Not Found">:write-content-type<"application/json">:write-str-body:finish; - } -}