diff --git a/.ci/build b/.ci/build new file mode 100755 index 0000000..cf1445a --- /dev/null +++ b/.ci/build @@ -0,0 +1,6 @@ +#!/bin/bash -e +set -Eeuo pipefail + +cd siterepo +./build.sh +cp ./assets/* ../sitegen/ diff --git a/.ci/deploy b/.ci/deploy new file mode 100755 index 0000000..509f6b2 --- /dev/null +++ b/.ci/deploy @@ -0,0 +1,17 @@ +#!/bin/bash +set -Eeu + +DEPLOY_HOST=172.19.11.5 + +mkdir -p ~/.ssh +cat >>~/.ssh/known_hosts <deploy-key +chmod 0600 ./deploy-key + +rsync -av sitegen/ blast@$DEPLOY_HOST:/mnt/static/main/ diff --git a/.ci/fly-set-pipeline b/.ci/fly-set-pipeline new file mode 100755 index 0000000..b752fa8 --- /dev/null +++ b/.ci/fly-set-pipeline @@ -0,0 +1,2 @@ +#!/bin/sh +exec fly -t bm set-pipeline -c .concourse.yml -p blastmud-site diff --git a/.concourse.yml b/.concourse.yml new file mode 100644 index 0000000..3bd10aa --- /dev/null +++ b/.concourse.yml @@ -0,0 +1,47 @@ +jobs: + - name: build-site + public: true + build_log_retention: + days: 365 + builds: 50 + plan: + - get: siterepo + trigger: true + - task: build + config: + platform: linux + image_resource: + type: registry-image + source: + repository: node + inputs: + - name: siterepo + caches: + - path: node_modules + - path: dist + outputs: + - name: sitegen + run: + path: siterepo/.ci/build + - task: deploy + config: + platform: linux + image_resource: + type: registry-image + source: + repository: blasthavers/deploy-base + inputs: + - name: sitegen + - name: siterepo + params: + DEPLOY_KEY: ((deploy_key)) + run: + path: siterepo/.ci/deploy +resources: + - name: siterepo + type: git + check_every: never + webhook_token: ((webhook_token)) + source: + uri: https://git.blastmud.org/blasthavers/blastmud-site.git + branch: main diff --git a/.gitignore b/.gitignore index 5b8c018..b8550ae 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ assets/main.js dist node_modules -assets/xterm.css \ No newline at end of file +assets/xterm.css diff --git a/assets/game.html b/assets/game.html index f650559..37d57ad 100644 --- a/assets/game.html +++ b/assets/game.html @@ -23,6 +23,11 @@

Play Blastmud

 
+
+
+ Sorry, this game is not yet available for play. +
+

You must be 18+ to play Blastmud

diff --git a/update-deps.sh b/build.sh similarity index 100% rename from update-deps.sh rename to build.sh diff --git a/src/index.ts b/src/index.ts index 871867b..2575dd0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -23,10 +23,16 @@ async function readForever() { } readForever(); +const params: {[key:string]: string} = + location.search.substr(1).split('&') + .reduce((o, s) => { const [k, v] = s.split('='); o[k] = v; return o;}, + {} as {[key:string]: string}); + function connectTerm() { lineHandler = () => {}; term.writeln("\x1b[0mConnecting to server..."); - const wsurl = document.location.href.replace(/^https:\/\/(.*)\/game(.html)?(\?.*)?(\#.*)?/, 'wss:\/\/$1/wsgame'); + const wsurl = (document.localStorage['allow_wsurl'] !== true || params.wsurl === undefined) ? + "wss://ws.blastmud.org/wsgame" : params.wsurl; let webSocket = new WebSocket(wsurl); webSocket.addEventListener('open', (event) => { if (sendLessExplicit) @@ -58,13 +64,10 @@ function over18() { } if ('serviceWorker' in navigator) navigator.serviceWorker.register('service-worker.js'); -const params: {[key:string]: string} = - location.search.substr(1).split('&') - .reduce((o, s) => { const [k, v] = s.split('='); o[k] = v; return o;}, - {} as {[key:string]: string}); if (params["source"] && params["source"] === "android") { isScreened = true; sendLessExplicit = true; + document.getElementById("notyet").style.display = 'none'; } if (isScreened || window.localStorage['over18']) {