UI: Improve connection status for VPN/AWG sections
This commit is contained in:
@@ -2729,3 +2729,12 @@ msgstr "Готово"
|
||||
|
||||
msgid "Конфиг AmneziaWG успешно загружен!"
|
||||
msgstr "Конфиг AmneziaWG успешно загружен!"
|
||||
|
||||
msgid "Connected"
|
||||
msgstr "Подключено"
|
||||
|
||||
msgid "Not tested"
|
||||
msgstr "Не проверено"
|
||||
|
||||
msgid "Test connection"
|
||||
msgstr "Проверить подключение"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "fe-app-tachyon",
|
||||
"version": "1.2.0",
|
||||
"version": "1.2.10",
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
@@ -365,7 +365,7 @@ function getJsonOutbounds(section: Tachyon.ConfigSection) {
|
||||
|
||||
function isConnectionAction(action?: string) {
|
||||
return Boolean(
|
||||
action && ['connection', 'proxy', 'outbound', 'vpn'].includes(action),
|
||||
action && ['connection', 'proxy', 'outbound', 'vpn', 'awg', 'warp'].includes(action),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1431,7 +1431,7 @@ export async function getDashboardSections(
|
||||
};
|
||||
}
|
||||
|
||||
if (sectionAction === 'vpn') {
|
||||
if (sectionAction === 'vpn' || sectionAction === 'awg' || sectionAction === 'warp') {
|
||||
const outboundTag = getOutboundTagBySection(sectionName);
|
||||
const outbound = proxies.find((proxy) => proxy.code === outboundTag);
|
||||
|
||||
@@ -1445,7 +1445,10 @@ export async function getDashboardSections(
|
||||
outbounds: [
|
||||
{
|
||||
code: outbound?.code || sectionName,
|
||||
displayName: section.interface || outbound?.value?.name || '',
|
||||
displayName:
|
||||
section.interface ||
|
||||
outbound?.value?.name ||
|
||||
(sectionAction === 'awg' ? 'AmneziaWG' : sectionAction.toUpperCase()),
|
||||
latency: outbound?.value?.history?.[0]?.delay || 0,
|
||||
type: outbound?.value?.type || '',
|
||||
selected: true,
|
||||
|
||||
@@ -294,6 +294,9 @@ function renderDefaultState({
|
||||
return 'tachyon_dashboard-page__outbound-grid__item__latency--red';
|
||||
}
|
||||
|
||||
const isConnectionNode = ['vpn', 'awg', 'warp'].includes(section.action || '');
|
||||
const connectionStatusText = outbound.latency > 0 ? _('Connected') : _('Not tested');
|
||||
|
||||
const canCopyLink =
|
||||
Boolean(outbound.canCopyLink) || isCopyableProxyLink(outbound.link);
|
||||
const selectorSwitching = Boolean(selectorSwitchingTag);
|
||||
@@ -426,7 +429,9 @@ function renderDefaultState({
|
||||
E(
|
||||
'div',
|
||||
{ class: getLatencyClass() },
|
||||
outbound.latency ? `${outbound.latency}ms` : 'N/A',
|
||||
isConnectionNode
|
||||
? connectionStatusText
|
||||
: (outbound.latency ? `${outbound.latency}ms` : 'N/A'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -217,7 +217,9 @@ export namespace Tachyon {
|
||||
| 'block'
|
||||
| 'zapret'
|
||||
| 'zapret2'
|
||||
| 'byedpi';
|
||||
| 'byedpi'
|
||||
| 'awg'
|
||||
| 'warp';
|
||||
type LegacyConnectionType = 'proxy' | 'vpn' | 'block' | 'exclusion';
|
||||
type ProxyConfigType =
|
||||
| 'urltest'
|
||||
|
||||
@@ -1972,6 +1972,8 @@ function renderDefaultState({
|
||||
}
|
||||
return "tachyon_dashboard-page__outbound-grid__item__latency--red";
|
||||
}
|
||||
const isConnectionNode = ["vpn", "awg", "warp"].includes(section.action || "");
|
||||
const connectionStatusText = outbound.latency > 0 ? _("Connected") : _("Not tested");
|
||||
const canCopyLink = Boolean(outbound.canCopyLink) || isCopyableProxyLink(outbound.link);
|
||||
const selectorSwitching = Boolean(selectorSwitchingTag);
|
||||
const outboundSwitching = selectorSwitchingTag === outbound.code;
|
||||
@@ -2075,7 +2077,7 @@ function renderDefaultState({
|
||||
E(
|
||||
"div",
|
||||
{ class: getLatencyClass() },
|
||||
outbound.latency ? `${outbound.latency}ms` : "N/A"
|
||||
isConnectionNode ? connectionStatusText : outbound.latency ? `${outbound.latency}ms` : "N/A"
|
||||
)
|
||||
]
|
||||
)
|
||||
@@ -3308,7 +3310,7 @@ function getJsonOutbounds(section) {
|
||||
}
|
||||
function isConnectionAction(action) {
|
||||
return Boolean(
|
||||
action && ["connection", "proxy", "outbound", "vpn"].includes(action)
|
||||
action && ["connection", "proxy", "outbound", "vpn", "awg", "warp"].includes(action)
|
||||
);
|
||||
}
|
||||
function hasSubscriptionSources(section) {
|
||||
@@ -4034,7 +4036,7 @@ async function getDashboardSections(options = {}) {
|
||||
outbounds
|
||||
};
|
||||
}
|
||||
if (sectionAction === "vpn") {
|
||||
if (sectionAction === "vpn" || sectionAction === "awg" || sectionAction === "warp") {
|
||||
const outboundTag = getOutboundTagBySection(sectionName);
|
||||
const outbound = proxies.find((proxy) => proxy.code === outboundTag);
|
||||
return {
|
||||
@@ -4047,7 +4049,7 @@ async function getDashboardSections(options = {}) {
|
||||
outbounds: [
|
||||
{
|
||||
code: outbound?.code || sectionName,
|
||||
displayName: section.interface || outbound?.value?.name || "",
|
||||
displayName: section.interface || outbound?.value?.name || (sectionAction === "awg" ? "AmneziaWG" : sectionAction.toUpperCase()),
|
||||
latency: outbound?.value?.history?.[0]?.delay || 0,
|
||||
type: outbound?.value?.type || "",
|
||||
selected: true,
|
||||
|
||||
Reference in New Issue
Block a user