1.0.2
Some checks failed
deploy / deploy (push) Failing after 32s

This commit is contained in:
Untone 2024-02-05 14:49:38 +03:00
parent 0c484f71dc
commit 8940086e96
7 changed files with 291 additions and 21 deletions

22
.gitea/workflows/main.yml Normal file
View File

@ -0,0 +1,22 @@
name: 'deploy'
on: [push]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Cloning repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get Repo Name
id: repo_name
run: echo "::set-output name=repo::$(echo ${GITHUB_REPOSITORY##*/})"
- name: Push to dokku
uses: dokku/github-action@master
with:
branch: 'main'
git_remote_url: 'ssh://dokku@staging.discours.io:22/${{ steps.repo_name.outputs.repo }}'
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}

View File

@ -1,6 +1,9 @@
[1.0.2]
- moved to typescript
- added biome
- authorizer adapter added
- migrated to Dockerfile deploy
- gitea ci script added
[1.0.0]
- basic CRDT server

View File

@ -1,4 +1,5 @@
FROM node:18
FROM node:alpine
EXPOSE 4242
COPY . .
RUN npm install
CMD npm start

67
biome.json Normal file
View File

@ -0,0 +1,67 @@
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"files": {
"include": ["*.tsx", "*.ts", "*.js", "*.json"],
"ignore": ["./dist", "./node_modules", ".husky", "docs", "gen"]
},
"vcs": {
"defaultBranch": "dev",
"useIgnoreFile": true
},
"organizeImports": {
"enabled": true,
"ignore": ["./api", "./gen"]
},
"formatter": {
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 108,
"ignore": ["./src/graphql/schema", "./gen"]
},
"javascript": {
"formatter": {
"semicolons": "asNeeded",
"quoteStyle": "single",
"trailingComma": "all",
"enabled": true,
"jsxQuoteStyle": "double",
"arrowParentheses": "always"
}
},
"linter": {
"ignore": ["*.scss", "*.md", ".DS_Store", "*.svg"],
"enabled": true,
"rules": {
"recommended": true,
"complexity": {
"all": true,
"noForEach": "off",
"useOptionalChain": "warn",
"useLiteralKeys": "off"
},
"a11y": {
"useHeadingContent": "off",
"useKeyWithClickEvents": "off",
"useKeyWithMouseEvents": "off",
"useAnchorContent": "off",
"useValidAnchor": "off",
"useMediaCaption": "off",
"useAltText": "off",
"useButtonType": "off",
"noRedundantAlt": "off",
"noSvgWithoutTitle": "off"
},
"nursery": {
"useImportRestrictions": "off"
},
"style": {
"useNamingConvention": "off",
"noUnusedTemplateLiteral": "off"
},
"suspicious": {
"noConsoleLog": "off",
"noAssignInExpressions": "off"
}
}
}
}

View File

@ -1,17 +1,22 @@
import { Server, onAuthenticatePayload } from "@hocuspocus/server";
import { ApiResponse, Authorizer, ConfigType, ValidateJWTTokenInput, ValidateJWTTokenResponse } from '@authorizerdev/authorizer-js';
import {
ApiResponse,
Authorizer,
ConfigType,
ValidateJWTTokenInput,
ValidateJWTTokenResponse,
} from '@authorizerdev/authorizer-js'
import { Server, onAuthenticatePayload } from '@hocuspocus/server'
const authorizer = new Authorizer({
clientID: process.env.AUTHORIZER_CLIENT_ID,
authorizerURL: 'https://auth.discours.io',
redirectURL: 'https://testing.discours.io'
} as ConfigType);
redirectURL: 'https://testing.discours.io',
} as ConfigType)
const server = await Server.configure({
port: 4242,
async onConnect({ connection }) {
connection.requiresAuthentication = false; // FIXME
connection.requiresAuthentication = false // FIXME
},
async onAuthenticate(data: onAuthenticatePayload) {
// Danger! This wont be called for that connection attempt.
@ -32,8 +37,7 @@ const server = await Server.configure({
}
}
}
},
}).listen();
}).listen()
server.listen();
server.listen()

176
package-lock.json generated
View File

