Added licence notice to many files, other minor type fixes

This commit is contained in:
mrfry 2022-03-22 11:19:32 +01:00
parent d9175c1fc2
commit 75d93af246
22 changed files with 483 additions and 107 deletions

View file

@ -1,4 +1,24 @@
import type { Response, NextFunction } from 'express'
/* ----------------------------------------------------------------------------
Question Server
GitLab: <https://gitlab.com/MrFry/mrfrys-node-server>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
------------------------------------------------------------------------- */
import type { Response, NextFunction, RequestHandler } from 'express'
import type { Request } from '../types/basicTypes'
import type { Database } from 'better-sqlite3'
@ -7,7 +27,7 @@ import utils from '../utils/utils'
import dbtools from '../utils/dbtools'
interface Options {
userDB: any
userDB: Database
jsonResponse: boolean
exceptions: Array<string>
}
@ -36,7 +56,7 @@ function renderLogin(_req: Request, res: Response, jsonResponse: boolean) {
}
}
export default function (options: Options): any {
export default function (options: Options): RequestHandler {
const {
userDB,
jsonResponse,
@ -133,7 +153,7 @@ export default function (options: Options): any {
}
}
function GetUserBySessionID(db: any, sessionID: string) {
function GetUserBySessionID(db: Database, sessionID: string) {
logger.DebugLog(`Getting user from db`, 'auth', 2)
const session = dbtools.Select(db, 'sessions', {