mirror of
https://github.com/louislam/dockge.git
synced 2026-05-23 06:52:17 +00:00
Compare commits
2 Commits
reset-pass
...
arm-runner
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad00e8badf | ||
|
|
771bcd5b3e |
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@@ -14,8 +14,8 @@ jobs:
|
|||||||
ci:
|
ci:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: [ubuntu-latest, windows-latest, macos-latest, ARM64]
|
||||||
node: [20.x] # Can be changed
|
node: [18.17.1] # Can be changed
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
|
|||||||
@@ -150,6 +150,9 @@ export class DockgeServer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create all the necessary directories
|
||||||
|
this.initDataDir();
|
||||||
|
|
||||||
// Create express
|
// Create express
|
||||||
this.app = express();
|
this.app = express();
|
||||||
|
|
||||||
@@ -252,9 +255,6 @@ export class DockgeServer {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
async serve() {
|
async serve() {
|
||||||
// Create all the necessary directories
|
|
||||||
this.initDataDir();
|
|
||||||
|
|
||||||
// Connect to database
|
// Connect to database
|
||||||
try {
|
try {
|
||||||
await Database.init(this);
|
await Database.init(this);
|
||||||
|
|||||||
@@ -1,84 +0,0 @@
|
|||||||
import { Database } from "../backend/database";
|
|
||||||
import { R } from "redbean-node";
|
|
||||||
import readline from "readline";
|
|
||||||
import { User } from "../backend/models/user";
|
|
||||||
import { DockgeServer } from "../backend/dockge-server";
|
|
||||||
import { log } from "../backend/log";
|
|
||||||
|
|
||||||
console.log("== Dockge Reset Password Tool ==");
|
|
||||||
|
|
||||||
const rl = readline.createInterface({
|
|
||||||
input: process.stdin,
|
|
||||||
output: process.stdout
|
|
||||||
});
|
|
||||||
|
|
||||||
export const main = async () => {
|
|
||||||
const server = new DockgeServer();
|
|
||||||
|
|
||||||
// Check if
|
|
||||||
|
|
||||||
console.log("Connecting the database");
|
|
||||||
try {
|
|
||||||
await Database.init(server);
|
|
||||||
} catch (e) {
|
|
||||||
if (e instanceof Error) {
|
|
||||||
log.error("server", "Failed to connect to your database: " + e.message);
|
|
||||||
}
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
// No need to actually reset the password for testing, just make sure no connection problem. It is ok for now.
|
|
||||||
if (!process.env.TEST_BACKEND) {
|
|
||||||
const user = await R.findOne("user");
|
|
||||||
if (! user) {
|
|
||||||
throw new Error("user not found, have you installed?");
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("Found user: " + user.username);
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
let password = await question("New Password: ");
|
|
||||||
let confirmPassword = await question("Confirm New Password: ");
|
|
||||||
|
|
||||||
if (password === confirmPassword) {
|
|
||||||
await User.resetPassword(user.id, password);
|
|
||||||
|
|
||||||
// Reset all sessions by reset jwt secret
|
|
||||||
await server.initJWTSecret();
|
|
||||||
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
console.log("Passwords do not match, please try again.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
console.log("Password reset successfully.");
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
if (e instanceof Error) {
|
|
||||||
console.error("Error: " + e.message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
await Database.close();
|
|
||||||
rl.close();
|
|
||||||
|
|
||||||
console.log("Finished.");
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Ask question of user
|
|
||||||
* @param question Question to ask
|
|
||||||
* @returns Users response
|
|
||||||
*/
|
|
||||||
function question(question : string) : Promise<string> {
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
rl.question(question, (answer) => {
|
|
||||||
resolve(answer);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!process.env.TEST_BACKEND) {
|
|
||||||
main();
|
|
||||||
}
|
|
||||||
@@ -19,8 +19,7 @@
|
|||||||
"build:docker-nightly": "pnpm run build:frontend && docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/dockge:nightly --target nightly -f ./docker/Dockerfile . --push",
|
"build:docker-nightly": "pnpm run build:frontend && docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/dockge:nightly --target nightly -f ./docker/Dockerfile . --push",
|
||||||
"start-docker": "docker run --rm -p 5001:5001 --name dockge louislam/dockge:latest",
|
"start-docker": "docker run --rm -p 5001:5001 --name dockge louislam/dockge:latest",
|
||||||
"mark-as-nightly": "tsx ./extra/mark-as-nightly.ts",
|
"mark-as-nightly": "tsx ./extra/mark-as-nightly.ts",
|
||||||
"reformat-changelog": "tsx ./extra/reformat-changelog.ts",
|
"reformat-changelog": "tsx ./extra/reformat-changelog.ts"
|
||||||
"reset-password": "tsx ./extra/reset-password.ts"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@homebridge/node-pty-prebuilt-multiarch": "~0.11.11",
|
"@homebridge/node-pty-prebuilt-multiarch": "~0.11.11",
|
||||||
|
|||||||
Reference in New Issue
Block a user