diff --git a/back/index.d.ts b/back/index.d.ts new file mode 100644 index 00000000..8fba99c8 --- /dev/null +++ b/back/index.d.ts @@ -0,0 +1,5 @@ +declare namespace Express { + interface Request { + platform: 'desktop' | 'mobile'; + } +} diff --git a/back/loaders/express.ts b/back/loaders/express.ts index bd34d83c..b04daeb9 100644 --- a/back/loaders/express.ts +++ b/back/loaders/express.ts @@ -80,11 +80,7 @@ export default ({ app }: { app: Application }) => { const data = fs.readFileSync(config.authConfigFile, 'utf8'); if (data) { const { token = '', tokens = {} } = JSON.parse(data); - console.log(tokens); - console.log(req.platform); - console.log(tokens[req.platform]); if (headerToken === token || tokens[req.platform] === headerToken) { - console.log('yes'); return next(); } } diff --git a/back/services/auth.ts b/back/services/auth.ts index 04a910b2..d8805e2c 100644 --- a/back/services/auth.ts +++ b/back/services/auth.ts @@ -6,11 +6,11 @@ import * as fs from 'fs'; import _ from 'lodash'; import jwt from 'jsonwebtoken'; import { authenticator } from '@otplib/preset-default'; -import { exec } from 'child_process'; import DataStore from 'nedb'; import { AuthDataType, AuthInfo, LoginStatus } from '../data/auth'; import { NotificationInfo } from '../data/notify'; import NotificationService from './notify'; +import { Request } from 'express'; @Service() export default class AuthService { diff --git a/typings.d.ts b/typings.d.ts index e1244ee2..06c8a5b8 100644 --- a/typings.d.ts +++ b/typings.d.ts @@ -8,9 +8,3 @@ declare module '*.svg' { const url: string; export default url; } - -declare namespace Express { - export interface Request { - platform: 'desktop' | 'mobile'; - } -}