Adding option for allowing users to define the Application visible name

This commit is contained in:
Rafael Foster
2026-04-26 19:32:19 -03:00
parent b0c1b8b6f9
commit 3c5a8c7eb3
2 changed files with 113 additions and 2 deletions
+9 -1
View File
@@ -39,6 +39,7 @@ const logOikos = createLogger('Oikos');
const { version: APP_VERSION } = JSON.parse(
readFileSync(new URL('../package.json', import.meta.url), 'utf-8')
);
const DEFAULT_APP_NAME = 'Oikos';
const app = express();
const PORT = process.env.PORT || 3000;
@@ -165,7 +166,14 @@ app.use('/api/v1/auth', authRouter);
// Versionsinformation - keine Authentifizierung erforderlich (Login-Seite benötigt diese)
app.get('/api/v1/version', (req, res) => {
res.json({ version: APP_VERSION });
let appName = DEFAULT_APP_NAME;
try {
const row = db.get().prepare('SELECT value FROM sync_config WHERE key = ?').get('app_name');
if (row?.value) appName = row.value;
} catch {
// fall back to default
}
res.json({ version: APP_VERSION, app_name: appName });
});
function sendOpenApi(req, res) {