Compare commits
2 commits
6f39e97977
...
5e31e785df
Author | SHA1 | Date | |
---|---|---|---|
5e31e785df | |||
d9ca9bcc52 |
7 changed files with 81 additions and 239 deletions
77
.gitea/workflows/deploy.yaml
Normal file
77
.gitea/workflows/deploy.yaml
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: alpine
|
||||||
|
steps:
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Check for new release
|
||||||
|
run: |
|
||||||
|
chmod +x ./7zas
|
||||||
|
echo ""
|
||||||
|
echo "Checking following projects:"
|
||||||
|
for f in *; do
|
||||||
|
[ -d "$f" ] && [ ! -L "$f" ] && [ ! "$f" = "base" ] && echo " * $f";
|
||||||
|
done
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
|
||||||
|
for f in *; do
|
||||||
|
[ ! -d "$f" ] || [ -L "$f" ] || [ "$f" = "base" ] && continue;
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "------------------------------------"
|
||||||
|
echo ""
|
||||||
|
echo "checking $f";
|
||||||
|
cd $f
|
||||||
|
|
||||||
|
CURR_VER="$(cat package.json | jq -r .name)_v$(cat package.json | jq -r .version)"
|
||||||
|
CURR_NAME="$(cat package.json | jq -r .name) v$(cat package.json | jq -r .version)"
|
||||||
|
|
||||||
|
echo "Checking https://git.nfp.is/api/v1/repos/${{ gitea.repository }}/releases for name ${CURR_NAME}"
|
||||||
|
|
||||||
|
if curl -s -X GET -H "Authorization: token ${{ secrets.deploytoken }}" https://git.nfp.is/api/v1/repos/${{ gitea.repository }}/releases | grep -o "\"name\"\:\"${CURR_NAME}\"" > /dev/null; then
|
||||||
|
echo "Skipping ${{ gitea.job }} since $CURR_NAME already exists";
|
||||||
|
cd ..
|
||||||
|
continue;
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "New release ${CURR_VER} found, running npm install..."
|
||||||
|
|
||||||
|
mv package.json fuck-you-npm-package.json
|
||||||
|
mv build-package.json package.json
|
||||||
|
npm install && npm run build
|
||||||
|
|
||||||
|
mv package.json build-package.json
|
||||||
|
mv fuck-you-npm-package.json package.json
|
||||||
|
|
||||||
|
../7zas a -xr!*.xcf -mx9 "${CURR_VER}_build-sc.7z" package.json index.mjs api base public
|
||||||
|
|
||||||
|
echo "Creating ${CURR_VER} release on gitea"
|
||||||
|
RELEASE_RESULT=$(curl \
|
||||||
|
-X POST \
|
||||||
|
-H "Authorization: token ${{ secrets.deploytoken }}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
https://git.nfp.is/api/v1/repos/${{ gitea.repository }}/releases \
|
||||||
|
-d "{\"tag_name\":\"${CURR_VER}\",\"name\":\"${CURR_NAME}\",\"body\":\"Automatic release from Appveyor from ${{ gitea.sha }} :\n\n${{ gitea.event.head_commit.message }}\"}")
|
||||||
|
|
||||||
|
RELEASE_ID=$(echo $RELEASE_RESULT | jq -r .id)
|
||||||
|
echo "Adding ${CURR_VER}_build-sc.7z to release ${RELEASE_ID}"
|
||||||
|
|
||||||
|
curl \
|
||||||
|
-X POST \
|
||||||
|
-H "Authorization: token ${{ secrets.deploytoken }}" \
|
||||||
|
-F "attachment=@${CURR_VER}_build-sc.7z" \
|
||||||
|
https://git.nfp.is/api/v1/repos/${{ gitea.repository }}/releases/$RELEASE_ID/assets
|
||||||
|
|
||||||
|
MAN_PORT=$(cat package.json | jq -r .port)
|
||||||
|
MAN_NAME=$(cat package.json | jq -r .name)
|
||||||
|
|
||||||
|
echo "Deplying to production"
|
||||||
|
echo "curl -X POST http://192.168.93.50:$MAN_PORT/update/$MAN_NAME"
|
||||||
|
curl -X POST http://192.168.93.50:$MAN_PORT/update/$MAN_NAME
|
||||||
|
done
|
|
@ -1,59 +0,0 @@
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
discord_embed:
|
|
||||||
runs-on: alpine
|
|
||||||
steps:
|
|
||||||
- name: Check out repository code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Check for new release
|
|
||||||
run: |
|
|
||||||
cd ${{ gitea.job }}
|
|
||||||
CURR_VER="$(cat package.json | jq -r .name)_v$(cat package.json | jq -r .version)"
|
|
||||||
CURR_NAME="$(cat package.json | jq -r .name) v$(cat package.json | jq -r .version)"
|
|
||||||
|
|
||||||
echo "Checking https://git.nfp.is/api/v1/repos/${{ gitea.repository }}/releases for name ${CURR_NAME}"
|
|
||||||
|
|
||||||
if curl -s -X GET -H "Authorization: token ${{ secrets.deploytoken }}" https://git.nfp.is/api/v1/repos/${{ gitea.repository }}/releases | grep -o "\"name\"\:\"${CURR_NAME}\"" > /dev/null; then
|
|
||||||
echo "Skipping ${{ gitea.job }} since $CURR_NAME already exists";
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "New release ${CURR_VER} found, running npm install..."
|
|
||||||
|
|
||||||
mv package.json fuck-you-npm-package.json
|
|
||||||
mv build-package.json package.json
|
|
||||||
npm install && npm run build
|
|
||||||
|
|
||||||
mv package.json build-package.json
|
|
||||||
mv fuck-you-npm-package.json package.json
|
|
||||||
|
|
||||||
chmod +x ../7zas
|
|
||||||
../7zas a -xr!*.xcf -mx9 "${CURR_VER}_build-sc.7z" package.json index.mjs api base public
|
|
||||||
|
|
||||||
echo "Creating ${CURR_VER} release on gitea"
|
|
||||||
RELEASE_RESULT=$(curl \
|
|
||||||
-X POST \
|
|
||||||
-H "Authorization: token ${{ secrets.deploytoken }}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
https://git.nfp.is/api/v1/repos/${{ gitea.repository }}/releases \
|
|
||||||
-d "{\"tag_name\":\"${CURR_VER}\",\"name\":\"${CURR_NAME}\",\"body\":\"Automatic release from Appveyor from ${{ gitea.sha }} :\n\n${{ gitea.event.head_commit.message }}\"}")
|
|
||||||
|
|
||||||
RELEASE_ID=$(echo $RELEASE_RESULT | jq -r .id)
|
|
||||||
echo "Adding ${CURR_VER}_build-sc.7z to release ${RELEASE_ID}"
|
|
||||||
|
|
||||||
curl \
|
|
||||||
-X POST \
|
|
||||||
-H "Authorization: token ${{ secrets.deploytoken }}" \
|
|
||||||
-F "attachment=@${CURR_VER}_build-sc.7z" \
|
|
||||||
https://git.nfp.is/api/v1/repos/${{ gitea.repository }}/releases/$RELEASE_ID/assets
|
|
||||||
|
|
||||||
MAN_PORT=$(cat package.json | jq -r .port)
|
|
||||||
MAN_NAME=$(cat package.json | jq -r .name)
|
|
||||||
|
|
||||||
echo "Deplying to production"
|
|
||||||
echo "curl -X POST http://192.168.93.50:$MAN_PORT/update/$MAN_NAME"
|
|
||||||
curl -X POST http://192.168.93.50:$MAN_PORT/update/$MAN_NAME
|
|
|
@ -1,59 +0,0 @@
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
nfp_is:
|
|
||||||
runs-on: alpine
|
|
||||||
steps:
|
|
||||||
- name: Check out repository code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Check for new release
|
|
||||||
run: |
|
|
||||||
cd ${{ gitea.job }}
|
|
||||||
CURR_VER="$(cat package.json | jq -r .name)_v$(cat package.json | jq -r .version)"
|
|
||||||
CURR_NAME="$(cat package.json | jq -r .name) v$(cat package.json | jq -r .version)"
|
|
||||||
|
|
||||||
echo "Checking https://git.nfp.is/api/v1/repos/${{ gitea.repository }}/releases for name ${CURR_NAME}"
|
|
||||||
|
|
||||||
if curl -s -X GET -H "Authorization: token ${{ secrets.deploytoken }}" https://git.nfp.is/api/v1/repos/${{ gitea.repository }}/releases | grep -o "\"name\"\:\"${CURR_NAME}\"" > /dev/null; then
|
|
||||||
echo "Skipping ${{ gitea.job }} since $CURR_NAME already exists";
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "New release ${CURR_VER} found, running npm install..."
|
|
||||||
|
|
||||||
mv package.json fuck-you-npm-package.json
|
|
||||||
mv build-package.json package.json
|
|
||||||
npm install && npm run build
|
|
||||||
|
|
||||||
mv package.json build-package.json
|
|
||||||
mv fuck-you-npm-package.json package.json
|
|
||||||
|
|
||||||
chmod +x ../7zas
|
|
||||||
../7zas a -xr!*.xcf -mx9 "${CURR_VER}_build-sc.7z" package.json index.mjs api base public
|
|
||||||
|
|
||||||
echo "Creating ${CURR_VER} release on gitea"
|
|
||||||
RELEASE_RESULT=$(curl \
|
|
||||||
-X POST \
|
|
||||||
-H "Authorization: token ${{ secrets.deploytoken }}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
https://git.nfp.is/api/v1/repos/${{ gitea.repository }}/releases \
|
|
||||||
-d "{\"tag_name\":\"${CURR_VER}\",\"name\":\"${CURR_NAME}\",\"body\":\"Automatic release from Appveyor from ${{ gitea.sha }} :\n\n${{ gitea.event.head_commit.message }}\"}")
|
|
||||||
|
|
||||||
RELEASE_ID=$(echo $RELEASE_RESULT | jq -r .id)
|
|
||||||
echo "Adding ${CURR_VER}_build-sc.7z to release ${RELEASE_ID}"
|
|
||||||
|
|
||||||
curl \
|
|
||||||
-X POST \
|
|
||||||
-H "Authorization: token ${{ secrets.deploytoken }}" \
|
|
||||||
-F "attachment=@${CURR_VER}_build-sc.7z" \
|
|
||||||
https://git.nfp.is/api/v1/repos/${{ gitea.repository }}/releases/$RELEASE_ID/assets
|
|
||||||
|
|
||||||
MAN_PORT=$(cat package.json | jq -r .port)
|
|
||||||
MAN_NAME=$(cat package.json | jq -r .name)
|
|
||||||
|
|
||||||
echo "Deplying to production"
|
|
||||||
echo "curl -X POST http://192.168.93.50:$MAN_PORT/update/$MAN_NAME"
|
|
||||||
curl -X POST http://192.168.93.50:$MAN_PORT/update/$MAN_NAME
|
|
|
@ -1,59 +0,0 @@
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
nfp_moe:
|
|
||||||
runs-on: alpine
|
|
||||||
steps:
|
|
||||||
- name: Check out repository code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Check for new release
|
|
||||||
run: |
|
|
||||||
cd ${{ gitea.job }}
|
|
||||||
CURR_VER="$(cat package.json | jq -r .name)_v$(cat package.json | jq -r .version)"
|
|
||||||
CURR_NAME="$(cat package.json | jq -r .name) v$(cat package.json | jq -r .version)"
|
|
||||||
|
|
||||||
echo "Checking https://git.nfp.is/api/v1/repos/${{ gitea.repository }}/releases for name ${CURR_NAME}"
|
|
||||||
|
|
||||||
if curl -s -X GET -H "Authorization: token ${{ secrets.deploytoken }}" https://git.nfp.is/api/v1/repos/${{ gitea.repository }}/releases | grep -o "\"name\"\:\"${CURR_NAME}\"" > /dev/null; then
|
|
||||||
echo "Skipping ${{ gitea.job }} since $CURR_NAME already exists";
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "New release ${CURR_VER} found, running npm install..."
|
|
||||||
|
|
||||||
mv package.json fuck-you-npm-package.json
|
|
||||||
mv build-package.json package.json
|
|
||||||
npm install && npm run build
|
|
||||||
|
|
||||||
mv package.json build-package.json
|
|
||||||
mv fuck-you-npm-package.json package.json
|
|
||||||
|
|
||||||
chmod +x ../7zas
|
|
||||||
../7zas a -xr!*.xcf -mx9 "${CURR_VER}_build-sc.7z" package.json index.mjs api base public
|
|
||||||
|
|
||||||
echo "Creating ${CURR_VER} release on gitea"
|
|
||||||
RELEASE_RESULT=$(curl \
|
|
||||||
-X POST \
|
|
||||||
-H "Authorization: token ${{ secrets.deploytoken }}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
https://git.nfp.is/api/v1/repos/${{ gitea.repository }}/releases \
|
|
||||||
-d "{\"tag_name\":\"${CURR_VER}\",\"name\":\"${CURR_NAME}\",\"body\":\"Automatic release from Appveyor from ${{ gitea.sha }} :\n\n${{ gitea.event.head_commit.message }}\"}")
|
|
||||||
|
|
||||||
RELEASE_ID=$(echo $RELEASE_RESULT | jq -r .id)
|
|
||||||
echo "Adding ${CURR_VER}_build-sc.7z to release ${RELEASE_ID}"
|
|
||||||
|
|
||||||
curl \
|
|
||||||
-X POST \
|
|
||||||
-H "Authorization: token ${{ secrets.deploytoken }}" \
|
|
||||||
-F "attachment=@${CURR_VER}_build-sc.7z" \
|
|
||||||
https://git.nfp.is/api/v1/repos/${{ gitea.repository }}/releases/$RELEASE_ID/assets
|
|
||||||
|
|
||||||
MAN_PORT=$(cat package.json | jq -r .port)
|
|
||||||
MAN_NAME=$(cat package.json | jq -r .name)
|
|
||||||
|
|
||||||
echo "Deplying to production"
|
|
||||||
echo "curl -X POST http://192.168.93.50:$MAN_PORT/update/$MAN_NAME"
|
|
||||||
curl -X POST http://192.168.93.50:$MAN_PORT/update/$MAN_NAME
|
|
|
@ -1,59 +0,0 @@
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
saproxy:
|
|
||||||
runs-on: alpine
|
|
||||||
steps:
|
|
||||||
- name: Check out repository code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Check for new release
|
|
||||||
run: |
|
|
||||||
cd ${{ gitea.job }}
|
|
||||||
CURR_VER="$(cat package.json | jq -r .name)_v$(cat package.json | jq -r .version)"
|
|
||||||
CURR_NAME="$(cat package.json | jq -r .name) v$(cat package.json | jq -r .version)"
|
|
||||||
|
|
||||||
echo "Checking https://git.nfp.is/api/v1/repos/${{ gitea.repository }}/releases for name ${CURR_NAME}"
|
|
||||||
|
|
||||||
if curl -s -X GET -H "Authorization: token ${{ secrets.deploytoken }}" https://git.nfp.is/api/v1/repos/${{ gitea.repository }}/releases | grep -o "\"name\"\:\"${CURR_NAME}\"" > /dev/null; then
|
|
||||||
echo "Skipping ${{ gitea.job }} since $CURR_NAME already exists";
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "New release ${CURR_VER} found, running npm install..."
|
|
||||||
|
|
||||||
mv package.json fuck-you-npm-package.json
|
|
||||||
mv build-package.json package.json
|
|
||||||
npm install && npm run build
|
|
||||||
|
|
||||||
mv package.json build-package.json
|
|
||||||
mv fuck-you-npm-package.json package.json
|
|
||||||
|
|
||||||
chmod +x ../7zas
|
|
||||||
../7zas a -xr!*.xcf -mx9 "${CURR_VER}_build-sc.7z" package.json index.mjs api base public
|
|
||||||
|
|
||||||
echo "Creating ${CURR_VER} release on gitea"
|
|
||||||
RELEASE_RESULT=$(curl \
|
|
||||||
-X POST \
|
|
||||||
-H "Authorization: token ${{ secrets.deploytoken }}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
https://git.nfp.is/api/v1/repos/${{ gitea.repository }}/releases \
|
|
||||||
-d "{\"tag_name\":\"${CURR_VER}\",\"name\":\"${CURR_NAME}\",\"body\":\"Automatic release from Appveyor from ${{ gitea.sha }} :\n\n${{ gitea.event.head_commit.message }}\"}")
|
|
||||||
|
|
||||||
RELEASE_ID=$(echo $RELEASE_RESULT | jq -r .id)
|
|
||||||
echo "Adding ${CURR_VER}_build-sc.7z to release ${RELEASE_ID}"
|
|
||||||
|
|
||||||
curl \
|
|
||||||
-X POST \
|
|
||||||
-H "Authorization: token ${{ secrets.deploytoken }}" \
|
|
||||||
-F "attachment=@${CURR_VER}_build-sc.7z" \
|
|
||||||
https://git.nfp.is/api/v1/repos/${{ gitea.repository }}/releases/$RELEASE_ID/assets
|
|
||||||
|
|
||||||
MAN_PORT=$(cat package.json | jq -r .port)
|
|
||||||
MAN_NAME=$(cat package.json | jq -r .name)
|
|
||||||
|
|
||||||
echo "Deplying to production"
|
|
||||||
echo "curl -X POST http://192.168.93.50:$MAN_PORT/update/$MAN_NAME"
|
|
||||||
curl -X POST http://192.168.93.50:$MAN_PORT/update/$MAN_NAME
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { Flaska, QueryHandler, JsonHandler, FormidableHandler } from 'flaska'
|
import { Flaska, QueryHandler, JsonHandler, FormidableHandler } from 'flaska'
|
||||||
import formidable from 'formidable'
|
import formidable from 'formidable'
|
||||||
|
|
||||||
import { initPool } from './db.mjs'
|
|
||||||
import config from './config.mjs'
|
import config from './config.mjs'
|
||||||
import PageRoutes from './page/routes.mjs'
|
import PageRoutes from './page/routes.mjs'
|
||||||
import ArticleRoutes from './article/routes.mjs'
|
import ArticleRoutes from './article/routes.mjs'
|
||||||
|
@ -109,7 +108,9 @@ export default class Server {
|
||||||
}
|
}
|
||||||
|
|
||||||
runCreateDatabase() {
|
runCreateDatabase() {
|
||||||
return initPool(this.core, config.get('mssql'))
|
return import('./db.mjs').then(db => {
|
||||||
|
return db.initPool(this.core, config.get('mssql'))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
runStartListen() {
|
runStartListen() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "nfp_is",
|
"name": "nfp_is",
|
||||||
"version": "1.0.1",
|
"version": "1.0.2",
|
||||||
"port": 4220,
|
"port": 4220,
|
||||||
"description": "nfp.is website",
|
"description": "nfp.is website",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
|
|
Loading…
Reference in a new issue