Feat : Control streamer
This commit is contained in:
@@ -45,6 +45,10 @@ export const AGENT_ACTIONS = [
|
||||
'recordDirectory.set',
|
||||
'watch.check',
|
||||
'hotkey.fullscreen',
|
||||
'browser.open',
|
||||
'browser.close',
|
||||
'capture.start',
|
||||
'capture.stop',
|
||||
'agent.update',
|
||||
'agent.ping',
|
||||
] as const;
|
||||
@@ -106,6 +110,54 @@ export interface WatchSettings {
|
||||
fullscreen: FullscreenSettings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pilotage du navigateur de la VM.
|
||||
*
|
||||
* On lance le navigateur déjà installé, avec son profil et sa session : c'est ce
|
||||
* qui donne accès au flux comme si l'opérateur l'ouvrait lui-même. Aucune
|
||||
* instance dédiée, aucun profil de test.
|
||||
*/
|
||||
export interface BrowserSettings {
|
||||
enabled: boolean;
|
||||
/** Exécutable du navigateur. */
|
||||
command: string;
|
||||
/** Arguments placés avant l'URL. */
|
||||
args: string[];
|
||||
/** Délai avant l'envoi du plein écran, le temps que le lecteur démarre. */
|
||||
readyDelayMs: number;
|
||||
/** Fermer la fenêtre quand l'enregistrement s'arrête. */
|
||||
closeOnStop: boolean;
|
||||
}
|
||||
|
||||
export const DEFAULT_BROWSER_SETTINGS: BrowserSettings = {
|
||||
enabled: false,
|
||||
command: 'firefox',
|
||||
args: ['--new-window'],
|
||||
readyDelayMs: 8000,
|
||||
closeOnStop: true,
|
||||
};
|
||||
|
||||
export function normalizeBrowserSettings(raw: unknown): BrowserSettings {
|
||||
const input = (raw ?? {}) as Partial<BrowserSettings>;
|
||||
const base = DEFAULT_BROWSER_SETTINGS;
|
||||
const delay = Number(input.readyDelayMs);
|
||||
|
||||
return {
|
||||
enabled: input.enabled === true,
|
||||
command:
|
||||
typeof input.command === 'string' && input.command.trim()
|
||||
? input.command.trim()
|
||||
: base.command,
|
||||
args: Array.isArray(input.args)
|
||||
? input.args.filter((arg): arg is string => typeof arg === 'string' && arg.trim() !== '')
|
||||
: base.args,
|
||||
readyDelayMs: Number.isFinite(delay)
|
||||
? Math.min(Math.max(Math.round(delay), 0), 120_000)
|
||||
: base.readyDelayMs,
|
||||
closeOnStop: input.closeOnStop !== false,
|
||||
};
|
||||
}
|
||||
|
||||
export const DEFAULT_WATCH_SETTINGS: WatchSettings = {
|
||||
enabled: false,
|
||||
provider: 'stripchat',
|
||||
@@ -288,6 +340,7 @@ export interface WelcomeMessage {
|
||||
/** Si vrai, l'agent tente de se connecter à OBS dès le démarrage. */
|
||||
autoConnectObs: boolean;
|
||||
watch: WatchSettings;
|
||||
browser: BrowserSettings;
|
||||
}
|
||||
|
||||
export interface CommandMessage {
|
||||
@@ -302,6 +355,7 @@ export interface ConfigMessage {
|
||||
obs: ObsSettings;
|
||||
autoConnectObs: boolean;
|
||||
watch: WatchSettings;
|
||||
browser: BrowserSettings;
|
||||
}
|
||||
|
||||
export interface PingMessage {
|
||||
@@ -327,6 +381,7 @@ export interface AgentView {
|
||||
obs: ObsSettings;
|
||||
autoConnectObs: boolean;
|
||||
watch: WatchSettings;
|
||||
browser: BrowserSettings;
|
||||
notes: string | null;
|
||||
status: AgentStatus;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user