@ -1,16 +1,20 @@
{
"name": "discours-hocuspocus",
"version": "1.0.0",
"version": "1.0.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "discours-hocuspocus",
"version": "1.0.0",
"version": "1.0.2",
"license": "MIT",
"dependencies": {
"@authorizerdev/authorizer-js": "2.0.0",
"@hocuspocus/server": "2.0.1"
},
"devDependencies": {
"@biomejs/biome": "1.5.3",
"typescript": "5.3.3"
}
},
"node_modules/@authorizerdev/authorizer-js": {
@ -27,6 +31,161 @@
"url": "https://github.com/sponsors/authorizerdev"
}
},
"node_modules/@biomejs/biome": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-1.5.3.tgz",
"integrity": "sha512-yvZCa/g3akwTaAQ7PCwPWDCkZs3Qa5ONg/fgOUT9e6wAWsPftCjLQFPXBeGxPK30yZSSpgEmRCfpGTmVbUjGgg==",
"dev": true,
"hasInstallScript": true,
"bin": {
"biome": "bin/biome"
},
"engines": {
"node": ">=14.*"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/biome"
},
"optionalDependencies": {
"@biomejs/cli-darwin-arm64": "1.5.3",
"@biomejs/cli-darwin-x64": "1.5.3",
"@biomejs/cli-linux-arm64": "1.5.3",
"@biomejs/cli-linux-arm64-musl": "1.5.3",
"@biomejs/cli-linux-x64": "1.5.3",
"@biomejs/cli-linux-x64-musl": "1.5.3",
"@biomejs/cli-win32-arm64": "1.5.3",
"@biomejs/cli-win32-x64": "1.5.3"
}
},
"node_modules/@biomejs/cli-darwin-arm64": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.5.3.tgz",
"integrity": "sha512-ImU7mh1HghEDyqNmxEZBoMPr8SxekkZuYcs+gynKlNW+TALQs7swkERiBLkG9NR0K1B3/2uVzlvYowXrmlW8hw==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=14.*"
}
},
"node_modules/@biomejs/cli-darwin-x64": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.5.3.tgz",
"integrity": "sha512-vCdASqYnlpq/swErH7FD6nrFz0czFtK4k/iLgj0/+VmZVjineFPgevOb+Sr9vz0tk0GfdQO60bSpI74zU8M9Dw==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=14.*"
}
},
"node_modules/@biomejs/cli-linux-arm64": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.5.3.tgz",
"integrity": "sha512-cupBQv0sNF1OKqBfx7EDWMSsKwRrBUZfjXawT4s6hKV6ALq7p0QzWlxr/sDmbKMLOaLQtw2Qgu/77N9rm+f9Rg==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=14.*"
}
},
"node_modules/@biomejs/cli-linux-arm64-musl": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.5.3.tgz",
"integrity": "sha512-DYuMizUYUBYfS0IHGjDrOP1RGipqWfMGEvNEJ398zdtmCKLXaUvTimiox5dvx4X15mBK5M2m8wgWUgOP1giUpQ==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=14.*"
}
},
"node_modules/@biomejs/cli-linux-x64": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-1.5.3.tgz",
"integrity": "sha512-YQrSArQvcv4FYsk7Q91Yv4uuu5F8hJyORVcv3zsjCLGkjIjx2RhjYLpTL733SNL7v33GmOlZY0eFR1ko38tuUw==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=14.*"
}
},
"node_modules/@biomejs/cli-linux-x64-musl": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-1.5.3.tgz",
"integrity": "sha512-UUHiAnlDqr2Y/LpvshBFhUYMWkl2/Jn+bi3U6jKuav0qWbbBKU/ByHgR4+NBxpKBYoCtWxhnmatfH1bpPIuZMw==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=14.*"
}
},
"node_modules/@biomejs/cli-win32-arm64": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.5.3.tgz",
"integrity": "sha512-HxatYH7vf/kX9nrD+pDYuV2GI9GV8EFo6cfKkahAecTuZLPxryHx1WEfJthp5eNsE0+09STGkKIKjirP0ufaZA==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=14.*"
}
},
"node_modules/@biomejs/cli-win32-x64": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-1.5.3.tgz",
"integrity": "sha512-fMvbSouZEASU7mZH8SIJSANDm5OqsjgtVXlbUqxwed6BP7uuHRSs396Aqwh2+VoW8fwTpp6ybIUoC9FrzB0kyA==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=14.*"
}
},
"node_modules/@hocuspocus/common": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@hocuspocus/common/-/common-2.0.1.tgz",
@ -151,6 +310,19 @@
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
},
"node_modules/typescript": {
"version": "5.3.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz",
"integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=14.17"
}
},
"node_modules/uuid": {
"version": "9.0.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz",

View File

@ -1,24 +1,25 @@
{
"name": "discours-hocuspocus",
"name": "discours-editing-server",
"version": "1.0.2",
"description": "",
"description": "discours.io webrtc p2p network helping crdt-server",
"main": "index.ts",
"type": "module",
"scripts": {
"start": "node index.ts"
"lint": "npx @biomejs/biome check --apply-unsafe .",
"start": "npx tsc index.ts"
},
"repository": {
"type": "git",
"url": "git+https://dev.discours.io/discours.io/editing-server.git"
"url": "git+https://dev.discours.io/discours.io/crdt-server.git"
},
"author": "Discours Dev Team",
"license": "MIT",
"bugs": {
"url": "https://gitlab.com/discoursio/hocuspocus/issues"
},
"homepage": "https://gitlab.com/discoursio/hocuspocus#readme",
"dependencies": {
"@authorizerdev/authorizer-js": "2.0.0",
"@hocuspocus/server": "2.0.1"
},
"devDependencies": {
"@biomejs/biome": "1.5.3",
"typescript": "5.3.3"
}
}