|
|
@ -3,6 +3,7 @@ const { R } = require("redbean-node");
|
|
|
|
const { setSetting, setting } = require("./util-server");
|
|
|
|
const { setSetting, setting } = require("./util-server");
|
|
|
|
const { log, sleep } = require("../src/util");
|
|
|
|
const { log, sleep } = require("../src/util");
|
|
|
|
const knex = require("knex");
|
|
|
|
const knex = require("knex");
|
|
|
|
|
|
|
|
const path = require("path");
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Database & App Data Folder
|
|
|
|
* Database & App Data Folder
|
|
|
@ -94,19 +95,19 @@ class Database {
|
|
|
|
// Data Directory (must be end with "/")
|
|
|
|
// Data Directory (must be end with "/")
|
|
|
|
Database.dataDir = process.env.DATA_DIR || args["data-dir"] || "./data/";
|
|
|
|
Database.dataDir = process.env.DATA_DIR || args["data-dir"] || "./data/";
|
|
|
|
|
|
|
|
|
|
|
|
Database.path = Database.dataDir + "kuma.db";
|
|
|
|
Database.path = path.join(Database.dataDir, "kuma.db");
|
|
|
|
if (! fs.existsSync(Database.dataDir)) {
|
|
|
|
if (! fs.existsSync(Database.dataDir)) {
|
|
|
|
fs.mkdirSync(Database.dataDir, { recursive: true });
|
|
|
|
fs.mkdirSync(Database.dataDir, { recursive: true });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Database.uploadDir = Database.dataDir + "upload/";
|
|
|
|
Database.uploadDir = path.join(Database.dataDir, "upload/");
|
|
|
|
|
|
|
|
|
|
|
|
if (! fs.existsSync(Database.uploadDir)) {
|
|
|
|
if (! fs.existsSync(Database.uploadDir)) {
|
|
|
|
fs.mkdirSync(Database.uploadDir, { recursive: true });
|
|
|
|
fs.mkdirSync(Database.uploadDir, { recursive: true });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Create screenshot dir
|
|
|
|
// Create screenshot dir
|
|
|
|
Database.screenshotDir = Database.dataDir + "screenshots/";
|
|
|
|
Database.screenshotDir = path.join(Database.dataDir, "screenshots/");
|
|
|
|
if (! fs.existsSync(Database.screenshotDir)) {
|
|
|
|
if (! fs.existsSync(Database.screenshotDir)) {
|
|
|
|
fs.mkdirSync(Database.screenshotDir, { recursive: true });
|
|
|
|
fs.mkdirSync(Database.screenshotDir, { recursive: true });
|
|
|
|
}
|
|
|
|
}
|
|
|
|