Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.15.4 #1472

Merged
merged 4 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- name: Checkout repository
Expand Down Expand Up @@ -41,6 +41,10 @@ jobs:
exit 1
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "GITHUB REF TYPE: ${{ github.ref_type }}"
echo "GITHUB REF NAME: ${{ github.ref_name }}"
echo "EVENT INPUT VERSION: ${{ github.event.inputs.version }}"
echo "ENV VERSION: $VERSION"

- name: Build and push Docker image
uses: docker/build-push-action@v5
Expand Down
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# misc
/.angular/cache
Expand Down
20 changes: 0 additions & 20 deletions .vscode/launch.json

This file was deleted.

13 changes: 0 additions & 13 deletions .vscode/settings.json

This file was deleted.

6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG BASE_DISTRO="node:alpine"
ARG BASE_DISTRO="node:20-alpine"

FROM --platform=${BUILDPLATFORM} ${BASE_DISTRO} as builder
FROM --platform=${BUILDPLATFORM} ${BASE_DISTRO} AS builder

WORKDIR /RTL

Expand All @@ -20,7 +20,7 @@ RUN npm run buildbackend
# Remove non production necessary modules
RUN npm prune --omit=dev --legacy-peer-deps

FROM --platform=${TARGETPLATFORM} ${BASE_DISTRO} as runner
FROM --platform=${TARGETPLATFORM} ${BASE_DISTRO} AS runner

RUN apk add --no-cache tini

