mirror of
https://github.com/jorisbertomeu/web-screensaver.git
synced 2026-04-19 16:27:40 +02:00
Fixes relative to fresh instance
This commit is contained in:
@@ -14,10 +14,14 @@ export class AdminController {
|
||||
|
||||
async updateSettings(req, res, next) {
|
||||
try {
|
||||
if (req.params.hasOwnProperty('id'))
|
||||
if (req.params.id) {
|
||||
console.log('Update', req.params.id);
|
||||
await this.db.update('settings', req.params.id, req.body);
|
||||
else
|
||||
}
|
||||
else {
|
||||
console.log('Create')
|
||||
await this.db.add('settings', req.body);
|
||||
}
|
||||
res.json(req.body);
|
||||
} catch(e) {
|
||||
next(e);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import fs from 'fs';
|
||||
import { generateRandomID } from '../utils/helper.js';
|
||||
|
||||
export class DatabaseService {
|
||||
constructor(dbPath) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import crypto from 'crypto';
|
||||
|
||||
export const generateRandomID = (length = DEFAULT_ID_LENGTH) => {
|
||||
export const generateRandomID = (length = 32) => {
|
||||
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
return Array.from(
|
||||
{ length },
|
||||
|
||||
Reference in New Issue
Block a user