Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions .eslintrc

This file was deleted.

34 changes: 17 additions & 17 deletions .github/workflows/code-test.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#name: Unit Tests
#
#on: [ push, pull_request ]
#
#jobs:
# checks:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-node@v3
# with:
# node-version: '22'
# cache: 'yarn'
# - run: yarn install --frozen-lockfile
# - run: npx webpack
# - run: yarn run test
# - uses: codecov/codecov-action@v3
name: Unit Tests

on: [ push, pull_request ]

jobs:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '22'
cache: 'yarn'
- run: yarn install --frozen-lockfile
- run: npx webpack
- run: yarn run test
- uses: codecov/codecov-action@v3

58 changes: 58 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { defineConfig } from 'eslint/config'
import prettier from 'eslint-plugin-prettier'
import globals from 'globals'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import js from '@eslint/js'
import { FlatCompat } from '@eslint/eslintrc'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
})

export default defineConfig([
{
extends: compat.extends('standard', 'plugin:prettier/recommended'),

plugins: {
prettier,
},

rules: {
'prettier/prettier': 'error',
},
},
{
files: ['src/frontend/**/*.js'],

languageOptions: {
globals: {
...globals.browser,
},
},
},
{
files: ['src/backend/**/*.js'],

languageOptions: {
globals: {
...globals.node,
},
},
},
{
files: ['tests/**/*.js'],

languageOptions: {
globals: {
...globals.node,
...globals.jest,
...globals.jasmine,
},
},
},
])
144 changes: 73 additions & 71 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,73 +1,75 @@
{
"name": "website",
"version": "2.0.0",
"private": true,
"dependencies": {
"axios": "1.10.0",
"body-parser": "2.2.0",
"client-oauth2": "4.3.3",
"connect-flash": "^0.1.1",
"dotenv": "17.0.0",
"express": "^5.1.0",
"express-session": "^1.18.1",
"express-validator": "7.2.1",
"moment": "^2.30.1",
"node-cache": "^5.1.2",
"node-dependency-injection": "^3.2.2",
"node-fetch": "^3.3.2",
"npm-check": "^6.0.1",
"passport": "^0.7.0",
"passport-oauth2-refresh": "^2.2.0",
"passport-openidconnect": "^0.1.2",
"pug": "3.0.3",
"request": "2.88.2",
"sass": "^1.89.2",
"session-file-store": "^1.5.0",
"showdown": "^2.1.0",
"simple-datatables": "^10.0.0",
"simple-oauth2": "^5.1.0",
"supertest-session": "^5.0.1",
"url-slug": "^4.0.1"
},
"devDependencies": {
"@prettier/plugin-pug": "^3.4.0",
"awesomplete": "^1.1.7",
"css-loader": "^7.1.2",
"eslint": "^9.30.0",
"eslint-config-prettier": "^10.1.5",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-n": "^17.20.0",
"eslint-plugin-prettier": "^5.5.1",
"eslint-plugin-promise": "^7.2.1",
"grunt": "1.6.1",
"grunt-concurrent": "3.0.0",
"grunt-contrib-watch": "^1.1.0",
"grunt-nodemon": "^0.4.2",
"grunt-postcss": "0.9.0",
"grunt-run": "^0.8.1",
"grunt-sass": "4.0.0",
"highcharts": "^12.3.0",
"jest": "^30.0.3",
"load-grunt-config": "4.0.1",
"load-grunt-tasks": "5.1.0",
"nock": "^14.0.5",
"octokit": "^5.0.3",
"prettier": "^3.6.2",
"style-loader": "^4.0.0",
"supertest": "^7.1.1",
"typescript": "^5.8.3",
"webpack": "^5.99.9",
"webpack-cli": "^6.0.1",
"webpack-manifest-plugin": "^5.0.1"
},
"engines": {
"node": ">=22.0.0",
"yarn": ">=1.22.0"
},
"scripts": {
"test": "jest",
"lint": "eslint --ignore-path .gitignore src tests && prettier --check **/*.pug",
"lint:fix": "eslint --fix --ignore-path .gitignore src tests && prettier --write **/*.pug"
}
"name": "website",
"version": "2.0.0",
"private": true,
"dependencies": {
"axios": "1.10.0",
"body-parser": "2.2.0",
"client-oauth2": "4.3.3",
"connect-flash": "^0.1.1",
"dotenv": "17.0.0",
"express": "^5.1.0",
"express-session": "^1.18.1",
"express-validator": "7.2.1",
"moment": "^2.30.1",
"node-cache": "^5.1.2",
"node-dependency-injection": "^3.2.2",
"node-fetch": "^3.3.2",
"npm-check": "^6.0.1",
"passport": "^0.7.0",
"passport-oauth2-refresh": "^2.2.0",
"passport-openidconnect": "^0.1.2",
"pug": "3.0.3",
"request": "2.88.2",
"sass": "^1.89.2",
"session-file-store": "^1.5.0",
"showdown": "^2.1.0",
"simple-datatables": "^10.0.0",
"simple-oauth2": "^5.1.0",
"supertest-session": "^5.0.1",
"url-slug": "^4.0.1"
},
"devDependencies": {
"@prettier/plugin-pug": "^3.4.0",
"@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.31.0",
"awesomplete": "^1.1.7",
"css-loader": "^7.1.2",
"eslint": "^9.30.0",
"eslint-config-prettier": "^10.1.5",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-n": "^17.20.0",
"eslint-plugin-prettier": "^5.5.1",
"eslint-plugin-promise": "^7.2.1",
"grunt": "1.6.1",
"grunt-concurrent": "3.0.0",
"grunt-contrib-watch": "^1.1.0",
"grunt-nodemon": "^0.4.2",
"grunt-postcss": "0.9.0",
"grunt-run": "^0.8.1",
"grunt-sass": "4.0.0",
"highcharts": "^12.3.0",
"jest": "^30.0.3",
"load-grunt-config": "4.0.1",
"load-grunt-tasks": "5.1.0",
"nock": "^14.0.5",
"octokit": "^5.0.3",
"prettier": "^3.6.2",
"style-loader": "^4.0.0",
"supertest": "^7.1.1",
"typescript": "^5.8.3",
"webpack": "^5.99.9",
"webpack-cli": "^6.0.1",
"webpack-manifest-plugin": "^5.0.1"
},
"engines": {
"node": ">=22.0.0",
"yarn": ">=1.22.0"
},
"scripts": {
"test": "jest",
"lint": "eslint src tests && prettier --check **/*.pug",
"lint:fix": "eslint --fix src tests && prettier --write **/*.pug"
}
}
4 changes: 3 additions & 1 deletion src/backend/routes/views/clanRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ router.get(
middlewares.isAuthenticated(),
require('./clans/inviteAccept')
)
router.all('*splat', (req, res) => res.status(503).render('errors/503-known-issue'))
router.all('*splat', (req, res) =>
res.status(503).render('errors/503-known-issue')
)

