TeaSpeak-Client/modules/core/instance_handler.ts

21 lines
842 B
TypeScript
Raw Normal View History

import * as main_window from "./main_window";
export function handle_second_instance_call(argv: string[], work_dir: string) {
const original_args = argv.slice(1).filter(e => !e.startsWith("--original-process-start-time=") && e != "--allow-file-access-from-files");
console.log("Second instance: %o", original_args);
if(!main_window.main_window) {
console.warn("Ignoring second instance call because we haven't yet started");
return;
}
main_window.main_window.focus();
2019-11-24 12:38:50 -05:00
execute_connect_urls(original_args);
}
2019-11-24 12:38:50 -05:00
export function execute_connect_urls(argv: string[]) {
const connect_urls = argv.filter(e => e.startsWith("teaclient://"));
for(const url of connect_urls) {
console.log("Received connect url: %s", url);
main_window.main_window.webContents.send('connect', url);
}
}