mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-10-25 08:51:35 +08:00
Removed unused files/code/imports/comments.
This commit is contained in:
parent
13937a2568
commit
9dd185e37e
@ -1,4 +1,3 @@
|
|||||||
import options from '../../services/options.js';
|
|
||||||
import {generateSecret} from 'time2fa';
|
import {generateSecret} from 'time2fa';
|
||||||
|
|
||||||
function generateTOTPSecret() {
|
function generateTOTPSecret() {
|
||||||
@ -17,26 +16,10 @@ function getTotpEnabled() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getTOTPStatus() {
|
function getTOTPStatus() {
|
||||||
// const totpEnabled = options.getOptionBool('totpEnabled');
|
|
||||||
const totpEnabled = getTotpEnabled();
|
const totpEnabled = getTotpEnabled();
|
||||||
return {success: true, message: totpEnabled, enabled: 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() {
|
function getSecret() {
|
||||||
return process.env.TOTP_SECRET;
|
return process.env.TOTP_SECRET;
|
||||||
}
|
}
|
||||||
@ -44,7 +27,5 @@ function getSecret() {
|
|||||||
export default {
|
export default {
|
||||||
generateSecret: generateTOTPSecret,
|
generateSecret: generateTOTPSecret,
|
||||||
getTOTPStatus,
|
getTOTPStatus,
|
||||||
enableTOTP,
|
|
||||||
disableTOTP,
|
|
||||||
getSecret
|
getSecret
|
||||||
};
|
};
|
||||||
@ -124,8 +124,6 @@ function register(app: express.Application) {
|
|||||||
|
|
||||||
apiRoute(GET, '/api/totp/generate', totp.generateSecret);
|
apiRoute(GET, '/api/totp/generate', totp.generateSecret);
|
||||||
apiRoute(GET, '/api/totp/status', totp.getTOTPStatus);
|
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/totp/get', totp.getSecret);
|
||||||
|
|
||||||
apiRoute(GET, '/api/oauth/status', openID.getOAuthStatus);
|
apiRoute(GET, '/api/oauth/status', openID.getOAuthStatus);
|
||||||
|
|||||||
@ -10,7 +10,6 @@ import passwordService from "./encryption/password.js";
|
|||||||
import type { NextFunction, Request, Response } from 'express';
|
import type { NextFunction, Request, Response } from 'express';
|
||||||
import { AppRequest } from '../routes/route-interface.js';
|
import { AppRequest } from '../routes/route-interface.js';
|
||||||
import openID from './open_id.js';
|
import openID from './open_id.js';
|
||||||
import sql from './sql.js';
|
|
||||||
import open_id_encryption from './encryption/open_id_encryption.js';
|
import open_id_encryption from './encryption/open_id_encryption.js';
|
||||||
|
|
||||||
const noAuthentication = config.General && config.General.noAuthentication === true;
|
const noAuthentication = config.General && config.General.noAuthentication === true;
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
import optionService from "../options.js";
|
import optionService from "../options.js";
|
||||||
import crypto from "crypto";
|
import crypto from "crypto";
|
||||||
import utils from "../utils.js";
|
|
||||||
import sql from "../sql.js";
|
import sql from "../sql.js";
|
||||||
|
|
||||||
function getVerificationHash(password: crypto.BinaryLike) {
|
function getVerificationHash(password: crypto.BinaryLike) {
|
||||||
@ -56,11 +55,6 @@ function createSubjectIdentifierDerivedKey(
|
|||||||
subjectIdentifer: string | crypto.BinaryLike,
|
subjectIdentifer: string | crypto.BinaryLike,
|
||||||
salt: 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);
|
return getScryptHash(subjectIdentifer, salt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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
|
|
||||||
}
|
|
||||||
@ -115,7 +115,6 @@ function generateOAuthConfig() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const logoutParams = {
|
const logoutParams = {
|
||||||
// end_session_endpoint: "/end-session/",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const authConfig = {
|
const authConfig = {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user