fix sharex

This commit is contained in:
waveringana 2022-12-07 16:30:39 +00:00
parent 5290f4e960
commit 52b1aeea98
12 changed files with 80 additions and 49 deletions

View file

@ -1,31 +0,0 @@
import sqlite3 from "sqlite3";
import mkdirp from "mkdirp";
import crypto from "crypto";
mkdirp.sync("./uploads");
mkdirp.sync("./var/db");
export const db = new sqlite3.Database("./var/db/media.db");
export function createUser(username: string, password: string) {
var salt = crypto.randomBytes(16);
db.run("INSERT OR IGNORE INTO users (username, hashed_password, salt) VALUES (?, ?, ?)", [
username,
crypto.pbkdf2Sync(password, salt, 310000, 32, "sha256"),
salt
]);
}
export interface MediaRow {
id? : Number,
path: String,
expire: Number,
username: String
}
export interface UserRow {
id? : Number,
username: String,
hashed_password: any,
salt: any
}