Feat : open link on current firefox session
All checks were successful
release / build (push) Successful in 44s
release / verify-windows (push) Successful in 1m19s

This commit is contained in:
jeanotx32
2026-08-12 00:40:20 +02:00
parent 55bb55ae55
commit 6ad8429cf1
6 changed files with 176 additions and 22 deletions

View File

@@ -151,6 +151,49 @@ function migrateIdleStatus(): void {
migrateIdleStatus();
/**
* `--new-window` et la fermeture systématique de la fenêtre détruisaient à chaque
* capture la source « capture de fenêtre » d'OBS, qu'il fallait ensuite repointer
* à la main. Les agents configurés avant le correctif portent ces valeurs dans
* leur JSON.
*
* Même précaution qu'au-dessus : seules les configurations restées au défaut sont
* reprises, ce qui rend la migration idempotente et respecte les réglages
* personnalisés.
*/
function migrateBrowserWindowReuse(): void {
const rows = db
.prepare('SELECT id, browser_json FROM agents WHERE browser_json IS NOT NULL')
.all() as unknown as Array<{ id: string; browser_json: string }>;
const update = db.prepare('UPDATE agents SET browser_json = ? WHERE id = ?');
let migrated = 0;
for (const row of rows) {
const browser = safeJsonParse<BrowserSettings & { closeOnStop?: boolean }>(row.browser_json);
if (!browser) continue;
const atLegacyDefault =
Array.isArray(browser.args) &&
browser.args.length === 1 &&
browser.args[0] === '--new-window' &&
browser.closeOnStop === true &&
browser.onStop === undefined;
if (!atLegacyDefault) continue;
const { closeOnStop: _legacy, ...rest } = browser;
update.run(JSON.stringify({ ...rest, args: [], onStop: 'blank' }), row.id);
migrated += 1;
}
if (migrated > 0) {
console.log(
`Migration : réutilisation de la fenêtre du navigateur activée sur ${migrated} agent(s)`,
);
}
}
migrateBrowserWindowReuse();
export interface AgentRow {
id: string;
name: string;