redesign bots and app to highlight legacy approaches
This commit is contained in:
1 parent
6adeb9ced3
commit
91920118ff
5 files changed
+43
-26
No files matched your search
@@ -16,11 +16,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="toolbar" id="toolbar" style="display:none">
|
<div class="toolbar" id="toolbar" style="display:none">
|
||||||
<button class="btn-vk" id="btnVk">VK</button>
|
<button class="btn-headless" id="btnHeadlessVK">VK</button>
|
||||||
<button class="btn-telemost" id="btnTelemost">Telemost</button>
|
<button class="btn-headless-tm" id="btnHeadlessTM">Telemost</button>
|
||||||
<button class="btn-headless" id="btnHeadlessVK">Headless VK</button>
|
<button class="btn-headless-wb" id="btnHeadlessWB">WBStream</button>
|
||||||
<button class="btn-headless-tm" id="btnHeadlessTM">Headless TM</button>
|
<button class="btn-vk" id="btnVk">VK (legacy)</button>
|
||||||
<button class="btn-headless-wb" id="btnHeadlessWB">Headless WB</button>
|
<button class="btn-telemost" id="btnTelemost">Telemost (legacy)</button>
|
||||||
<span class="toolbar-spacer"></span>
|
<span class="toolbar-spacer"></span>
|
||||||
<span class="toolbar-label" id="tunnelLabel" style="display:none">Tunnel:</span>
|
<span class="toolbar-label" id="tunnelLabel" style="display:none">Tunnel:</span>
|
||||||
<select id="modeSelect" class="toolbar-select" style="display:none">
|
<select id="modeSelect" class="toolbar-select" style="display:none">
|
||||||
|
|||||||
@@ -26,16 +26,16 @@ export function createMainKeyboard() {
|
|||||||
one_time: false,
|
one_time: false,
|
||||||
buttons: [
|
buttons: [
|
||||||
[
|
[
|
||||||
{ action: { type: 'text', label: '📞 VK DC', payload: JSON.stringify({ cmd: BotCommand.VK, mode: 'dc' }) } },
|
{ action: { type: 'text', label: '🟦 VK', payload: JSON.stringify({ cmd: BotCommand.VK, mode: 'headless' }) } },
|
||||||
{ action: { type: 'text', label: '📹 VK Video', payload: JSON.stringify({ cmd: BotCommand.VK, mode: 'video' }) } },
|
{ action: { type: 'text', label: 'DC (legacy)', payload: JSON.stringify({ cmd: BotCommand.VK, mode: 'dc' }) } },
|
||||||
{ action: { type: 'text', label: '👻 VK Headless', payload: JSON.stringify({ cmd: BotCommand.VK, mode: 'headless' }) } },
|
{ action: { type: 'text', label: 'Video (legacy)', payload: JSON.stringify({ cmd: BotCommand.VK, mode: 'video' }) } },
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{ action: { type: 'text', label: '📹 TM Video', payload: JSON.stringify({ cmd: BotCommand.TM, mode: 'video' }) } },
|
{ action: { type: 'text', label: '🟥 Telemost', payload: JSON.stringify({ cmd: BotCommand.TM, mode: 'headless' }) } },
|
||||||
{ action: { type: 'text', label: '👻 TM Headless', payload: JSON.stringify({ cmd: BotCommand.TM, mode: 'headless' }) } },
|
{ action: { type: 'text', label: 'Video (legacy)', payload: JSON.stringify({ cmd: BotCommand.TM, mode: 'video' }) } },
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{ action: { type: 'text', label: '👻 WB Headless', payload: JSON.stringify({ cmd: BotCommand.WB, mode: 'headless' }) } },
|
{ action: { type: 'text', label: '🟪 WBStream', payload: JSON.stringify({ cmd: BotCommand.WB, mode: 'headless' }) } },
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{ action: { type: 'text', label: '📋 Active Tabs', payload: JSON.stringify({ cmd: BotCommand.List }) } },
|
{ action: { type: 'text', label: '📋 Active Tabs', payload: JSON.stringify({ cmd: BotCommand.List }) } },
|
||||||
|
|||||||
@@ -52,9 +52,9 @@ export function renderContent(tm: RendererTabManager): void {
|
|||||||
} else if (activeTab.headless) {
|
} else if (activeTab.headless) {
|
||||||
toolbar.style.display = 'none';
|
toolbar.style.display = 'none';
|
||||||
headlessInfo.style.display = 'block';
|
headlessInfo.style.display = 'block';
|
||||||
let title = 'Headless VK';
|
let title = 'VK';
|
||||||
if (activeTab.platform === Platform.Telemost) title = 'Headless Telemost';
|
if (activeTab.platform === Platform.Telemost) title = 'Telemost';
|
||||||
else if (activeTab.platform === Platform.WBStream) title = 'Headless WB Stream';
|
else if (activeTab.platform === Platform.WBStream) title = 'WBStream';
|
||||||
document.getElementById('headlessTitle')!.textContent = title;
|
document.getElementById('headlessTitle')!.textContent = title;
|
||||||
document.getElementById('headlessStatus')!.textContent = activeTab.headlessStatus || 'Starting...';
|
document.getElementById('headlessStatus')!.textContent = activeTab.headlessStatus || 'Starting...';
|
||||||
const callInfo = activeTab.callInfo;
|
const callInfo = activeTab.callInfo;
|
||||||
|
|||||||
@@ -43,15 +43,15 @@ export class RendererTabManager {
|
|||||||
switch (platform) {
|
switch (platform) {
|
||||||
case Platform.Telemost:
|
case Platform.Telemost:
|
||||||
tab.mode = TunnelMode.HeadlessTelemost;
|
tab.mode = TunnelMode.HeadlessTelemost;
|
||||||
tab.name = 'Headless TM';
|
if (!tab.isBot) tab.name = 'Telemost';
|
||||||
break;
|
break;
|
||||||
case Platform.WBStream:
|
case Platform.WBStream:
|
||||||
tab.mode = TunnelMode.HeadlessWBStream;
|
tab.mode = TunnelMode.HeadlessWBStream;
|
||||||
tab.name = 'Headless WB';
|
if (!tab.isBot) tab.name = 'WBStream';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
tab.mode = TunnelMode.HeadlessVK;
|
tab.mode = TunnelMode.HeadlessVK;
|
||||||
tab.name = 'Headless VK';
|
if (!tab.isBot) tab.name = 'VK';
|
||||||
}
|
}
|
||||||
tab.headless = true;
|
tab.headless = true;
|
||||||
tab.platform = platform;
|
tab.platform = platform;
|
||||||
@@ -66,9 +66,14 @@ export class RendererTabManager {
|
|||||||
|
|
||||||
createBotTab(data: BotTabData): void {
|
createBotTab(data: BotTabData): void {
|
||||||
if (!this.tabs[data.tabId]) {
|
if (!this.tabs[data.tabId]) {
|
||||||
const isHeadless = data.mode === TunnelMode.HeadlessVK || data.mode === TunnelMode.HeadlessTelemost;
|
const isHeadless =
|
||||||
const platformLabel = data.platform === Platform.Telemost ? 'TM' : 'VK';
|
data.mode === TunnelMode.HeadlessVK ||
|
||||||
const botName = isHeadless ? `Bot-Headless-${platformLabel}` : `Bot-${data.platform === Platform.Telemost ? 'Telemost' : 'VK'}`;
|
data.mode === TunnelMode.HeadlessTelemost ||
|
||||||
|
data.mode === TunnelMode.HeadlessWBStream;
|
||||||
|
let platformName = 'VK';
|
||||||
|
if (data.platform === Platform.Telemost) platformName = 'Telemost';
|
||||||
|
else if (data.platform === Platform.WBStream) platformName = 'WBStream';
|
||||||
|
const botName = isHeadless ? `Bot-${platformName}` : `Bot-${platformName} (legacy)`;
|
||||||
this.tabs[data.tabId] = {
|
this.tabs[data.tabId] = {
|
||||||
wv: null,
|
wv: null,
|
||||||
url: '',
|
url: '',
|
||||||
@@ -120,8 +125,8 @@ export class RendererTabManager {
|
|||||||
getTabLabel(tab: RendererTab): string {
|
getTabLabel(tab: RendererTab): string {
|
||||||
if (tab.name) return tab.name;
|
if (tab.name) return tab.name;
|
||||||
if (tab.url) {
|
if (tab.url) {
|
||||||
if (tab.url.includes('vk.com')) return 'VK';
|
if (tab.url.includes('vk.com')) return 'VK (legacy)';
|
||||||
if (tab.url.includes('telemost')) return 'Telemost';
|
if (tab.url.includes('telemost')) return 'Telemost (legacy)';
|
||||||
}
|
}
|
||||||
return 'New';
|
return 'New';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,14 +17,26 @@ type keyboard struct {
|
|||||||
Buttons [][]kbButton `json:"buttons"`
|
Buttons [][]kbButton `json:"buttons"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func platformSquare(platform string) string {
|
||||||
|
switch platform {
|
||||||
|
case "vk":
|
||||||
|
return "🟦"
|
||||||
|
case "tm", "telemost":
|
||||||
|
return "🟥"
|
||||||
|
case "wb", "wbstream":
|
||||||
|
return "🟪"
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func mainMenuKeyboard() string {
|
func mainMenuKeyboard() string {
|
||||||
kb := keyboard{
|
kb := keyboard{
|
||||||
OneTime: false,
|
OneTime: false,
|
||||||
Buttons: [][]kbButton{
|
Buttons: [][]kbButton{
|
||||||
{
|
{
|
||||||
{Action: kbAction{Type: "text", Label: "👻 VK", Payload: `{"cmd":"vk"}`}},
|
{Action: kbAction{Type: "text", Label: "🟦 VK", Payload: `{"cmd":"vk"}`}},
|
||||||
{Action: kbAction{Type: "text", Label: "👻 Telemost", Payload: `{"cmd":"tm"}`}},
|
{Action: kbAction{Type: "text", Label: "🟥 Telemost", Payload: `{"cmd":"tm"}`}},
|
||||||
{Action: kbAction{Type: "text", Label: "👻 WB Stream", Payload: `{"cmd":"wb"}`}},
|
{Action: kbAction{Type: "text", Label: "🟪 WBStream", Payload: `{"cmd":"wb"}`}},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
{Action: kbAction{Type: "text", Label: "📋 Active sessions", Payload: `{"cmd":"list"}`}},
|
{Action: kbAction{Type: "text", Label: "📋 Active sessions", Payload: `{"cmd":"list"}`}},
|
||||||
@@ -39,7 +51,7 @@ func sessionsKeyboard(sessions []*session) string {
|
|||||||
rows := make([][]kbButton, 0, len(sessions)+1)
|
rows := make([][]kbButton, 0, len(sessions)+1)
|
||||||
for _, s := range sessions {
|
for _, s := range sessions {
|
||||||
payload, _ := json.Marshal(map[string]string{"cmd": "close", "id": s.id})
|
payload, _ := json.Marshal(map[string]string{"cmd": "close", "id": s.id})
|
||||||
label := "👻 " + s.platform + " " + s.id + " 🟢"
|
label := platformSquare(s.platform) + " " + s.platform + " " + s.id + " 🟢"
|
||||||
rows = append(rows, []kbButton{
|
rows = append(rows, []kbButton{
|
||||||
{Action: kbAction{Type: "text", Label: label, Payload: string(payload)}},
|
{Action: kbAction{Type: "text", Label: label, Payload: string(payload)}},
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in new issue
Block a user