fix(geplante-nachrichten): read bot credentials from tool_config_nextcloud, add manual trigger endpoint
This commit is contained in:
@@ -2,7 +2,6 @@ import pool from '../config/database';
|
|||||||
import settingsService from './settings.service';
|
import settingsService from './settings.service';
|
||||||
import nextcloudService from './nextcloud.service';
|
import nextcloudService from './nextcloud.service';
|
||||||
import logger from '../utils/logger';
|
import logger from '../utils/logger';
|
||||||
|
|
||||||
// ── Types ────────────────────────────────────────────────────────────────────
|
// ── Types ────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
interface ScheduledMessageRule {
|
interface ScheduledMessageRule {
|
||||||
@@ -43,10 +42,11 @@ interface RoomsResult {
|
|||||||
// ── Helpers ──────────────────────────────────────────────────────────────────
|
// ── Helpers ──────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
async function getBotCredentials(): Promise<{ username: string; appPassword: string } | null> {
|
async function getBotCredentials(): Promise<{ username: string; appPassword: string } | null> {
|
||||||
const usernameRow = await settingsService.get('nextcloud_bot_username');
|
const setting = await settingsService.get('tool_config_nextcloud');
|
||||||
const appPasswordRow = await settingsService.get('nextcloud_bot_app_password');
|
if (!setting?.value || typeof setting.value !== 'object') return null;
|
||||||
const username = typeof usernameRow?.value === 'string' ? usernameRow.value : null;
|
const cfg = setting.value as Record<string, unknown>;
|
||||||
const appPassword = typeof appPasswordRow?.value === 'string' ? appPasswordRow.value : null;
|
const username = typeof cfg.bot_username === 'string' ? cfg.bot_username : null;
|
||||||
|
const appPassword = typeof cfg.bot_app_password === 'string' ? cfg.bot_app_password : null;
|
||||||
if (!username || !appPassword) return null;
|
if (!username || !appPassword) return null;
|
||||||
return { username, appPassword };
|
return { username, appPassword };
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user