Expand Down
62 changes: 27 additions & 35 deletions backend/controllers/shared/RTLConf.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Database } from '../../utils/database.js';
import { Logger } from '../../utils/logger.js';
import { Common } from '../../utils/common.js';
import { WSServer } from '../../utils/webSocketServer.js';
import { Authentication, SSO } from '../../models/config.model.js';
import { Authentication } from '../../models/config.model.js';
const options = { url: '' };
const logger = Logger;
const common = Common;
Expand Down Expand Up @@ -96,41 +96,33 @@ export const getFile = (req, res, next) => {
};
export const getApplicationSettings = (req, res, next) => {
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'RTLConf', msg: 'Getting RTL Configuration..' });
const confFile = common.appConfig.rtlConfFilePath + sep + 'RTL-Config.json';
fs.readFile(confFile, 'utf8', (errRes, data) => {
if (errRes) {
const errMsg = 'Get Node Config Error';
const err = common.handleError({ statusCode: 500, message: errMsg, error: errRes }, 'RTLConf', errMsg, req.session.selectedNode);
return res.status(err.statusCode).json({ message: err.error, error: err.error });
}
else {
const appConfData = common.removeSecureData(JSON.parse(data));
appConfData.allowPasswordUpdate = common.appConfig.allowPasswordUpdate;
appConfData.enable2FA = common.appConfig.enable2FA;
appConfData.selectedNodeIndex = (req.session.selectedNode && req.session.selectedNode.index ? req.session.selectedNode.index : common.selectedNode.index);
common.appConfig.selectedNodeIndex = appConfData.selectedNodeIndex;
const token = req.headers.authorization ? req.headers.authorization.split(' ')[1] : '';
jwt.verify(token, common.secret_key, (err, user) => {
if (err) {
// Delete unnecessary data for initial response (without security token)
const selNodeIdx = appConfData.nodes.findIndex((node) => node.index === appConfData.selectedNodeIndex) || 0;
appConfData.SSO = new SSO();
appConfData.secret2FA = '';
appConfData.dbDirectoryPath = '';
appConfData.nodes[selNodeIdx].authentication = new Authentication();
delete appConfData.nodes[selNodeIdx].settings.bitcoindConfigPath;
delete appConfData.nodes[selNodeIdx].settings.lnServerUrl;
delete appConfData.nodes[selNodeIdx].settings.swapServerUrl;
delete appConfData.nodes[selNodeIdx].settings.boltzServerUrl;
delete appConfData.nodes[selNodeIdx].settings.enableOffers;
delete appConfData.nodes[selNodeIdx].settings.enablePeerswap;
delete appConfData.nodes[selNodeIdx].settings.channelBackupPath;
appConfData.nodes = [appConfData.nodes[selNodeIdx]];
}
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'RTLConf', msg: 'RTL Configuration Received', data: appConfData });
res.status(200).json(appConfData);
});
const appConfData = common.removeSecureData(JSON.parse(JSON.stringify(common.appConfig)));
appConfData.allowPasswordUpdate = common.appConfig.allowPasswordUpdate;
appConfData.enable2FA = common.appConfig.enable2FA;
appConfData.selectedNodeIndex = (req.session.selectedNode && req.session.selectedNode.index ? req.session.selectedNode.index : common.selectedNode.index);
common.appConfig.selectedNodeIndex = appConfData.selectedNodeIndex;
const token = req.headers.authorization ? req.headers.authorization.split(' ')[1] : '';
jwt.verify(token, common.secret_key, (err, user) => {
if (err) {
// Delete unnecessary data for initial response (without security token)
const selNodeIdx = appConfData.nodes.findIndex((node) => node.index === appConfData.selectedNodeIndex) || 0;
delete appConfData.SSO.rtlCookiePath;
delete appConfData.SSO.cookieValue;
delete appConfData.SSO.logoutRedirectLink;
appConfData.secret2FA = '';
appConfData.dbDirectoryPath = '';
appConfData.nodes[selNodeIdx].authentication = new Authentication();
delete appConfData.nodes[selNodeIdx].settings.bitcoindConfigPath;
delete appConfData.nodes[selNodeIdx].settings.lnServerUrl;
delete appConfData.nodes[selNodeIdx].settings.swapServerUrl;
delete appConfData.nodes[selNodeIdx].settings.boltzServerUrl;
delete appConfData.nodes[selNodeIdx].settings.enableOffers;
delete appConfData.nodes[selNodeIdx].settings.enablePeerswap;
delete appConfData.nodes[selNodeIdx].settings.channelBackupPath;
appConfData.nodes = [appConfData.nodes[selNodeIdx]];
}
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'RTLConf', msg: 'RTL Configuration Received', data: appConfData });
res.status(200).json(appConfData);
});
};
export const updateSelectedNode = (req, res, next) => {
Expand Down
4 changes: 2 additions & 2 deletions backend/controllers/shared/authenticate.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const verifyToken = (twoFAToken) => !!(common.appConfig.secret2FA && comm
export const authenticateUser = (req, res, next) => {
const { authenticateWith, authenticationValue, twoFAToken } = req.body;
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Authenticate', msg: 'Authenticating User..' });
if (+common.appConfig.SSO.rtlSso) {
if (+common.appConfig.SSO.rtlSSO) {
if (authenticateWith === 'JWT' && jwt.verify(authenticationValue, common.secret_key)) {
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Authenticate', msg: 'User Authenticated' });
res.status(406).json({ message: 'SSO Authentication Error', error: 'Login with Password is not allowed with SSO.' });
Expand Down Expand Up @@ -103,7 +103,7 @@ export const authenticateUser = (req, res, next) => {
export const resetPassword = (req, res, next) => {
const { currPassword, newPassword } = req.body;
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Authenticate', msg: 'Resetting Password..' });
if (+common.appConfig.SSO.rtlSso) {
if (+common.appConfig.SSO.rtlSSO) {
const errMsg = 'Password cannot be reset for SSO authentication';
const err = common.handleError({ statusCode: 401, message: 'Password Reset Error', error: errMsg }, 'Authenticate', errMsg, req.session.selectedNode);
return res.status(err.statusCode).json({ message: err.message, error: err.error });
Expand Down
4 changes: 2 additions & 2 deletions backend/models/config.model.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export class SSO {
constructor(rtlSso, rtlCookiePath, logoutRedirectLink, cookieValue) {
this.rtlSso = rtlSso;
constructor(rtlSSO, rtlCookiePath, logoutRedirectLink, cookieValue) {
this.rtlSSO = rtlSSO;
this.rtlCookiePath = rtlCookiePath;
this.logoutRedirectLink = logoutRedirectLink;
this.cookieValue = cookieValue;
Expand Down
4 changes: 2 additions & 2 deletions backend/utils/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class CommonService {
this.logger = Logger;
this.nodes = [];
this.selectedNode = null;
this.ssoInit = { rtlSso: 0, rtlCookiePath: '', logoutRedirectLink: '', cookieValue: '' };
this.ssoInit = { rtlSSO: 0, rtlCookiePath: '', logoutRedirectLink: '', cookieValue: '' };
this.appConfig = { defaultNodeIndex: 0, selectedNodeIndex: 0, rtlConfFilePath: '', dbDirectoryPath: join(dirname(fileURLToPath(import.meta.url)), '..', '..'), rtlPass: '', allowPasswordUpdate: true, enable2FA: false, secret2FA: '', SSO: this.ssoInit, nodes: [] };
this.port = 3000;
this.host = '';
Expand Down Expand Up @@ -528,7 +528,7 @@ export class CommonService {
const selNode = req.session.selectedNode;
if (selNode && selNode.index) {
this.logger.log({ selectedNode: selNode, level: 'INFO', fileName: 'Config Setup:', msg: JSON.stringify(this.removeSecureData(JSON.parse(JSON.stringify(this.appConfig)))) });
this.logger.log({ selectedNode: selNode, level: 'INFO', fileName: 'Config Setup Variable', msg: 'SSO: ' + this.appConfig.SSO.rtlSso });
this.logger.log({ selectedNode: selNode, level: 'INFO', fileName: 'Config Setup Variable', msg: 'SSO: ' + this.appConfig.SSO.rtlSSO });
}
};
this.filterData = (dataKey, lnImplementation) => {
Expand Down
6 changes: 3 additions & 3 deletions backend/utils/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,10 @@ export class ConfigService {
};
this.setSSOParams = (config) => {
if (process?.env?.RTL_SSO) {
config.SSO.rtlSso = +process?.env?.RTL_SSO;
config.SSO.rtlSSO = +process?.env?.RTL_SSO;
}
else if (config.SSO && config.SSO.rtlSSO) {
config.SSO.rtlSso = config.SSO.rtlSSO;
config.SSO.rtlSSO = config.SSO.rtlSSO;
Comment on lines +321 to +324
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix self-assignment and improve optional chaining.

There are two issues in this code segment:

  1. The self-assignment config.SSO.rtlSSO = config.SSO.rtlSSO is redundant and can be removed.
  2. The environment variable access can be improved with optional chaining.

Apply this diff to fix the issues:

-                config.SSO.rtlSSO = +process?.env?.RTL_SSO;
+                config.SSO.rtlSSO = +process?.env?.RTL_SSO ?? 0;
-            else if (config.SSO && config.SSO.rtlSSO) {
-                config.SSO.rtlSSO = config.SSO.rtlSSO;
+            else if (config.SSO?.rtlSSO) {
+                // Value already set in config.SSO.rtlSSO
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
config.SSO.rtlSSO = +process?.env?.RTL_SSO;
}
else if (config.SSO && config.SSO.rtlSSO) {
config.SSO.rtlSso = config.SSO.rtlSSO;
config.SSO.rtlSSO = config.SSO.rtlSSO;
config.SSO.rtlSSO = +process?.env?.RTL_SSO ?? 0;
}
else if (config.SSO?.rtlSSO) {
// Value already set in config.SSO.rtlSSO
🧰 Tools
🪛 Biome

[error] 323-323: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 324-324: rtlSSO is assigned to itself.

This is where is assigned.

(lint/correctness/noSelfAssign)

}
if (process?.env?.RTL_COOKIE_PATH) {
config.SSO.rtlCookiePath = process?.env?.RTL_COOKIE_PATH;
Expand All @@ -338,7 +338,7 @@ export class ConfigService {
else if (config.SSO && config.SSO.logoutRedirectLink) {
config.SSO.logoutRedirectLink = config.SSO.logoutRedirectLink;
}
if (+config.SSO.rtlSso) {
if (+config.SSO.rtlSSO) {
if (!config.SSO.rtlCookiePath || config.SSO.rtlCookiePath.trim() === '') {
this.errMsg = 'Please set rtlCookiePath value for single sign on option!';
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/index.html

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion frontend/main.6e2567250e1fcca3.js

This file was deleted.

1 change: 1 addition & 0 deletions frontend/main.89468e89473d89c7.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rtl",
"version": "0.15.3-beta",
"version": "0.15.4-beta",
"license": "MIT",
"type": "module",
"scripts": {
Expand Down
61 changes: 27 additions & 34 deletions server/controllers/shared/RTLConf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Database, DatabaseService } from '../../utils/database.js';
import { Logger, LoggerService } from '../../utils/logger.js';
import { Common, CommonService } from '../../utils/common.js';
import { WSServer } from '../../utils/webSocketServer.js';
import { Authentication, SSO } from '../../models/config.model.js';
import { Authentication } from '../../models/config.model.js';

const options = { url: '' };
const logger: LoggerService = Logger;
Expand Down Expand Up @@ -99,40 +99,33 @@ export const getFile = (req, res, next) => {

export const getApplicationSettings = (req, res, next) => {
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'RTLConf', msg: 'Getting RTL Configuration..' });
const confFile = common.appConfig.rtlConfFilePath + sep + 'RTL-Config.json';
fs.readFile(confFile, 'utf8', (errRes, data) => {
if (errRes) {
const errMsg = 'Get Node Config Error';
const err = common.handleError({ statusCode: 500, message: errMsg, error: errRes }, 'RTLConf', errMsg, req.session.selectedNode);
return res.status(err.statusCode).json({ message: err.error, error: err.error });
} else {
const appConfData = common.removeSecureData(JSON.parse(data));
appConfData.allowPasswordUpdate = common.appConfig.allowPasswordUpdate;
appConfData.enable2FA = common.appConfig.enable2FA;
appConfData.selectedNodeIndex = (req.session.selectedNode && req.session.selectedNode.index ? req.session.selectedNode.index : common.selectedNode.index);
common.appConfig.selectedNodeIndex = appConfData.selectedNodeIndex;
const token = req.headers.authorization ? req.headers.authorization.split(' ')[1] : '';
jwt.verify(token, common.secret_key, (err, user) => {
if (err) {
// Delete unnecessary data for initial response (without security token)
const selNodeIdx = appConfData.nodes.findIndex((node) => node.index === appConfData.selectedNodeIndex) || 0;
appConfData.SSO = new SSO();
appConfData.secret2FA = '';
appConfData.dbDirectoryPath = '';
appConfData.nodes[selNodeIdx].authentication = new Authentication();
delete appConfData.nodes[selNodeIdx].settings.bitcoindConfigPath;
delete appConfData.nodes[selNodeIdx].settings.lnServerUrl;
delete appConfData.nodes[selNodeIdx].settings.swapServerUrl;
delete appConfData.nodes[selNodeIdx].settings.boltzServerUrl;
delete appConfData.nodes[selNodeIdx].settings.enableOffers;
delete appConfData.nodes[selNodeIdx].settings.enablePeerswap;
delete appConfData.nodes[selNodeIdx].settings.channelBackupPath;
appConfData.nodes = [appConfData.nodes[selNodeIdx]];
}
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'RTLConf', msg: 'RTL Configuration Received', data: appConfData });
res.status(200).json(appConfData);
});
const appConfData = common.removeSecureData(JSON.parse(JSON.stringify(common.appConfig)));
appConfData.allowPasswordUpdate = common.appConfig.allowPasswordUpdate;
appConfData.enable2FA = common.appConfig.enable2FA;
appConfData.selectedNodeIndex = (req.session.selectedNode && req.session.selectedNode.index ? req.session.selectedNode.index : common.selectedNode.index);
common.appConfig.selectedNodeIndex = appConfData.selectedNodeIndex;
const token = req.headers.authorization ? req.headers.authorization.split(' ')[1] : '';
jwt.verify(token, common.secret_key, (err, user) => {
if (err) {
// Delete unnecessary data for initial response (without security token)
const selNodeIdx = appConfData.nodes.findIndex((node) => node.index === appConfData.selectedNodeIndex) || 0;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix potential null reference with optional chaining

The findIndex operation could return -1, making the || 0 fallback potentially incorrect.

Apply this fix:

-  const selNodeIdx = appConfData.nodes.findIndex((node) => node.index === appConfData.selectedNodeIndex) || 0;
+  const selNodeIdx = appConfData.nodes.findIndex((node) => node?.index === appConfData.selectedNodeIndex) ?? 0;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const selNodeIdx = appConfData.nodes.findIndex((node) => node.index === appConfData.selectedNodeIndex) || 0;
const selNodeIdx = appConfData.nodes.findIndex((node) => node?.index === appConfData.selectedNodeIndex) ?? 0;

delete appConfData.SSO.rtlCookiePath;
delete appConfData.SSO.cookieValue;
delete appConfData.SSO.logoutRedirectLink;
appConfData.secret2FA = '';
appConfData.dbDirectoryPath = '';
appConfData.nodes[selNodeIdx].authentication = new Authentication();
delete appConfData.nodes[selNodeIdx].settings.bitcoindConfigPath;
delete appConfData.nodes[selNodeIdx].settings.lnServerUrl;
delete appConfData.nodes[selNodeIdx].settings.swapServerUrl;
delete appConfData.nodes[selNodeIdx].settings.boltzServerUrl;
delete appConfData.nodes[selNodeIdx].settings.enableOffers;
delete appConfData.nodes[selNodeIdx].settings.enablePeerswap;
delete appConfData.nodes[selNodeIdx].settings.channelBackupPath;
Comment on lines +112 to +124
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Improve performance by avoiding delete operators

Multiple delete operators can impact performance. Consider using undefined assignments instead.

Apply this refactoring:

-  delete appConfData.SSO.rtlCookiePath;
-  delete appConfData.SSO.cookieValue;
-  delete appConfData.SSO.logoutRedirectLink;
+  appConfData.SSO.rtlCookiePath = undefined;
+  appConfData.SSO.cookieValue = undefined;
+  appConfData.SSO.logoutRedirectLink = undefined;

-  delete appConfData.nodes[selNodeIdx].settings.bitcoindConfigPath;
-  delete appConfData.nodes[selNodeIdx].settings.lnServerUrl;
-  delete appConfData.nodes[selNodeIdx].settings.swapServerUrl;
-  delete appConfData.nodes[selNodeIdx].settings.boltzServerUrl;
-  delete appConfData.nodes[selNodeIdx].settings.enableOffers;
-  delete appConfData.nodes[selNodeIdx].settings.enablePeerswap;
-  delete appConfData.nodes[selNodeIdx].settings.channelBackupPath;
+  appConfData.nodes[selNodeIdx].settings.bitcoindConfigPath = undefined;
+  appConfData.nodes[selNodeIdx].settings.lnServerUrl = undefined;
+  appConfData.nodes[selNodeIdx].settings.swapServerUrl = undefined;
+  appConfData.nodes[selNodeIdx].settings.boltzServerUrl = undefined;
+  appConfData.nodes[selNodeIdx].settings.enableOffers = undefined;
+  appConfData.nodes[selNodeIdx].settings.enablePeerswap = undefined;
+  appConfData.nodes[selNodeIdx].settings.channelBackupPath = undefined;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
delete appConfData.SSO.rtlCookiePath;
delete appConfData.SSO.cookieValue;
delete appConfData.SSO.logoutRedirectLink;
appConfData.secret2FA = '';
appConfData.dbDirectoryPath = '';
appConfData.nodes[selNodeIdx].authentication = new Authentication();
delete appConfData.nodes[selNodeIdx].settings.bitcoindConfigPath;
delete appConfData.nodes[selNodeIdx].settings.lnServerUrl;
delete appConfData.nodes[selNodeIdx].settings.swapServerUrl;
delete appConfData.nodes[selNodeIdx].settings.boltzServerUrl;
delete appConfData.nodes[selNodeIdx].settings.enableOffers;
delete appConfData.nodes[selNodeIdx].settings.enablePeerswap;
delete appConfData.nodes[selNodeIdx].settings.channelBackupPath;
appConfData.SSO.rtlCookiePath = undefined;
appConfData.SSO.cookieValue = undefined;
appConfData.SSO.logoutRedirectLink = undefined;
appConfData.secret2FA = '';
appConfData.dbDirectoryPath = '';
appConfData.nodes[selNodeIdx].authentication = new Authentication();
appConfData.nodes[selNodeIdx].settings.bitcoindConfigPath = undefined;
appConfData.nodes[selNodeIdx].settings.lnServerUrl = undefined;
appConfData.nodes[selNodeIdx].settings.swapServerUrl = undefined;
appConfData.nodes[selNodeIdx].settings.boltzServerUrl = undefined;
appConfData.nodes[selNodeIdx].settings.enableOffers = undefined;
appConfData.nodes[selNodeIdx].settings.enablePeerswap = undefined;
appConfData.nodes[selNodeIdx].settings.channelBackupPath = undefined;
🧰 Tools
🪛 Biome

[error] 112-112: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 113-113: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 114-114: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 118-118: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 119-119: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 120-120: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 121-121: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 122-122: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 123-123: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 124-124: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)

appConfData.nodes = [appConfData.nodes[selNodeIdx]];
}
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'RTLConf', msg: 'RTL Configuration Received', data: appConfData });
res.status(200).json(appConfData);
});
};

Expand Down
4 changes: 2 additions & 2 deletions server/controllers/shared/authenticate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const verifyToken = (twoFAToken) => !!(common.appConfig.secret2FA && comm
export const authenticateUser = (req, res, next) => {
const { authenticateWith, authenticationValue, twoFAToken } = req.body;
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Authenticate', msg: 'Authenticating User..' });
if (+common.appConfig.SSO.rtlSso) {
if (+common.appConfig.SSO.rtlSSO) {
if (authenticateWith === 'JWT' && jwt.verify(authenticationValue, common.secret_key)) {
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Authenticate', msg: 'User Authenticated' });
res.status(406).json({ message: 'SSO Authentication Error', error: 'Login with Password is not allowed with SSO.' });
Expand Down Expand Up @@ -100,7 +100,7 @@ export const authenticateUser = (req, res, next) => {
export const resetPassword = (req, res, next) => {
const { currPassword, newPassword } = req.body;
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Authenticate', msg: 'Resetting Password..' });
if (+common.appConfig.SSO.rtlSso) {
if (+common.appConfig.SSO.rtlSSO) {
const errMsg = 'Password cannot be reset for SSO authentication';
const err = common.handleError({ statusCode: 401, message: 'Password Reset Error', error: errMsg }, 'Authenticate', errMsg, req.session.selectedNode);
return res.status(err.statusCode).json({ message: err.message, error: err.error });
Expand Down
2 changes: 1 addition & 1 deletion server/models/config.model.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export class SSO {

constructor(
public rtlSso?: number,
public rtlSSO?: number,
public rtlCookiePath?: string,
public logoutRedirectLink?: string,
public cookieValue?: string
Expand Down
4 changes: 2 additions & 2 deletions server/utils/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class CommonService {
public logger: LoggerService = Logger;
public nodes: SelectedNode[] = [];
public selectedNode: SelectedNode = null;
public ssoInit = { rtlSso: 0, rtlCookiePath: '', logoutRedirectLink: '', cookieValue: '' };
public ssoInit = { rtlSSO: 0, rtlCookiePath: '', logoutRedirectLink: '', cookieValue: '' };
public appConfig: ApplicationConfig = { defaultNodeIndex: 0, selectedNodeIndex: 0, rtlConfFilePath: '', dbDirectoryPath: join(dirname(fileURLToPath(import.meta.url)), '..', '..'), rtlPass: '', allowPasswordUpdate: true, enable2FA: false, secret2FA: '', SSO: this.ssoInit, nodes: [] };
public port = 3000;
public host = '';
Expand Down Expand Up @@ -542,7 +542,7 @@ export class CommonService {
const selNode = <SelectedNode>req.session.selectedNode;
if (selNode && selNode.index) {
this.logger.log({ selectedNode: selNode, level: 'INFO', fileName: 'Config Setup:', msg: JSON.stringify(this.removeSecureData(JSON.parse(JSON.stringify(this.appConfig)))) });
this.logger.log({ selectedNode: selNode, level: 'INFO', fileName: 'Config Setup Variable', msg: 'SSO: ' + this.appConfig.SSO.rtlSso });
this.logger.log({ selectedNode: selNode, level: 'INFO', fileName: 'Config Setup Variable', msg: 'SSO: ' + this.appConfig.SSO.rtlSSO });
}
};

Expand Down
Loading
Loading