mirror of
https://github.com/zadam/trilium.git
synced 2025-11-17 10:40:41 +01:00
Merge pull request #44 from TriliumNext/feature/typescript_backend_8
Convert backend to TypeScript (80% -> 81%)
This commit is contained in:
@@ -8,19 +8,10 @@ import passwordEncryptionService = require('./encryption/password_encryption');
|
||||
import config = require('./config');
|
||||
import passwordService = require('./encryption/password');
|
||||
import type { NextFunction, Request, Response } from 'express';
|
||||
import { AppRequest } from '../routes/route-interface';
|
||||
|
||||
const noAuthentication = config.General && config.General.noAuthentication === true;
|
||||
|
||||
interface AppRequest extends Request {
|
||||
headers: {
|
||||
authorization?: string;
|
||||
"trilium-cred"?: string;
|
||||
}
|
||||
session: {
|
||||
loggedIn: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
function checkAuth(req: AppRequest, res: Response, next: NextFunction) {
|
||||
if (!sqlInit.isDbInitialized()) {
|
||||
res.redirect("setup");
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
import { Request, Response } from "express";
|
||||
import AbstractBeccaEntity = require("../becca/entities/abstract_becca_entity");
|
||||
import BNote = require("../becca/entities/bnote");
|
||||
|
||||
export interface ApiParams {
|
||||
startNote?: BNote;
|
||||
originEntity?: AbstractBeccaEntity<any>;
|
||||
pathParams?: string[],
|
||||
req?: Request,
|
||||
res?: Response
|
||||
}
|
||||
@@ -28,7 +28,7 @@ interface OpmlOutline {
|
||||
outline: OpmlOutline[];
|
||||
}
|
||||
|
||||
async function importOpml(taskContext: TaskContext, fileBuffer: Buffer, parentNote: BNote) {
|
||||
async function importOpml(taskContext: TaskContext, fileBuffer: string | Buffer, parentNote: BNote) {
|
||||
const xml = await new Promise<OpmlXml>(function(resolve, reject)
|
||||
{
|
||||
parseString(fileBuffer, function (err: any, result: OpmlXml) {
|
||||
|
||||
@@ -7,7 +7,7 @@ import log = require('./log');
|
||||
|
||||
const sessionSecretPath = `${dataDir.TRILIUM_DATA_DIR}/session_secret.txt`;
|
||||
|
||||
let sessionSecret;
|
||||
let sessionSecret: string;
|
||||
|
||||
const ENCODING = "ascii";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user