chore: restart the repository with a clean history
CI / Docker image (push) Successful in 12s
CI / Server (push) Successful in 25s
CI / CLI (push) Successful in 13s
Development image / Development image (push) Successful in 21s
CI / CLI (windows) (push) Successful in 57s
CI / CLI (linux-arm64, static) (push) Successful in 1m37s
Release / Prepare release (push) Successful in 2s
Release / Server (linux-x64) (push) Successful in 53s
Release / CLI (linux-arm64, static) (push) Successful in 1m32s
Release / Docker image (push) Successful in 2m48s
Release / Server (windows-x64) (push) Successful in 6m20s
Release / CLI (windows-x64) (push) Successful in 6m48s
Release / CLI (linux-x64) (push) Successful in 7m8s
Release / Publish release (push) Successful in 1s

Squash the tree into one commit, drop docs/architecture.html, reset the version line to 0.3.0, consolidate the changelog, enable Renovate automerge for non-major updates and add AGENTS.md.
This commit is contained in:
fristy committed 2026-11-10 11:31:13 +03:00
commit 650807c1fb
438 files changed
+45070

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
const accounts = require("../lib/accounts");
const totp = require("../lib/totp");
const logger = require("../utils/logger");
module.exports.login = async (sessions, { username, password, code }, meta) => {
if (!await accounts.count()) return { code: 409, message: "The server has not been set up yet" };
const account = await accounts.checkCredentials({ username, password });
if (!account) return { code: 401, message: "Username or password incorrect" };
if (account.totpEnabled) {
if (!code) return { code: 202, message: "This account asks for a code from your authenticator" };
if (!totp.verify(account.totpSecret, code)) return { code: 401, message: "That code is not right or has expired" };
}
const token = await sessions.create(account.id, meta);
logger.info(`${account.username} logged in`, { ip: meta.ip });
return { token, username: account.username, role: account.role };
};
module.exports.accountFromCredentials = credentials => accounts.checkCredentials(credentials);
module.exports.checkAccountCredentials = async credentials => {
const account = await accounts.checkCredentials(credentials);
return !!account && !account.totpEnabled;
};
module.exports.logout = (sessions, token) => sessions.remove(token);
module.exports.currentUser = session => ({
id: session.account.id,
username: session.username,
role: session.role,
totpEnabled: !!session.account.totpEnabled,
createdAt: session.createdAt,
});