Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
Removed unused files/code/imports/comments.
chesspro139dd185e37e10
diff --git a/src/routes/api/totp.ts b/src/routes/api/totp.tsindex bfe1ce746c..6435b796b4 100644--- a/src/routes/api/totp.ts+++ b/src/routes/api/totp.ts@@ -1,4 +1,3 @@-import options from '../../services/options.js';import {generateSecret} from 'time2fa';function generateTOTPSecret() {@@ -17,26 +16,10 @@ function getTotpEnabled() {}function getTOTPStatus() {- // const totpEnabled = options.getOptionBool('totpEnabled');const totpEnabled = getTotpEnabled();return {success: true, message: totpEnabled, enabled: getTotpEnabled()};}-function enableTOTP() {- if (!getTotpEnabled()) {- return {success: 'false'};- }-- options.setOption('totpEnabled', true);- options.setOption('oAuthEnabled', false);- return {success: 'true'};-}--function disableTOTP() {- options.setOption('totpEnabled', false);- return {success: true};-}-function getSecret() {return process.env.TOTP_SECRET;}@@ -44,7 +27,5 @@ function getSecret() {export default {generateSecret: generateTOTPSecret,getTOTPStatus,- enableTOTP,- disableTOTP,getSecret};\ No newline at end of filediff --git a/src/routes/routes.ts b/src/routes/routes.tsindex d6f2024eac..e6d86a2a84 100644--- a/src/routes/routes.ts+++ b/src/routes/routes.ts@@ -124,8 +124,6 @@ function register(app: express.Application) {apiRoute(GET, '/api/totp/generate', totp.generateSecret);apiRoute(GET, '/api/totp/status', totp.getTOTPStatus);- apiRoute(PST, '/api/totp/enable', totp.enableTOTP);- apiRoute(PST, '/api/totp/disable', totp.disableTOTP);apiRoute(GET, '/api/totp/get', totp.getSecret);apiRoute(GET, '/api/oauth/status', openID.getOAuthStatus);diff --git a/src/services/auth.ts b/src/services/auth.tsindex 5d9de249c4..5bca6ef558 100644--- a/src/services/auth.ts+++ b/src/services/auth.ts@@ -10,7 +10,6 @@ import passwordService from "./encryption/password.js";import type { NextFunction, Request, Response } from 'express';import { AppRequest } from '../routes/route-interface.js';import openID from './open_id.js';-import sql from './sql.js';import open_id_encryption from './encryption/open_id_encryption.js';const noAuthentication = config.General && config.General.noAuthentication === true;diff --git a/src/services/encryption/my_scrypt.ts b/src/services/encryption/my_scrypt.tsindex 7c26ce05b2..589da6eedb 100644--- a/src/services/encryption/my_scrypt.ts+++ b/src/services/encryption/my_scrypt.ts@@ -2,7 +2,6 @@import optionService from "../options.js";import crypto from "crypto";-import utils from "../utils.js";import sql from "../sql.js";function getVerificationHash(password: crypto.BinaryLike) {@@ -56,11 +55,6 @@ function createSubjectIdentifierDerivedKey(subjectIdentifer: string | crypto.BinaryLike,salt: string | crypto.BinaryLike) {- // const salt = optionService.getOption("subjectIdentifierDerivedKeySalt");-- // const salt = sql.getValue("SELECT salt FROM user_data");- // if (salt === undefined || salt === null) return undefined;-return getScryptHash(subjectIdentifer, salt);}diff --git a/src/services/environment_variable_loader.ts b/src/services/environment_variable_loader.tsdeleted file mode 100644index 0655339d18..0000000000--- a/src/services/environment_variable_loader.ts+++ /dev/null@@ -1,19 +0,0 @@-import options from '../services/options.js';--function loadEnvironmentVariables(){- if (process.env.TOTP_ENABLED === undefined) {- options.setOption("totpEnabled", false);- return false;- }-- if (process.env.TOTP_ENABLED.toLocaleLowerCase() !== 'true') {- options.setOption("totpEnabled", false);- return false;- }-- options.setOption("totpEnabled", true);-}--export default {- loadEnvironmentVariables-}\ No newline at end of filediff --git a/src/services/open_id.ts b/src/services/open_id.tsindex c431b6c2d0..fb17744c91 100644--- a/src/services/open_id.ts+++ b/src/services/open_id.ts@@ -115,7 +115,6 @@ function generateOAuthConfig() {};const logoutParams = {- // end_session_endpoint: "/end-session/",};const authConfig = {