join to existing call in creator app
This commit is contained in:
1 parent
7528f653e9
commit
221c4f595f
9 files changed
+251
-16
No files matched your search
@@ -57,7 +57,35 @@ export function renderContent(tm: RendererTabManager): void {
|
||||
else if (activeTab.platform === Platform.WBStream) title = 'WBStream';
|
||||
else if (activeTab.platform === Platform.Dion) title = 'DION';
|
||||
document.getElementById('headlessTitle')!.textContent = title;
|
||||
document.getElementById('headlessStatus')!.textContent = activeTab.headlessStatus || 'Starting...';
|
||||
const startEl = document.getElementById('headlessStart')!;
|
||||
const statusEl = document.getElementById('headlessStatus')!;
|
||||
if (!activeTab.headlessStarted) {
|
||||
startEl.classList.add('visible');
|
||||
statusEl.style.display = 'none';
|
||||
const targetInput = document.getElementById('headlessStartTarget') as HTMLInputElement;
|
||||
const targetLabel = document.getElementById('headlessStartTargetLabel')!;
|
||||
const errorEl = document.getElementById('headlessStartError')!;
|
||||
targetInput.value = activeTab.headlessStartTarget || '';
|
||||
targetInput.classList.remove('invalid');
|
||||
errorEl.textContent = '';
|
||||
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>';
|
||||
} else if (activeTab.platform === Platform.Dion) {
|
||||
targetLabel.textContent = 'Paste a room id or dion.vc event link.';
|
||||
targetInput.placeholder = 'abc-def-ghi';
|
||||
} else if (activeTab.platform === Platform.Telemost) {
|
||||
targetLabel.textContent = 'Paste a Telemost conference link.';
|
||||
targetInput.placeholder = 'https://telemost.yandex.ru/j/...';
|
||||
} else {
|
||||
targetLabel.textContent = 'Paste a VK call link.';
|
||||
targetInput.placeholder = 'https://vk.com/call/join/...';
|
||||
}
|
||||
} else {
|
||||
startEl.classList.remove('visible');
|
||||
statusEl.style.display = '';
|
||||
statusEl.textContent = activeTab.headlessStatus || 'Starting...';
|
||||
}
|
||||
const callInfo = activeTab.callInfo;
|
||||
const callInfoVK = document.getElementById('headlessCallInfo')!;
|
||||
const callInfoTM = document.getElementById('headlessCallInfoTM')!;
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
detachLoginWebview,
|
||||
} from './dom';
|
||||
import { VK_IM_URL, TELEMOST_URL } from '../constants';
|
||||
import { Platform, Bridge, BotTabData, LogPanel, TunnelMode } from '../types';
|
||||
import { Platform, Bridge, BotTabData, LogPanel, TunnelMode, HeadlessMode } from '../types';
|
||||
|
||||
declare const window: Window & { bridge: Bridge };
|
||||
|
||||
@@ -128,6 +128,40 @@ function bindHeadlessEvents(): void {
|
||||
if (sourceEl) copyToClipboard(sourceEl.textContent || '');
|
||||
}
|
||||
});
|
||||
document.getElementById('btnHeadlessCreate')!.addEventListener('click', () => {
|
||||
clearHeadlessJoinError();
|
||||
tm.startHeadlessCall({ mode: HeadlessMode.Create });
|
||||
});
|
||||
document.getElementById('btnHeadlessJoin')!.addEventListener('click', () => {
|
||||
const targetInput = document.getElementById('headlessStartTarget') as HTMLInputElement;
|
||||
const target = targetInput.value.trim();
|
||||
if (!target) {
|
||||
showHeadlessJoinError('Enter a room or link to join.');
|
||||
targetInput.focus();
|
||||
return;
|
||||
}
|
||||
clearHeadlessJoinError();
|
||||
tm.startHeadlessCall({ mode: HeadlessMode.Join, target });
|
||||
});
|
||||
document.getElementById('headlessStartTarget')!.addEventListener('input', (event) => {
|
||||
const tab = tm.getActiveTab();
|
||||
if (tab) tab.headlessStartTarget = (event.target as HTMLInputElement).value;
|
||||
clearHeadlessJoinError();
|
||||
});
|
||||
}
|
||||
|
||||
function showHeadlessJoinError(msg: string): void {
|
||||
const errEl = document.getElementById('headlessStartError')!;
|
||||
const input = document.getElementById('headlessStartTarget') as HTMLInputElement;
|
||||
errEl.textContent = msg;
|
||||
input.classList.add('invalid');
|
||||
}
|
||||
|
||||
function clearHeadlessJoinError(): void {
|
||||
const errEl = document.getElementById('headlessStartError')!;
|
||||
const input = document.getElementById('headlessStartTarget') as HTMLInputElement;
|
||||
errEl.textContent = '';
|
||||
input.classList.remove('invalid');
|
||||
}
|
||||
|
||||
function openSettings(): void {
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
import { RendererTab, BotTabData, BotSettings, TunnelMode, Platform, Bridge } from '../types';
|
||||
import {
|
||||
RendererTab,
|
||||
BotTabData,
|
||||
BotSettings,
|
||||
TunnelMode,
|
||||
Platform,
|
||||
Bridge,
|
||||
HeadlessMode,
|
||||
HeadlessStartArgs,
|
||||
} from '../types';
|
||||
import { HeadlessLogMarker } from '../constants';
|
||||
|
||||
declare const window: Window & { bridge: Bridge };
|
||||
@@ -58,13 +67,27 @@ export class RendererTabManager {
|
||||
if (!tab.isBot) tab.name = 'VK';
|
||||
}
|
||||
tab.headless = true;
|
||||
tab.headlessStarted = false;
|
||||
tab.platform = platform;
|
||||
tab.callInfo = undefined;
|
||||
tab.headlessStatus = 'Starting...';
|
||||
tab.headlessStatus = undefined;
|
||||
tab.tunnelConnected = false;
|
||||
tab.relayLogs = '';
|
||||
tab.hookLogs = '';
|
||||
window.bridge.startHeadless(this.activeTabId, platform);
|
||||
if (tab.isBot) {
|
||||
this.startHeadlessCall({ mode: HeadlessMode.Create });
|
||||
}
|
||||
this.onRender();
|
||||
}
|
||||
|
||||
startHeadlessCall(args: HeadlessStartArgs): void {
|
||||
if (!this.activeTabId) return;
|
||||
const tab = this.tabs[this.activeTabId];
|
||||
if (!tab || !tab.headless || !tab.platform) return;
|
||||
tab.headlessStarted = true;
|
||||
tab.headlessStatus = 'Starting...';
|
||||
tab.callInfo = undefined;
|
||||
window.bridge.startHeadless(this.activeTabId, tab.platform, args);
|
||||
this.onRender();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user