preliminary work for guest account support
This commit is contained in:
parent
b6779a7d7c
commit
bbc655b3f9
11 changed files with 132 additions and 50 deletions
14
app/db.ts
14
app/db.ts
|
@ -1,13 +1,11 @@
|
|||
import type {RequestHandler as Middleware} from 'express';
|
||||
|
||||
const sqlite3 = require("sqlite3");
|
||||
const mkdirp = require("mkdirp");
|
||||
const crypto = require("crypto");
|
||||
import sqlite3 from "sqlite3";
|
||||
import mkdirp from "mkdirp";
|
||||
import crypto from "crypto";
|
||||
|
||||
mkdirp.sync("./uploads");
|
||||
mkdirp.sync("./var/db");
|
||||
|
||||
let db = new sqlite3.Database("./var/db/media.db");
|
||||
export const db = new sqlite3.Database("./var/db/media.db");
|
||||
|
||||
export function createUser(username: string, password: string) {
|
||||
var salt = crypto.randomBytes(16);
|
||||
|
@ -16,6 +14,4 @@ export function createUser(username: string, password: string) {
|
|||
crypto.pbkdf2Sync(password, salt, 310000, 32, "sha256"),
|
||||
salt
|
||||
]);
|
||||
}
|
||||
|
||||
export default db;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue