build everything inside dockerfile/add some scripts

Signed-off-by: Zoey <zoey@z0ey.de>
This commit is contained in:
Zoey
2023-03-16 21:52:41 +01:00
parent 437144211a
commit 4af50b7ef5
10 changed files with 307 additions and 206 deletions

View File

@@ -1,38 +1,38 @@
{
"name": "nginx-proxy-manager",
"version": "0.0.0",
"description": "A beautiful interface for creating Nginx endpoints",
"main": "js/index.js",
"dependencies": {
"@apidevtools/json-schema-ref-parser": "10.1.0",
"ajv": "6.12.6",
"archiver": "5.3.1",
"batchflow": "0.4.0",
"bcrypt": "5.1.0",
"body-parser": "1.20.2",
"compression": "1.7.4",
"config": "3.3.9",
"express": "4.18.2",
"express-fileupload": "1.4.0",
"gravatar": "1.8.2",
"jsonwebtoken": "9.0.0",
"knex": "2.4.1",
"liquidjs": "9.43.0",
"lodash": "4.17.21",
"moment": "2.29.4",
"mysql": "2.18.1",
"node-rsa": "1.1.1",
"nodemon": "2.0.21",
"objection": "2.2.18",
"path": "0.12.7",
"signale": "1.4.0",
"sqlite3": "5.1.6",
"temp-write": "4.0.0"
},
"author": "Jamie Curnow <jc@jc21.com>",
"license": "MIT",
"devDependencies": {
"eslint": "8.36.0",
"eslint-plugin-align-assignments": "1.1.2"
}
"name": "nginx-proxy-manager",
"version": "0.0.0",
"description": "A beautiful interface for creating Nginx endpoints",
"main": "js/index.js",
"dependencies": {
"@apidevtools/json-schema-ref-parser": "10.1.0",
"ajv": "6.12.6",
"archiver": "5.3.1",
"batchflow": "0.4.0",
"bcrypt": "5.1.0",
"body-parser": "1.20.2",
"compression": "1.7.4",
"config": "3.3.9",
"express": "4.18.2",
"express-fileupload": "1.4.0",
"gravatar": "1.8.2",
"jsonwebtoken": "9.0.0",
"knex": "2.4.1",
"liquidjs": "9.43.0",
"lodash": "4.17.21",
"moment": "2.29.4",
"mysql": "2.18.1",
"node-rsa": "1.1.1",
"nodemon": "2.0.21",
"objection": "2.2.18",
"path": "0.12.7",
"signale": "1.4.0",
"sqlite3": "5.1.6",
"temp-write": "4.0.0"
},
"author": "Jamie Curnow <jc@jc21.com>",
"license": "MIT",
"devDependencies": {
"eslint": "8.36.0",
"eslint-plugin-align-assignments": "1.1.2"
}
}

59
backend/password-reset.js Normal file
View File

@@ -0,0 +1,59 @@
#!/usr/bin/node
// based on: https://github.com/jlesage/docker-nginx-proxy-manager/blob/796734a3f9a87e0b1561b47fd418f82216359634/rootfs/opt/nginx-proxy-manager/bin/reset-password
const fs = require('fs');
const bcrypt = require('bcrypt');
const sqlite3 = require('sqlite3');
function usage() {
console.log(`usage: node ${process.argv[1]} USER_EMAIL PASSWORD
Reset password of a Nginx Proxy Manager user.
Arguments:
USER_EMAIL Email address of the user to reset the password.
PASSWORD Optional new password of the user. If not set, password
is set to 'changeme'.
`);
process.exit(1);
}
const args = process.argv.slice(2);
const USER_EMAIL = args[0];
if (!USER_EMAIL) {
console.error('ERROR: User email address must be set.');
usage();
}
const PASSWORD = args[1];
if (!PASSWORD) {
console.error('ERROR: Password must be set.');
usage();
}
if (fs.existsSync(process.env.DB_SQLITE_FILE)) {
bcrypt.hash(PASSWORD, 13, (err, PASSWORD_HASH) => {
if (err) {
console.error(err);
process.exit(1);
}
const db = new sqlite3.Database(process.env.DB_SQLITE_FILE);
db.run(
`UPDATE auth SET secret = ? WHERE EXISTS
(SELECT * FROM user WHERE user.id = auth.user_id AND user.email = ?)`,
[PASSWORD_HASH, USER_EMAIL],
function (err) {
if (err) {
console.error(err);
process.exit(1);
}
console.log(`Password for user ${USER_EMAIL} has been reset.`);
process.exit(0);
}
);
});
}

22
backend/sqlite-vaccum.js Normal file
View File

@@ -0,0 +1,22 @@
#!/usr/bin/node
const fs = require('fs');
const sqlite3 = require('sqlite3');
if (fs.existsSync(process.env.DB_SQLITE_FILE)) {
const db = new sqlite3.Database(process.env.DB_SQLITE_FILE, sqlite3.OPEN_READWRITE, (err) => {
if (err) {
console.error(err.message);
} else {
db.run('VACUUM;', [], (err) => {
if (err) {
console.error(err.message);
}
db.close((err) => {
if (err) {
console.error(err.message);
}
});
});
}
});
}