feat(dashboard): add selector support to dashboard

This commit is contained in:
divocatt
2026-01-14 21:04:52 +02:00
parent 782f08b71b
commit 3f7e7cbc4b
3 changed files with 62 additions and 0 deletions

View File

@@ -86,6 +86,37 @@ export async function getDashboardSections(): Promise<IGetDashboardSectionsRespo
};
}
if (section.proxy_config_type === 'selector') {
const selector = proxies.find(
(proxy) => proxy.code === `${section['.name']}-out`,
);
const links = section.selector_proxy_links ?? [];
const outbounds = links
.map((link, index) => ({
link,
outbound: proxies.find(
(item) => item.code === `${section['.name']}-${index + 1}-out`,
),
}))
.map((item) => ({
code: item?.outbound?.code || '',
displayName:
getProxyUrlName(item.link) || item?.outbound?.value?.name || '',
latency: item?.outbound?.value?.history?.[0]?.delay || 0,
type: item?.outbound?.value?.type || '',
selected: selector?.value?.now === item?.outbound?.code,
}));
return {
withTagSelect: true,
code: selector?.code || section['.name'],
displayName: section['.name'],
outbounds,
};
}
if (section.proxy_config_type === 'urltest') {
const selector = proxies.find(
(proxy) => proxy.code === `${section['.name']}-out`,

View File

@@ -95,6 +95,12 @@ export namespace Podkop {
urltest_proxy_links: string[];
}
export interface ConfigProxySelectorSection {
connection_type: 'proxy';
proxy_config_type: 'selector';
selector_proxy_links: string[];
}
export interface ConfigProxyUrlSection {
connection_type: 'proxy';
proxy_config_type: 'url';
@@ -118,6 +124,7 @@ export namespace Podkop {
export type ConfigBaseSection =
| ConfigProxyUrlTestSection
| ConfigProxySelectorSection
| ConfigProxyUrlSection
| ConfigProxyOutboundSection
| ConfigVpnSection