mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2026-06-23 04:10:17 +00:00
chore(lint): replace ESLint with OXLint for performance
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
@@ -1,3 +0,0 @@
|
|||||||
SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
|
|
||||||
|
|
||||||
SPDX-License-Identifier: CC0-1.0
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
||||||
|
"plugins": [
|
||||||
|
"typescript",
|
||||||
|
"jest",
|
||||||
|
"react",
|
||||||
|
"nextjs",
|
||||||
|
"jsx-a11y",
|
||||||
|
"import",
|
||||||
|
"unicorn",
|
||||||
|
"oxc"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"no-debugger": "warn",
|
||||||
|
"no-unused-vars": ["warn", { "argsIgnorePattern": "^_+$" }],
|
||||||
|
"typescript/no-unused-vars": ["warn", { "argsIgnorePattern": "^_+$" }],
|
||||||
|
"typescript/consistent-type-imports": ["error", {
|
||||||
|
"prefer": "type-imports",
|
||||||
|
"disallowTypeAnnotations": false
|
||||||
|
}],
|
||||||
|
"jest/no-disabled-tests": "warn",
|
||||||
|
"jest/no-focused-tests": "error",
|
||||||
|
"jest/no-identical-title": "error",
|
||||||
|
"jest/valid-expect": "error"
|
||||||
|
},
|
||||||
|
"env": {
|
||||||
|
"node": true,
|
||||||
|
"jest": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
SPDX-FileCopyrightText: 2026 The HedgeDoc developers (see AUTHORS file)
|
||||||
|
|
||||||
|
SPDX-License-Identifier: CC0-1.0
|
||||||
@@ -1,112 +0,0 @@
|
|||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2025 The HedgeDoc developers (see AUTHORS file)
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: CC0-1.0
|
|
||||||
*/
|
|
||||||
module.exports = {
|
|
||||||
parser: '@typescript-eslint/parser',
|
|
||||||
parserOptions: {
|
|
||||||
project: 'tsconfig.json',
|
|
||||||
sourceType: 'module',
|
|
||||||
},
|
|
||||||
overrides: [
|
|
||||||
{
|
|
||||||
files: ['test/**', 'src/**/*.spec.ts'],
|
|
||||||
extends: ['plugin:jest/recommended'],
|
|
||||||
rules: {
|
|
||||||
'@typescript-eslint/unbound-method': 'off',
|
|
||||||
'@typescript-eslint/no-unsafe-assignment': 'off',
|
|
||||||
'@typescript-eslint/no-unsafe-argument': 'off',
|
|
||||||
'@typescript-eslint/no-unsafe-member-access': 'off',
|
|
||||||
'@typescript-eslint/require-await': 'off',
|
|
||||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
||||||
// This rule seems to create trouble with our tests and mock-knex-client
|
|
||||||
'@darraghor/nestjs-typed/provided-injected-should-match-factory-parameters':
|
|
||||||
'off',
|
|
||||||
'jest/unbound-method': 'error',
|
|
||||||
'jest/expect-expect': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
assertFunctionNames: [
|
|
||||||
'expect**',
|
|
||||||
'request.**.expect',
|
|
||||||
'agent**.**.expect',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'jest/no-standalone-expect': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
additionalTestBlockFunctions: ['afterEach', 'beforeAll'],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
files: ['src/database/**'],
|
|
||||||
rules: {
|
|
||||||
'@typescript-eslint/naming-convention': 'off',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
plugins: [
|
|
||||||
'@typescript-eslint',
|
|
||||||
'jest',
|
|
||||||
'eslint-plugin-local-rules',
|
|
||||||
'@darraghor/nestjs-typed',
|
|
||||||
],
|
|
||||||
extends: [
|
|
||||||
'eslint:recommended',
|
|
||||||
'plugin:@typescript-eslint/recommended',
|
|
||||||
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
|
||||||
'plugin:prettier/recommended',
|
|
||||||
'plugin:@darraghor/nestjs-typed/recommended',
|
|
||||||
],
|
|
||||||
root: true,
|
|
||||||
env: {
|
|
||||||
node: true,
|
|
||||||
jest: true,
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
'prettier/prettier': ['error', require('./.prettierrc.json')],
|
|
||||||
'local-rules/correct-logger-context': 'error',
|
|
||||||
'func-style': ['error', 'declaration'],
|
|
||||||
'@typescript-eslint/no-unused-vars': [
|
|
||||||
'warn',
|
|
||||||
{ argsIgnorePattern: '^_+$' },
|
|
||||||
],
|
|
||||||
'@typescript-eslint/explicit-function-return-type': 'warn',
|
|
||||||
'no-return-await': 'off',
|
|
||||||
'@typescript-eslint/return-await': ['error', 'always'],
|
|
||||||
'@typescript-eslint/naming-convention': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
selector: 'default',
|
|
||||||
format: ['camelCase'],
|
|
||||||
leadingUnderscore: 'allow',
|
|
||||||
trailingUnderscore: 'allow',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
selector: 'import',
|
|
||||||
format: ['camelCase', 'PascalCase'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
selector: 'enumMember',
|
|
||||||
format: ['UPPER_CASE'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
selector: 'variable',
|
|
||||||
format: ['camelCase', 'UPPER_CASE'],
|
|
||||||
leadingUnderscore: 'allow',
|
|
||||||
trailingUnderscore: 'allow',
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
selector: 'typeLike',
|
|
||||||
format: ['PascalCase'],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
// We have our own OpenApi decorator and don't directly use the one from NestJS
|
|
||||||
'@darraghor/nestjs-typed/api-method-should-specify-api-response': 'off',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
"$schema": "../node_modules/oxlint/configuration_schema.json",
|
||||||
|
"jsPlugins": ["./oxlint-local-rules.js"],
|
||||||
|
"plugins": [
|
||||||
|
"typescript",
|
||||||
|
"jest",
|
||||||
|
"oxc"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"no-debugger": "warn",
|
||||||
|
"hedgedoc-local/correct-logger-context": "error",
|
||||||
|
"typescript/no-unused-vars": ["warn", { "argsIgnorePattern": "^_+$" }],
|
||||||
|
"typescript/return-await": ["error", "always"],
|
||||||
|
"typescript/naming-convention": "off",
|
||||||
|
"typescript/no-base-to-string": "error"
|
||||||
|
},
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": ["test/**", "src/**/*.spec.ts"],
|
||||||
|
"rules": {
|
||||||
|
"typescript/unbound-method": "off",
|
||||||
|
"typescript/no-unsafe-assignment": "off",
|
||||||
|
"typescript/no-unsafe-argument": "off",
|
||||||
|
"typescript/no-unsafe-member-access": "off",
|
||||||
|
"typescript/require-await": "off",
|
||||||
|
"typescript/explicit-function-return-type": "off",
|
||||||
|
"jest/unbound-method": "error",
|
||||||
|
"jest/no-standalone-expect": "off"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": ["src/database/**"],
|
||||||
|
"rules": {
|
||||||
|
"typescript/naming-convention": "off"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"env": {
|
||||||
|
"node": true,
|
||||||
|
"jest": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
SPDX-FileCopyrightText: 2026 The HedgeDoc developers (see AUTHORS file)
|
||||||
|
|
||||||
|
SPDX-License-Identifier: CC0-1.0
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
const loggerFunctions = ['error', 'log', 'warn', 'debug', 'verbose'];
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
'correct-logger-context': {
|
|
||||||
meta: {
|
|
||||||
fixable: 'code',
|
|
||||||
type: 'problem',
|
|
||||||
docs: {
|
|
||||||
recommended: true,
|
|
||||||
},
|
|
||||||
schema: [],
|
|
||||||
},
|
|
||||||
create: function (context) {
|
|
||||||
return {
|
|
||||||
CallExpression: function (node) {
|
|
||||||
if (
|
|
||||||
node.callee.type === 'MemberExpression' &&
|
|
||||||
node.callee.object.type === 'MemberExpression' &&
|
|
||||||
node.callee.object.property.name === 'logger' &&
|
|
||||||
loggerFunctions.includes(node.callee.property.name) &&
|
|
||||||
!!node.arguments &&
|
|
||||||
node.arguments.length === 2
|
|
||||||
) {
|
|
||||||
const usedContext = node.arguments[1].value;
|
|
||||||
let correctContext = 'undefined';
|
|
||||||
const ancestors = context.getAncestors();
|
|
||||||
for (let index = ancestors.length - 1; index >= 0; index--) {
|
|
||||||
if (ancestors[index].type === 'MethodDefinition') {
|
|
||||||
correctContext = ancestors[index].key.name;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (usedContext !== correctContext) {
|
|
||||||
context.report({
|
|
||||||
node: node,
|
|
||||||
message: `Used wrong context in log statement`,
|
|
||||||
fix: function (fixer) {
|
|
||||||
return fixer.replaceText(
|
|
||||||
node.arguments[1],
|
|
||||||
`'${correctContext}'`,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
@@ -0,0 +1,111 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2026 The HedgeDoc developers (see AUTHORS file)
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
const loggerFunctions = ['error', 'log', 'warn', 'debug', 'verbose'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensures that logger context strings match the method name where they're called.
|
||||||
|
* This helps with debugging by ensuring log context accurately reflects the source.
|
||||||
|
*
|
||||||
|
* Example of correct usage:
|
||||||
|
* class ExampleService {
|
||||||
|
* exampleMethod() {
|
||||||
|
* this.logger.log('Hello', 'exampleMethod');
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* Example of incorrect usage:
|
||||||
|
* class ExampleService {
|
||||||
|
* exampleMethod() {
|
||||||
|
* this.logger.log('Hello', 'wrongName');
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
const correctLoggerContextRule = {
|
||||||
|
meta: {
|
||||||
|
type: 'problem',
|
||||||
|
docs: {
|
||||||
|
description: 'Ensure logger context strings match the method name where they are called',
|
||||||
|
category: 'Best Practices',
|
||||||
|
recommended: true,
|
||||||
|
},
|
||||||
|
fixable: 'code',
|
||||||
|
schema: [],
|
||||||
|
messages: {
|
||||||
|
wrongContext: "Used wrong context in log statement. Expected '{{expected}}', got '{{actual}}'",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
create: function (context) {
|
||||||
|
const sourceCode = context.sourceCode || context.getSourceCode();
|
||||||
|
|
||||||
|
return {
|
||||||
|
CallExpression: function (node) {
|
||||||
|
// Check if this is a logger call: this.logger.log/error/warn/debug/verbose(...)
|
||||||
|
if (
|
||||||
|
node.callee.type === 'MemberExpression' &&
|
||||||
|
node.callee.object.type === 'MemberExpression' &&
|
||||||
|
node.callee.object.property.name === 'logger' &&
|
||||||
|
loggerFunctions.includes(node.callee.property.name) &&
|
||||||
|
node.arguments &&
|
||||||
|
node.arguments.length === 2
|
||||||
|
) {
|
||||||
|
const contextArg = node.arguments[1];
|
||||||
|
|
||||||
|
// Only check string literal contexts
|
||||||
|
if (contextArg.type !== 'Literal' || typeof contextArg.value !== 'string') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const usedContext = contextArg.value;
|
||||||
|
let correctContext = 'undefined';
|
||||||
|
|
||||||
|
// Walk up the AST to find the enclosing method
|
||||||
|
const ancestors = sourceCode.getAncestors
|
||||||
|
? sourceCode.getAncestors(node)
|
||||||
|
: context.getAncestors();
|
||||||
|
for (let index = ancestors.length - 1; index >= 0; index--) {
|
||||||
|
const ancestor = ancestors[index];
|
||||||
|
if (ancestor.type === 'MethodDefinition' && ancestor.key) {
|
||||||
|
correctContext = ancestor.key.name || ancestor.key.value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Report if context doesn't match
|
||||||
|
if (usedContext !== correctContext) {
|
||||||
|
context.report({
|
||||||
|
node: contextArg,
|
||||||
|
messageId: 'wrongContext',
|
||||||
|
data: {
|
||||||
|
expected: correctContext,
|
||||||
|
actual: usedContext,
|
||||||
|
},
|
||||||
|
fix: function (fixer) {
|
||||||
|
return fixer.replaceText(contextArg, `'${correctContext}'`);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const plugin = {
|
||||||
|
meta: {
|
||||||
|
name: 'hedgedoc-local',
|
||||||
|
version: '1.0.0',
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
'correct-logger-context': correctLoggerContextRule,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
// Export CommonJS for ESLint, ESM for oxlint
|
||||||
|
if (typeof module !== 'undefined' && module.exports) {
|
||||||
|
module.exports = plugin;
|
||||||
|
}
|
||||||
|
export default plugin;
|
||||||
+5
-12
@@ -11,8 +11,8 @@
|
|||||||
"format:fix": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
"format:fix": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||||
"start": "node dist/src/main",
|
"start": "node dist/src/main",
|
||||||
"start:dev": "nest start --watch",
|
"start:dev": "nest start --watch",
|
||||||
"lint": "eslint --max-warnings 0 \"{src,apps,libs,test}/**/*.ts\"",
|
"lint": "../node_modules/.bin/oxlint src test",
|
||||||
"lint:fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
"lint:fix": "../node_modules/.bin/oxlint src test --fix",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"test:watch": "jest --watch",
|
"test:watch": "jest --watch",
|
||||||
"test:ci": "jest --coverage --runInBand",
|
"test:ci": "jest --coverage --runInBand",
|
||||||
@@ -70,7 +70,6 @@
|
|||||||
"zod": "3.25.76"
|
"zod": "3.25.76"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@darraghor/eslint-plugin-nestjs-typed": "5.0.32",
|
|
||||||
"@nestjs/cli": "10.4.9",
|
"@nestjs/cli": "10.4.9",
|
||||||
"@nestjs/schematics": "10.2.3",
|
"@nestjs/schematics": "10.2.3",
|
||||||
"@nestjs/testing": "10.4.20",
|
"@nestjs/testing": "10.4.20",
|
||||||
@@ -92,14 +91,6 @@
|
|||||||
"@types/source-map-support": "0.5.10",
|
"@types/source-map-support": "0.5.10",
|
||||||
"@types/supertest": "2.0.16",
|
"@types/supertest": "2.0.16",
|
||||||
"@types/ws": "8.18.1",
|
"@types/ws": "8.18.1",
|
||||||
"@typescript-eslint/eslint-plugin": "7.18.0",
|
|
||||||
"@typescript-eslint/parser": "7.18.0",
|
|
||||||
"eslint": "8.57.1",
|
|
||||||
"eslint-config-prettier": "9.1.2",
|
|
||||||
"eslint-plugin-import": "2.32.0",
|
|
||||||
"eslint-plugin-jest": "28.14.0",
|
|
||||||
"eslint-plugin-local-rules": "3.0.2",
|
|
||||||
"eslint-plugin-prettier": "5.5.4",
|
|
||||||
"jest": "29.7.0",
|
"jest": "29.7.0",
|
||||||
"knex-mock-client": "3.0.2",
|
"knex-mock-client": "3.0.2",
|
||||||
"mocked-env": "1.3.5",
|
"mocked-env": "1.3.5",
|
||||||
@@ -126,7 +117,9 @@
|
|||||||
{
|
{
|
||||||
"tsconfig": "test/tsconfig.json",
|
"tsconfig": "test/tsconfig.json",
|
||||||
"diagnostics": {
|
"diagnostics": {
|
||||||
"ignoreCodes": [151002]
|
"ignoreCodes": [
|
||||||
|
151002
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -277,12 +277,12 @@ describe('ApiTokenService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// expect is common in this test group, and therefore called in afterEach instead of each test
|
// expect is common in this test group, and therefore called in afterEach instead of each test
|
||||||
// eslint-disable-next-line jest/expect-expect
|
// oxlint-disable-next-line jest/expect-expect
|
||||||
it('without validUntil', async () => {
|
it('without validUntil', async () => {
|
||||||
token = await service.createToken(userId, label);
|
token = await service.createToken(userId, label);
|
||||||
});
|
});
|
||||||
|
|
||||||
// eslint-disable-next-line jest/expect-expect
|
// oxlint-disable-next-line jest/expect-expect
|
||||||
it('with validUntil more than two years in the future', async () => {
|
it('with validUntil more than two years in the future', async () => {
|
||||||
token = await service.createToken(
|
token = await service.createToken(
|
||||||
userId,
|
userId,
|
||||||
@@ -291,7 +291,7 @@ describe('ApiTokenService', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
// eslint-disable-next-line jest/expect-expect
|
// oxlint-disable-next-line jest/expect-expect
|
||||||
it('with validUntil less than two years in the future', async () => {
|
it('with validUntil less than two years in the future', async () => {
|
||||||
token = await service.createToken(
|
token = await service.createToken(
|
||||||
userId,
|
userId,
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import getRawBody from 'raw-body';
|
|||||||
* Implementation inspired by https://stackoverflow.com/questions/52283713/how-do-i-pass-plain-text-as-my-request-body-using-nestjs
|
* Implementation inspired by https://stackoverflow.com/questions/52283713/how-do-i-pass-plain-text-as-my-request-body-using-nestjs
|
||||||
*/
|
*/
|
||||||
// Override naming convention as decorators are in PascalCase
|
// Override naming convention as decorators are in PascalCase
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||||
export const MarkdownBody = createParamDecorator(
|
export const MarkdownBody = createParamDecorator(
|
||||||
async (_, context: ExecutionContext) => {
|
async (_, context: ExecutionContext) => {
|
||||||
// we have to check req.readable because of raw-body issue #57
|
// we have to check req.readable because of raw-body issue #57
|
||||||
@@ -43,7 +43,7 @@ export const MarkdownBody = createParamDecorator(
|
|||||||
(target, key): void => {
|
(target, key): void => {
|
||||||
if (key === undefined) {
|
if (key === undefined) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
// oxlint-disable-next-line @typescript-eslint/no-base-to-string
|
||||||
`Could not enhance param decorator for target ${target.toString()} because key is undefined`,
|
`Could not enhance param decorator for target ${target.toString()} because key is undefined`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -53,7 +53,7 @@ export const MarkdownBody = createParamDecorator(
|
|||||||
);
|
);
|
||||||
if (!ownPropertyDescriptor) {
|
if (!ownPropertyDescriptor) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
// oxlint-disable-next-line @typescript-eslint/no-base-to-string
|
||||||
`Could not get property descriptor for target ${target.toString()} and key ${key.toString()}`,
|
`Could not get property descriptor for target ${target.toString()} and key ${key.toString()}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,13 +74,13 @@ export interface HttpStatusCodeWithExtraInformation {
|
|||||||
* For non-200 successful responses the appropriate {@link HttpCode} decorator is set
|
* For non-200 successful responses the appropriate {@link HttpCode} decorator is set
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention,func-style
|
// oxlint-disable-next-line @typescript-eslint/naming-convention,func-style
|
||||||
export const OpenApi = (
|
export const OpenApi = (
|
||||||
...httpStatusCodesMaybeWithExtraInformation: (
|
...httpStatusCodesMaybeWithExtraInformation: (
|
||||||
| HttpStatusCodes
|
| HttpStatusCodes
|
||||||
| HttpStatusCodeWithExtraInformation
|
| HttpStatusCodeWithExtraInformation
|
||||||
)[]
|
)[]
|
||||||
): // eslint-disable-next-line @typescript-eslint/ban-types
|
): // oxlint-disable-next-line @typescript-eslint/ban-types
|
||||||
(<TFunction extends Function, Y>(
|
(<TFunction extends Function, Y>(
|
||||||
target: object | TFunction,
|
target: object | TFunction,
|
||||||
propertyKey?: string | symbol,
|
propertyKey?: string | symbol,
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import { CompleteRequest } from '../request.type';
|
|||||||
*
|
*
|
||||||
* Will throw an {@link InternalServerErrorException} if no note is present
|
* Will throw an {@link InternalServerErrorException} if no note is present
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||||
export const RequestNoteId = createParamDecorator(
|
export const RequestNoteId = createParamDecorator(
|
||||||
(data: unknown, ctx: ExecutionContext) => {
|
(data: unknown, ctx: ExecutionContext) => {
|
||||||
const request: CompleteRequest = ctx.switchToHttp().getRequest();
|
const request: CompleteRequest = ctx.switchToHttp().getRequest();
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ type RequestUserIdParameter = {
|
|||||||
* If no user is present and guests are allowed, returns `null`.
|
* If no user is present and guests are allowed, returns `null`.
|
||||||
* If no user is present and guests are not allowed, throws {@link UnauthorizedException}.
|
* If no user is present and guests are not allowed, throws {@link UnauthorizedException}.
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||||
export const RequestUserId = createParamDecorator(
|
export const RequestUserId = createParamDecorator(
|
||||||
(
|
(
|
||||||
data: RequestUserIdParameter = { forbidGuests: false },
|
data: RequestUserIdParameter = { forbidGuests: false },
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import { CompleteRequest } from '../request.type';
|
|||||||
*
|
*
|
||||||
* Will throw an {@link InternalServerErrorException} if no identifier is present
|
* Will throw an {@link InternalServerErrorException} if no identifier is present
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||||
export const SessionAuthProvider = createParamDecorator(
|
export const SessionAuthProvider = createParamDecorator(
|
||||||
(data: unknown, ctx: ExecutionContext) => {
|
(data: unknown, ctx: ExecutionContext) => {
|
||||||
const request: CompleteRequest = ctx.switchToHttp().getRequest();
|
const request: CompleteRequest = ctx.switchToHttp().getRequest();
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ describe('extract note from request', () => {
|
|||||||
: {},
|
: {},
|
||||||
headers: headerValue
|
headers: headerValue
|
||||||
? {
|
? {
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||||
'hedgedoc-note': headerValue,
|
'hedgedoc-note': headerValue,
|
||||||
}
|
}
|
||||||
: {},
|
: {},
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import { PendingLdapUserInfoDto } from '../../dtos/pending-ldap-user-info.dto';
|
|||||||
import { ConsoleLoggerService } from '../../logger/console-logger.service';
|
import { ConsoleLoggerService } from '../../logger/console-logger.service';
|
||||||
|
|
||||||
const LDAP_ERROR_MAP: Record<string, string> = {
|
const LDAP_ERROR_MAP: Record<string, string> = {
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
'530': 'Not Permitted to login at this time',
|
'530': 'Not Permitted to login at this time',
|
||||||
'531': 'Not permitted to logon at this workstation',
|
'531': 'Not permitted to logon at this workstation',
|
||||||
'532': 'Password expired',
|
'532': 'Password expired',
|
||||||
@@ -31,7 +31,7 @@ const LDAP_ERROR_MAP: Record<string, string> = {
|
|||||||
'773': 'User must reset password',
|
'773': 'User must reset password',
|
||||||
'775': 'User account locked',
|
'775': 'User account locked',
|
||||||
default: 'Invalid username/password',
|
default: 'Invalid username/password',
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@@ -76,7 +76,7 @@ export class LdapService {
|
|||||||
const exception = this.getLdapException(username, error);
|
const exception = this.getLdapException(username, error);
|
||||||
return reject(exception);
|
return reject(exception);
|
||||||
});
|
});
|
||||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
// oxlint-disable-next-line @typescript-eslint/no-empty-function
|
||||||
auth.on('error', () => {}); // Ignore further errors
|
auth.on('error', () => {}); // Ignore further errors
|
||||||
auth.authenticate(
|
auth.authenticate(
|
||||||
username,
|
username,
|
||||||
|
|||||||
@@ -85,23 +85,23 @@ export class OidcService {
|
|||||||
const issuer = useAutodiscover
|
const issuer = useAutodiscover
|
||||||
? await Issuer.discover(oidcConfig.issuer)
|
? await Issuer.discover(oidcConfig.issuer)
|
||||||
: new Issuer({
|
: new Issuer({
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
issuer: oidcConfig.issuer,
|
issuer: oidcConfig.issuer,
|
||||||
authorization_endpoint: oidcConfig.authorizeUrl,
|
authorization_endpoint: oidcConfig.authorizeUrl,
|
||||||
token_endpoint: oidcConfig.tokenUrl,
|
token_endpoint: oidcConfig.tokenUrl,
|
||||||
userinfo_endpoint: oidcConfig.userinfoUrl,
|
userinfo_endpoint: oidcConfig.userinfoUrl,
|
||||||
end_session_endpoint: oidcConfig.endSessionUrl,
|
end_session_endpoint: oidcConfig.endSessionUrl,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
});
|
});
|
||||||
|
|
||||||
const redirectUri = `${this.appConfig.baseUrl}/api/private/auth/oidc/${oidcConfig.identifier}/callback`;
|
const redirectUri = `${this.appConfig.baseUrl}/api/private/auth/oidc/${oidcConfig.identifier}/callback`;
|
||||||
const client = new issuer.Client({
|
const client = new issuer.Client({
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
client_id: oidcConfig.clientId,
|
client_id: oidcConfig.clientId,
|
||||||
client_secret: oidcConfig.clientSecret,
|
client_secret: oidcConfig.clientSecret,
|
||||||
redirect_uris: [redirectUri],
|
redirect_uris: [redirectUri],
|
||||||
response_types: ['code'],
|
response_types: ['code'],
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
client,
|
client,
|
||||||
@@ -157,11 +157,11 @@ export class OidcService {
|
|||||||
const client = clientConfig.client;
|
const client = clientConfig.client;
|
||||||
return client.authorizationUrl({
|
return client.authorizationUrl({
|
||||||
scope: clientConfig.config.scope,
|
scope: clientConfig.config.scope,
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
code_challenge: generators.codeChallenge(code),
|
code_challenge: generators.codeChallenge(code),
|
||||||
code_challenge_method: 'S256',
|
code_challenge_method: 'S256',
|
||||||
state,
|
state,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,7 +193,7 @@ export class OidcService {
|
|||||||
? client.callback.bind(client)
|
? client.callback.bind(client)
|
||||||
: client.oauthCallback.bind(client);
|
: client.oauthCallback.bind(client);
|
||||||
const tokenSet = await callbackMethod(clientConfig.redirectUri, params, {
|
const tokenSet = await callbackMethod(clientConfig.redirectUri, params, {
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||||
code_verifier: code,
|
code_verifier: code,
|
||||||
state,
|
state,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -25,13 +25,13 @@ describe('appConfig', () => {
|
|||||||
it('when given correct and complete environment variables', async () => {
|
it('when given correct and complete environment variables', async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_BASE_URL: baseUrl,
|
HD_BASE_URL: baseUrl,
|
||||||
HD_RENDERER_BASE_URL: rendererBaseUrl,
|
HD_RENDERER_BASE_URL: rendererBaseUrl,
|
||||||
HD_BACKEND_PORT: port.toString(),
|
HD_BACKEND_PORT: port.toString(),
|
||||||
HD_LOG_LEVEL: loglevel,
|
HD_LOG_LEVEL: loglevel,
|
||||||
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -49,12 +49,12 @@ describe('appConfig', () => {
|
|||||||
it('when no HD_RENDER_BASE_URL is set', () => {
|
it('when no HD_RENDER_BASE_URL is set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_BASE_URL: baseUrl,
|
HD_BASE_URL: baseUrl,
|
||||||
HD_BACKEND_PORT: port.toString(),
|
HD_BACKEND_PORT: port.toString(),
|
||||||
HD_LOG_LEVEL: loglevel,
|
HD_LOG_LEVEL: loglevel,
|
||||||
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -72,12 +72,12 @@ describe('appConfig', () => {
|
|||||||
it('when no PORT is set', () => {
|
it('when no PORT is set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_BASE_URL: baseUrl,
|
HD_BASE_URL: baseUrl,
|
||||||
HD_RENDERER_BASE_URL: rendererBaseUrl,
|
HD_RENDERER_BASE_URL: rendererBaseUrl,
|
||||||
HD_LOG_LEVEL: loglevel,
|
HD_LOG_LEVEL: loglevel,
|
||||||
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -95,12 +95,12 @@ describe('appConfig', () => {
|
|||||||
it('when no HD_LOG_LEVEL is set', () => {
|
it('when no HD_LOG_LEVEL is set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_BASE_URL: baseUrl,
|
HD_BASE_URL: baseUrl,
|
||||||
HD_RENDERER_BASE_URL: rendererBaseUrl,
|
HD_RENDERER_BASE_URL: rendererBaseUrl,
|
||||||
HD_BACKEND_PORT: port.toString(),
|
HD_BACKEND_PORT: port.toString(),
|
||||||
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -118,13 +118,13 @@ describe('appConfig', () => {
|
|||||||
it('when no HD_LOG_SHOW_TIMESTAMP is set', () => {
|
it('when no HD_LOG_SHOW_TIMESTAMP is set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_BASE_URL: baseUrl,
|
HD_BASE_URL: baseUrl,
|
||||||
HD_RENDERER_BASE_URL: rendererBaseUrl,
|
HD_RENDERER_BASE_URL: rendererBaseUrl,
|
||||||
HD_LOG_LEVEL: loglevel,
|
HD_LOG_LEVEL: loglevel,
|
||||||
HD_BACKEND_PORT: port.toString(),
|
HD_BACKEND_PORT: port.toString(),
|
||||||
HD_PERSIST_INTERVAL: '0',
|
HD_PERSIST_INTERVAL: '0',
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -163,12 +163,12 @@ describe('appConfig', () => {
|
|||||||
it('when given a non-valid HD_BASE_URL', async () => {
|
it('when given a non-valid HD_BASE_URL', async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_BASE_URL: invalidBaseUrl,
|
HD_BASE_URL: invalidBaseUrl,
|
||||||
HD_BACKEND_PORT: port.toString(),
|
HD_BACKEND_PORT: port.toString(),
|
||||||
HD_LOG_LEVEL: loglevel,
|
HD_LOG_LEVEL: loglevel,
|
||||||
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -185,11 +185,11 @@ describe('appConfig', () => {
|
|||||||
it('when given a base url with subdirectory in HD_BASE_URL', async () => {
|
it('when given a base url with subdirectory in HD_BASE_URL', async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_BASE_URL: 'https://example.org/subdirectory/',
|
HD_BASE_URL: 'https://example.org/subdirectory/',
|
||||||
HD_LOG_LEVEL: loglevel,
|
HD_LOG_LEVEL: loglevel,
|
||||||
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -206,12 +206,12 @@ describe('appConfig', () => {
|
|||||||
it('when given a negative PORT', async () => {
|
it('when given a negative PORT', async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_BASE_URL: baseUrl,
|
HD_BASE_URL: baseUrl,
|
||||||
HD_BACKEND_PORT: negativePort.toString(),
|
HD_BACKEND_PORT: negativePort.toString(),
|
||||||
HD_LOG_LEVEL: loglevel,
|
HD_LOG_LEVEL: loglevel,
|
||||||
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -228,12 +228,12 @@ describe('appConfig', () => {
|
|||||||
it('when given a out-of-range PORT', async () => {
|
it('when given a out-of-range PORT', async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_BASE_URL: baseUrl,
|
HD_BASE_URL: baseUrl,
|
||||||
HD_BACKEND_PORT: outOfRangePort.toString(),
|
HD_BACKEND_PORT: outOfRangePort.toString(),
|
||||||
HD_LOG_LEVEL: loglevel,
|
HD_LOG_LEVEL: loglevel,
|
||||||
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -250,12 +250,12 @@ describe('appConfig', () => {
|
|||||||
it('when given a non-integer PORT', async () => {
|
it('when given a non-integer PORT', async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_BASE_URL: baseUrl,
|
HD_BASE_URL: baseUrl,
|
||||||
HD_BACKEND_PORT: floatPort.toString(),
|
HD_BACKEND_PORT: floatPort.toString(),
|
||||||
HD_LOG_LEVEL: loglevel,
|
HD_LOG_LEVEL: loglevel,
|
||||||
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -272,12 +272,12 @@ describe('appConfig', () => {
|
|||||||
it('when given a non-number PORT', async () => {
|
it('when given a non-number PORT', async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_BASE_URL: baseUrl,
|
HD_BASE_URL: baseUrl,
|
||||||
HD_BACKEND_PORT: invalidPort,
|
HD_BACKEND_PORT: invalidPort,
|
||||||
HD_LOG_LEVEL: loglevel,
|
HD_LOG_LEVEL: loglevel,
|
||||||
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -294,12 +294,12 @@ describe('appConfig', () => {
|
|||||||
it('when given a non-loglevel HD_LOG_LEVEL', async () => {
|
it('when given a non-loglevel HD_LOG_LEVEL', async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_BASE_URL: baseUrl,
|
HD_BASE_URL: baseUrl,
|
||||||
HD_BACKEND_PORT: port.toString(),
|
HD_BACKEND_PORT: port.toString(),
|
||||||
HD_LOG_LEVEL: invalidLoglevel,
|
HD_LOG_LEVEL: invalidLoglevel,
|
||||||
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ jest.mock('fs', () => ({
|
|||||||
describe('authConfig', () => {
|
describe('authConfig', () => {
|
||||||
const secret = 'this-is-a-secret';
|
const secret = 'this-is-a-secret';
|
||||||
const neededAuthConfig = {
|
const neededAuthConfig = {
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_AUTH_SESSION_SECRET: secret,
|
HD_AUTH_SESSION_SECRET: secret,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
};
|
};
|
||||||
|
|
||||||
describe('local', () => {
|
describe('local', () => {
|
||||||
@@ -31,20 +31,20 @@ describe('authConfig', () => {
|
|||||||
const enableRegister = true;
|
const enableRegister = true;
|
||||||
const minimalPasswordStrength = 1;
|
const minimalPasswordStrength = 1;
|
||||||
const completeLocalConfig = {
|
const completeLocalConfig = {
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_AUTH_LOCAL_ENABLE_LOGIN: String(enableLogin),
|
HD_AUTH_LOCAL_ENABLE_LOGIN: String(enableLogin),
|
||||||
HD_AUTH_LOCAL_ENABLE_REGISTER: String(enableRegister),
|
HD_AUTH_LOCAL_ENABLE_REGISTER: String(enableRegister),
|
||||||
HD_AUTH_LOCAL_MINIMAL_PASSWORD_STRENGTH: String(minimalPasswordStrength),
|
HD_AUTH_LOCAL_MINIMAL_PASSWORD_STRENGTH: String(minimalPasswordStrength),
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
};
|
};
|
||||||
describe('is correctly parsed', () => {
|
describe('is correctly parsed', () => {
|
||||||
it('when given correct and complete environment variables', () => {
|
it('when given correct and complete environment variables', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeLocalConfig,
|
...completeLocalConfig,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -62,11 +62,11 @@ describe('authConfig', () => {
|
|||||||
it('when HD_AUTH_LOCAL_ENABLE_LOGIN is not set', () => {
|
it('when HD_AUTH_LOCAL_ENABLE_LOGIN is not set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeLocalConfig,
|
...completeLocalConfig,
|
||||||
HD_AUTH_LOCAL_ENABLE_LOGIN: undefined,
|
HD_AUTH_LOCAL_ENABLE_LOGIN: undefined,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -84,11 +84,11 @@ describe('authConfig', () => {
|
|||||||
it('when HD_AUTH_LOCAL_ENABLE_REGISTER is not set', () => {
|
it('when HD_AUTH_LOCAL_ENABLE_REGISTER is not set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeLocalConfig,
|
...completeLocalConfig,
|
||||||
HD_AUTH_LOCAL_ENABLE_REGISTER: undefined,
|
HD_AUTH_LOCAL_ENABLE_REGISTER: undefined,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -106,11 +106,11 @@ describe('authConfig', () => {
|
|||||||
it('when HD_AUTH_LOCAL_MINIMAL_PASSWORD_STRENGTH is not set', () => {
|
it('when HD_AUTH_LOCAL_MINIMAL_PASSWORD_STRENGTH is not set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeLocalConfig,
|
...completeLocalConfig,
|
||||||
HD_AUTH_LOCAL_MINIMAL_PASSWORD_STRENGTH: undefined,
|
HD_AUTH_LOCAL_MINIMAL_PASSWORD_STRENGTH: undefined,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -147,11 +147,11 @@ describe('authConfig', () => {
|
|||||||
it('when HD_AUTH_LOCAL_MINIMAL_PASSWORD_STRENGTH is 5', () => {
|
it('when HD_AUTH_LOCAL_MINIMAL_PASSWORD_STRENGTH is 5', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeLocalConfig,
|
...completeLocalConfig,
|
||||||
HD_AUTH_LOCAL_MINIMAL_PASSWORD_STRENGTH: '5',
|
HD_AUTH_LOCAL_MINIMAL_PASSWORD_STRENGTH: '5',
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -167,11 +167,11 @@ describe('authConfig', () => {
|
|||||||
it('when HD_AUTH_LOCAL_MINIMAL_PASSWORD_STRENGTH is -1', () => {
|
it('when HD_AUTH_LOCAL_MINIMAL_PASSWORD_STRENGTH is -1', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeLocalConfig,
|
...completeLocalConfig,
|
||||||
HD_AUTH_LOCAL_MINIMAL_PASSWORD_STRENGTH: '-1',
|
HD_AUTH_LOCAL_MINIMAL_PASSWORD_STRENGTH: '-1',
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -203,7 +203,7 @@ describe('authConfig', () => {
|
|||||||
const tlsCa = ['./test.pem'];
|
const tlsCa = ['./test.pem'];
|
||||||
const tlsCaContent = ['test-cert\n'];
|
const tlsCaContent = ['test-cert\n'];
|
||||||
const completeLdapConfig = {
|
const completeLdapConfig = {
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_AUTH_LDAP_SERVERS: ldapNames.join(','),
|
HD_AUTH_LDAP_SERVERS: ldapNames.join(','),
|
||||||
HD_AUTH_LDAP_FUTURAMA_PROVIDER_NAME: providerName,
|
HD_AUTH_LDAP_FUTURAMA_PROVIDER_NAME: providerName,
|
||||||
HD_AUTH_LDAP_FUTURAMA_URL: url,
|
HD_AUTH_LDAP_FUTURAMA_URL: url,
|
||||||
@@ -217,16 +217,16 @@ describe('authConfig', () => {
|
|||||||
HD_AUTH_LDAP_FUTURAMA_BIND_DN: bindDn,
|
HD_AUTH_LDAP_FUTURAMA_BIND_DN: bindDn,
|
||||||
HD_AUTH_LDAP_FUTURAMA_BIND_CREDENTIALS: bindCredentials,
|
HD_AUTH_LDAP_FUTURAMA_BIND_CREDENTIALS: bindCredentials,
|
||||||
HD_AUTH_LDAP_FUTURAMA_TLS_CERT_PATHS: tlsCa.join(','),
|
HD_AUTH_LDAP_FUTURAMA_TLS_CERT_PATHS: tlsCa.join(','),
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
};
|
};
|
||||||
describe('is correctly parsed', () => {
|
describe('is correctly parsed', () => {
|
||||||
it('when given correct and complete environment variables', () => {
|
it('when given correct and complete environment variables', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeLdapConfig,
|
...completeLdapConfig,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -255,11 +255,11 @@ describe('authConfig', () => {
|
|||||||
it('when no HD_AUTH_LDAP_FUTURAMA_PROVIDER_NAME is not set', () => {
|
it('when no HD_AUTH_LDAP_FUTURAMA_PROVIDER_NAME is not set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeLdapConfig,
|
...completeLdapConfig,
|
||||||
HD_AUTH_LDAP_FUTURAMA_PROVIDER_NAME: undefined,
|
HD_AUTH_LDAP_FUTURAMA_PROVIDER_NAME: undefined,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -287,11 +287,11 @@ describe('authConfig', () => {
|
|||||||
it('when no HD_AUTH_LDAP_FUTURAMA_SEARCH_FILTER is not set', () => {
|
it('when no HD_AUTH_LDAP_FUTURAMA_SEARCH_FILTER is not set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeLdapConfig,
|
...completeLdapConfig,
|
||||||
HD_AUTH_LDAP_FUTURAMA_SEARCH_FILTER: undefined,
|
HD_AUTH_LDAP_FUTURAMA_SEARCH_FILTER: undefined,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -319,11 +319,11 @@ describe('authConfig', () => {
|
|||||||
it('when no HD_AUTH_LDAP_FUTURAMA_USER_ID_FIELD is not set', () => {
|
it('when no HD_AUTH_LDAP_FUTURAMA_USER_ID_FIELD is not set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeLdapConfig,
|
...completeLdapConfig,
|
||||||
HD_AUTH_LDAP_FUTURAMA_USER_ID_FIELD: undefined,
|
HD_AUTH_LDAP_FUTURAMA_USER_ID_FIELD: undefined,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -351,11 +351,11 @@ describe('authConfig', () => {
|
|||||||
it('when no HD_AUTH_LDAP_FUTURAMA_DISPLAY_NAME_FIELD is not set', () => {
|
it('when no HD_AUTH_LDAP_FUTURAMA_DISPLAY_NAME_FIELD is not set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeLdapConfig,
|
...completeLdapConfig,
|
||||||
HD_AUTH_LDAP_FUTURAMA_DISPLAY_NAME_FIELD: undefined,
|
HD_AUTH_LDAP_FUTURAMA_DISPLAY_NAME_FIELD: undefined,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -383,11 +383,11 @@ describe('authConfig', () => {
|
|||||||
it('when no HD_AUTH_LDAP_FUTURAMA_PROFILE_PICTURE_FIELD is not set', () => {
|
it('when no HD_AUTH_LDAP_FUTURAMA_PROFILE_PICTURE_FIELD is not set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeLdapConfig,
|
...completeLdapConfig,
|
||||||
HD_AUTH_LDAP_FUTURAMA_PROFILE_PICTURE_FIELD: undefined,
|
HD_AUTH_LDAP_FUTURAMA_PROFILE_PICTURE_FIELD: undefined,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -415,11 +415,11 @@ describe('authConfig', () => {
|
|||||||
it('when no HD_AUTH_LDAP_FUTURAMA_BIND_DN is not set', () => {
|
it('when no HD_AUTH_LDAP_FUTURAMA_BIND_DN is not set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeLdapConfig,
|
...completeLdapConfig,
|
||||||
HD_AUTH_LDAP_FUTURAMA_BIND_DN: undefined,
|
HD_AUTH_LDAP_FUTURAMA_BIND_DN: undefined,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -447,11 +447,11 @@ describe('authConfig', () => {
|
|||||||
it('when no HD_AUTH_LDAP_FUTURAMA_BIND_CREDENTIALS is not set', () => {
|
it('when no HD_AUTH_LDAP_FUTURAMA_BIND_CREDENTIALS is not set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeLdapConfig,
|
...completeLdapConfig,
|
||||||
HD_AUTH_LDAP_FUTURAMA_BIND_CREDENTIALS: undefined,
|
HD_AUTH_LDAP_FUTURAMA_BIND_CREDENTIALS: undefined,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -479,11 +479,11 @@ describe('authConfig', () => {
|
|||||||
it('when no HD_AUTH_LDAP_FUTURAMA_TLS_CERT_PATHS is not set', () => {
|
it('when no HD_AUTH_LDAP_FUTURAMA_TLS_CERT_PATHS is not set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeLdapConfig,
|
...completeLdapConfig,
|
||||||
HD_AUTH_LDAP_FUTURAMA_TLS_CERT_PATHS: undefined,
|
HD_AUTH_LDAP_FUTURAMA_TLS_CERT_PATHS: undefined,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -531,11 +531,11 @@ describe('authConfig', () => {
|
|||||||
it('when HD_AUTH_LDAP_FUTURAMA_URL is wrong', () => {
|
it('when HD_AUTH_LDAP_FUTURAMA_URL is wrong', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeLdapConfig,
|
...completeLdapConfig,
|
||||||
HD_AUTH_LDAP_FUTURAMA_URL: undefined,
|
HD_AUTH_LDAP_FUTURAMA_URL: undefined,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -551,11 +551,11 @@ describe('authConfig', () => {
|
|||||||
it('when HD_AUTH_LDAP_FUTURAMA_SEARCH_BASE is wrong', () => {
|
it('when HD_AUTH_LDAP_FUTURAMA_SEARCH_BASE is wrong', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeLdapConfig,
|
...completeLdapConfig,
|
||||||
HD_AUTH_LDAP_FUTURAMA_SEARCH_BASE: undefined,
|
HD_AUTH_LDAP_FUTURAMA_SEARCH_BASE: undefined,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -571,11 +571,11 @@ describe('authConfig', () => {
|
|||||||
it('when HD_AUTH_LDAP_FUTURAMA_TLS_CERT_PATHS is wrong', () => {
|
it('when HD_AUTH_LDAP_FUTURAMA_TLS_CERT_PATHS is wrong', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeLdapConfig,
|
...completeLdapConfig,
|
||||||
HD_AUTH_LDAP_FUTURAMA_TLS_CERT_PATHS: 'not-a-file.pem',
|
HD_AUTH_LDAP_FUTURAMA_TLS_CERT_PATHS: 'not-a-file.pem',
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -615,7 +615,7 @@ describe('authConfig', () => {
|
|||||||
const defaultEmailField = 'email';
|
const defaultEmailField = 'email';
|
||||||
const enableRegistration = 'false';
|
const enableRegistration = 'false';
|
||||||
const completeOidcConfig = {
|
const completeOidcConfig = {
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_AUTH_OIDC_SERVERS: oidcNames.join(','),
|
HD_AUTH_OIDC_SERVERS: oidcNames.join(','),
|
||||||
HD_AUTH_OIDC_GITLAB_PROVIDER_NAME: providerName,
|
HD_AUTH_OIDC_GITLAB_PROVIDER_NAME: providerName,
|
||||||
HD_AUTH_OIDC_GITLAB_ISSUER: issuer,
|
HD_AUTH_OIDC_GITLAB_ISSUER: issuer,
|
||||||
@@ -633,16 +633,16 @@ describe('authConfig', () => {
|
|||||||
HD_AUTH_OIDC_GITLAB_PROFILE_PICTURE_FIELD: profilePictureField,
|
HD_AUTH_OIDC_GITLAB_PROFILE_PICTURE_FIELD: profilePictureField,
|
||||||
HD_AUTH_OIDC_GITLAB_EMAIL_FIELD: emailField,
|
HD_AUTH_OIDC_GITLAB_EMAIL_FIELD: emailField,
|
||||||
HD_AUTH_OIDC_GITLAB_ENABLE_REGISTRATION: enableRegistration,
|
HD_AUTH_OIDC_GITLAB_ENABLE_REGISTRATION: enableRegistration,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
};
|
};
|
||||||
describe('is correctly parsed', () => {
|
describe('is correctly parsed', () => {
|
||||||
it('when given correct and complete environment variables', () => {
|
it('when given correct and complete environment variables', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeOidcConfig,
|
...completeOidcConfig,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -673,11 +673,11 @@ describe('authConfig', () => {
|
|||||||
it('when HD_AUTH_OIDC_GITLAB_THEME is not set', () => {
|
it('when HD_AUTH_OIDC_GITLAB_THEME is not set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeOidcConfig,
|
...completeOidcConfig,
|
||||||
HD_AUTH_OIDC_GITLAB_THEME: undefined,
|
HD_AUTH_OIDC_GITLAB_THEME: undefined,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -708,11 +708,11 @@ describe('authConfig', () => {
|
|||||||
it('when HD_AUTH_OIDC_GITLAB_AUTHORIZE_URL is not set', () => {
|
it('when HD_AUTH_OIDC_GITLAB_AUTHORIZE_URL is not set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeOidcConfig,
|
...completeOidcConfig,
|
||||||
HD_AUTH_OIDC_GITLAB_AUTHORIZE_URL: undefined,
|
HD_AUTH_OIDC_GITLAB_AUTHORIZE_URL: undefined,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -743,11 +743,11 @@ describe('authConfig', () => {
|
|||||||
it('when HD_AUTH_OIDC_GITLAB_TOKEN_URL is not set', () => {
|
it('when HD_AUTH_OIDC_GITLAB_TOKEN_URL is not set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeOidcConfig,
|
...completeOidcConfig,
|
||||||
HD_AUTH_OIDC_GITLAB_TOKEN_URL: undefined,
|
HD_AUTH_OIDC_GITLAB_TOKEN_URL: undefined,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -778,11 +778,11 @@ describe('authConfig', () => {
|
|||||||
it('when HD_AUTH_OIDC_GITLAB_USERINFO_URL is not set', () => {
|
it('when HD_AUTH_OIDC_GITLAB_USERINFO_URL is not set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeOidcConfig,
|
...completeOidcConfig,
|
||||||
HD_AUTH_OIDC_GITLAB_USERINFO_URL: undefined,
|
HD_AUTH_OIDC_GITLAB_USERINFO_URL: undefined,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -813,11 +813,11 @@ describe('authConfig', () => {
|
|||||||
it('when HD_AUTH_OIDC_GITLAB_END_SESSION_URL is not set', () => {
|
it('when HD_AUTH_OIDC_GITLAB_END_SESSION_URL is not set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeOidcConfig,
|
...completeOidcConfig,
|
||||||
HD_AUTH_OIDC_GITLAB_END_SESSION_URL: undefined,
|
HD_AUTH_OIDC_GITLAB_END_SESSION_URL: undefined,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -848,11 +848,11 @@ describe('authConfig', () => {
|
|||||||
it('when HD_AUTH_OIDC_GITLAB_SCOPE is not set', () => {
|
it('when HD_AUTH_OIDC_GITLAB_SCOPE is not set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeOidcConfig,
|
...completeOidcConfig,
|
||||||
HD_AUTH_OIDC_GITLAB_SCOPE: undefined,
|
HD_AUTH_OIDC_GITLAB_SCOPE: undefined,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -883,11 +883,11 @@ describe('authConfig', () => {
|
|||||||
it('when HD_AUTH_OIDC_GITLAB_USER_ID_FIELD is not set', () => {
|
it('when HD_AUTH_OIDC_GITLAB_USER_ID_FIELD is not set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeOidcConfig,
|
...completeOidcConfig,
|
||||||
HD_AUTH_OIDC_GITLAB_USER_ID_FIELD: undefined,
|
HD_AUTH_OIDC_GITLAB_USER_ID_FIELD: undefined,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -918,11 +918,11 @@ describe('authConfig', () => {
|
|||||||
it('when HD_AUTH_OIDC_GITLAB_DISPLAY_NAME_FIELD is not set', () => {
|
it('when HD_AUTH_OIDC_GITLAB_DISPLAY_NAME_FIELD is not set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeOidcConfig,
|
...completeOidcConfig,
|
||||||
HD_AUTH_OIDC_GITLAB_DISPLAY_NAME_FIELD: undefined,
|
HD_AUTH_OIDC_GITLAB_DISPLAY_NAME_FIELD: undefined,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -953,11 +953,11 @@ describe('authConfig', () => {
|
|||||||
it('when HD_AUTH_OIDC_GITLAB_PROFILE_PICTURE_FIELD is not set', () => {
|
it('when HD_AUTH_OIDC_GITLAB_PROFILE_PICTURE_FIELD is not set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeOidcConfig,
|
...completeOidcConfig,
|
||||||
HD_AUTH_OIDC_GITLAB_PROFILE_PICTURE_FIELD: undefined,
|
HD_AUTH_OIDC_GITLAB_PROFILE_PICTURE_FIELD: undefined,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -990,11 +990,11 @@ describe('authConfig', () => {
|
|||||||
it('when HD_AUTH_OIDC_GITLAB_EMAIL_FIELD is not set', () => {
|
it('when HD_AUTH_OIDC_GITLAB_EMAIL_FIELD is not set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeOidcConfig,
|
...completeOidcConfig,
|
||||||
HD_AUTH_OIDC_GITLAB_EMAIL_FIELD: undefined,
|
HD_AUTH_OIDC_GITLAB_EMAIL_FIELD: undefined,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -1025,11 +1025,11 @@ describe('authConfig', () => {
|
|||||||
it('when HD_AUTH_OIDC_GITLAB_ENABLE_REGISTRATION is not set', () => {
|
it('when HD_AUTH_OIDC_GITLAB_ENABLE_REGISTRATION is not set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeOidcConfig,
|
...completeOidcConfig,
|
||||||
HD_AUTH_OIDC_GITLAB_ENABLE_REGISTRATION: undefined,
|
HD_AUTH_OIDC_GITLAB_ENABLE_REGISTRATION: undefined,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -1081,11 +1081,11 @@ describe('authConfig', () => {
|
|||||||
it('when HD_AUTH_OIDC_GITLAB_ISSUER is not set', () => {
|
it('when HD_AUTH_OIDC_GITLAB_ISSUER is not set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeOidcConfig,
|
...completeOidcConfig,
|
||||||
HD_AUTH_OIDC_GITLAB_ISSUER: undefined,
|
HD_AUTH_OIDC_GITLAB_ISSUER: undefined,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -1101,11 +1101,11 @@ describe('authConfig', () => {
|
|||||||
it('when HD_AUTH_OIDC_GITLAB_CLIENT_ID is not set', () => {
|
it('when HD_AUTH_OIDC_GITLAB_CLIENT_ID is not set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeOidcConfig,
|
...completeOidcConfig,
|
||||||
HD_AUTH_OIDC_GITLAB_CLIENT_ID: undefined,
|
HD_AUTH_OIDC_GITLAB_CLIENT_ID: undefined,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -1121,11 +1121,11 @@ describe('authConfig', () => {
|
|||||||
it('when HD_AUTH_OIDC_GITLAB_CLIENT_SECRET is not set', () => {
|
it('when HD_AUTH_OIDC_GITLAB_CLIENT_SECRET is not set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeOidcConfig,
|
...completeOidcConfig,
|
||||||
HD_AUTH_OIDC_GITLAB_CLIENT_SECRET: undefined,
|
HD_AUTH_OIDC_GITLAB_CLIENT_SECRET: undefined,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -1141,11 +1141,11 @@ describe('authConfig', () => {
|
|||||||
it('when HD_AUTH_OIDC_GITLAB_THEME is set to a wrong value', () => {
|
it('when HD_AUTH_OIDC_GITLAB_THEME is set to a wrong value', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
...neededAuthConfig,
|
...neededAuthConfig,
|
||||||
...completeOidcConfig,
|
...completeOidcConfig,
|
||||||
HD_AUTH_OIDC_GITLAB_THEME: 'something else',
|
HD_AUTH_OIDC_GITLAB_THEME: 'something else',
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ const ldapSchema = z
|
|||||||
tlsCaCerts: z
|
tlsCaCerts: z
|
||||||
.array(
|
.array(
|
||||||
z.string({
|
z.string({
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||||
required_error: 'File not found',
|
required_error: 'File not found',
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -21,13 +21,13 @@ describe('customizationConfig', () => {
|
|||||||
it('correctly parses valid config', () => {
|
it('correctly parses valid config', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_BRANDING_CUSTOM_NAME: customName,
|
HD_BRANDING_CUSTOM_NAME: customName,
|
||||||
HD_BRANDING_CUSTOM_LOGO: customLogo,
|
HD_BRANDING_CUSTOM_LOGO: customLogo,
|
||||||
HD_URLS_PRIVACY: privacyUrl,
|
HD_URLS_PRIVACY: privacyUrl,
|
||||||
HD_URLS_TERMS_OF_USE: termsOfUseUrl,
|
HD_URLS_TERMS_OF_USE: termsOfUseUrl,
|
||||||
HD_URLS_IMPRINT: imprintUrl,
|
HD_URLS_IMPRINT: imprintUrl,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -65,13 +65,13 @@ describe('customizationConfig', () => {
|
|||||||
it('when anything is wrongly configured', () => {
|
it('when anything is wrongly configured', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_BRANDING_CUSTOM_NAME: customName,
|
HD_BRANDING_CUSTOM_NAME: customName,
|
||||||
HD_BRANDING_CUSTOM_LOGO: invalidCustomLogo,
|
HD_BRANDING_CUSTOM_LOGO: invalidCustomLogo,
|
||||||
HD_URLS_PRIVACY: invalidPrivacyUrl,
|
HD_URLS_PRIVACY: invalidPrivacyUrl,
|
||||||
HD_URLS_TERMS_OF_USE: invalidTermsOfUseUrl,
|
HD_URLS_TERMS_OF_USE: invalidTermsOfUseUrl,
|
||||||
HD_URLS_IMPRINT: invalidImprintUrl,
|
HD_URLS_IMPRINT: invalidImprintUrl,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ describe('databaseConfig', () => {
|
|||||||
it('SQLite config', () => {
|
it('SQLite config', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_DATABASE_TYPE: databaseTypeSqlite,
|
HD_DATABASE_TYPE: databaseTypeSqlite,
|
||||||
HD_DATABASE_NAME: databaseFileSqlite,
|
HD_DATABASE_NAME: databaseFileSqlite,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -46,14 +46,14 @@ describe('databaseConfig', () => {
|
|||||||
it('MariaDB config', () => {
|
it('MariaDB config', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_DATABASE_TYPE: databaseTypeMariadb,
|
HD_DATABASE_TYPE: databaseTypeMariadb,
|
||||||
HD_DATABASE_NAME: databaseName,
|
HD_DATABASE_NAME: databaseName,
|
||||||
HD_DATABASE_USERNAME: databaseUser,
|
HD_DATABASE_USERNAME: databaseUser,
|
||||||
HD_DATABASE_PASSWORD: databasePass,
|
HD_DATABASE_PASSWORD: databasePass,
|
||||||
HD_DATABASE_HOST: databaseHost,
|
HD_DATABASE_HOST: databaseHost,
|
||||||
HD_DATABASE_PORT: String(databasePort),
|
HD_DATABASE_PORT: String(databasePort),
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -72,14 +72,14 @@ describe('databaseConfig', () => {
|
|||||||
it('Postgres config', () => {
|
it('Postgres config', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_DATABASE_TYPE: databaseTypePostgres,
|
HD_DATABASE_TYPE: databaseTypePostgres,
|
||||||
HD_DATABASE_NAME: databaseName,
|
HD_DATABASE_NAME: databaseName,
|
||||||
HD_DATABASE_USERNAME: databaseUser,
|
HD_DATABASE_USERNAME: databaseUser,
|
||||||
HD_DATABASE_PASSWORD: databasePass,
|
HD_DATABASE_PASSWORD: databasePass,
|
||||||
HD_DATABASE_HOST: databaseHost,
|
HD_DATABASE_HOST: databaseHost,
|
||||||
HD_DATABASE_PORT: String(databasePort),
|
HD_DATABASE_PORT: String(databasePort),
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -119,14 +119,14 @@ describe('databaseConfig', () => {
|
|||||||
it('when the port is negative', () => {
|
it('when the port is negative', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_DATABASE_TYPE: databaseTypePostgres,
|
HD_DATABASE_TYPE: databaseTypePostgres,
|
||||||
HD_DATABASE_NAME: databaseName,
|
HD_DATABASE_NAME: databaseName,
|
||||||
HD_DATABASE_USERNAME: databaseUser,
|
HD_DATABASE_USERNAME: databaseUser,
|
||||||
HD_DATABASE_PASSWORD: databasePass,
|
HD_DATABASE_PASSWORD: databasePass,
|
||||||
HD_DATABASE_HOST: databaseHost,
|
HD_DATABASE_HOST: databaseHost,
|
||||||
HD_DATABASE_PORT: String(invalidDatabasePort),
|
HD_DATABASE_PORT: String(invalidDatabasePort),
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -142,14 +142,14 @@ describe('databaseConfig', () => {
|
|||||||
it('when the port is too big', () => {
|
it('when the port is too big', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_DATABASE_TYPE: databaseTypePostgres,
|
HD_DATABASE_TYPE: databaseTypePostgres,
|
||||||
HD_DATABASE_NAME: databaseName,
|
HD_DATABASE_NAME: databaseName,
|
||||||
HD_DATABASE_USERNAME: databaseUser,
|
HD_DATABASE_USERNAME: databaseUser,
|
||||||
HD_DATABASE_PASSWORD: databasePass,
|
HD_DATABASE_PASSWORD: databasePass,
|
||||||
HD_DATABASE_HOST: databaseHost,
|
HD_DATABASE_HOST: databaseHost,
|
||||||
HD_DATABASE_PORT: String(invalidDatabasePort2),
|
HD_DATABASE_PORT: String(invalidDatabasePort2),
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ export function getKnexConfig(databaseConfig: DatabaseConfig): Knex.Config {
|
|||||||
user: databaseConfig.username,
|
user: databaseConfig.username,
|
||||||
database: databaseConfig.name,
|
database: databaseConfig.name,
|
||||||
password: databaseConfig.password,
|
password: databaseConfig.password,
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||||
application_name: 'HedgeDoc',
|
application_name: 'HedgeDoc',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ describe('externalServices', () => {
|
|||||||
it('correctly parses valid config', () => {
|
it('correctly parses valid config', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_PLANTUML_SERVER: plantUmlServer,
|
HD_PLANTUML_SERVER: plantUmlServer,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -51,9 +51,9 @@ describe('externalServices', () => {
|
|||||||
const invalid = 'wrong!';
|
const invalid = 'wrong!';
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_PLANTUML_SERVER: invalid,
|
HD_PLANTUML_SERVER: invalid,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -70,9 +70,9 @@ describe('externalServices', () => {
|
|||||||
it('when image proxy is configured', () => {
|
it('when image proxy is configured', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_IMAGE_PROXY: imageProxy,
|
HD_IMAGE_PROXY: imageProxy,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
|
|||||||
@@ -38,10 +38,10 @@ describe('mediaConfig', () => {
|
|||||||
it('for backend filesystem', () => {
|
it('for backend filesystem', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.FILESYSTEM,
|
HD_MEDIA_BACKEND_TYPE: MediaBackendType.FILESYSTEM,
|
||||||
HD_MEDIA_BACKEND_FILESYSTEM_UPLOAD_PATH: uploadPath,
|
HD_MEDIA_BACKEND_FILESYSTEM_UPLOAD_PATH: uploadPath,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -56,7 +56,7 @@ describe('mediaConfig', () => {
|
|||||||
it('for backend s3', () => {
|
it('for backend s3', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.S3,
|
HD_MEDIA_BACKEND_TYPE: MediaBackendType.S3,
|
||||||
HD_MEDIA_BACKEND_S3_ACCESS_KEY: accessKeyId,
|
HD_MEDIA_BACKEND_S3_ACCESS_KEY: accessKeyId,
|
||||||
HD_MEDIA_BACKEND_S3_SECRET_KEY: secretAccessKey,
|
HD_MEDIA_BACKEND_S3_SECRET_KEY: secretAccessKey,
|
||||||
@@ -64,7 +64,7 @@ describe('mediaConfig', () => {
|
|||||||
HD_MEDIA_BACKEND_S3_ENDPOINT: endPoint,
|
HD_MEDIA_BACKEND_S3_ENDPOINT: endPoint,
|
||||||
HD_MEDIA_BACKEND_S3_REGION: region,
|
HD_MEDIA_BACKEND_S3_REGION: region,
|
||||||
HD_MEDIA_BACKEND_S3_PATH_STYLE: pathStyle.toString(),
|
HD_MEDIA_BACKEND_S3_PATH_STYLE: pathStyle.toString(),
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -84,11 +84,11 @@ describe('mediaConfig', () => {
|
|||||||
it('for backend azure', () => {
|
it('for backend azure', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.AZURE,
|
HD_MEDIA_BACKEND_TYPE: MediaBackendType.AZURE,
|
||||||
HD_MEDIA_BACKEND_AZURE_CONNECTION_STRING: azureConnectionString,
|
HD_MEDIA_BACKEND_AZURE_CONNECTION_STRING: azureConnectionString,
|
||||||
HD_MEDIA_BACKEND_AZURE_CONTAINER: container,
|
HD_MEDIA_BACKEND_AZURE_CONTAINER: container,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -106,10 +106,10 @@ describe('mediaConfig', () => {
|
|||||||
it('for backend imgur', () => {
|
it('for backend imgur', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.IMGUR,
|
HD_MEDIA_BACKEND_TYPE: MediaBackendType.IMGUR,
|
||||||
HD_MEDIA_BACKEND_IMGUR_CLIENT_ID: clientID,
|
HD_MEDIA_BACKEND_IMGUR_CLIENT_ID: clientID,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -124,12 +124,12 @@ describe('mediaConfig', () => {
|
|||||||
it('for backend webdav', () => {
|
it('for backend webdav', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.WEBDAV,
|
HD_MEDIA_BACKEND_TYPE: MediaBackendType.WEBDAV,
|
||||||
HD_MEDIA_BACKEND_WEBDAV_CONNECTION_STRING: webdavConnectionString,
|
HD_MEDIA_BACKEND_WEBDAV_CONNECTION_STRING: webdavConnectionString,
|
||||||
HD_MEDIA_BACKEND_WEBDAV_UPLOAD_DIR: uploadDir,
|
HD_MEDIA_BACKEND_WEBDAV_UPLOAD_DIR: uploadDir,
|
||||||
HD_MEDIA_BACKEND_WEBDAV_PUBLIC_URL: publicUrl,
|
HD_MEDIA_BACKEND_WEBDAV_PUBLIC_URL: publicUrl,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -170,9 +170,9 @@ describe('mediaConfig', () => {
|
|||||||
it('when HD_MEDIA_BACKEND_FILESYSTEM_UPLOAD_PATH is not set', async () => {
|
it('when HD_MEDIA_BACKEND_FILESYSTEM_UPLOAD_PATH is not set', async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.FILESYSTEM,
|
HD_MEDIA_BACKEND_TYPE: MediaBackendType.FILESYSTEM,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -191,12 +191,12 @@ describe('mediaConfig', () => {
|
|||||||
it('when HD_MEDIA_BACKEND_S3_ACCESS_KEY is not set', async () => {
|
it('when HD_MEDIA_BACKEND_S3_ACCESS_KEY is not set', async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.S3,
|
HD_MEDIA_BACKEND_TYPE: MediaBackendType.S3,
|
||||||
HD_MEDIA_BACKEND_S3_SECRET_KEY: secretAccessKey,
|
HD_MEDIA_BACKEND_S3_SECRET_KEY: secretAccessKey,
|
||||||
HD_MEDIA_BACKEND_S3_BUCKET: bucket,
|
HD_MEDIA_BACKEND_S3_BUCKET: bucket,
|
||||||
HD_MEDIA_BACKEND_S3_ENDPOINT: endPoint,
|
HD_MEDIA_BACKEND_S3_ENDPOINT: endPoint,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -212,12 +212,12 @@ describe('mediaConfig', () => {
|
|||||||
it('when HD_MEDIA_BACKEND_S3_SECRET_KEY is not set', async () => {
|
it('when HD_MEDIA_BACKEND_S3_SECRET_KEY is not set', async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.S3,
|
HD_MEDIA_BACKEND_TYPE: MediaBackendType.S3,
|
||||||
HD_MEDIA_BACKEND_S3_ACCESS_KEY: accessKeyId,
|
HD_MEDIA_BACKEND_S3_ACCESS_KEY: accessKeyId,
|
||||||
HD_MEDIA_BACKEND_S3_BUCKET: bucket,
|
HD_MEDIA_BACKEND_S3_BUCKET: bucket,
|
||||||
HD_MEDIA_BACKEND_S3_ENDPOINT: endPoint,
|
HD_MEDIA_BACKEND_S3_ENDPOINT: endPoint,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -233,12 +233,12 @@ describe('mediaConfig', () => {
|
|||||||
it('when HD_MEDIA_BACKEND_S3_BUCKET is not set', async () => {
|
it('when HD_MEDIA_BACKEND_S3_BUCKET is not set', async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.S3,
|
HD_MEDIA_BACKEND_TYPE: MediaBackendType.S3,
|
||||||
HD_MEDIA_BACKEND_S3_ACCESS_KEY: accessKeyId,
|
HD_MEDIA_BACKEND_S3_ACCESS_KEY: accessKeyId,
|
||||||
HD_MEDIA_BACKEND_S3_SECRET_KEY: secretAccessKey,
|
HD_MEDIA_BACKEND_S3_SECRET_KEY: secretAccessKey,
|
||||||
HD_MEDIA_BACKEND_S3_ENDPOINT: endPoint,
|
HD_MEDIA_BACKEND_S3_ENDPOINT: endPoint,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -254,12 +254,12 @@ describe('mediaConfig', () => {
|
|||||||
it('when HD_MEDIA_BACKEND_S3_ENDPOINT is not set', async () => {
|
it('when HD_MEDIA_BACKEND_S3_ENDPOINT is not set', async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.S3,
|
HD_MEDIA_BACKEND_TYPE: MediaBackendType.S3,
|
||||||
HD_MEDIA_BACKEND_S3_ACCESS_KEY: accessKeyId,
|
HD_MEDIA_BACKEND_S3_ACCESS_KEY: accessKeyId,
|
||||||
HD_MEDIA_BACKEND_S3_SECRET_KEY: secretAccessKey,
|
HD_MEDIA_BACKEND_S3_SECRET_KEY: secretAccessKey,
|
||||||
HD_MEDIA_BACKEND_S3_BUCKET: bucket,
|
HD_MEDIA_BACKEND_S3_BUCKET: bucket,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -275,13 +275,13 @@ describe('mediaConfig', () => {
|
|||||||
it('when HD_MEDIA_BACKEND_S3_ENDPOINT is not an URI', async () => {
|
it('when HD_MEDIA_BACKEND_S3_ENDPOINT is not an URI', async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.S3,
|
HD_MEDIA_BACKEND_TYPE: MediaBackendType.S3,
|
||||||
HD_MEDIA_BACKEND_S3_ACCESS_KEY: accessKeyId,
|
HD_MEDIA_BACKEND_S3_ACCESS_KEY: accessKeyId,
|
||||||
HD_MEDIA_BACKEND_S3_SECRET_KEY: secretAccessKey,
|
HD_MEDIA_BACKEND_S3_SECRET_KEY: secretAccessKey,
|
||||||
HD_MEDIA_BACKEND_S3_BUCKET: bucket,
|
HD_MEDIA_BACKEND_S3_BUCKET: bucket,
|
||||||
HD_MEDIA_BACKEND_S3_ENDPOINT: 'wrong-uri',
|
HD_MEDIA_BACKEND_S3_ENDPOINT: 'wrong-uri',
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -300,10 +300,10 @@ describe('mediaConfig', () => {
|
|||||||
it('when HD_MEDIA_BACKEND_AZURE_CONNECTION_STRING is not set', async () => {
|
it('when HD_MEDIA_BACKEND_AZURE_CONNECTION_STRING is not set', async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.AZURE,
|
HD_MEDIA_BACKEND_TYPE: MediaBackendType.AZURE,
|
||||||
HD_MEDIA_BACKEND_AZURE_CONTAINER: container,
|
HD_MEDIA_BACKEND_AZURE_CONTAINER: container,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -319,10 +319,10 @@ describe('mediaConfig', () => {
|
|||||||
it('when HD_MEDIA_BACKEND_AZURE_CONTAINER is not set', async () => {
|
it('when HD_MEDIA_BACKEND_AZURE_CONTAINER is not set', async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.AZURE,
|
HD_MEDIA_BACKEND_TYPE: MediaBackendType.AZURE,
|
||||||
HD_MEDIA_BACKEND_AZURE_CONNECTION_STRING: azureConnectionString,
|
HD_MEDIA_BACKEND_AZURE_CONNECTION_STRING: azureConnectionString,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -341,9 +341,9 @@ describe('mediaConfig', () => {
|
|||||||
it('when HD_MEDIA_BACKEND_IMGUR_CLIENT_ID is not set', async () => {
|
it('when HD_MEDIA_BACKEND_IMGUR_CLIENT_ID is not set', async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.IMGUR,
|
HD_MEDIA_BACKEND_TYPE: MediaBackendType.IMGUR,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -362,11 +362,11 @@ describe('mediaConfig', () => {
|
|||||||
it('when HD_MEDIA_BACKEND_WEBDAV_CONNECTION_STRING is not set', async () => {
|
it('when HD_MEDIA_BACKEND_WEBDAV_CONNECTION_STRING is not set', async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.WEBDAV,
|
HD_MEDIA_BACKEND_TYPE: MediaBackendType.WEBDAV,
|
||||||
HD_MEDIA_BACKEND_WEBDAV_UPLOAD_DIR: uploadDir,
|
HD_MEDIA_BACKEND_WEBDAV_UPLOAD_DIR: uploadDir,
|
||||||
HD_MEDIA_BACKEND_WEBDAV_PUBLIC_URL: publicUrl,
|
HD_MEDIA_BACKEND_WEBDAV_PUBLIC_URL: publicUrl,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -382,12 +382,12 @@ describe('mediaConfig', () => {
|
|||||||
it('when HD_MEDIA_BACKEND_WEBDAV_CONNECTION_STRING is not set to an url', async () => {
|
it('when HD_MEDIA_BACKEND_WEBDAV_CONNECTION_STRING is not set to an url', async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.WEBDAV,
|
HD_MEDIA_BACKEND_TYPE: MediaBackendType.WEBDAV,
|
||||||
HD_MEDIA_BACKEND_WEBDAV_CONNECTION_STRING: 'not-an-url',
|
HD_MEDIA_BACKEND_WEBDAV_CONNECTION_STRING: 'not-an-url',
|
||||||
HD_MEDIA_BACKEND_WEBDAV_UPLOAD_DIR: uploadDir,
|
HD_MEDIA_BACKEND_WEBDAV_UPLOAD_DIR: uploadDir,
|
||||||
HD_MEDIA_BACKEND_WEBDAV_PUBLIC_URL: publicUrl,
|
HD_MEDIA_BACKEND_WEBDAV_PUBLIC_URL: publicUrl,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -403,11 +403,11 @@ describe('mediaConfig', () => {
|
|||||||
it('when HD_MEDIA_BACKEND_WEBDAV_PUBLIC_URL is not set', async () => {
|
it('when HD_MEDIA_BACKEND_WEBDAV_PUBLIC_URL is not set', async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.WEBDAV,
|
HD_MEDIA_BACKEND_TYPE: MediaBackendType.WEBDAV,
|
||||||
HD_MEDIA_BACKEND_WEBDAV_CONNECTION_STRING: webdavConnectionString,
|
HD_MEDIA_BACKEND_WEBDAV_CONNECTION_STRING: webdavConnectionString,
|
||||||
HD_MEDIA_BACKEND_WEBDAV_UPLOAD_DIR: uploadDir,
|
HD_MEDIA_BACKEND_WEBDAV_UPLOAD_DIR: uploadDir,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -423,12 +423,12 @@ describe('mediaConfig', () => {
|
|||||||
it('when HD_MEDIA_BACKEND_WEBDAV_PUBLIC_URL is not set to an url', async () => {
|
it('when HD_MEDIA_BACKEND_WEBDAV_PUBLIC_URL is not set to an url', async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.WEBDAV,
|
HD_MEDIA_BACKEND_TYPE: MediaBackendType.WEBDAV,
|
||||||
HD_MEDIA_BACKEND_WEBDAV_CONNECTION_STRING: webdavConnectionString,
|
HD_MEDIA_BACKEND_WEBDAV_CONNECTION_STRING: webdavConnectionString,
|
||||||
HD_MEDIA_BACKEND_WEBDAV_UPLOAD_DIR: uploadDir,
|
HD_MEDIA_BACKEND_WEBDAV_UPLOAD_DIR: uploadDir,
|
||||||
HD_MEDIA_BACKEND_WEBDAV_PUBLIC_URL: 'not-an-url',
|
HD_MEDIA_BACKEND_WEBDAV_PUBLIC_URL: 'not-an-url',
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ describe('noteConfig', () => {
|
|||||||
it('when given correct and complete environment variables', () => {
|
it('when given correct and complete environment variables', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||||
@@ -37,7 +37,7 @@ describe('noteConfig', () => {
|
|||||||
publiclyVisible.toString(),
|
publiclyVisible.toString(),
|
||||||
HD_NOTE_REVISION_RETENTION_DAYS: retentionDays.toString(),
|
HD_NOTE_REVISION_RETENTION_DAYS: retentionDays.toString(),
|
||||||
HD_NOTE_PERSIST_INTERVAL: persistInteval.toString(),
|
HD_NOTE_PERSIST_INTERVAL: persistInteval.toString(),
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -65,13 +65,13 @@ describe('noteConfig', () => {
|
|||||||
it('when no HD_NOTE_FORBIDDEN_ALIASES is set', () => {
|
it('when no HD_NOTE_FORBIDDEN_ALIASES is set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||||
PermissionLevelNames[PermissionLevel.WRITE],
|
PermissionLevelNames[PermissionLevel.WRITE],
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
||||||
PermissionLevelNames[PermissionLevel.WRITE],
|
PermissionLevelNames[PermissionLevel.WRITE],
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -94,14 +94,14 @@ describe('noteConfig', () => {
|
|||||||
it('when HD_NOTE_FORBIDDEN_ALIASES is a single item', () => {
|
it('when HD_NOTE_FORBIDDEN_ALIASES is a single item', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAlias,
|
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAlias,
|
||||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||||
PermissionLevelNames[PermissionLevel.WRITE],
|
PermissionLevelNames[PermissionLevel.WRITE],
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
||||||
PermissionLevelNames[PermissionLevel.WRITE],
|
PermissionLevelNames[PermissionLevel.WRITE],
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -125,13 +125,13 @@ describe('noteConfig', () => {
|
|||||||
it('when no HD_NOTE_MAX_LENGTH is set', () => {
|
it('when no HD_NOTE_MAX_LENGTH is set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||||
PermissionLevelNames[PermissionLevel.WRITE],
|
PermissionLevelNames[PermissionLevel.WRITE],
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
||||||
PermissionLevelNames[PermissionLevel.WRITE],
|
PermissionLevelNames[PermissionLevel.WRITE],
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -155,14 +155,14 @@ describe('noteConfig', () => {
|
|||||||
it('when no HD_PERMISSION_DEFAULT_EVERYONE is set', () => {
|
it('when no HD_PERMISSION_DEFAULT_EVERYONE is set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||||
HD_NOTE_PERMISSIONS_MAX_GUEST_LEVEL:
|
HD_NOTE_PERMISSIONS_MAX_GUEST_LEVEL:
|
||||||
PermissionLevelNames[PermissionLevel.READ],
|
PermissionLevelNames[PermissionLevel.READ],
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
||||||
PermissionLevelNames[PermissionLevel.READ],
|
PermissionLevelNames[PermissionLevel.READ],
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -182,12 +182,12 @@ describe('noteConfig', () => {
|
|||||||
it('when no HD_PERMISSION_DEFAULT_LOGGED_IN is set', () => {
|
it('when no HD_PERMISSION_DEFAULT_LOGGED_IN is set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||||
PermissionLevelNames[PermissionLevel.WRITE],
|
PermissionLevelNames[PermissionLevel.WRITE],
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -211,12 +211,12 @@ describe('noteConfig', () => {
|
|||||||
it('when no HD_PERMISSIONS_MAX_GUEST_LEVEL is set', () => {
|
it('when no HD_PERMISSIONS_MAX_GUEST_LEVEL is set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||||
PermissionLevelNames[PermissionLevel.WRITE],
|
PermissionLevelNames[PermissionLevel.WRITE],
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -240,14 +240,14 @@ describe('noteConfig', () => {
|
|||||||
it('when no HD_NOTE_REVISION_RETENTION_DAYS is set', () => {
|
it('when no HD_NOTE_REVISION_RETENTION_DAYS is set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||||
PermissionLevelNames[PermissionLevel.WRITE],
|
PermissionLevelNames[PermissionLevel.WRITE],
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
||||||
PermissionLevelNames[PermissionLevel.WRITE],
|
PermissionLevelNames[PermissionLevel.WRITE],
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -272,14 +272,14 @@ describe('noteConfig', () => {
|
|||||||
it('when no HD_NOTE_PERSIST_INTERVAL is set', () => {
|
it('when no HD_NOTE_PERSIST_INTERVAL is set', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||||
PermissionLevelNames[PermissionLevel.WRITE],
|
PermissionLevelNames[PermissionLevel.WRITE],
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
||||||
PermissionLevelNames[PermissionLevel.WRITE],
|
PermissionLevelNames[PermissionLevel.WRITE],
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -324,14 +324,14 @@ describe('noteConfig', () => {
|
|||||||
it('when given a non-valid HD_NOTE_FORBIDDEN_ALIASES', async () => {
|
it('when given a non-valid HD_NOTE_FORBIDDEN_ALIASES', async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_NOTE_FORBIDDEN_ALIASES: invalidforbiddenAliases.join(' , '),
|
HD_NOTE_FORBIDDEN_ALIASES: invalidforbiddenAliases.join(' , '),
|
||||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||||
PermissionLevelNames[PermissionLevel.READ],
|
PermissionLevelNames[PermissionLevel.READ],
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
||||||
PermissionLevelNames[PermissionLevel.READ],
|
PermissionLevelNames[PermissionLevel.READ],
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -351,14 +351,14 @@ describe('noteConfig', () => {
|
|||||||
it('when given a negative HD_NOTE_MAX_LENGTH', async () => {
|
it('when given a negative HD_NOTE_MAX_LENGTH', async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||||
HD_NOTE_MAX_LENGTH: negativeMaxDocumentLength.toString(),
|
HD_NOTE_MAX_LENGTH: negativeMaxDocumentLength.toString(),
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||||
PermissionLevelNames[PermissionLevel.READ],
|
PermissionLevelNames[PermissionLevel.READ],
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
||||||
PermissionLevelNames[PermissionLevel.READ],
|
PermissionLevelNames[PermissionLevel.READ],
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -375,14 +375,14 @@ describe('noteConfig', () => {
|
|||||||
it('when given a non-integer HD_NOTE_MAX_LENGTH', async () => {
|
it('when given a non-integer HD_NOTE_MAX_LENGTH', async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||||
HD_NOTE_MAX_LENGTH: floatMaxDocumentLength.toString(),
|
HD_NOTE_MAX_LENGTH: floatMaxDocumentLength.toString(),
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||||
PermissionLevelNames[PermissionLevel.READ],
|
PermissionLevelNames[PermissionLevel.READ],
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
||||||
PermissionLevelNames[PermissionLevel.READ],
|
PermissionLevelNames[PermissionLevel.READ],
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -399,14 +399,14 @@ describe('noteConfig', () => {
|
|||||||
it('when given a non-number HD_NOTE_MAX_LENGTH', async () => {
|
it('when given a non-number HD_NOTE_MAX_LENGTH', async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||||
HD_NOTE_MAX_LENGTH: invalidMaxDocumentLength,
|
HD_NOTE_MAX_LENGTH: invalidMaxDocumentLength,
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||||
PermissionLevelNames[PermissionLevel.READ],
|
PermissionLevelNames[PermissionLevel.READ],
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
||||||
PermissionLevelNames[PermissionLevel.READ],
|
PermissionLevelNames[PermissionLevel.READ],
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -423,13 +423,13 @@ describe('noteConfig', () => {
|
|||||||
it('when given a non-valid HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE', async () => {
|
it('when given a non-valid HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE', async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE: wrongDefaultPermission,
|
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE: wrongDefaultPermission,
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
||||||
PermissionLevelNames[PermissionLevel.READ],
|
PermissionLevelNames[PermissionLevel.READ],
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -446,13 +446,13 @@ describe('noteConfig', () => {
|
|||||||
it('when given a non-valid HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN', async () => {
|
it('when given a non-valid HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN', async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||||
PermissionLevelNames[PermissionLevel.READ],
|
PermissionLevelNames[PermissionLevel.READ],
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN: wrongDefaultPermission,
|
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN: wrongDefaultPermission,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -469,7 +469,7 @@ describe('noteConfig', () => {
|
|||||||
it('when given a non-valid HD_PERMISSIONS_MAX_GUEST_LEVEL', async () => {
|
it('when given a non-valid HD_PERMISSIONS_MAX_GUEST_LEVEL', async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||||
@@ -477,7 +477,7 @@ describe('noteConfig', () => {
|
|||||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
||||||
PermissionLevelNames[PermissionLevel.READ],
|
PermissionLevelNames[PermissionLevel.READ],
|
||||||
HD_NOTE_PERMISSIONS_MAX_GUEST_LEVEL: wrongDefaultPermission,
|
HD_NOTE_PERMISSIONS_MAX_GUEST_LEVEL: wrongDefaultPermission,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -494,7 +494,7 @@ describe('noteConfig', () => {
|
|||||||
it('when HD_PERMISSIONS_MAX_GUEST_LEVEL is set to deny and HD_PERMISSION_DEFAULT_EVERYONE is set', async () => {
|
it('when HD_PERMISSIONS_MAX_GUEST_LEVEL is set to deny and HD_PERMISSION_DEFAULT_EVERYONE is set', async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||||
@@ -502,7 +502,7 @@ describe('noteConfig', () => {
|
|||||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
||||||
PermissionLevelNames[PermissionLevel.READ],
|
PermissionLevelNames[PermissionLevel.READ],
|
||||||
HD_NOTE_PERMISSIONS_MAX_GUEST_LEVEL: 'deny',
|
HD_NOTE_PERMISSIONS_MAX_GUEST_LEVEL: 'deny',
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -536,12 +536,12 @@ describe('noteConfig', () => {
|
|||||||
it(`when HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE is set to ${everyonePermission}, but HD_PERMISSION_DEFAULT_LOGGED_IN is set to ${loggedInPermission}`, async () => {
|
it(`when HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE is set to ${everyonePermission}, but HD_PERMISSION_DEFAULT_LOGGED_IN is set to ${loggedInPermission}`, async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE: everyonePermission,
|
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE: everyonePermission,
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN: loggedInPermission,
|
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN: loggedInPermission,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -566,13 +566,13 @@ describe('noteConfig', () => {
|
|||||||
it(`when HD_NOTE_PERMISSIONS_MAX_GUEST_LEVEL is set to ${PermissionLevelNames[PermissionLevel.FULL]} and HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE is set to ${defaultEveryone}`, async () => {
|
it(`when HD_NOTE_PERMISSIONS_MAX_GUEST_LEVEL is set to ${PermissionLevelNames[PermissionLevel.FULL]} and HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE is set to ${defaultEveryone}`, async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE: defaultEveryone,
|
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE: defaultEveryone,
|
||||||
HD_NOTE_PERMISSIONS_MAX_GUEST_LEVEL:
|
HD_NOTE_PERMISSIONS_MAX_GUEST_LEVEL:
|
||||||
PermissionLevelNames[PermissionLevel.FULL],
|
PermissionLevelNames[PermissionLevel.FULL],
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -606,12 +606,12 @@ describe('noteConfig', () => {
|
|||||||
it(`when 'HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE' is set to '${defaultEveryone}', but 'HD_NOTE_PERMISSIONS_MAX_GUEST_LEVEL' is set to '${maxGuestLevel}'`, async () => {
|
it(`when 'HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE' is set to '${defaultEveryone}', but 'HD_NOTE_PERMISSIONS_MAX_GUEST_LEVEL' is set to '${maxGuestLevel}'`, async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE: defaultEveryone,
|
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE: defaultEveryone,
|
||||||
HD_NOTE_PERMISSIONS_MAX_GUEST_LEVEL: maxGuestLevel,
|
HD_NOTE_PERMISSIONS_MAX_GUEST_LEVEL: maxGuestLevel,
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -631,7 +631,7 @@ describe('noteConfig', () => {
|
|||||||
it('when given a negative retention days', async () => {
|
it('when given a negative retention days', async () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||||
@@ -639,7 +639,7 @@ describe('noteConfig', () => {
|
|||||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
||||||
PermissionLevelNames[PermissionLevel.READ],
|
PermissionLevelNames[PermissionLevel.READ],
|
||||||
HD_NOTE_REVISION_RETENTION_DAYS: (-1).toString(),
|
HD_NOTE_REVISION_RETENTION_DAYS: (-1).toString(),
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
@@ -656,7 +656,7 @@ describe('noteConfig', () => {
|
|||||||
it('when given a negative persistence interval', () => {
|
it('when given a negative persistence interval', () => {
|
||||||
const restore = mockedEnv(
|
const restore = mockedEnv(
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||||
@@ -665,7 +665,7 @@ describe('noteConfig', () => {
|
|||||||
PermissionLevelNames[PermissionLevel.READ],
|
PermissionLevelNames[PermissionLevel.READ],
|
||||||
HD_NOTE_REVISION_RETENTION_DAYS: retentionDays.toString(),
|
HD_NOTE_REVISION_RETENTION_DAYS: retentionDays.toString(),
|
||||||
HD_NOTE_PERSIST_INTERVAL: (-1).toString(),
|
HD_NOTE_PERSIST_INTERVAL: (-1).toString(),
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
clear: true,
|
clear: true,
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ describe('config utils', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('ensureNoDuplicatesExist', () => {
|
describe('ensureNoDuplicatesExist', () => {
|
||||||
// eslint-disable-next-line jest/expect-expect
|
// oxlint-disable-next-line jest/expect-expect
|
||||||
it('throws no error if everything is correct', () => {
|
it('throws no error if everything is correct', () => {
|
||||||
ensureNoDuplicatesExist('Test', ['A']);
|
ensureNoDuplicatesExist('Test', ['A']);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* eslint-disable */
|
/* oxlint-disable */
|
||||||
const {
|
const {
|
||||||
AuthProviderType,
|
AuthProviderType,
|
||||||
FieldNameAlias,
|
FieldNameAlias,
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ import {
|
|||||||
} from '@hedgedoc/database';
|
} from '@hedgedoc/database';
|
||||||
import { Knex } from 'knex';
|
import { Knex } from 'knex';
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||||
declare module 'knex/types/tables.js' {
|
declare module 'knex/types/tables.js' {
|
||||||
interface Tables {
|
interface Tables {
|
||||||
[TableAlias]: Knex.CompositeTableType<Alias, Alias, TypeUpdateAlias>;
|
[TableAlias]: Knex.CompositeTableType<Alias, Alias, TypeUpdateAlias>;
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ describe('ExploreService', () => {
|
|||||||
][])(
|
][])(
|
||||||
'correctly get all notes owned by user with',
|
'correctly get all notes owned by user with',
|
||||||
(name, noteType, sortBy, search, regex, bindings) => {
|
(name, noteType, sortBy, search, regex, bindings) => {
|
||||||
// eslint-disable-next-line jest/valid-title
|
// oxlint-disable-next-line jest/valid-title
|
||||||
it(name, async () => {
|
it(name, async () => {
|
||||||
mockQuery('select', tracker, regex, selectedRows);
|
mockQuery('select', tracker, regex, selectedRows);
|
||||||
mockQuery(
|
mockQuery(
|
||||||
@@ -254,7 +254,7 @@ describe('ExploreService', () => {
|
|||||||
][])(
|
][])(
|
||||||
'correctly get all notes shared with the user with',
|
'correctly get all notes shared with the user with',
|
||||||
(name, noteType, sortBy, search, regex, bindings) => {
|
(name, noteType, sortBy, search, regex, bindings) => {
|
||||||
// eslint-disable-next-line jest/valid-title
|
// oxlint-disable-next-line jest/valid-title
|
||||||
it(name, async () => {
|
it(name, async () => {
|
||||||
mockQuery('select', tracker, regex, selectedRows);
|
mockQuery('select', tracker, regex, selectedRows);
|
||||||
mockQuery(
|
mockQuery(
|
||||||
@@ -337,7 +337,7 @@ describe('ExploreService', () => {
|
|||||||
][])(
|
][])(
|
||||||
'correctly get all public notes with',
|
'correctly get all public notes with',
|
||||||
(name, noteType, sortBy, search, regex, bindings) => {
|
(name, noteType, sortBy, search, regex, bindings) => {
|
||||||
// eslint-disable-next-line jest/valid-title
|
// oxlint-disable-next-line jest/valid-title
|
||||||
it(name, async () => {
|
it(name, async () => {
|
||||||
mockSelect(
|
mockSelect(
|
||||||
tracker,
|
tracker,
|
||||||
@@ -462,7 +462,7 @@ describe('ExploreService', () => {
|
|||||||
][])(
|
][])(
|
||||||
'correctly get all notes visited by the user with',
|
'correctly get all notes visited by the user with',
|
||||||
(name, noteType, sortBy, search, regex, bindings) => {
|
(name, noteType, sortBy, search, regex, bindings) => {
|
||||||
// eslint-disable-next-line jest/valid-title
|
// oxlint-disable-next-line jest/valid-title
|
||||||
it(name, async () => {
|
it(name, async () => {
|
||||||
mockQuery(
|
mockQuery(
|
||||||
'select',
|
'select',
|
||||||
|
|||||||
@@ -369,7 +369,7 @@ export class ExploreService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
// oxlint-disable-next-line @typescript-eslint/explicit-function-return-type
|
||||||
private joinWithTableVisitedNote(query: Knex.QueryBuilder) {
|
private joinWithTableVisitedNote(query: Knex.QueryBuilder) {
|
||||||
return query.leftJoin(
|
return query.leftJoin(
|
||||||
TableVisitedNote,
|
TableVisitedNote,
|
||||||
@@ -379,7 +379,7 @@ export class ExploreService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The correct return type with all joins and selects is very specific and should just be inferred from Knex
|
// The correct return type with all joins and selects is very specific and should just be inferred from Knex
|
||||||
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
// oxlint-disable-next-line @typescript-eslint/explicit-function-return-type
|
||||||
private applyCommonQuery(
|
private applyCommonQuery(
|
||||||
query: Knex.QueryBuilder,
|
query: Knex.QueryBuilder,
|
||||||
transaction: Knex.Transaction,
|
transaction: Knex.Transaction,
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import { LoggerModule } from '../logger/logger.module';
|
|||||||
import { getServerVersionFromPackageJson } from '../utils/server-version';
|
import { getServerVersionFromPackageJson } from '../utils/server-version';
|
||||||
import { FrontendConfigService } from './frontend-config.service';
|
import { FrontendConfigService } from './frontend-config.service';
|
||||||
|
|
||||||
/* eslint-disable jest/no-conditional-expect */
|
/* oxlint-disable jest/no-conditional-expect */
|
||||||
describe('FrontendConfigService', () => {
|
describe('FrontendConfigService', () => {
|
||||||
const domain = 'http://md.example.com';
|
const domain = 'http://md.example.com';
|
||||||
const emptyAuthConfig: AuthConfig = {
|
const emptyAuthConfig: AuthConfig = {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ interface KnexData {
|
|||||||
cancelOnTimeout: boolean;
|
cancelOnTimeout: boolean;
|
||||||
bindings: (number | string)[];
|
bindings: (number | string)[];
|
||||||
sql: string;
|
sql: string;
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||||
__knexQueryUid: string;
|
__knexQueryUid: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ export class ImgurBackend implements MediaBackend {
|
|||||||
const result = (await fetch('https://api.imgur.com/3/image', {
|
const result = (await fetch('https://api.imgur.com/3/image', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: params,
|
body: params,
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||||
headers: { Authorization: `Client-ID ${this.config.clientId}` },
|
headers: { Authorization: `Client-ID ${this.config.clientId}` },
|
||||||
})
|
})
|
||||||
.then((res) => ImgurBackend.checkStatus(res))
|
.then((res) => ImgurBackend.checkStatus(res))
|
||||||
@@ -87,12 +87,12 @@ export class ImgurBackend implements MediaBackend {
|
|||||||
`https://api.imgur.com/3/image/${backendData.deleteHash}`,
|
`https://api.imgur.com/3/image/${backendData.deleteHash}`,
|
||||||
{
|
{
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||||
headers: { Authorization: `Client-ID ${this.config.clientId}` },
|
headers: { Authorization: `Client-ID ${this.config.clientId}` },
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
ImgurBackend.checkStatus(result);
|
ImgurBackend.checkStatus(result);
|
||||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
// oxlint-disable-next-line @typescript-eslint/no-base-to-string
|
||||||
this.logger.log(`Deleted file ${uuid}`, 'deleteFile');
|
this.logger.log(`Deleted file ${uuid}`, 'deleteFile');
|
||||||
return;
|
return;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ describe('s3 backend', () => {
|
|||||||
mockedBuffer,
|
mockedBuffer,
|
||||||
mockedBuffer.length,
|
mockedBuffer.length,
|
||||||
{
|
{
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||||
'Content-Type': 'image/png',
|
'Content-Type': 'image/png',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -189,7 +189,7 @@ describe('s3 backend', () => {
|
|||||||
mockedBuffer,
|
mockedBuffer,
|
||||||
mockedBuffer.length,
|
mockedBuffer.length,
|
||||||
{
|
{
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||||
'Content-Type': 'image/png',
|
'Content-Type': 'image/png',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ export class S3Backend implements MediaBackend {
|
|||||||
buffer,
|
buffer,
|
||||||
buffer.length,
|
buffer.length,
|
||||||
{
|
{
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||||
'Content-Type': fileType.mime,
|
'Content-Type': fileType.mime,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -47,9 +47,9 @@ export class WebdavBackend implements MediaBackend {
|
|||||||
fetch(this.baseUrl, {
|
fetch(this.baseUrl, {
|
||||||
method: 'PROPFIND',
|
method: 'PROPFIND',
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'text/plain', // eslint-disable-line @typescript-eslint/naming-convention
|
Accept: 'text/plain', // oxlint-disable-line @typescript-eslint/naming-convention
|
||||||
Authorization: this.authHeader, // eslint-disable-line @typescript-eslint/naming-convention
|
Authorization: this.authHeader, // oxlint-disable-line @typescript-eslint/naming-convention
|
||||||
Depth: '0', // eslint-disable-line @typescript-eslint/naming-convention
|
Depth: '0', // oxlint-disable-line @typescript-eslint/naming-convention
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
@@ -74,10 +74,10 @@ export class WebdavBackend implements MediaBackend {
|
|||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
body: buffer,
|
body: buffer,
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: this.authHeader, // eslint-disable-line @typescript-eslint/naming-convention
|
Authorization: this.authHeader, // oxlint-disable-line @typescript-eslint/naming-convention
|
||||||
'Content-Type': 'application/octet-stream', // eslint-disable-line @typescript-eslint/naming-convention
|
'Content-Type': 'application/octet-stream', // oxlint-disable-line @typescript-eslint/naming-convention
|
||||||
'Content-Length': `${contentLength}`, // eslint-disable-line @typescript-eslint/naming-convention
|
'Content-Length': `${contentLength}`, // oxlint-disable-line @typescript-eslint/naming-convention
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||||
'If-None-Match': '*', // Don't overwrite already existing files
|
'If-None-Match': '*', // Don't overwrite already existing files
|
||||||
},
|
},
|
||||||
}).then((res) => WebdavBackend.checkStatus(res));
|
}).then((res) => WebdavBackend.checkStatus(res));
|
||||||
@@ -101,7 +101,7 @@ export class WebdavBackend implements MediaBackend {
|
|||||||
await fetch(WebdavBackend.joinURL(this.baseUrl, '/', file), {
|
await fetch(WebdavBackend.joinURL(this.baseUrl, '/', file), {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
headers: {
|
headers: {
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||||
Authorization: this.authHeader,
|
Authorization: this.authHeader,
|
||||||
},
|
},
|
||||||
}).then((res) => WebdavBackend.checkStatus(res));
|
}).then((res) => WebdavBackend.checkStatus(res));
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ describe('NoteService', () => {
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
/* eslint-disable jest/no-conditional-expect */
|
/* oxlint-disable jest/no-conditional-expect */
|
||||||
describe.each([
|
describe.each([
|
||||||
[
|
[
|
||||||
PermissionLevel.READ,
|
PermissionLevel.READ,
|
||||||
@@ -346,7 +346,7 @@ describe('NoteService', () => {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
/* eslint-enable jest/no-conditional-expect */
|
/* oxlint-enable jest/no-conditional-expect */
|
||||||
|
|
||||||
describe('getNoteContent', () => {
|
describe('getNoteContent', () => {
|
||||||
let realtimeNoteStoreSpy: jest.SpyInstance;
|
let realtimeNoteStoreSpy: jest.SpyInstance;
|
||||||
@@ -378,7 +378,7 @@ describe('NoteService', () => {
|
|||||||
|
|
||||||
describe('getNoteIdByAlias', () => {
|
describe('getNoteIdByAlias', () => {
|
||||||
let aliasServiceSpy: jest.SpyInstance;
|
let aliasServiceSpy: jest.SpyInstance;
|
||||||
// eslint-disable-next-line func-style
|
// oxlint-disable-next-line func-style
|
||||||
const buildMockSelect = (returnValues: unknown) => {
|
const buildMockSelect = (returnValues: unknown) => {
|
||||||
mockSelect(
|
mockSelect(
|
||||||
tracker,
|
tracker,
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import { PERMISSION_METADATA_KEY } from './require-permission.decorator';
|
|||||||
|
|
||||||
jest.mock('../api/utils/extract-note-id-from-request');
|
jest.mock('../api/utils/extract-note-id-from-request');
|
||||||
|
|
||||||
// eslint-disable-next-line func-style
|
// oxlint-disable-next-line func-style
|
||||||
const buildContext = (
|
const buildContext = (
|
||||||
userId: number | undefined,
|
userId: number | undefined,
|
||||||
handler: () => void,
|
handler: () => void,
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ describe('PermissionsService', () => {
|
|||||||
expectBindings(tracker, 'select', [[mockMediaUploadUuid]], true);
|
expectBindings(tracker, 'select', [[mockMediaUploadUuid]], true);
|
||||||
});
|
});
|
||||||
|
|
||||||
// eslint-disable-next-line func-style
|
// oxlint-disable-next-line func-style
|
||||||
const buildMockSelect = (returnValues: unknown) => {
|
const buildMockSelect = (returnValues: unknown) => {
|
||||||
mockSelect(
|
mockSelect(
|
||||||
tracker,
|
tracker,
|
||||||
@@ -200,7 +200,7 @@ describe('PermissionsService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('isOwner', () => {
|
describe('isOwner', () => {
|
||||||
// eslint-disable-next-line func-style
|
// oxlint-disable-next-line func-style
|
||||||
const buildMockSelect = (returnValues: unknown) => {
|
const buildMockSelect = (returnValues: unknown) => {
|
||||||
mockSelect(
|
mockSelect(
|
||||||
tracker,
|
tracker,
|
||||||
@@ -285,7 +285,7 @@ describe('PermissionsService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
for (const testCase of determinePermissionTestCases) {
|
for (const testCase of determinePermissionTestCases) {
|
||||||
// eslint-disable-next-line jest/valid-title
|
// oxlint-disable-next-line jest/valid-title
|
||||||
it(testCase.description, async () => {
|
it(testCase.description, async () => {
|
||||||
// Owner
|
// Owner
|
||||||
spyOnPermissionsServiceIsOwner.mockResolvedValue(testCase.isOwner);
|
spyOnPermissionsServiceIsOwner.mockResolvedValue(testCase.isOwner);
|
||||||
@@ -387,7 +387,7 @@ describe('PermissionsService', () => {
|
|||||||
});
|
});
|
||||||
it('and user is registered', async () => {
|
it('and user is registered', async () => {
|
||||||
const spyOneNotifyOthers = jest.spyOn(
|
const spyOneNotifyOthers = jest.spyOn(
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// oxlint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
service as any,
|
service as any,
|
||||||
'notifyOthers',
|
'notifyOthers',
|
||||||
);
|
);
|
||||||
@@ -408,7 +408,7 @@ describe('PermissionsService', () => {
|
|||||||
let spyOneNotifyOthers: jest.SpyInstance;
|
let spyOneNotifyOthers: jest.SpyInstance;
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyOneNotifyOthers = jest.spyOn(
|
spyOneNotifyOthers = jest.spyOn(
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// oxlint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
service as any,
|
service as any,
|
||||||
'notifyOthers',
|
'notifyOthers',
|
||||||
);
|
);
|
||||||
@@ -458,7 +458,7 @@ describe('PermissionsService', () => {
|
|||||||
describe('setGroupPermission', () => {
|
describe('setGroupPermission', () => {
|
||||||
it('correctly sets group permissions and notifies other user', async () => {
|
it('correctly sets group permissions and notifies other user', async () => {
|
||||||
const spyOneNotifyOthers = jest.spyOn(
|
const spyOneNotifyOthers = jest.spyOn(
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// oxlint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
service as any,
|
service as any,
|
||||||
'notifyOthers',
|
'notifyOthers',
|
||||||
);
|
);
|
||||||
@@ -477,12 +477,12 @@ describe('PermissionsService', () => {
|
|||||||
let spyOneNotifyOthers: jest.SpyInstance;
|
let spyOneNotifyOthers: jest.SpyInstance;
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyOneNotifyOthers = jest.spyOn(
|
spyOneNotifyOthers = jest.spyOn(
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// oxlint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
service as any,
|
service as any,
|
||||||
'notifyOthers',
|
'notifyOthers',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
// eslint-disable-next-line func-style
|
// oxlint-disable-next-line func-style
|
||||||
const buildMockDelete = (deletedEntries: number) => {
|
const buildMockDelete = (deletedEntries: number) => {
|
||||||
mockDelete(
|
mockDelete(
|
||||||
tracker,
|
tracker,
|
||||||
@@ -514,12 +514,12 @@ describe('PermissionsService', () => {
|
|||||||
let spyOneNotifyOthers: jest.SpyInstance;
|
let spyOneNotifyOthers: jest.SpyInstance;
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyOneNotifyOthers = jest.spyOn(
|
spyOneNotifyOthers = jest.spyOn(
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// oxlint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
service as any,
|
service as any,
|
||||||
'notifyOthers',
|
'notifyOthers',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
// eslint-disable-next-line func-style
|
// oxlint-disable-next-line func-style
|
||||||
const buildMockUpdate = (updatedEntries: number) => {
|
const buildMockUpdate = (updatedEntries: number) => {
|
||||||
mockUpdate(
|
mockUpdate(
|
||||||
tracker,
|
tracker,
|
||||||
@@ -546,7 +546,7 @@ describe('PermissionsService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('changePubliclyVisibly', () => {
|
describe('changePubliclyVisibly', () => {
|
||||||
// eslint-disable-next-line func-style
|
// oxlint-disable-next-line func-style
|
||||||
const buildMockUpdate = (updatedEntries: number) => {
|
const buildMockUpdate = (updatedEntries: number) => {
|
||||||
mockUpdate(
|
mockUpdate(
|
||||||
tracker,
|
tracker,
|
||||||
@@ -571,7 +571,7 @@ describe('PermissionsService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('getPermissionsDtoForNote', () => {
|
describe('getPermissionsDtoForNote', () => {
|
||||||
// eslint-disable-next-line func-style
|
// oxlint-disable-next-line func-style
|
||||||
const buildMockOwnerSelect = (returnValues: unknown) => {
|
const buildMockOwnerSelect = (returnValues: unknown) => {
|
||||||
mockSelect(
|
mockSelect(
|
||||||
tracker,
|
tracker,
|
||||||
@@ -591,7 +591,7 @@ describe('PermissionsService', () => {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
// eslint-disable-next-line func-style
|
// oxlint-disable-next-line func-style
|
||||||
const buildMockUserPermissionsSelect = (returnValues: unknown) => {
|
const buildMockUserPermissionsSelect = (returnValues: unknown) => {
|
||||||
mockSelect(
|
mockSelect(
|
||||||
tracker,
|
tracker,
|
||||||
@@ -611,7 +611,7 @@ describe('PermissionsService', () => {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
// eslint-disable-next-line func-style
|
// oxlint-disable-next-line func-style
|
||||||
const buildMockGroupPermissionsSelect = (returnValues: unknown) => {
|
const buildMockGroupPermissionsSelect = (returnValues: unknown) => {
|
||||||
mockSelect(
|
mockSelect(
|
||||||
tracker,
|
tracker,
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export const PERMISSION_METADATA_KEY = 'requiredPermission';
|
|||||||
* @param permissionLevel the required permission for the decorated action
|
* @param permissionLevel the required permission for the decorated action
|
||||||
* @returns The custom decorator action
|
* @returns The custom decorator action
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||||
export function RequirePermission(
|
export function RequirePermission(
|
||||||
permissionLevel: PermissionLevel,
|
permissionLevel: PermissionLevel,
|
||||||
): CustomDecorator {
|
): CustomDecorator {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ jest.mock(
|
|||||||
() =>
|
() =>
|
||||||
({
|
({
|
||||||
...jest.requireActual('@hedgedoc/commons'),
|
...jest.requireActual('@hedgedoc/commons'),
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||||
YDocSyncServerAdapter: jest.fn(() => Mock.of<YDocSyncServerAdapter>({})),
|
YDocSyncServerAdapter: jest.fn(() => Mock.of<YDocSyncServerAdapter>({})),
|
||||||
}) as Record<string, unknown>,
|
}) as Record<string, unknown>,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ describe('RevisionsService', () => {
|
|||||||
|
|
||||||
describe('purgeRevisions', () => {
|
describe('purgeRevisions', () => {
|
||||||
let spyOnGetPrimaryAlias: jest.SpyInstance;
|
let spyOnGetPrimaryAlias: jest.SpyInstance;
|
||||||
// eslint-disable-next-line func-style
|
// oxlint-disable-next-line func-style
|
||||||
const buildMockSelect = (returnValues: unknown) => {
|
const buildMockSelect = (returnValues: unknown) => {
|
||||||
mockSelect(
|
mockSelect(
|
||||||
tracker,
|
tracker,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export function setupValidationPipe(
|
|||||||
logger: ConsoleLoggerService,
|
logger: ConsoleLoggerService,
|
||||||
): ValidationPipe {
|
): ValidationPipe {
|
||||||
// This issue is only relevant for usage of class-validator, however we use Zod
|
// This issue is only relevant for usage of class-validator, however we use Zod
|
||||||
// eslint-disable-next-line @darraghor/nestjs-typed/should-specify-forbid-unknown-values
|
// oxlint-disable-next-line @darraghor/nestjs-typed/should-specify-forbid-unknown-values
|
||||||
return new ValidationPipe({
|
return new ValidationPipe({
|
||||||
forbidUnknownValues: false,
|
forbidUnknownValues: false,
|
||||||
skipMissingProperties: false,
|
skipMissingProperties: false,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
/* eslint-disable
|
/* oxlint-disable
|
||||||
@typescript-eslint/no-unsafe-assignment,
|
@typescript-eslint/no-unsafe-assignment,
|
||||||
@typescript-eslint/no-unsafe-member-access
|
@typescript-eslint/no-unsafe-member-access
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ export class TestSetupBuilder {
|
|||||||
password: 'hedgedoc',
|
password: 'hedgedoc',
|
||||||
host: process.env.HD_DATABASE_HOST || 'localhost',
|
host: process.env.HD_DATABASE_HOST || 'localhost',
|
||||||
port: parseInt(process.env.HD_DATABASE_PORT || '5432'),
|
port: parseInt(process.env.HD_DATABASE_PORT || '5432'),
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||||
application_name: 'HedgeDoc Test Server',
|
application_name: 'HedgeDoc Test Server',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
"parser": "@typescript-eslint/parser",
|
|
||||||
"parserOptions": {
|
|
||||||
"project": [
|
|
||||||
"./tsconfig.test.json"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"plugins": [
|
|
||||||
"@typescript-eslint",
|
|
||||||
"jest",
|
|
||||||
"prettier"
|
|
||||||
],
|
|
||||||
"env": {
|
|
||||||
"jest": true,
|
|
||||||
"jest/globals": true
|
|
||||||
},
|
|
||||||
"extends": [
|
|
||||||
"eslint:recommended",
|
|
||||||
"plugin:@typescript-eslint/eslint-recommended",
|
|
||||||
"plugin:@typescript-eslint/recommended-requiring-type-checking",
|
|
||||||
"plugin:@typescript-eslint/recommended",
|
|
||||||
"prettier"
|
|
||||||
],
|
|
||||||
"rules": {
|
|
||||||
"prettier/prettier": ["error",
|
|
||||||
require('./.prettierrc.json')
|
|
||||||
],
|
|
||||||
"jest/no-disabled-tests": "warn",
|
|
||||||
"jest/no-focused-tests": "error",
|
|
||||||
"jest/no-identical-title": "error",
|
|
||||||
"jest/prefer-to-have-length": "warn",
|
|
||||||
"jest/valid-expect": "error"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"$schema": "../node_modules/oxlint/configuration_schema.json",
|
||||||
|
"plugins": [
|
||||||
|
"typescript",
|
||||||
|
"jest",
|
||||||
|
"oxc"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"jest/no-disabled-tests": "warn",
|
||||||
|
"jest/no-focused-tests": "error",
|
||||||
|
"jest/no-identical-title": "error",
|
||||||
|
"jest/valid-expect": "error"
|
||||||
|
},
|
||||||
|
"env": {
|
||||||
|
"node": true,
|
||||||
|
"jest": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
SPDX-FileCopyrightText: 2026 The HedgeDoc developers (see AUTHORS file)
|
||||||
|
|
||||||
|
SPDX-License-Identifier: CC0-1.0
|
||||||
@@ -10,8 +10,8 @@
|
|||||||
"test": "jest",
|
"test": "jest",
|
||||||
"test:ci": "jest --ci",
|
"test:ci": "jest --ci",
|
||||||
"prepublish": "rm -rf dist && yarn lint && yarn build && yarn test",
|
"prepublish": "rm -rf dist && yarn lint && yarn build && yarn test",
|
||||||
"lint": "eslint src --ext .ts",
|
"lint": "../node_modules/.bin/oxlint src",
|
||||||
"lint:fix": "eslint --fix --ext .ts src"
|
"lint:fix": "../node_modules/.bin/oxlint --fix src"
|
||||||
},
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"source": "src/index.ts",
|
"source": "src/index.ts",
|
||||||
@@ -56,12 +56,6 @@
|
|||||||
"@mrdrogdrog/optional": "1.2.1",
|
"@mrdrogdrog/optional": "1.2.1",
|
||||||
"@types/js-yaml": "4.0.9",
|
"@types/js-yaml": "4.0.9",
|
||||||
"@types/ws": "8.18.1",
|
"@types/ws": "8.18.1",
|
||||||
"@typescript-eslint/eslint-plugin": "8.14.0",
|
|
||||||
"@typescript-eslint/parser": "8.14.0",
|
|
||||||
"eslint": "8.57.1",
|
|
||||||
"eslint-config-prettier": "9.1.2",
|
|
||||||
"eslint-plugin-jest": "28.14.0",
|
|
||||||
"eslint-plugin-prettier": "5.5.4",
|
|
||||||
"jest": "29.7.0",
|
"jest": "29.7.0",
|
||||||
"prettier": "3.7.4",
|
"prettier": "3.7.4",
|
||||||
"ts-jest": "29.4.6",
|
"ts-jest": "29.4.6",
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ export class RealtimeDoc extends EventEmitter2<RealtimeDocEvents> {
|
|||||||
* @return The current note content.
|
* @return The current note content.
|
||||||
*/
|
*/
|
||||||
public getCurrentContent(): string {
|
public getCurrentContent(): string {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
// oxlint-disable-next-line @typescript-eslint/no-base-to-string
|
||||||
return this.getMarkdownContentChannel().toString()
|
return this.getMarkdownContentChannel().toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,15 +29,15 @@ describe('y-doc-sync-adapter', () => {
|
|||||||
const textClient2 = docClient2.getMarkdownContentChannel()
|
const textClient2 = docClient2.getMarkdownContentChannel()
|
||||||
|
|
||||||
textServer.observe(() =>
|
textServer.observe(() =>
|
||||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
// oxlint-disable-next-line @typescript-eslint/no-base-to-string
|
||||||
console.log('textServer', new Date(), textServer.toString()),
|
console.log('textServer', new Date(), textServer.toString()),
|
||||||
)
|
)
|
||||||
textClient1.observe(() =>
|
textClient1.observe(() =>
|
||||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
// oxlint-disable-next-line @typescript-eslint/no-base-to-string
|
||||||
console.log('textClient1', new Date(), textClient1.toString()),
|
console.log('textClient1', new Date(), textClient1.toString()),
|
||||||
)
|
)
|
||||||
textClient2.observe(() =>
|
textClient2.observe(() =>
|
||||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
// oxlint-disable-next-line @typescript-eslint/no-base-to-string
|
||||||
console.log('textClient2', new Date(), textClient2.toString()),
|
console.log('textClient2', new Date(), textClient2.toString()),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -209,11 +209,11 @@ describe('y-doc-sync-adapter', () => {
|
|||||||
textClient1.insert(0, 'test3')
|
textClient1.insert(0, 'test3')
|
||||||
textClient2.insert(0, 'test4')
|
textClient2.insert(0, 'test4')
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
// oxlint-disable-next-line @typescript-eslint/no-base-to-string
|
||||||
expect(textServer.toString()).toBe('test4test3test2This is a test note')
|
expect(textServer.toString()).toBe('test4test3test2This is a test note')
|
||||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
// oxlint-disable-next-line @typescript-eslint/no-base-to-string
|
||||||
expect(textClient1.toString()).toBe('test4test3test2This is a test note')
|
expect(textClient1.toString()).toBe('test4test3test2This is a test note')
|
||||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
// oxlint-disable-next-line @typescript-eslint/no-base-to-string
|
||||||
expect(textClient2.toString()).toBe('test4test3test2This is a test note')
|
expect(textClient2.toString()).toBe('test4test3test2This is a test note')
|
||||||
|
|
||||||
docServer.destroy()
|
docServer.destroy()
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
parser: '@typescript-eslint/parser',
|
|
||||||
parserOptions: {
|
|
||||||
project: ['./tsconfig.test.json'],
|
|
||||||
},
|
|
||||||
plugins: ['@typescript-eslint', 'prettier'],
|
|
||||||
extends: [
|
|
||||||
'eslint:recommended',
|
|
||||||
'plugin:@typescript-eslint/eslint-recommended',
|
|
||||||
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
|
||||||
'plugin:@typescript-eslint/recommended',
|
|
||||||
'prettier',
|
|
||||||
],
|
|
||||||
rules: {
|
|
||||||
'prettier/prettier': ['error', require('./.prettierrc.json')],
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"$schema": "../node_modules/oxlint/configuration_schema.json",
|
||||||
|
"plugins": [
|
||||||
|
"typescript",
|
||||||
|
"oxc"
|
||||||
|
],
|
||||||
|
"env": {
|
||||||
|
"node": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
SPDX-FileCopyrightText: 2026 The HedgeDoc developers (see AUTHORS file)
|
||||||
|
|
||||||
|
SPDX-License-Identifier: CC0-1.0
|
||||||
@@ -7,8 +7,8 @@
|
|||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "./build.sh",
|
"build": "./build.sh",
|
||||||
"lint": "eslint src --ext .ts",
|
"lint": "../node_modules/.bin/oxlint src",
|
||||||
"lint:fix": "eslint --fix --ext .ts src"
|
"lint:fix": "../node_modules/.bin/oxlint --fix src"
|
||||||
},
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"source": "src/index.ts",
|
"source": "src/index.ts",
|
||||||
@@ -35,12 +35,6 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "24.10.7",
|
"@types/node": "24.10.7",
|
||||||
"@typescript-eslint/eslint-plugin": "8.14.0",
|
|
||||||
"@typescript-eslint/parser": "8.14.0",
|
|
||||||
"eslint": "8.57.1",
|
|
||||||
"eslint-config-prettier": "9.1.2",
|
|
||||||
"eslint-plugin-jest": "28.14.0",
|
|
||||||
"eslint-plugin-prettier": "5.5.4",
|
|
||||||
"prettier": "3.7.4",
|
"prettier": "3.7.4",
|
||||||
"typescript": "5.9.3"
|
"typescript": "5.9.3"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,61 +0,0 @@
|
|||||||
/**
|
|
||||||
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: CC0-1.0
|
|
||||||
**/
|
|
||||||
module.exports = {
|
|
||||||
"root": true,
|
|
||||||
"parserOptions": {
|
|
||||||
"tsconfigRootDir": ".",
|
|
||||||
"project": [
|
|
||||||
"./tsconfig.json"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"prettier/prettier": ["error",
|
|
||||||
require('./.prettierrc.json')
|
|
||||||
],
|
|
||||||
"no-use-before-define": "off",
|
|
||||||
"no-debugger": "warn",
|
|
||||||
"default-param-last": "off",
|
|
||||||
"@typescript-eslint/consistent-type-imports": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"prefer": "type-imports",
|
|
||||||
"disallowTypeAnnotations": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"jest/no-disabled-tests": "warn",
|
|
||||||
"jest/no-focused-tests": "error",
|
|
||||||
"jest/no-identical-title": "error",
|
|
||||||
"jest/prefer-to-have-length": "warn",
|
|
||||||
"jest/valid-expect": "error"
|
|
||||||
},
|
|
||||||
"env": {
|
|
||||||
"jest": true,
|
|
||||||
"jest/globals": true
|
|
||||||
},
|
|
||||||
"plugins": [
|
|
||||||
"@typescript-eslint",
|
|
||||||
"testing-library",
|
|
||||||
"jest",
|
|
||||||
"prettier"
|
|
||||||
],
|
|
||||||
"extends": [
|
|
||||||
"next/core-web-vitals",
|
|
||||||
"eslint:recommended",
|
|
||||||
"plugin:@typescript-eslint/eslint-recommended",
|
|
||||||
"plugin:@typescript-eslint/recommended",
|
|
||||||
"plugin:@typescript-eslint/recommended-requiring-type-checking",
|
|
||||||
"prettier"
|
|
||||||
],
|
|
||||||
"overrides": [
|
|
||||||
{
|
|
||||||
"files": [
|
|
||||||
"**/__tests__/**/*.[jt]s?(x)",
|
|
||||||
"**/?(*.)+(spec|test).[jt]s?(x)"
|
|
||||||
],
|
|
||||||
"extends": ["plugin:testing-library/react"]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"$schema": "../node_modules/oxlint/configuration_schema.json",
|
||||||
|
"plugins": [
|
||||||
|
"typescript",
|
||||||
|
"react",
|
||||||
|
"nextjs",
|
||||||
|
"jsx-a11y",
|
||||||
|
"jest",
|
||||||
|
"oxc"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"no-debugger": "warn",
|
||||||
|
"typescript/consistent-type-imports": ["error", {
|
||||||
|
"prefer": "type-imports",
|
||||||
|
"disallowTypeAnnotations": false
|
||||||
|
}],
|
||||||
|
"jest/no-disabled-tests": "warn",
|
||||||
|
"jest/no-focused-tests": "error",
|
||||||
|
"jest/no-identical-title": "error",
|
||||||
|
"jest/valid-expect": "error",
|
||||||
|
"jest/expect-expect": ["error", {
|
||||||
|
"assertFunctionNames": ["expect*", "screen.*", "test*"]
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"jest": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
SPDX-FileCopyrightText: 2026 The HedgeDoc developers (see AUTHORS file)
|
||||||
|
|
||||||
|
SPDX-License-Identifier: CC0-1.0
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
{
|
|
||||||
"parserOptions": {
|
|
||||||
"tsconfigRootDir": "",
|
|
||||||
"project": [
|
|
||||||
"./tsconfig.json"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"plugins": [
|
|
||||||
"cypress",
|
|
||||||
"chai-friendly"
|
|
||||||
],
|
|
||||||
"extends": [
|
|
||||||
"plugin:cypress/recommended"
|
|
||||||
],
|
|
||||||
"rules": {
|
|
||||||
"@typescript-eslint/no-unused-expressions": 0,
|
|
||||||
"no-unused-expressions": 0,
|
|
||||||
"chai-friendly/no-unused-expressions": 2,
|
|
||||||
"@typescript-eslint/no-namespace": 0
|
|
||||||
},
|
|
||||||
"env": {
|
|
||||||
"cypress/globals": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
/* oxlint-disable @typescript-eslint/no-unsafe-call */
|
||||||
describe('Intro page', () => {
|
describe('Intro page', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.intercept('/public/intro.md', 'test content')
|
cy.intercept('/public/intro.md', 'test content')
|
||||||
|
|||||||
+2
-14
@@ -10,8 +10,8 @@
|
|||||||
"analyze": "cross-env ANALYZE=true yarn build --profile",
|
"analyze": "cross-env ANALYZE=true yarn build --profile",
|
||||||
"format": "prettier -c \"src/**/*.{ts,tsx,js}\" \"cypress/**/*.{ts,tsx}\"",
|
"format": "prettier -c \"src/**/*.{ts,tsx,js}\" \"cypress/**/*.{ts,tsx}\"",
|
||||||
"format:fix": "prettier -w \"src/**/*.{ts,tsx,js}\" \"cypress/**/*.{ts,tsx}\"",
|
"format:fix": "prettier -w \"src/**/*.{ts,tsx,js}\" \"cypress/**/*.{ts,tsx}\"",
|
||||||
"lint": "eslint --max-warnings=0 --ext .ts,.tsx src",
|
"lint": "../node_modules/.bin/oxlint src",
|
||||||
"lint:fix": "eslint --fix --ext .ts,.tsx src",
|
"lint:fix": "../node_modules/.bin/oxlint --fix src",
|
||||||
"start": "cross-env PORT=${HD_FRONTEND_PORT:-3001} node dist/frontend/server.js",
|
"start": "cross-env PORT=${HD_FRONTEND_PORT:-3001} node dist/frontend/server.js",
|
||||||
"start:dev": "cross-env PORT=${HD_FRONTEND_PORT:-3001} next dev",
|
"start:dev": "cross-env PORT=${HD_FRONTEND_PORT:-3001} next dev",
|
||||||
"start:dev:mock": "cross-env PORT=${HD_FRONTEND_PORT:-3001} NEXT_PUBLIC_USE_MOCK_API=true HD_BASE_URL=\"http://localhost:3001/\" HD_RENDERER_BASE_URL=\"http://127.0.0.1:3001/\" next dev",
|
"start:dev:mock": "cross-env PORT=${HD_FRONTEND_PORT:-3001} NEXT_PUBLIC_USE_MOCK_API=true HD_BASE_URL=\"http://localhost:3001/\" HD_RENDERER_BASE_URL=\"http://127.0.0.1:3001/\" next dev",
|
||||||
@@ -140,23 +140,11 @@
|
|||||||
"@types/react": "18.3.27",
|
"@types/react": "18.3.27",
|
||||||
"@types/react-dom": "18.3.7",
|
"@types/react-dom": "18.3.7",
|
||||||
"@types/ws": "8.18.1",
|
"@types/ws": "8.18.1",
|
||||||
"@typescript-eslint/eslint-plugin": "8.14.0",
|
|
||||||
"@typescript-eslint/parser": "8.14.0",
|
|
||||||
"csstype": "3.2.3",
|
"csstype": "3.2.3",
|
||||||
"cypress": "13.17.0",
|
"cypress": "13.17.0",
|
||||||
"cypress-commands": "3.0.0",
|
"cypress-commands": "3.0.0",
|
||||||
"cypress-fill-command": "1.0.2",
|
"cypress-fill-command": "1.0.2",
|
||||||
"dotenv-cli": "11.0.0",
|
"dotenv-cli": "11.0.0",
|
||||||
"eslint": "8.57.1",
|
|
||||||
"eslint-config-next": "14.2.35",
|
|
||||||
"eslint-config-prettier": "9.1.2",
|
|
||||||
"eslint-plugin-chai-friendly": "1.1.0",
|
|
||||||
"eslint-plugin-cypress": "4.3.0",
|
|
||||||
"eslint-plugin-jest": "28.14.0",
|
|
||||||
"eslint-plugin-n": "17.23.1",
|
|
||||||
"eslint-plugin-prettier": "5.5.4",
|
|
||||||
"eslint-plugin-promise": "7.2.1",
|
|
||||||
"eslint-plugin-testing-library": "6.5.0",
|
|
||||||
"jest": "29.7.0",
|
"jest": "29.7.0",
|
||||||
"jest-environment-jsdom": "29.7.0",
|
"jest-environment-jsdom": "29.7.0",
|
||||||
"prettier": "3.7.4",
|
"prettier": "3.7.4",
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export const CustomBranding: React.FC<BrandingProps> = ({ inline = false }) => {
|
|||||||
return null
|
return null
|
||||||
} else if (branding.logo) {
|
} else if (branding.logo) {
|
||||||
return (
|
return (
|
||||||
/* eslint-disable-next-line @next/next/no-img-element */
|
/* oxlint-disable-next-line @next/next/no-img-element */
|
||||||
<img
|
<img
|
||||||
src={branding.logo}
|
src={branding.logo}
|
||||||
alt={branding.name !== null ? branding.name : undefined}
|
alt={branding.name !== null ? branding.name : undefined}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ export const ProfilePictureSelectField: React.FC<ProfilePictureSelectFieldProps>
|
|||||||
onChange={onSetProviderPicture}
|
onChange={onSetProviderPicture}
|
||||||
/>
|
/>
|
||||||
<Form.Check.Label>
|
<Form.Check.Label>
|
||||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
{/* oxlint-disable-next-line @next/next/no-img-element */}
|
||||||
<img src={photoUrl} alt={'Profile picture provided by the identity provider'} height={48} width={48} />
|
<img src={photoUrl} alt={'Profile picture provided by the identity provider'} height={48} width={48} />
|
||||||
</Form.Check.Label>
|
</Form.Check.Label>
|
||||||
</Form.Check>
|
</Form.Check>
|
||||||
@@ -81,7 +81,7 @@ export const ProfilePictureSelectField: React.FC<ProfilePictureSelectFieldProps>
|
|||||||
onChange={onSetFallbackPicture}
|
onChange={onSetFallbackPicture}
|
||||||
/>
|
/>
|
||||||
<Form.Check.Label>
|
<Form.Check.Label>
|
||||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
{/* oxlint-disable-next-line @next/next/no-img-element */}
|
||||||
<img alt={'Fallback profile picture'} src={fallbackUrl} height={48} width={48} />
|
<img alt={'Fallback profile picture'} src={fallbackUrl} height={48} width={48} />
|
||||||
</Form.Check.Label>
|
</Form.Check.Label>
|
||||||
</Form.Check>
|
</Form.Check>
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export const UploadInput: React.FC<UploadInputProps> = ({ onLoad, allowedFileTyp
|
|||||||
|
|
||||||
const onChange = useCallback<React.ChangeEventHandler<HTMLInputElement>>(
|
const onChange = useCallback<React.ChangeEventHandler<HTMLInputElement>>(
|
||||||
// TODO Check and fix this
|
// TODO Check and fix this
|
||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
// oxlint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
async (event) => {
|
async (event) => {
|
||||||
const fileInput = event.currentTarget
|
const fileInput = event.currentTarget
|
||||||
if (!fileInput.files || fileInput.files.length < 1) {
|
if (!fileInput.files || fileInput.files.length < 1) {
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ export const UserAvatar: React.FC<UserAvatarProps> = ({
|
|||||||
return (
|
return (
|
||||||
<span className={'d-inline-flex align-items-center ' + additionalClasses}>
|
<span className={'d-inline-flex align-items-center ' + additionalClasses}>
|
||||||
{photoComponent ?? (
|
{photoComponent ?? (
|
||||||
// eslint-disable-next-line @next/next/no-img-element
|
// oxlint-disable-next-line @next/next/no-img-element
|
||||||
<img
|
<img
|
||||||
src={avatarUrl}
|
src={avatarUrl}
|
||||||
className={`rounded ${styles['user-image']}`}
|
className={`rounded ${styles['user-image']}`}
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@ import { useEffect } from 'react'
|
|||||||
export const useBindYTextToRedux = (realtimeDoc: RealtimeDoc): void => {
|
export const useBindYTextToRedux = (realtimeDoc: RealtimeDoc): void => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const yText = realtimeDoc.getMarkdownContentChannel()
|
const yText = realtimeDoc.getMarkdownContentChannel()
|
||||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
// oxlint-disable-next-line @typescript-eslint/no-base-to-string
|
||||||
const yTextCallback = () => setNoteContent(yText.toString())
|
const yTextCallback = () => setNoteContent(yText.toString())
|
||||||
yText.observe(yTextCallback)
|
yText.observe(yTextCallback)
|
||||||
return () => yText.unobserve(yTextCallback)
|
return () => yText.unobserve(yTextCallback)
|
||||||
|
|||||||
+1
-1
@@ -62,7 +62,7 @@ export const MediaEntry: React.FC<MediaEntryProps> = ({ entry, onDelete }) => {
|
|||||||
return (
|
return (
|
||||||
<div className={'p-2 border-bottom border-opacity-50'}>
|
<div className={'p-2 border-bottom border-opacity-50'}>
|
||||||
<a href={imageUrl} target={'_blank'} rel={'noreferrer'} className={'text-center d-block mb-2'}>
|
<a href={imageUrl} target={'_blank'} rel={'noreferrer'} className={'text-center d-block mb-2'}>
|
||||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
{/* oxlint-disable-next-line @next/next/no-img-element */}
|
||||||
<img src={imageUrl} alt={`Upload ${entry.fileName}`} className={styles.preview} />
|
<img src={imageUrl} alt={`Upload ${entry.fileName}`} className={styles.preview} />
|
||||||
</a>
|
</a>
|
||||||
<div className={'w-100 d-flex flex-row align-items-center justify-content-between'}>
|
<div className={'w-100 d-flex flex-row align-items-center justify-content-between'}>
|
||||||
|
|||||||
+2
-2
@@ -11,12 +11,12 @@ import type MarkdownIt from 'markdown-it'
|
|||||||
* Base class for Markdown extensions.
|
* Base class for Markdown extensions.
|
||||||
*/
|
*/
|
||||||
export abstract class MarkdownRendererExtension {
|
export abstract class MarkdownRendererExtension {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// oxlint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
public configureMarkdownIt(markdownIt: MarkdownIt): void {
|
public configureMarkdownIt(markdownIt: MarkdownIt): void {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// oxlint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
public configureMarkdownItPost(markdownIt: MarkdownIt): void {
|
public configureMarkdownItPost(markdownIt: MarkdownIt): void {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,6 @@ export const ProxyImageFrame: React.FC<React.ImgHTMLAttributes<HTMLImageElement>
|
|||||||
}, [imageProxyEnabled, src])
|
}, [imageProxyEnabled, src])
|
||||||
|
|
||||||
// The next image processor works with a whitelist of origins. Therefore, we can't use it for general images.
|
// The next image processor works with a whitelist of origins. Therefore, we can't use it for general images.
|
||||||
// eslint-disable-next-line @next/next/no-img-element
|
// oxlint-disable-next-line @next/next/no-img-element
|
||||||
return <img src={imageProxyEnabled ? imageUrl : (src ?? '')} title={title ?? alt ?? ''} alt={alt} {...props} />
|
return <img src={imageProxyEnabled ? imageUrl : (src ?? '')} title={title ?? alt ?? ''} alt={alt} {...props} />
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@ export class AnchorNodePreprocessor extends TravelerNodeProcessor {
|
|||||||
|
|
||||||
const url = node.attribs.href.trim()
|
const url = node.attribs.href.trim()
|
||||||
|
|
||||||
// eslint-disable-next-line no-script-url
|
// oxlint-disable-next-line no-script-url
|
||||||
if (url.startsWith('data:') || url.startsWith('javascript:') || url.startsWith('vbscript:')) {
|
if (url.startsWith('data:') || url.startsWith('javascript:') || url.startsWith('vbscript:')) {
|
||||||
delete node.attribs.href
|
delete node.attribs.href
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export interface MarkdownRendererExtensionOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export abstract class AppExtension {
|
export abstract class AppExtension {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// oxlint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
public buildMarkdownRendererExtensions(options: MarkdownRendererExtensionOptions): MarkdownRendererExtension[] {
|
public buildMarkdownRendererExtensions(options: MarkdownRendererExtensionOptions): MarkdownRendererExtension[] {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { Vimeo as IconVimeo } from 'react-bootstrap-icons'
|
|||||||
|
|
||||||
interface VimeoApiResponse {
|
interface VimeoApiResponse {
|
||||||
// Vimeo uses strange names for their fields. ESLint doesn't like that.
|
// Vimeo uses strange names for their fields. ESLint doesn't like that.
|
||||||
// eslint-disable-next-line camelcase
|
// oxlint-disable-next-line camelcase
|
||||||
thumbnail_large?: string
|
thumbnail_large?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export const useEffectWithCatch = (effect: EffectCallback, deps: DependencyList
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
setError(error as Error)
|
setError(error as Error)
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// oxlint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, deps)
|
}, deps)
|
||||||
|
|
||||||
return error
|
return error
|
||||||
|
|||||||
@@ -1186,7 +1186,7 @@ export const InboxesFill: Icon = () => <>BootstrapIconMock_InboxesFill</>
|
|||||||
export const Inboxes: Icon = () => <>BootstrapIconMock_Inboxes</>
|
export const Inboxes: Icon = () => <>BootstrapIconMock_Inboxes</>
|
||||||
export const Incognito: Icon = () => <>BootstrapIconMock_Incognito</>
|
export const Incognito: Icon = () => <>BootstrapIconMock_Incognito</>
|
||||||
export const Indent: Icon = () => <>BootstrapIconMock_Indent</>
|
export const Indent: Icon = () => <>BootstrapIconMock_Indent</>
|
||||||
// eslint-disable-next-line no-shadow-restricted-names
|
// oxlint-disable-next-line no-shadow-restricted-names
|
||||||
export const Infinity: Icon = () => <>BootstrapIconMock_Infinity</>
|
export const Infinity: Icon = () => <>BootstrapIconMock_Infinity</>
|
||||||
export const InfoCircleFill: Icon = () => <>BootstrapIconMock_InfoCircleFill</>
|
export const InfoCircleFill: Icon = () => <>BootstrapIconMock_InfoCircleFill</>
|
||||||
export const InfoCircle: Icon = () => <>BootstrapIconMock_InfoCircle</>
|
export const InfoCircle: Icon = () => <>BootstrapIconMock_InfoCircle</>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export const updateObject = <T extends Record<string, unknown>>(oldObject: T, ne
|
|||||||
Object.keys(oldObject).forEach((key) => {
|
Object.keys(oldObject).forEach((key) => {
|
||||||
if (Object.prototype.hasOwnProperty.call(newValues, key) && typeof oldObject[key] === typeof newValues[key]) {
|
if (Object.prototype.hasOwnProperty.call(newValues, key) && typeof oldObject[key] === typeof newValues[key]) {
|
||||||
// TypeScript does not allow to assign a value to a key of a generic object (as it could be potentially readonly)
|
// TypeScript does not allow to assign a value to a key of a generic object (as it could be potentially readonly)
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// oxlint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
oldObject[key] = newValues[key]
|
oldObject[key] = newValues[key]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { updateObject } from './update-object'
|
|||||||
describe('updateObject', () => {
|
describe('updateObject', () => {
|
||||||
it('should not update the object if newValues is not an object', () => {
|
it('should not update the object if newValues is not an object', () => {
|
||||||
const oldObject = { a: 1, b: 2 }
|
const oldObject = { a: 1, b: 2 }
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// oxlint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
updateObject(oldObject, 'abc')
|
updateObject(oldObject, 'abc')
|
||||||
expect(oldObject).toEqual({ a: 1, b: 2 })
|
expect(oldObject).toEqual({ a: 1, b: 2 })
|
||||||
@@ -37,7 +37,7 @@ describe('updateObject', () => {
|
|||||||
it('should ignore keys with different types', () => {
|
it('should ignore keys with different types', () => {
|
||||||
const oldObject = { a: 1, b: 2 }
|
const oldObject = { a: 1, b: 2 }
|
||||||
const newValues = { a: '3', b: 4 }
|
const newValues = { a: '3', b: 4 }
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// oxlint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
updateObject(oldObject, newValues)
|
updateObject(oldObject, newValues)
|
||||||
expect(oldObject).toEqual({ a: 1, b: 4 })
|
expect(oldObject).toEqual({ a: 1, b: 4 })
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
"parser": "@typescript-eslint/parser",
|
|
||||||
"parserOptions": {
|
|
||||||
"project": [
|
|
||||||
"./tsconfig.test.json"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"plugins": [
|
|
||||||
"@typescript-eslint",
|
|
||||||
"jest",
|
|
||||||
"prettier"
|
|
||||||
],
|
|
||||||
"env": {
|
|
||||||
"jest": true,
|
|
||||||
"jest/globals": true
|
|
||||||
},
|
|
||||||
"extends": [
|
|
||||||
"eslint:recommended",
|
|
||||||
"plugin:@typescript-eslint/eslint-recommended",
|
|
||||||
"plugin:@typescript-eslint/recommended-requiring-type-checking",
|
|
||||||
"plugin:@typescript-eslint/recommended",
|
|
||||||
"prettier"
|
|
||||||
],
|
|
||||||
"rules": {
|
|
||||||
"prettier/prettier": ["error",
|
|
||||||
require('./.prettierrc.json')
|
|
||||||
],
|
|
||||||
"jest/no-disabled-tests": "warn",
|
|
||||||
"jest/no-focused-tests": "error",
|
|
||||||
"jest/no-identical-title": "error",
|
|
||||||
"jest/prefer-to-have-length": "warn",
|
|
||||||
"jest/valid-expect": "error"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"$schema": "../node_modules/oxlint/configuration_schema.json",
|
||||||
|
"plugins": [
|
||||||
|
"typescript",
|
||||||
|
"jest",
|
||||||
|
"oxc"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"jest/no-disabled-tests": "warn",
|
||||||
|
"jest/no-focused-tests": "error",
|
||||||
|
"jest/no-identical-title": "error",
|
||||||
|
"jest/valid-expect": "error"
|
||||||
|
},
|
||||||
|
"env": {
|
||||||
|
"node": true,
|
||||||
|
"jest": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
SPDX-FileCopyrightText: 2026 The HedgeDoc developers (see AUTHORS file)
|
||||||
|
|
||||||
|
SPDX-License-Identifier: CC0-1.0
|
||||||
@@ -21,8 +21,8 @@
|
|||||||
"test": "jest",
|
"test": "jest",
|
||||||
"build": "./build.sh",
|
"build": "./build.sh",
|
||||||
"prepublish": "yarn lint && yarn build && yarn test",
|
"prepublish": "yarn lint && yarn build && yarn test",
|
||||||
"lint": "eslint src --ext .ts",
|
"lint": "../node_modules/.bin/oxlint src",
|
||||||
"lint:fix": "eslint --fix --ext .ts src"
|
"lint:fix": "../node_modules/.bin/oxlint --fix src"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"LICENSES/*",
|
"LICENSES/*",
|
||||||
@@ -52,12 +52,6 @@
|
|||||||
"@jest/types": "29.6.3",
|
"@jest/types": "29.6.3",
|
||||||
"@types/react": "18.3.27",
|
"@types/react": "18.3.27",
|
||||||
"@types/react-dom": "18.3.7",
|
"@types/react-dom": "18.3.7",
|
||||||
"@typescript-eslint/eslint-plugin": "8.14.0",
|
|
||||||
"@typescript-eslint/parser": "8.14.0",
|
|
||||||
"eslint": "8.57.1",
|
|
||||||
"eslint-config-prettier": "9.1.2",
|
|
||||||
"eslint-plugin-jest": "28.14.0",
|
|
||||||
"eslint-plugin-prettier": "5.5.4",
|
|
||||||
"jest": "29.7.0",
|
"jest": "29.7.0",
|
||||||
"prettier": "3.7.4",
|
"prettier": "3.7.4",
|
||||||
"react": "18.3.1",
|
"react": "18.3.1",
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
"parser": "@typescript-eslint/parser",
|
|
||||||
"parserOptions": {
|
|
||||||
"project": [
|
|
||||||
"./tsconfig.test.json"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"plugins": [
|
|
||||||
"@typescript-eslint",
|
|
||||||
"jest",
|
|
||||||
"prettier"
|
|
||||||
],
|
|
||||||
"env": {
|
|
||||||
"jest": true,
|
|
||||||
"jest/globals": true
|
|
||||||
},
|
|
||||||
"extends": [
|
|
||||||
"eslint:recommended",
|
|
||||||
"plugin:@typescript-eslint/eslint-recommended",
|
|
||||||
"plugin:@typescript-eslint/recommended-requiring-type-checking",
|
|
||||||
"plugin:@typescript-eslint/recommended",
|
|
||||||
"prettier"
|
|
||||||
],
|
|
||||||
"rules": {
|
|
||||||
"prettier/prettier": ["error",
|
|
||||||
require('./.prettierrc.json')
|
|
||||||
],
|
|
||||||
"jest/no-disabled-tests": "warn",
|
|
||||||
"jest/no-focused-tests": "error",
|
|
||||||
"jest/no-identical-title": "error",
|
|
||||||
"jest/prefer-to-have-length": "warn",
|
|
||||||
"jest/valid-expect": "error"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"$schema": "../node_modules/oxlint/configuration_schema.json",
|
||||||
|
"plugins": [
|
||||||
|
"typescript",
|
||||||
|
"jest",
|
||||||
|
"oxc"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"jest/no-disabled-tests": "warn",
|
||||||
|
"jest/no-focused-tests": "error",
|
||||||
|
"jest/no-identical-title": "error",
|
||||||
|
"jest/valid-expect": "error"
|
||||||
|
},
|
||||||
|
"env": {
|
||||||
|
"node": true,
|
||||||
|
"jest": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
SPDX-FileCopyrightText: 2026 The HedgeDoc developers (see AUTHORS file)
|
||||||
|
|
||||||
|
SPDX-License-Identifier: CC0-1.0
|
||||||
@@ -89,8 +89,8 @@
|
|||||||
"test": "jest",
|
"test": "jest",
|
||||||
"test:ci": "jest --ci",
|
"test:ci": "jest --ci",
|
||||||
"prepublish": "rm -rf dist && yarn lint && yarn build && yarn test",
|
"prepublish": "rm -rf dist && yarn lint && yarn build && yarn test",
|
||||||
"lint": "eslint src --ext .ts",
|
"lint": "../node_modules/.bin/oxlint src",
|
||||||
"lint:fix": "eslint --fix --ext .ts src"
|
"lint:fix": "../node_modules/.bin/oxlint --fix src"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"markdown",
|
"markdown",
|
||||||
@@ -110,12 +110,6 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@jest/types": "29.6.3",
|
"@jest/types": "29.6.3",
|
||||||
"@types/markdown-it": "13.0.8",
|
"@types/markdown-it": "13.0.8",
|
||||||
"@typescript-eslint/eslint-plugin": "8.14.0",
|
|
||||||
"@typescript-eslint/parser": "8.14.0",
|
|
||||||
"eslint": "8.57.1",
|
|
||||||
"eslint-config-prettier": "9.1.2",
|
|
||||||
"eslint-plugin-jest": "28.14.0",
|
|
||||||
"eslint-plugin-prettier": "5.5.4",
|
|
||||||
"jest": "29.7.0",
|
"jest": "29.7.0",
|
||||||
"markdown-it": "13.0.2",
|
"markdown-it": "13.0.2",
|
||||||
"prettier": "3.7.4",
|
"prettier": "3.7.4",
|
||||||
|
|||||||
@@ -46,6 +46,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"dotenv-cli": "11.0.0",
|
"dotenv-cli": "11.0.0",
|
||||||
|
"oxlint": "1.38.0",
|
||||||
"turbo": "2.6.3"
|
"turbo": "2.6.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -78,7 +78,8 @@
|
|||||||
"lint:fix": {
|
"lint:fix": {
|
||||||
"dependsOn": [
|
"dependsOn": [
|
||||||
"^build"
|
"^build"
|
||||||
]
|
],
|
||||||
|
"cache": false
|
||||||
},
|
},
|
||||||
"format": {},
|
"format": {},
|
||||||
"test": {
|
"test": {
|
||||||
|
|||||||
Reference in New Issue
Block a user