module.exports = router
2 changes: 1 addition & 1 deletion src/backend/templates/mixins/flash-error.pug
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mixin flash-error(validationErrors)
if validationErrors && validationErrors.messages
if validationErrors && validationErrors.messages
.alert(class=validationErrors.class)
ul.validationErrors-errors
each error in validationErrors.messages.errors
Expand Down
2 changes: 1 addition & 1 deletion src/backend/templates/mixins/form/account.pug
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ mixin usernameOrEmail
)
span(aria-hidden='true')

mixin confirm-password(passwordName,labelPassword)
mixin confirm-password(passwordName, labelPassword)
- passwordName = passwordName || 'password'
- labelPassword = labelPassword || ''
.form-group.has-feedback
Expand Down
2 changes: 1 addition & 1 deletion src/backend/templates/views/account/changePassword.pug
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ block content
data-toggle='validator'
)
+oldPassword('Old')
+confirm-password('','New')
+confirm-password('', 'New')
.form-actions
button.btn.btn-default.btn-lg.btn-outro.btn-danger(
type='submit'
Expand Down
9 changes: 0 additions & 9 deletions test.js

This file was deleted.

14 changes: 7 additions & 7 deletions tests/JavaApiClient.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ test('empty passport', () => {
new UserService(),
'http://api-localhost'
)
).toThrowError('oAuthPassport not an object')
).toThrow('oAuthPassport not an object')
})

test('empty token', () => {
Expand All @@ -45,7 +45,7 @@ test('empty token', () => {
'http://api-localhost',
{ refreshToken: '123' }
)
).toThrowError('oAuthPassport.token not a string')
).toThrow('oAuthPassport.token not a string')
})

test('empty refresh-token', () => {
Expand All @@ -55,7 +55,7 @@ test('empty refresh-token', () => {
'http://api-localhost',
{ token: '123' }
)
).toThrowError('oAuthPassport.refreshToken not a string')
).toThrow('oAuthPassport.refreshToken not a string')
})

test('multiple calls with stale token will trigger refresh only once', async () => {
Expand Down Expand Up @@ -89,16 +89,16 @@ test('multiple calls with stale token will trigger refresh only once', async ()
.reply(200, { access_token: 'new_tok', refresh_token: 'new_ref' })

const response = client.get('/example').then((res) => {
expect(res.request.headers.authorization).toBe('Bearer new_tok')
expect(res.config.headers.get('Authorization')).toBe('Bearer new_tok')
})

const response2 = client.get('/example').then((res) => {
expect(res.request.headers.authorization).toBe('Bearer new_tok')
expect(res.config.headers.get('Authorization')).toBe('Bearer new_tok')
})

await Promise.all([response, response2])

expect(refreshSpy).toBeCalledTimes(1)
expect(refreshSpy).toHaveBeenCalledTimes(1)

apiScope.done()
authScope.done()
Expand Down Expand Up @@ -139,7 +139,7 @@ test('refresh will throw on error', async () => {
}

expect(thrown).toBe(true)
expect(refreshSpy).toBeCalledTimes(1)
expect(refreshSpy).toHaveBeenCalledTimes(1)

apiScope.done()
authScope.done()
Expand Down
Loading