mirror of
https://github.com/Zakkaus/doona.git
synced 2026-12-05 08:00:59 +00:00
feat(groups): edit a group's exit node and explain rejected refreshes (#703)
## Problem / 问题 After #702, doona can add and edit proxy chains, but two parts of honk's chain support are still missing. A group's experimental `exit` node can only be set in the configuration text, and the group document from the API does not expose it. When a subscription refresh removes or duplicates a node that a chain hop or group exit names, honk rejects the update and keeps the old nodes, but doona shows only a generic failure. ## How I fixed it / 解决方法 Group exit: - `readGroupEntries` reads `exit`, and `writeGroupEntry` writes it with `quoteName` right after `final`, the same way as `default` and `final`. It is part of the no-change comparison and the save-conflict retry merge. - The group editor has an "Exit node (Experimental)" select, offered only when the engine is honk. It lists None plus nodes that can be a later hop, reusing the `tunnelDialable` check from #702. Chains, groups, direct, block, Hysteria2, TUIC, Juicity and AnyTLS are excluded. - The running-configuration section of the group dialog shows the exit when one is set. - honk's four group exit diagnostic codes have localized messages. Rejected refresh: - When a provider's `last_error.code` is `publication_rejected` and `details.diagnostic_code` is one of the seven chain or exit codes, the subscription status explains that a proxy chain or group exit refers to a node the update removed or duplicated, and that the previous nodes stay in use. The mock `office` group gains `exit: hk-02`, which moves the mock rule lines down by one; the rule tests follow. ## Screenshots | | | |---|---| |  |  | |  |  | |  |  | |  |  | The rejected refresh shots use an intercepted providers response, because the mock has no such provider. All 40 variants are kept locally. ## Verified / 验证 - `pnpm typecheck`, `lint`, `check:i18n`, `format:check`, `check:gen` and `build` all exit 0. - `pnpm test` exits 0: 251 files, 4417 tests. - Playwright on Chromium: 12 specs covering groups, policies, rules, nodes and the builder, 273 tests, all pass. - `check:size`: the Policies chunk is 21055 B gzip, up 213 B. The Nodes route is 73134 B against a 76000 B budget. - Not yet checked against a running honk: the exit write and the real shape of `publication_rejected`, which honk documents in api.md but which has not been observed live.
This commit is contained in:
22 files changed
+228
-37
No files matched your search
@@ -0,0 +1,5 @@
|
||||
Added
|
||||
|
||||
- The group editor has an experimental Exit node field on honk. It offers the nodes a proxy chain can tunnel through, and writes the group's `exit` to the configuration. A group's details show its exit.
|
||||
- A subscription whose refresh honk rejected because a proxy chain hop or group exit would name a removed or duplicated node says so beside its status, and that the previous nodes stay in use.
|
||||
- honk's group exit diagnostics read in the page language where a configuration write is refused.
|
||||
@@ -152,16 +152,16 @@ test('a resource-level read-only dialog explains why configuration cannot be edi
|
||||
|
||||
test('running configuration has a heading when interruption is its only field', async ({page}) => {
|
||||
const {api, handlers} = await mockBackend(page);
|
||||
handlers['GET groups/office'] = async () => {
|
||||
const group = await api.group('office');
|
||||
handlers['GET groups/backup'] = async () => {
|
||||
const group = await api.group('backup');
|
||||
for (const key of Object.keys(group.config)) Object.assign(group.config, {[key]: null});
|
||||
group.capabilities.mutable_config = ['interrupt_connections'];
|
||||
return group;
|
||||
};
|
||||
await page.goto('/#/policies');
|
||||
await page.getByRole('region', {name: 'office', exact: true}).scrollIntoViewIfNeeded();
|
||||
await page.getByRole('region', {name: 'office', exact: true}).getByRole('button', {name: 'Edit group', exact: true}).click();
|
||||
const dialog = page.getByRole('dialog', {name: 'Edit group office'});
|
||||
await page.getByRole('region', {name: 'backup', exact: true}).scrollIntoViewIfNeeded();
|
||||
await page.getByRole('region', {name: 'backup', exact: true}).getByRole('button', {name: 'Edit group', exact: true}).click();
|
||||
const dialog = page.getByRole('dialog', {name: 'Edit group backup'});
|
||||
await expect(dialog.locator('.rp-kv')).toHaveCount(0);
|
||||
await expect(dialog.getByRole('heading', {name: 'Running configuration'})).toBeVisible();
|
||||
await expect(dialog.getByRole('switch', {name: 'Interrupt existing connections on switch', exact: true})).toBeVisible();
|
||||
|
||||
@@ -50,7 +50,7 @@ test('the rule list shows the dictionary in evaluation order with its source lin
|
||||
const list = rows(page);
|
||||
await expect(list).toHaveCount(21);
|
||||
await expect(list.first()).toContainText('pname(NetworkManager)');
|
||||
await expect(list.first()).toContainText('config.dae:150');
|
||||
await expect(list.first()).toContainText('config.dae:151');
|
||||
await expect(list.nth(7)).toContainText('domain(geosite:telegram)');
|
||||
await expect(list.last()).toContainText('fallback: proxy');
|
||||
await expect(page.getByRole('tabpanel', {name: 'Routing rules'})).toContainText('21 rules, generation 40');
|
||||
@@ -62,11 +62,11 @@ test('the rule list shows the dictionary in evaluation order with its source lin
|
||||
test('a visually editable rule keeps Edit and Remove beside the link to its config file line', async ({page}) => {
|
||||
await page.goto('/#/rules?tab=list&view=advanced');
|
||||
const row = rows(page).first();
|
||||
await expect(row).toContainText('config.dae:150');
|
||||
await expect(row).toContainText('config.dae:151');
|
||||
await expect(row.getByRole('button', {name: 'Edit rule', exact: true})).toBeEnabled();
|
||||
await expect(row.getByRole('button', {name: 'Remove rule', exact: true})).toBeVisible();
|
||||
await row.getByRole('button', {name: 'Open config file', exact: true}).click();
|
||||
await expect(page).toHaveURL(/#\/config\?tab=source&source=[^&]+&line=150$/);
|
||||
await expect(page).toHaveURL(/#\/config\?tab=source&source=[^&]+&line=151$/);
|
||||
await expect(page.getByRole('dialog')).toHaveCount(0);
|
||||
});
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ async function unsupportedRule(page: import('@playwright/test').Page) {
|
||||
}
|
||||
|
||||
const lists = [
|
||||
{name: 'routing', route: '/#/rules?tab=list&view=advanced', scope: 'Routing rules', role: 'tabpanel', line: 150},
|
||||
{name: 'routing', route: '/#/rules?tab=list&view=advanced', scope: 'Routing rules', role: 'tabpanel', line: 151},
|
||||
{name: 'DNS request', route: '/#/rules?tab=dns', scope: 'Request rules', role: 'region', line: 30},
|
||||
{name: 'DNS response', route: '/#/rules?tab=dns', scope: 'Response rules', role: 'region', line: 37}
|
||||
] as const;
|
||||
|
||||
@@ -87,6 +87,7 @@ export const configMain =
|
||||
office {
|
||||
policy: fixed(0)
|
||||
default: hk-01
|
||||
exit: hk-02
|
||||
}
|
||||
backup {
|
||||
filter: subtag(harbor)
|
||||
|
||||
@@ -79,6 +79,28 @@ describe('group entries', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it.each([
|
||||
['adds exit after final', 'final: direct', {exit: "'jp 01'"}, "final: direct\nexit: 'jp 01'"],
|
||||
['adds exit after policy when there is no final', '', {exit: 'jp'}, 'exit: jp'],
|
||||
['replaces exit in place', 'exit: hk # keep\nfinal: direct', {exit: 'jp'}, 'exit: jp # keep\nfinal: direct'],
|
||||
['removes exit', 'final: direct\nexit: hk', {exit: null}, 'final: direct'],
|
||||
['edits only exit and leaves final alone', 'final: direct\nexit: hk', {final: undefined, exit: "'jp 01'"}, "final: direct\nexit: 'jp 01'"],
|
||||
['leaves exit alone when not given', 'exit: hk', {final: 'direct'}, 'final: direct\nexit: hk']
|
||||
])('%s', (_, fields, update, expected) => {
|
||||
const group = (lines: string) =>
|
||||
`group {\n g {\n${['policy: select', ...lines.split('\n').filter(Boolean), 'check_url: x'].map(line => ` ${line}\n`).join('')} }\n}\n`;
|
||||
const written = writeGroupEntry(group(fields), 'g', {filters: [], policy: 'select', ...update});
|
||||
expect(written).toBe(group(expected));
|
||||
expect(writeGroupEntry(written, 'g', {filters: [], policy: 'select', ...update})).toBe(written);
|
||||
});
|
||||
|
||||
it('reads exit as written and writes it after final in a new group', () => {
|
||||
expect(readGroupEntries("group { g { exit: 'jp 01' } }")[0].exit).toBe("'jp 01'");
|
||||
expect(writeGroupEntry('group {\n}\n', 'g', {filters: [], policy: 'select', final: 'direct', exit: 'jp'})).toBe(
|
||||
'group {\n g {\n policy: select\n final: direct\n exit: jp\n }\n}\n'
|
||||
);
|
||||
});
|
||||
|
||||
it('round-trips interruption and edits it without moving comments or other fields', () => {
|
||||
const source = "group {\n g {\n policy: select\n interrupt_connections: 'true' # keep\n check_url: x\n }\n}\n";
|
||||
const unchanged = {filters: [], policy: 'select'};
|
||||
|
||||
+14
-4
@@ -6,9 +6,10 @@ export type GroupEntry = {
|
||||
written: string;
|
||||
filters: string[];
|
||||
policy: string | null;
|
||||
// `default` and `final` as written, quotes included, or null when the entry sets none.
|
||||
// `default`, `final` and `exit` as written, quotes included, or null when the entry sets none.
|
||||
default: string | null;
|
||||
final: string | null;
|
||||
exit: string | null;
|
||||
interrupt: string | null;
|
||||
from: number;
|
||||
to: number;
|
||||
@@ -30,6 +31,7 @@ export function readGroupEntries(text: string): GroupEntry[] {
|
||||
policy: last('policy'),
|
||||
default: last('default'),
|
||||
final: last('final'),
|
||||
exit: last('exit'),
|
||||
interrupt: last('interrupt_connections'),
|
||||
from: entry.line,
|
||||
to: entry.endLine
|
||||
@@ -47,7 +49,14 @@ export function groupNameProblem(name: string, taken: ReadonlySet<string>): 'inv
|
||||
}
|
||||
|
||||
// Optional fields are written as given; undefined leaves the line alone and null removes it.
|
||||
export type GroupEntryUpdate = {filters: string[]; policy: string | null; default?: string | null; final?: string | null; interrupt?: string | null};
|
||||
export type GroupEntryUpdate = {
|
||||
filters: string[];
|
||||
policy: string | null;
|
||||
default?: string | null;
|
||||
final?: string | null;
|
||||
exit?: string | null;
|
||||
interrupt?: string | null;
|
||||
};
|
||||
export function writeGroupEntry(text: string, name: string, next: GroupEntryUpdate): string {
|
||||
const {blocks, tokens} = scanConfig(text);
|
||||
const sections = blocks.filter(block => block.name === 'group');
|
||||
@@ -63,7 +72,7 @@ export function writeGroupEntry(text: string, name: string, next: GroupEntryUpda
|
||||
current.filters.length === next.filters.length &&
|
||||
current.filters.every((filter, i) => filter === next.filters[i]) &&
|
||||
current.policy === next.policy &&
|
||||
(['default', 'final', 'interrupt'] as const).every(key => next[key] === undefined || next[key] === current[key])
|
||||
(['default', 'final', 'exit', 'interrupt'] as const).every(key => next[key] === undefined || next[key] === current[key])
|
||||
)
|
||||
return text;
|
||||
const lineStart = text.lastIndexOf('\n', entry.from - 1) + 1;
|
||||
@@ -90,6 +99,7 @@ export function writeGroupEntry(text: string, name: string, next: GroupEntryUpda
|
||||
...(next.policy ? [`${indent}${indent}policy: ${next.policy}`] : []),
|
||||
...(next.default ? [`${indent}${indent}default: ${next.default}`] : []),
|
||||
...(next.final ? [`${indent}${indent}final: ${next.final}`] : []),
|
||||
...(next.exit ? [`${indent}${indent}exit: ${next.exit}`] : []),
|
||||
...(next.interrupt ? [`${indent}${indent}interrupt_connections: ${next.interrupt}`] : []),
|
||||
`${indent}}`
|
||||
].join('\n');
|
||||
@@ -103,7 +113,7 @@ export function writeGroupEntry(text: string, name: string, next: GroupEntryUpda
|
||||
|
||||
// Changes fields where they stand, so comments and other fields keep their place.
|
||||
// A new line goes after the last line of its own key or of a key listed before it, in the order a group is written.
|
||||
const singleKeys = ['policy', 'default', 'final', 'interrupt'] as const;
|
||||
const singleKeys = ['policy', 'default', 'final', 'exit', 'interrupt'] as const;
|
||||
const fieldName = (key: (typeof singleKeys)[number]) => (key === 'interrupt' ? 'interrupt_connections' : key);
|
||||
function rewriteFields(text: string, entry: TextBlock, fields: TextField[], inner: string, next: GroupEntryUpdate): string {
|
||||
const filters = fields.filter(field => field.name === 'filter');
|
||||
|
||||
@@ -536,6 +536,20 @@ describe('a failed subscription download', () => {
|
||||
expect(row.failure![0]).toContain('downloaded');
|
||||
});
|
||||
|
||||
it.each([
|
||||
['unsupported-chain-hop', [t('nodes.proxyChain.refreshRejected')]],
|
||||
['group-exit-route-too-long', [t('nodes.proxyChain.refreshRejected')]],
|
||||
['duplicate-subscription-entry', undefined],
|
||||
[undefined, undefined]
|
||||
])('explains a refresh rejected for diagnostic %s', (code, failure) => {
|
||||
const rejected = provider('a', {
|
||||
last_error: {code: 'publication_rejected', message: 'rejected', details: {diagnostic_code: code} as unknown as Record<string, never>}
|
||||
});
|
||||
const row = providerRowView(rejected, undefined, 'en-US', t);
|
||||
expect(row.failure).toEqual(failure);
|
||||
expect(row.error).toBe(failure ? undefined : t('ui.backend.publicationRejected'));
|
||||
});
|
||||
|
||||
it('keeps the plain text for an engine that sends no details or no stage', () => {
|
||||
for (const details of [null, {}, {node: 'n1'}]) {
|
||||
const row = providerRowView(failed(details), undefined, 'en-US', t, names);
|
||||
|
||||
@@ -387,6 +387,19 @@ export function fetchFailure(item: ProviderRow, names: OutboundNames | undefined
|
||||
return [reason, via, ownWords ? t('nodes.fetchKept') : null].filter((line): line is string => line !== null);
|
||||
}
|
||||
|
||||
// The diagnostics with which honk refuses a refresh that would break a proxy chain hop or a group exit; it keeps the previous nodes.
|
||||
const referenceCodes = new Set([
|
||||
'invalid-chain-hop-reference',
|
||||
'ambiguous-chain-hop-reference',
|
||||
'unsupported-chain-hop',
|
||||
'invalid-group-exit-target',
|
||||
'ambiguous-group-exit-target',
|
||||
'unsupported-group-exit-target',
|
||||
'group-exit-route-too-long'
|
||||
]);
|
||||
const referenceRejected = (error: Provider['last_error']) =>
|
||||
error?.code === 'publication_rejected' && referenceCodes.has((error.details as {diagnostic_code?: string} | null | undefined)?.diagnostic_code ?? '');
|
||||
|
||||
export function providerRowView(item: ProviderRow, seconds: number | null | undefined, locale: string, t: Translator, names?: OutboundNames) {
|
||||
const kinds: Record<ProviderRow['kind'], Key> = {
|
||||
subscription: 'nodes.kind.subscription',
|
||||
@@ -406,7 +419,7 @@ export function providerRowView(item: ProviderRow, seconds: number | null | unde
|
||||
// undefined: no configuration entry to write; null: an entry without an interval, which can still get one.
|
||||
const interval = item.kind === 'subscription' ? seconds : undefined;
|
||||
const name = item.displayName ?? item.name;
|
||||
const failure = fetchFailure(item, names, t);
|
||||
const failure = fetchFailure(item, names, t) ?? (referenceRejected(item.last_error) ? [t('nodes.proxyChain.refreshRejected')] : undefined);
|
||||
return {
|
||||
id: item.id,
|
||||
name,
|
||||
|
||||
@@ -125,6 +125,17 @@ export function GroupDialog({model: m, details}: {model: GroupDialogView; detail
|
||||
onChange={field.change}
|
||||
/>
|
||||
))}
|
||||
{m.exit && (
|
||||
<SearchSelect
|
||||
label={m.exit.label}
|
||||
searchLabel={m.exit.searchLabel}
|
||||
sections={m.exit.sections}
|
||||
value={m.exit.value}
|
||||
description={m.exit.description}
|
||||
isDisabled={m.busy}
|
||||
onChange={m.exit.change}
|
||||
/>
|
||||
)}
|
||||
</DialogSection>
|
||||
{!m.name && details && <Details details={details} />}
|
||||
</DialogForm>
|
||||
|
||||
@@ -2,8 +2,15 @@ import {unquote} from '../../../dae/text';
|
||||
import type {GroupEntry, GroupEntryUpdate} from '../../../dae/groups';
|
||||
import {routeValue} from '../../shared/groupText';
|
||||
|
||||
// The fields a save writes, as the dialog holds them: `default` and `final` unquoted, `interrupt` as written.
|
||||
export type GroupFields = {filters: string[]; policy: string | null; default: string | null; final: string | null; interrupt: string | null};
|
||||
// The fields a save writes, as the dialog holds them: `default`, `final` and `exit` unquoted, `interrupt` as written.
|
||||
export type GroupFields = {
|
||||
filters: string[];
|
||||
policy: string | null;
|
||||
default: string | null;
|
||||
final: string | null;
|
||||
exit?: string | null;
|
||||
interrupt: string | null;
|
||||
};
|
||||
type GroupMerge = {kind: 'gone'} | {kind: 'conflict'} | {kind: 'merge'; keep: Partial<GroupEntryUpdate>};
|
||||
|
||||
// A retry after a refusal writes only the fields changed since the dialog opened (`opened`) and keeps the rest as read again (`current`),
|
||||
@@ -13,7 +20,7 @@ export function mergeGroupRetry(
|
||||
mine: GroupFields,
|
||||
opened: GroupEntry,
|
||||
current: GroupEntry | undefined,
|
||||
routes: ReadonlyArray<'default' | 'final'>
|
||||
routes: ReadonlyArray<'default' | 'final' | 'exit'>
|
||||
): GroupMerge {
|
||||
if (!current) return {kind: 'gone'};
|
||||
const keys = ['filters', 'policy', 'interrupt', ...routes] as const;
|
||||
@@ -21,7 +28,7 @@ export function mergeGroupRetry(
|
||||
// Interruption compares as a flag, so `'true'` and `true` agree.
|
||||
const flag = (value: string | null) => (value === null ? null : unquote(value) === 'true');
|
||||
const read = (from: GroupEntry, key: Key) =>
|
||||
JSON.stringify(key === 'default' || key === 'final' ? routeValue(from[key]) : key === 'interrupt' ? flag(from[key]) : from[key]);
|
||||
JSON.stringify(key === 'default' || key === 'final' || key === 'exit' ? routeValue(from[key]) : key === 'interrupt' ? flag(from[key]) : from[key]);
|
||||
const own = (key: Key) => JSON.stringify(key === 'interrupt' ? flag(mine[key]) : mine[key]);
|
||||
// A field already holding the value read again is not written, so it keeps the spelling there.
|
||||
const changed = keys.filter(key => own(key) !== read(opened, key) && own(key) !== read(current, key));
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import {expect, it, vi} from 'vitest';
|
||||
import {ApiError} from '../../../api/error';
|
||||
import type {Node} from '../../../api/model';
|
||||
import {newGroupCondition, type GroupConditionKind, type GroupConditionRow} from '../../../dae/groupConditions';
|
||||
import {addAlternative, changeTerm, conditionTerms, kindChoices, removeAlternative} from './groupTerms';
|
||||
|
||||
@@ -63,8 +64,14 @@ import {hookHarness} from '../../../store/testHelpers';
|
||||
import {useGroupDialog} from './useGroupDialog';
|
||||
import {translate, type Translator} from '../../../i18n';
|
||||
vi.mock('react', async original => ({...(await original<typeof import('react')>()), ...hookHarness.hooks}));
|
||||
vi.mock('../../../store', () => ({useCapabilities: () => ({data: undefined}), useNodes: () => ({data: []}), useProviders: () => ({data: undefined})}));
|
||||
vi.mock('../../../store', () => ({
|
||||
useCapabilities: () => ({data: undefined}),
|
||||
useNodes: () => ({data: undefined}),
|
||||
useProviders: () => ({data: undefined}),
|
||||
useVersion: () => ({data: version.data})
|
||||
}));
|
||||
const config = vi.hoisted(() => ({data: undefined as {sources: unknown[]} | undefined}));
|
||||
const version = vi.hoisted(() => ({data: undefined as {engine: {name: string}} | undefined}));
|
||||
vi.mock('../../../store/config', () => ({useConfig: () => ({data: config.data})}));
|
||||
vi.mock('../../../shell/draft', () => ({useDraftGuard: () => ({clear: vi.fn()}), useDialogSession: () => ({next: vi.fn(), start: () => () => true})}));
|
||||
vi.mock('../../../i18n', async original => ({
|
||||
@@ -140,3 +147,34 @@ it.each([
|
||||
});
|
||||
config.data = undefined;
|
||||
});
|
||||
|
||||
it('offers a group exit only on honk, among the nodes a chain can tunnel through, and writes it', () => {
|
||||
hookHarness.reset();
|
||||
const apply = vi.fn().mockResolvedValue({kind: 'ok'});
|
||||
const node = (name: string, protocol: string, stream_transport?: string) => ({name, protocol, stream_transport}) as Node;
|
||||
const nodes = [node('jp 01', 'trojan'), node('hk', 'vless', 'xhttp'), node('hy', 'hysteria2'), node('sg', 'ss'), node('sg', 'vmess')];
|
||||
const read = () =>
|
||||
hookHarness.render(() =>
|
||||
useGroupDialog({
|
||||
mode: 'create',
|
||||
source: {main: null, writable: true, busy: false, apply},
|
||||
taken: new Set(),
|
||||
outbounds: {groups: [], nodes: [], links: new Map()},
|
||||
nodes
|
||||
})
|
||||
);
|
||||
read().show();
|
||||
expect(read().exit).toBeNull();
|
||||
version.data = {engine: {name: 'honk'}};
|
||||
const exit = read().exit!;
|
||||
expect(exit.sections.flatMap(section => section.items.map(item => [item.label, !!item.isDisabled]))).toEqual([
|
||||
['None', false],
|
||||
['jp 01', false],
|
||||
['sg', true]
|
||||
]);
|
||||
exit.change(exit.sections[1].items[0].id);
|
||||
read().name!.change('work');
|
||||
read().save(vi.fn());
|
||||
expect(apply.mock.calls[0][0]('')).toContain("exit: 'jp 01'");
|
||||
version.data = undefined;
|
||||
});
|
||||
@@ -1,7 +1,8 @@
|
||||
import {useMemo, useRef, useState} from 'react';
|
||||
import {useLang, useT} from '../../../i18n';
|
||||
import {offered} from '../../../api/capabilities';
|
||||
import {useCapabilities, useNodes, useProviders} from '../../../store';
|
||||
import {useCapabilities, useNodes, useProviders, useVersion} from '../../../store';
|
||||
import {engineOf} from '../../../api/engines';
|
||||
import {useConfig} from '../../../store/config';
|
||||
import {readSubscriptionEntries} from '../../../dae/subscriptions';
|
||||
import {
|
||||
@@ -42,6 +43,7 @@ import type {SearchSection} from '../../../ui/SearchSelect';
|
||||
import type {CheckboxChoice} from '../../../ui/CheckboxSet';
|
||||
import {
|
||||
editBlocked,
|
||||
exitSections,
|
||||
finalSections,
|
||||
finalExcluded,
|
||||
groupConfigLabels,
|
||||
@@ -144,6 +146,8 @@ export type GroupDialogView = {
|
||||
sections: SearchSection[];
|
||||
change: (id: string) => void;
|
||||
}>;
|
||||
// The group's exit node picker, offered only on honk.
|
||||
exit: {label: string; description: string; searchLabel: string; value: string; sections: SearchSection[]; change: (id: string) => void} | null;
|
||||
show: (filters?: string[]) => void;
|
||||
// Opens the dialog read-only, on the group's configuration alone.
|
||||
view: () => void;
|
||||
@@ -175,6 +179,7 @@ type Draft = {
|
||||
filters: GroupFilterDraft[];
|
||||
default: string | null;
|
||||
final: string | null;
|
||||
exit: string | null;
|
||||
interrupt: string | null;
|
||||
};
|
||||
type Input =
|
||||
@@ -205,6 +210,8 @@ export function useGroupDialog(input: Input): GroupDialogView {
|
||||
const [viewing, setViewing] = useState(false);
|
||||
const busy = source.busy;
|
||||
const resources = useCapabilities().data?.resources;
|
||||
// `exit` is honk syntax, so only honk's text gets the field.
|
||||
const exitShown = engineOf(useVersion().data).daeText;
|
||||
const allNodes = useNodes(!!draft && offered(resources, 'nodes', {whileLoading: false}));
|
||||
const providers = useProviders(!!draft && offered(resources, 'providers', {whileLoading: false}));
|
||||
const config = useConfig(!!draft && offered(resources, 'config', {whileLoading: false}));
|
||||
@@ -231,6 +238,8 @@ export function useGroupDialog(input: Input): GroupDialogView {
|
||||
? ['default_member_id', 'final_outbound']
|
||||
: ['final_outbound']
|
||||
: routeFields(context.g, draft?.policy ?? null);
|
||||
// The entry's keys the save writes as names.
|
||||
const nameKeys = [...routes.map(id => routeKeys[id]), ...(exitShown ? (['exit'] as const) : [])];
|
||||
const members = draft && manualPolicy(draft.policy) ? draftMembers(filters, nodes, t) : creating ? [] : context.members;
|
||||
const groupName = creating ? (draft?.name.trim() ?? '') : (draft?.name ?? '');
|
||||
const excluded = finalExcluded(groupName, context.outbounds.links);
|
||||
@@ -248,7 +257,7 @@ export function useGroupDialog(input: Input): GroupDialogView {
|
||||
draft.policy !== (creating ? newGroupPolicies[0].id : entry?.policy) ||
|
||||
invalid ||
|
||||
JSON.stringify(filters) !== JSON.stringify(creating ? [] : entry?.filters) ||
|
||||
routes.some(id => draft[routeKeys[id]] !== routeValue(entry?.[routeKeys[id]] ?? null)));
|
||||
nameKeys.some(key => draft[key] !== routeValue(entry?.[key] ?? null)));
|
||||
const [discarding, setDiscarding] = useState(false);
|
||||
const guard = useDraftGuard(
|
||||
dirty,
|
||||
@@ -274,17 +283,16 @@ export function useGroupDialog(input: Input): GroupDialogView {
|
||||
if (nameProblem || invalid) return;
|
||||
const filters = groupFilterTexts(draft.filters).filter(f => f.trim());
|
||||
// A retry merges into the group as read again.
|
||||
const mine = {filters, policy: draft.policy, interrupt: draft.interrupt, default: draft.default, final: draft.final};
|
||||
const keys = routes.map(id => routeKeys[id]);
|
||||
const retry = draft.refused && draft.opened ? mergeGroupRetry(mine, draft.opened, entry, keys) : null;
|
||||
const mine = {filters, policy: draft.policy, interrupt: draft.interrupt, default: draft.default, final: draft.final, exit: draft.exit};
|
||||
const retry = draft.refused && draft.opened ? mergeGroupRetry(mine, draft.opened, entry, nameKeys) : null;
|
||||
if (retry?.kind === 'gone') {
|
||||
refuse(t('policy.editReopen'));
|
||||
return;
|
||||
}
|
||||
const written = {default: entry?.default ?? null, final: entry?.final ?? null};
|
||||
const written = {default: entry?.default ?? null, final: entry?.final ?? null, exit: entry?.exit ?? null};
|
||||
if (
|
||||
!groupEditSafe(filters, draft.policy, entry) ||
|
||||
!routes.every(id => routeWritable(draft[routeKeys[id]], written[routeKeys[id]])) ||
|
||||
!nameKeys.every(key => routeWritable(draft[key], written[key])) ||
|
||||
(creating && draft.final !== null && excluded.has(draft.final))
|
||||
) {
|
||||
refuse(t('policy.editUnsafe'));
|
||||
@@ -292,7 +300,7 @@ export function useGroupDialog(input: Input): GroupDialogView {
|
||||
}
|
||||
const group = creating ? draft.name.trim() : draft.name;
|
||||
const update: GroupEntryUpdate = {filters, policy: draft.policy, ...(!creating ? {interrupt: draft.interrupt} : {})};
|
||||
for (const id of routes) Object.assign(update, {[routeKeys[id]]: nameText(draft[routeKeys[id]], written[routeKeys[id]])});
|
||||
for (const key of nameKeys) Object.assign(update, {[key]: nameText(draft[key], written[key])});
|
||||
if (retry?.kind === 'conflict') {
|
||||
refuse(t('policy.editReopen'));
|
||||
return;
|
||||
@@ -467,6 +475,17 @@ export function useGroupDialog(input: Input): GroupDialogView {
|
||||
};
|
||||
})
|
||||
: [],
|
||||
exit:
|
||||
draft && exitShown
|
||||
? {
|
||||
label: t('ui.aside', {text: t('groups.exit.label'), note: t('groups.exit.experimental')}),
|
||||
description: t('groups.exit.help'),
|
||||
searchLabel: t('nodes.search'),
|
||||
value: routeChoiceId(draft.exit),
|
||||
sections: exitSections(nodes, [routeValue(entry?.exit ?? null), draft.exit], t),
|
||||
change: choice => edit(prev => ({...prev, exit: routeChoiceValue(choice)}))
|
||||
}
|
||||
: null,
|
||||
show: (filters = []) => {
|
||||
session.next();
|
||||
setHistory([]);
|
||||
@@ -482,6 +501,7 @@ export function useGroupDialog(input: Input): GroupDialogView {
|
||||
filters: filters.map(filter => groupFilterDraft(filter)),
|
||||
default: null,
|
||||
final: null,
|
||||
exit: null,
|
||||
interrupt: null
|
||||
});
|
||||
else if (declared && !blocked)
|
||||
@@ -497,6 +517,7 @@ export function useGroupDialog(input: Input): GroupDialogView {
|
||||
).map(filter => groupFilterDraft(filter)),
|
||||
default: routeValue(declared.entry.default),
|
||||
final: routeValue(declared.entry.final),
|
||||
exit: routeValue(declared.entry.exit),
|
||||
interrupt: declared.entry.interrupt
|
||||
});
|
||||
},
|
||||
|
||||
@@ -2,7 +2,8 @@ import type {Capabilities} from '../../api/model';
|
||||
import {offered} from '../../api/capabilities';
|
||||
import type {SearchTarget} from '../../shell/routes';
|
||||
|
||||
// The group editor opens from a link with `new=1`; creating a group writes the main configuration.
|
||||
// The group editor opens from a link with `new=1`; creating a group writes the main configuration. The exit node is
|
||||
// one of its fields.
|
||||
export const policiesTargets = (resources: Capabilities['resources'] | undefined): SearchTarget[] =>
|
||||
offered(resources, 'groups', {whileLoading: false}) && resources?.config.writable === true
|
||||
? [{id: 'policies:new', titleKey: 'group.newGroup', parentKey: 'nav.policies', route: 'policies', params: {new: '1'}, aliases: ['group editor']}]
|
||||
|
||||
@@ -11,7 +11,7 @@ import type {MainSourceEdit} from '../../store/mainSource';
|
||||
import {memberHealth} from './health';
|
||||
import {actionErrorText, groupActionsReason, memberViews, policyCardView, selectionSummary, probeSummary, untestedHelp} from './view';
|
||||
import {useGroupDialog, type PolicyDeclaration} from './group/useGroupDialog';
|
||||
import type {OutboundCatalogue} from '../shared/groupText';
|
||||
import {routeValue, type OutboundCatalogue} from '../shared/groupText';
|
||||
import {useCheckEdit} from './useCheckEdit';
|
||||
import {toast} from '../../ui/ui';
|
||||
import {failureNotice, requestIdOf} from '../../api/error';
|
||||
@@ -119,6 +119,8 @@ export function usePolicyGroup(input: PolicyGroupInput) {
|
||||
if (input.editRequested && declared.editable && !declared.open) openRequested();
|
||||
}, [input.editRequested, declared.editable, declared.open]);
|
||||
const filters = useMemo(() => (declaration.owner && declaration.owner !== 'ambiguous' ? declaration.owner.entry.filters : []), [declaration.owner]);
|
||||
// The API leaves `exit` out of a group's configuration, so it is read from the declaration.
|
||||
const exit = declaration.owner && declaration.owner !== 'ambiguous' ? routeValue(declaration.owner.entry.exit) : null;
|
||||
const otherFilters = useMemo(() => filters.filter(filter => !recogniseInclude(filter)), [filters]);
|
||||
const named = useMemo(() => selectedIncludeLabels(filters, input.nodes ?? [], input.providers ?? [], lang), [filters, input.nodes, input.providers, lang]);
|
||||
const includes = {
|
||||
@@ -206,7 +208,7 @@ export function usePolicyGroup(input: PolicyGroupInput) {
|
||||
// the backend reports it. The interrupt switch edits the draft when present, otherwise the live group.
|
||||
details: card
|
||||
? {
|
||||
fields: card.fields,
|
||||
fields: exit ? [...card.fields, {label: t('groups.exit.label'), value: exit, nodeName: true}] : card.fields,
|
||||
heading: edit.editing ? t('policy.liveConfig') : null,
|
||||
reason: edit.editing ? null : (edit.tip ?? null),
|
||||
interrupt: card.interruptable
|
||||
|
||||
@@ -477,7 +477,10 @@ it('finds the one source that declares each group, and none when two entries do'
|
||||
|
||||
it('says why a group cannot be edited in the source that declares it', () => {
|
||||
const origin = {id: 'extra', path: '/etc/honk/extra.dae', writable: true} as ConfigSource;
|
||||
const owner = {entry: {name: 'media', written: 'media', filters: [], policy: null, default: null, final: null, interrupt: null, from: 1, to: 1}, origin};
|
||||
const owner = {
|
||||
entry: {name: 'media', written: 'media', filters: [], policy: null, default: null, final: null, exit: null, interrupt: null, from: 1, to: 1},
|
||||
origin
|
||||
};
|
||||
const state = {loaded: true, complete: true, error: null};
|
||||
expect(editBlocked(owner, state, t)).toBeNull();
|
||||
expect(editBlocked(owner, {...state, error: new LocalError('ui.groupNotLoaded')}, t)).toBe(t('ui.groupNotLoaded'));
|
||||
|
||||
@@ -73,10 +73,10 @@ it('offers edits only at writable sources and preserves source locations when pa
|
||||
const api = createMockApi();
|
||||
const [rules, config, flows, groups] = await Promise.all([api.rules(), api.config(), api.flows(), api.groups()]);
|
||||
const first = rules.rules[0];
|
||||
expect(first.source).toMatchObject({source_id: 'src-main', line: 150, column: 3});
|
||||
expect(first.source).toMatchObject({source_id: 'src-main', line: 151, column: 3});
|
||||
const view = dictionaryView(rules.rules, rules.generation_id, flows, config.sources, groups, t, 'en');
|
||||
expect(view.rows[0].position).toBe('config.dae:150');
|
||||
expect(view.rows[0].sourceQuery).toBe('tab=source&source=src-main&line=150');
|
||||
expect(view.rows[0].position).toBe('config.dae:151');
|
||||
expect(view.rows[0].sourceQuery).toBe('tab=source&source=src-main&line=151');
|
||||
expect(view.positions[0].id).toBe('end');
|
||||
expect(view.rows.at(-1)?.number).toBe('—');
|
||||
expect(view.rows.at(-1)?.removable).toBe(false);
|
||||
@@ -243,7 +243,7 @@ it('does not infer a source from its display name when the ID is unknown', async
|
||||
const explicit = {...rule, rule_id: 'explicit', source: {...rule.source!, file: 'config.dae', source_id: 'b'}};
|
||||
const view = dictionaryView([unknown, explicit], undefined, undefined, sources, [], t, 'en');
|
||||
expect(view.rows[0]).toMatchObject({sourceQuery: null, removable: false});
|
||||
expect(view.rows[1]).toMatchObject({sourceQuery: 'tab=source&source=b&line=150', removable: true});
|
||||
expect(view.rows[1]).toMatchObject({sourceQuery: 'tab=source&source=b&line=151', removable: true});
|
||||
});
|
||||
|
||||
it('tips why a rule cannot be added: no writable place first, then a change still being applied', () => {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import type {ConfigSource, Group, HealthObservation} from '../../api/model';
|
||||
import type {ConfigSource, Group, HealthObservation, Node} from '../../api/model';
|
||||
import {isWritableName, nestedIn, readGroupEntries, type GroupEntry} from '../../dae/groups';
|
||||
import {tunnelDialable} from '../../dae/nodes';
|
||||
import {unquote} from '../../dae/text';
|
||||
import {backendCode} from '../../i18n/backend';
|
||||
import {builtinOutboundNames} from '../../dae/vocab';
|
||||
import {formatLatency} from '../../i18n/format';
|
||||
import type {Key, Translator} from '../../i18n';
|
||||
@@ -109,6 +111,19 @@ export function finalSections(name: string, catalogue: OutboundCatalogue, held:
|
||||
{id: 'nodes', title: t('policy.pickNodes'), items: nodes}
|
||||
].filter(section => section.items.length);
|
||||
}
|
||||
// A group exit's choices: None, then each node name a proxy chain can tunnel through, as honk checks an exit. A name
|
||||
// several nodes share, or one the file cannot write, is listed but disabled.
|
||||
export function exitSections(nodes: readonly Node[], held: Array<string | null>, t: Translator): SearchSection[] {
|
||||
const byName = new Map<string, Node[]>();
|
||||
for (const node of nodes) byName.set(node.name, [...(byName.get(node.name) ?? []), node]);
|
||||
const items = [...byName]
|
||||
.filter(([, matches]) => matches.some(tunnelDialable))
|
||||
.map(([name, [node, ...more]]): SearchItem => {
|
||||
const problem = more.length ? backendCode('ambiguous-group-exit-target', t) : !isWritableName(name) ? t('nodes.proxyChain.unquotable') : null;
|
||||
return {id: routeChoiceId(name), label: name, nodeName: true, desc: problem ?? node.protocol ?? '—', isDisabled: !!problem};
|
||||
});
|
||||
return [noneFirst(items, held, t), {id: 'nodes', title: t('policy.pickNodes'), items}].filter(section => section.items.length);
|
||||
}
|
||||
// The default member's choices: None, then the group's direct members with the status their tiles show.
|
||||
export function memberSections(
|
||||
members: Array<{name: string; nodeName?: boolean; status: NodeStatus}>,
|
||||
|
||||
+5
-1
@@ -83,7 +83,11 @@ const known: Record<string, Key> = {
|
||||
'duplicate-subscription-entry': 'ui.backend.duplicateSubscriptionEntry',
|
||||
'invalid-chain-hop-reference': 'ui.backend.invalidChainHopReference',
|
||||
'ambiguous-chain-hop-reference': 'ui.backend.ambiguousChainHopReference',
|
||||
'unsupported-chain-hop': 'ui.backend.unsupportedChainHop'
|
||||
'unsupported-chain-hop': 'ui.backend.unsupportedChainHop',
|
||||
'invalid-group-exit-target': 'ui.backend.invalidGroupExitTarget',
|
||||
'ambiguous-group-exit-target': 'ui.backend.ambiguousGroupExitTarget',
|
||||
'unsupported-group-exit-target': 'ui.backend.unsupportedGroupExitTarget',
|
||||
'group-exit-route-too-long': 'ui.backend.groupExitRouteTooLong'
|
||||
};
|
||||
|
||||
const configurationRefusals = new Set(['permission_denied', 'capability_not_supported', 'temporarily_unavailable', 'invalid_request']);
|
||||
|
||||
@@ -857,6 +857,9 @@
|
||||
},
|
||||
"group.subscriptions": "Subscriptions",
|
||||
"group.takenName": "A group with this name already exists.",
|
||||
"groups.exit.experimental": "Experimental",
|
||||
"groups.exit.help": "Connections reach this node through the selected member and leave from it. It must be SOCKS5, Shadowsocks, Trojan, or VMess or VLESS without XHTTP. None leaves it unset.",
|
||||
"groups.exit.label": "Exit node",
|
||||
"hint.config": "Accepted config files, validation and editing",
|
||||
"hint.connections": "Live connections, grouped by device",
|
||||
"hint.dns": "Name resolution and cache contents",
|
||||
@@ -1144,6 +1147,7 @@
|
||||
"nodes.proxyChain.moveUp": "Move hop {n} up",
|
||||
"nodes.proxyChain.pickHop": "Choose a node",
|
||||
"nodes.proxyChain.protocol": "Proxy chain",
|
||||
"nodes.proxyChain.refreshRejected": "Update rejected: a proxy chain or group exit refers to a node this subscription removed or duplicated. The previous nodes stay in use.",
|
||||
"nodes.proxyChain.removeHop": "Remove hop {n}",
|
||||
"nodes.proxyChain.udp": "UDP",
|
||||
"nodes.proxyChain.udpDepends": "Depends on node settings",
|
||||
@@ -2169,6 +2173,7 @@
|
||||
"ui.back": "Back",
|
||||
"ui.backend.activationUnconfirmed": "The backend could not confirm whether the configuration is active",
|
||||
"ui.backend.ambiguousChainHopReference": "Several nodes share this proxy chain hop's name",
|
||||
"ui.backend.ambiguousGroupExitTarget": "Several nodes share this group exit's name",
|
||||
"ui.backend.assetTooLarge": "The downloaded file exceeds the size limit",
|
||||
"ui.backend.assetValidationFailed": "The new geodata file failed validation: it could not be read or lacks categories the rules use. The current files are kept",
|
||||
"ui.backend.authenticationRequired": "Authentication required",
|
||||
@@ -2183,6 +2188,7 @@
|
||||
"ui.backend.fetchFailed": "Could not fetch the subscription; the active nodes are kept",
|
||||
"ui.backend.flowExpired": "Flow record expired",
|
||||
"ui.backend.geodataUpdateFailed": "The geodata update failed",
|
||||
"ui.backend.groupExitRouteTooLong": "The route through this group's exits has more than 4 hops",
|
||||
"ui.backend.groupUnavailable": "The download route's group is missing or has no usable node. Choose another route",
|
||||
"ui.backend.httpFailed": "The HTTP transfer failed. Try again",
|
||||
"ui.backend.httpNotFound": "The server has no file at this URL (HTTP 404). Check the URL",
|
||||
@@ -2191,6 +2197,7 @@
|
||||
"ui.backend.interfaceWatcherDisabled": "The interface watcher is not running, so interface changes apply after a restart",
|
||||
"ui.backend.invalidChainHopReference": "No node has this proxy chain hop's name",
|
||||
"ui.backend.invalidCredentials": "Invalid credentials",
|
||||
"ui.backend.invalidGroupExitTarget": "No node has this group exit's name",
|
||||
"ui.backend.invalidRequest": "Invalid request",
|
||||
"ui.backend.invalidSource": "No usable download URL: the list is empty or a URL is malformed. Check the sources",
|
||||
"ui.backend.legacyConfigWarning": "Legacy configuration warning",
|
||||
@@ -2237,6 +2244,7 @@
|
||||
"ui.backend.tlsFailed": "The TLS handshake with the server failed. Check the URL and the system clock, or use another route",
|
||||
"ui.backend.udpTraceUnavailable": "Kernel UDP tracing is unavailable, so recorded UDP flows may lack kernel route details",
|
||||
"ui.backend.unsupportedChainHop": "This node cannot be a proxy chain hop at this position",
|
||||
"ui.backend.unsupportedGroupExitTarget": "This node cannot be a group exit",
|
||||
"ui.backend.unsupportedMediaType": "Unsupported media type",
|
||||
"ui.backend.unsupportedValue": "Unsupported value",
|
||||
"ui.backendMessage": "Backend message: {message}",
|
||||
|
||||
@@ -737,6 +737,9 @@
|
||||
"group.subscriptionCount": "{name},{n} 个节点",
|
||||
"group.subscriptions": "订阅",
|
||||
"group.takenName": "已有同名的组。",
|
||||
"groups.exit.experimental": "实验性",
|
||||
"groups.exit.help": "连接先经所选成员到达此节点,再由此节点连至目的地。须为 SOCKS5、Shadowsocks、Trojan,或未使用 XHTTP 的 VMess、VLESS。未选择节点时不设置出口。",
|
||||
"groups.exit.label": "出口节点",
|
||||
"hint.config": "生效的配置文件、校验与编辑",
|
||||
"hint.connections": "当前的连接,按设备分组",
|
||||
"hint.dns": "域名解析与缓存内容",
|
||||
@@ -991,6 +994,7 @@
|
||||
"nodes.proxyChain.moveUp": "上移跃点 {n}",
|
||||
"nodes.proxyChain.pickHop": "选择节点",
|
||||
"nodes.proxyChain.protocol": "代理链",
|
||||
"nodes.proxyChain.refreshRejected": "已拒绝更新:代理链或组出口引用的节点在此订阅中已移除或重名。仍沿用先前的节点。",
|
||||
"nodes.proxyChain.removeHop": "移除跃点 {n}",
|
||||
"nodes.proxyChain.udp": "UDP",
|
||||
"nodes.proxyChain.udpDepends": "取决于节点设置",
|
||||
@@ -1953,6 +1957,7 @@
|
||||
"ui.back": "返回",
|
||||
"ui.backend.activationUnconfirmed": "后端无法确认配置是否已生效",
|
||||
"ui.backend.ambiguousChainHopReference": "多个节点与此代理链跃点同名",
|
||||
"ui.backend.ambiguousGroupExitTarget": "多个节点与此组出口同名",
|
||||
"ui.backend.assetTooLarge": "下载的文件超过大小上限",
|
||||
"ui.backend.assetValidationFailed": "新的地理数据文件未通过校验:文件无法解析,或缺少规则使用的分类。已沿用当前的文件",
|
||||
"ui.backend.authenticationRequired": "需要验证身份",
|
||||
@@ -1967,6 +1972,7 @@
|
||||
"ui.backend.fetchFailed": "无法下载订阅,沿用当前节点",
|
||||
"ui.backend.flowExpired": "流程记录已过期",
|
||||
"ui.backend.geodataUpdateFailed": "地理数据更新失败",
|
||||
"ui.backend.groupExitRouteTooLong": "经由组出口的路由超过 4 个跃点",
|
||||
"ui.backend.groupUnavailable": "下载路由指定的组不存在或没有可用节点。请改选其他下载路由",
|
||||
"ui.backend.httpFailed": "HTTP 传输失败,请重试",
|
||||
"ui.backend.httpNotFound": "服务器上没有此网址的文件(HTTP 404)。请检查网址",
|
||||
@@ -1975,6 +1981,7 @@
|
||||
"ui.backend.interfaceWatcherDisabled": "接口监视未运行,接口变更需重启后生效",
|
||||
"ui.backend.invalidChainHopReference": "找不到与此代理链跃点同名的节点",
|
||||
"ui.backend.invalidCredentials": "凭据无效",
|
||||
"ui.backend.invalidGroupExitTarget": "找不到与此组出口同名的节点",
|
||||
"ui.backend.invalidRequest": "请求内容无效",
|
||||
"ui.backend.invalidSource": "没有可用的下载网址:列表为空或网址格式有误。请检查来源",
|
||||
"ui.backend.legacyConfigWarning": "旧版配置警告",
|
||||
@@ -2021,6 +2028,7 @@
|
||||
"ui.backend.tlsFailed": "与服务器的 TLS 握手失败。请检查网址与系统时间,或改用其他下载路由",
|
||||
"ui.backend.udpTraceUnavailable": "内核 UDP 跟踪不可用,记录的 UDP 流程可能缺少内核路由信息",
|
||||
"ui.backend.unsupportedChainHop": "此节点不可作为代理链中此位置的跃点",
|
||||
"ui.backend.unsupportedGroupExitTarget": "此节点不可作为组出口",
|
||||
"ui.backend.unsupportedMediaType": "不支持此媒体类型",
|
||||
"ui.backend.unsupportedValue": "不支持此设置值",
|
||||
"ui.backendMessage": "后端消息:{message}",
|
||||
|
||||
@@ -737,6 +737,9 @@
|
||||
"group.subscriptionCount": "{name},{n} 個節點",
|
||||
"group.subscriptions": "訂閱",
|
||||
"group.takenName": "已有同名的群組。",
|
||||
"groups.exit.experimental": "實驗性",
|
||||
"groups.exit.help": "連線先經所選成員抵達此節點,再由此節點連至目的地。須為 SOCKS5、Shadowsocks、Trojan,或未使用 XHTTP 的 VMess、VLESS。未選擇節點時不設定出口。",
|
||||
"groups.exit.label": "出口節點",
|
||||
"hint.config": "生效的設定檔、驗證與編輯",
|
||||
"hint.connections": "目前的連線,依裝置分組",
|
||||
"hint.dns": "網域解析與快取內容",
|
||||
@@ -991,6 +994,7 @@
|
||||
"nodes.proxyChain.moveUp": "上移跳點 {n}",
|
||||
"nodes.proxyChain.pickHop": "選擇節點",
|
||||
"nodes.proxyChain.protocol": "代理鏈",
|
||||
"nodes.proxyChain.refreshRejected": "已拒絕更新:代理鏈或群組出口引用的節點在此訂閱中已移除或重名。仍沿用先前的節點。",
|
||||
"nodes.proxyChain.removeHop": "移除跳點 {n}",
|
||||
"nodes.proxyChain.udp": "UDP",
|
||||
"nodes.proxyChain.udpDepends": "取決於節點設定",
|
||||
@@ -1953,6 +1957,7 @@
|
||||
"ui.back": "返回",
|
||||
"ui.backend.activationUnconfirmed": "後端無法確認組態是否已生效",
|
||||
"ui.backend.ambiguousChainHopReference": "多個節點與此代理鏈跳點同名",
|
||||
"ui.backend.ambiguousGroupExitTarget": "多個節點與此群組出口同名",
|
||||
"ui.backend.assetTooLarge": "下載的檔案超過大小上限",
|
||||
"ui.backend.assetValidationFailed": "新的地理資料檔未通過驗證:檔案無法解析,或缺少規則使用的分類。已沿用目前的檔案",
|
||||
"ui.backend.authenticationRequired": "需要驗證身分",
|
||||
@@ -1967,6 +1972,7 @@
|
||||
"ui.backend.fetchFailed": "無法下載訂閱,沿用目前的節點",
|
||||
"ui.backend.flowExpired": "流程記錄已過期",
|
||||
"ui.backend.geodataUpdateFailed": "地理資料更新失敗",
|
||||
"ui.backend.groupExitRouteTooLong": "經由群組出口的路由超過 4 個跳點",
|
||||
"ui.backend.groupUnavailable": "下載路由指定的群組不存在或沒有可用節點。請改選其他下載路由",
|
||||
"ui.backend.httpFailed": "HTTP 傳輸失敗,請重試",
|
||||
"ui.backend.httpNotFound": "伺服器上沒有此網址的檔案(HTTP 404)。請檢查網址",
|
||||
@@ -1975,6 +1981,7 @@
|
||||
"ui.backend.interfaceWatcherDisabled": "介面監視未執行,介面變更需重新啟動後生效",
|
||||
"ui.backend.invalidChainHopReference": "找不到與此代理鏈跳點同名的節點",
|
||||
"ui.backend.invalidCredentials": "憑證無效",
|
||||
"ui.backend.invalidGroupExitTarget": "找不到與此群組出口同名的節點",
|
||||
"ui.backend.invalidRequest": "請求內容無效",
|
||||
"ui.backend.invalidSource": "沒有可用的下載網址:清單為空或網址格式有誤。請檢查來源",
|
||||
"ui.backend.legacyConfigWarning": "舊版組態警告",
|
||||
@@ -2021,6 +2028,7 @@
|
||||
"ui.backend.tlsFailed": "與伺服器的 TLS 交握失敗。請檢查網址與系統時間,或改用其他下載路由",
|
||||
"ui.backend.udpTraceUnavailable": "核心 UDP 追蹤無法使用,記錄的 UDP 流程可能缺少核心路由資訊",
|
||||
"ui.backend.unsupportedChainHop": "此節點不可作為代理鏈中此位置的跳點",
|
||||
"ui.backend.unsupportedGroupExitTarget": "此節點不可作為群組出口",
|
||||
"ui.backend.unsupportedMediaType": "不支援此媒體類型",
|
||||
"ui.backend.unsupportedValue": "不支援此設定值",
|
||||
"ui.backendMessage": "後端訊息:{message}",
|
||||
|
||||
Reference in new issue
Block a user