Feat : OBS presets
Some checks failed
release / build (push) Successful in 26s
release / verify-windows (push) Failing after 1m0s

This commit is contained in:
jeanotx32
2026-08-11 22:24:45 +02:00
parent 3b614c5d05
commit 03b1963150
11 changed files with 710 additions and 8 deletions

View File

@@ -6,6 +6,7 @@ import type {
LogLevel,
ObsSettings,
Platform,
RecordingSettings,
StreamState,
BrowserSettings,
WatchSettings,
@@ -14,8 +15,10 @@ import type {
import {
DEFAULT_BROWSER_SETTINGS,
DEFAULT_OBS_SETTINGS,
DEFAULT_RECORDING_SETTINGS,
DEFAULT_WATCH_SETTINGS,
normalizeBrowserSettings,
normalizeRecordingSettings,
normalizeWatchSettings,
safeJsonParse,
stripchatProfileUrl,
@@ -90,6 +93,9 @@ function addColumnIfMissing(table: string, column: string, definition: string):
// que la table (nouveaux fournisseurs, nouveaux statuts).
addColumnIfMissing('agents', 'watch_json', 'TEXT');
addColumnIfMissing('agents', 'browser_json', 'TEXT');
// Preset d'enregistrement : réglable VM par VM, absent = aucune intervention
// de l'agent sur les réglages d'OBS.
addColumnIfMissing('agents', 'recording_json', 'TEXT');
// Enrichissement des profils surveillés : photo et historique de diffusion.
addColumnIfMissing('watch_targets', 'avatar_url', 'TEXT');
@@ -110,6 +116,7 @@ export interface AgentRow {
auto_connect: number;
watch_json: string | null;
browser_json: string | null;
recording_json: string | null;
notes: string | null;
created_at: number;
last_seen_at: number | null;
@@ -126,6 +133,7 @@ export interface AgentRecord {
autoConnectObs: boolean;
watch: WatchSettings;
browser: BrowserSettings;
recording: RecordingSettings;
notes: string | null;
createdAt: number;
lastSeenAt: number | null;
@@ -151,6 +159,11 @@ function toRecord(row: AgentRow): AgentRecord {
browser: normalizeBrowserSettings(
row.browser_json ? safeJsonParse<BrowserSettings>(row.browser_json) : DEFAULT_BROWSER_SETTINGS,
),
recording: normalizeRecordingSettings(
row.recording_json
? safeJsonParse<RecordingSettings>(row.recording_json)
: DEFAULT_RECORDING_SETTINGS,
),
notes: row.notes,
createdAt: Number(row.created_at),
lastSeenAt: row.last_seen_at === null ? null : Number(row.last_seen_at),
@@ -164,8 +177,8 @@ const stmts = {
insertAgent: db.prepare(`
INSERT INTO agents (id, name, hostname, platform, agent_version, token_hash,
obs_host, obs_port, obs_password, auto_connect, watch_json,
browser_json, notes, created_at)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
browser_json, recording_json, notes, created_at)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
`),
updateIdentity: db.prepare(`
UPDATE agents SET hostname = ?, platform = ?, agent_version = ?, last_seen_at = ?
@@ -173,7 +186,8 @@ const stmts = {
`),
updateSettings: db.prepare(`
UPDATE agents SET name = ?, obs_host = ?, obs_port = ?, obs_password = ?,
auto_connect = ?, watch_json = ?, browser_json = ?, notes = ?
auto_connect = ?, watch_json = ?, browser_json = ?,
recording_json = ?, notes = ?
WHERE id = ?
`),
touchAgent: db.prepare('UPDATE agents SET last_seen_at = ? WHERE id = ?'),
@@ -217,6 +231,7 @@ export const agentsRepo = {
autoConnectObs?: boolean;
watch?: WatchSettings;
browser?: BrowserSettings;
recording?: RecordingSettings;
notes?: string | null;
}): AgentRecord {
const obs = { ...DEFAULT_OBS_SETTINGS, ...input.obs };
@@ -233,6 +248,7 @@ export const agentsRepo = {
input.autoConnectObs === false ? 0 : 1,
JSON.stringify(normalizeWatchSettings(input.watch ?? DEFAULT_WATCH_SETTINGS)),
JSON.stringify(normalizeBrowserSettings(input.browser ?? DEFAULT_BROWSER_SETTINGS)),
JSON.stringify(normalizeRecordingSettings(input.recording ?? DEFAULT_RECORDING_SETTINGS)),
input.notes ?? null,
Date.now(),
);
@@ -262,6 +278,7 @@ export const agentsRepo = {
autoConnectObs: boolean;
watch: WatchSettings;
browser: BrowserSettings;
recording: RecordingSettings;
notes: string | null;
},
): void {
@@ -273,6 +290,7 @@ export const agentsRepo = {
settings.autoConnectObs ? 1 : 0,
JSON.stringify(normalizeWatchSettings(settings.watch)),
JSON.stringify(normalizeBrowserSettings(settings.browser)),
JSON.stringify(normalizeRecordingSettings(settings.recording)),
settings.notes,
id,
);