dion: add email/password to fix cookie expiration
This commit is contained in:
1 parent
a7b7fba0a6
commit
6c732f34e3
12 files changed
+388
-63
No files matched your search
@@ -68,6 +68,8 @@ export function renderContent(tm: RendererTabManager): void {
|
||||
targetInput.value = activeTab.headlessStartTarget || '';
|
||||
targetInput.classList.remove('invalid');
|
||||
errorEl.textContent = '';
|
||||
const dionAccountCard = document.getElementById('headlessDionAccountCard')!;
|
||||
dionAccountCard.style.display = activeTab.platform === Platform.Dion ? '' : 'none';
|
||||
if (activeTab.platform === Platform.WBStream) {
|
||||
targetLabel.textContent = 'Paste a room id or stream.wb.ru/room/<id> link.';
|
||||
targetInput.placeholder = 'https://stream.wb.ru/room/<id>';
|
||||
|
||||
@@ -108,6 +108,41 @@ function bindSettingsEvents(): void {
|
||||
});
|
||||
}
|
||||
|
||||
function bindDionAccountEvents(): void {
|
||||
document.getElementById('btnDionAccount')!.addEventListener('click', openDionAccount);
|
||||
document.getElementById('dionAccountPopup')!.addEventListener('click', closeDionAccount);
|
||||
document.querySelector('#dionAccountPopup .popup')!.addEventListener('click', (event) => event.stopPropagation());
|
||||
document.getElementById('btnDionAccountCancel')!.addEventListener('click', closeDionAccount);
|
||||
document.getElementById('btnDionAccountSave')!.addEventListener('click', async () => {
|
||||
const email = (document.getElementById('dionEmail') as HTMLInputElement).value.trim();
|
||||
const password = (document.getElementById('dionPassword') as HTMLInputElement).value;
|
||||
const status = document.getElementById('dionAccountStatus')!;
|
||||
try {
|
||||
await window.bridge.setDionCredentials(email, password);
|
||||
closeDionAccount();
|
||||
} catch {
|
||||
status.textContent = 'Failed to save the credentials.';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function openDionAccount(): Promise<void> {
|
||||
const status = document.getElementById('dionAccountStatus')!;
|
||||
status.textContent = '';
|
||||
document.getElementById('dionAccountPopup')!.classList.add('visible');
|
||||
try {
|
||||
const credentials = await window.bridge.getDionCredentials();
|
||||
(document.getElementById('dionEmail') as HTMLInputElement).value = credentials.email;
|
||||
(document.getElementById('dionPassword') as HTMLInputElement).value = credentials.password;
|
||||
} catch {
|
||||
status.textContent = 'Failed to read the session file.';
|
||||
}
|
||||
}
|
||||
|
||||
function closeDionAccount(): void {
|
||||
document.getElementById('dionAccountPopup')!.classList.remove('visible');
|
||||
}
|
||||
|
||||
function bindErrorPopup(): void {
|
||||
document.getElementById('errorPopup')!.addEventListener('click', closeError);
|
||||
document.querySelector('#errorPopup .popup')!.addEventListener('click', (event) => event.stopPropagation());
|
||||
@@ -189,6 +224,7 @@ function init(): void {
|
||||
bindToolbarEvents();
|
||||
bindActionBarEvents();
|
||||
bindSettingsEvents();
|
||||
bindDionAccountEvents();
|
||||
bindErrorPopup();
|
||||
bindLogEvents();
|
||||
bindHeadlessEvents();
|
||||
|
||||
Reference in new issue
Block a user