feat(clients): append external links in bulk adjustments (#6948)

The Links tab of the client editor was the only way to give a client external share links or subscriptions, and it replaces the whole list, one client at a time (#6816).

Add an "Append external links" tab to Bulk Adjust: the same links are appended to every selected client, existing ones stay, and a link a client already has is skipped. The request is exclusive with the other adjustments. clientRecordsByEmail no longer accumulates WHERE clauses across chunks, which reported clients past the first 400 as not found. Share links are validated with the now-async link parser.
This commit is contained in:
Hamed
2026-11-24 17:51:49 +03:30
committed by GitHub
parent e409ed7244
commit 447b2d036a
43 changed files with 1910 additions and 365 deletions
+26 -5
View File
@@ -133,9 +133,19 @@ _openapi:
"xtls-rprx-vision"/"xtls-rprx-vision-udp443" set it where the inbound
supports it (omit or "" to leave it unchanged). The optional limitHwid
sets maximum registered devices (0 = unlimited). The optional adTag sets
MTProto Telegram sponsor channel ("none" clears). Returns the adjusted
count and per-email skip reasons.'
url: '#shift-expiry-andor-traffic-quota-for-many-clients-in-one-call-adddaysaddbytes-may-be-negative-clients-with-unlimited-expiry-expirytime0-or-unlimited-traffic-totalgb0-are-skipped-for-the-corresponding-field--bulk-extend-never-converts-unlimited-to-limited-a-client-that-was-auto-disabled-solely-because-it-was-depleted-expired-or-over-quota-is-automatically-re-enabled--locally-and-on-its-node--when-the-adjustment-lifts-it-out-of-depletion-a-manually-disabled-or-still-depleted-client-is-left-disabled-the-optional-flow-directive-sets-the-xtls-flow-on-every-client-none-clears-it-xtls-rprx-visionxtls-rprx-vision-udp443-set-it-where-the-inbound-supports-it-omit-or--to-leave-it-unchanged-the-optional-limithwid-sets-maximum-registered-devices-0--unlimited-the-optional-adtag-sets-mtproto-telegram-sponsor-channel-none-clears-returns-the-adjusted-count-and-per-email-skip-reasons'
MTProto Telegram sponsor channel ("none" clears). Alternatively, send
externalLinks to append external share links and http(s) subscriptions
to each selected client in one transaction. This mode cannot be combined
with other adjustments. Existing entries, metadata, and ordering are
preserved. Duplicates match (kind, value) per client, including repeated
input rows; the first entry wins. Missing clients are not written and
appear in skipped. externalLinks.added counts inserted rows,
externalLinks.skipped counts duplicate rows across found clients,
externalLinks.errors counts missing clients, and adjusted counts clients
receiving at least one new row. Validation or database failure aborts
the whole append without writes. Repeating an append is idempotent and
does not restart Xray.'
url: '#shift-expiry-andor-traffic-quota-for-many-clients-in-one-call-adddaysaddbytes-may-be-negative-clients-with-unlimited-expiry-expirytime0-or-unlimited-traffic-totalgb0-are-skipped-for-the-corresponding-field--bulk-extend-never-converts-unlimited-to-limited-a-client-that-was-auto-disabled-solely-because-it-was-depleted-expired-or-over-quota-is-automatically-re-enabled--locally-and-on-its-node--when-the-adjustment-lifts-it-out-of-depletion-a-manually-disabled-or-still-depleted-client-is-left-disabled-the-optional-flow-directive-sets-the-xtls-flow-on-every-client-none-clears-it-xtls-rprx-visionxtls-rprx-vision-udp443-set-it-where-the-inbound-supports-it-omit-or--to-leave-it-unchanged-the-optional-limithwid-sets-maximum-registered-devices-0--unlimited-the-optional-adtag-sets-mtproto-telegram-sponsor-channel-none-clears-alternatively-send-externallinks-to-append-external-share-links-and-https-subscriptions-to-each-selected-client-in-one-transaction-this-mode-cannot-be-combined-with-other-adjustments-existing-entries-metadata-and-ordering-are-preserved-duplicates-match-kind-value-per-client-including-repeated-input-rows-the-first-entry-wins-missing-clients-are-not-written-and-appear-in-skipped-externallinksadded-counts-inserted-rows-externallinksskipped-counts-duplicate-rows-across-found-clients-externallinkserrors-counts-missing-clients-and-adjusted-counts-clients-receiving-at-least-one-new-row-validation-or-database-failure-aborts-the-whole-append-without-writes-repeating-an-append-is-idempotent-and-does-not-restart-xray'
- depth: 2
title: Enable many clients in one call. Emails are grouped by inbound and
applied with a single read-modify-write per inbound; the running Xray
@@ -428,8 +438,19 @@ _openapi:
the inbound supports it (omit or "" to leave it unchanged). The
optional limitHwid sets maximum registered devices (0 = unlimited).
The optional adTag sets MTProto Telegram sponsor channel ("none"
clears). Returns the adjusted count and per-email skip reasons.'
id: shift-expiry-andor-traffic-quota-for-many-clients-in-one-call-adddaysaddbytes-may-be-negative-clients-with-unlimited-expiry-expirytime0-or-unlimited-traffic-totalgb0-are-skipped-for-the-corresponding-field--bulk-extend-never-converts-unlimited-to-limited-a-client-that-was-auto-disabled-solely-because-it-was-depleted-expired-or-over-quota-is-automatically-re-enabled--locally-and-on-its-node--when-the-adjustment-lifts-it-out-of-depletion-a-manually-disabled-or-still-depleted-client-is-left-disabled-the-optional-flow-directive-sets-the-xtls-flow-on-every-client-none-clears-it-xtls-rprx-visionxtls-rprx-vision-udp443-set-it-where-the-inbound-supports-it-omit-or--to-leave-it-unchanged-the-optional-limithwid-sets-maximum-registered-devices-0--unlimited-the-optional-adtag-sets-mtproto-telegram-sponsor-channel-none-clears-returns-the-adjusted-count-and-per-email-skip-reasons
clears). Alternatively, send externalLinks to append external share
links and http(s) subscriptions to each selected client in one
transaction. This mode cannot be combined with other adjustments.
Existing entries, metadata, and ordering are preserved. Duplicates
match (kind, value) per client, including repeated input rows; the
first entry wins. Missing clients are not written and appear in
skipped. externalLinks.added counts inserted rows,
externalLinks.skipped counts duplicate rows across found clients,
externalLinks.errors counts missing clients, and adjusted counts
clients receiving at least one new row. Validation or database failure
aborts the whole append without writes. Repeating an append is
idempotent and does not restart Xray.'
id: shift-expiry-andor-traffic-quota-for-many-clients-in-one-call-adddaysaddbytes-may-be-negative-clients-with-unlimited-expiry-expirytime0-or-unlimited-traffic-totalgb0-are-skipped-for-the-corresponding-field--bulk-extend-never-converts-unlimited-to-limited-a-client-that-was-auto-disabled-solely-because-it-was-depleted-expired-or-over-quota-is-automatically-re-enabled--locally-and-on-its-node--when-the-adjustment-lifts-it-out-of-depletion-a-manually-disabled-or-still-depleted-client-is-left-disabled-the-optional-flow-directive-sets-the-xtls-flow-on-every-client-none-clears-it-xtls-rprx-visionxtls-rprx-vision-udp443-set-it-where-the-inbound-supports-it-omit-or--to-leave-it-unchanged-the-optional-limithwid-sets-maximum-registered-devices-0--unlimited-the-optional-adtag-sets-mtproto-telegram-sponsor-channel-none-clears-alternatively-send-externallinks-to-append-external-share-links-and-https-subscriptions-to-each-selected-client-in-one-transaction-this-mode-cannot-be-combined-with-other-adjustments-existing-entries-metadata-and-ordering-are-preserved-duplicates-match-kind-value-per-client-including-repeated-input-rows-the-first-entry-wins-missing-clients-are-not-written-and-appear-in-skipped-externallinksadded-counts-inserted-rows-externallinksskipped-counts-duplicate-rows-across-found-clients-externallinkserrors-counts-missing-clients-and-adjusted-counts-clients-receiving-at-least-one-new-row-validation-or-database-failure-aborts-the-whole-append-without-writes-repeating-an-append-is-idempotent-and-does-not-restart-xray
- content: Enable many clients in one call. Emails are grouped by inbound and
applied with a single read-modify-write per inbound; the running Xray
(local or remote node) is updated to add each user. Note that enabling
+159 -14
View File
@@ -1758,6 +1758,73 @@
],
"type": "object"
},
"BulkAdjustReport": {
"properties": {
"email": {
"example": "carol",
"type": "string"
},
"reason": {
"example": "client not found",
"type": "string"
}
},
"required": [
"email",
"reason"
],
"type": "object"
},
"BulkAdjustResult": {
"description": "BulkAdjustResult reports changed clients and per-client skip reasons.\nExternalLinks contains row counts only for append requests.",
"properties": {
"adjusted": {
"example": 2,
"type": "integer"
},
"externalLinks": {
"allOf": [
{
"$ref": "#/components/schemas/BulkExternalLinksResult"
}
],
"nullable": true
},
"skipped": {
"example": [],
"items": {
"$ref": "#/components/schemas/BulkAdjustReport"
},
"type": "array"
}
},
"required": [
"adjusted"
],
"type": "object"
},
"BulkExternalLinksResult": {
"properties": {
"added": {
"example": 4,
"type": "integer"
},
"errors": {
"example": 0,
"type": "integer"
},
"skipped": {
"example": 0,
"type": "integer"
}
},
"required": [
"added",
"errors",
"skipped"
],
"type": "object"
},
"Client": {
"description": "Client represents a client configuration for Xray inbounds with traffic limits and settings.",
"properties": {
@@ -2566,6 +2633,40 @@
],
"type": "object"
},
"ExternalLinkInput": {
"description": "ExternalLinkInput is one row from the client form's Links tab.",
"properties": {
"enable": {
"example": true,
"nullable": true,
"type": "boolean"
},
"expiryTime": {
"example": 0,
"format": "int64",
"type": "integer"
},
"kind": {
"example": "link",
"type": "string"
},
"namePrefix": {
"type": "string"
},
"remark": {
"example": "Backup",
"type": "string"
},
"value": {
"example": "vless://uuid@example.com:443",
"type": "string"
}
},
"required": [
"value"
],
"type": "object"
},
"FallbackParentInfo": {
"description": "FallbackParentInfo carries everything the frontend needs to rewrite a\nchild inbound's client link: where to connect (the master's address\nand port) and which path matched on the master's fallbacks array.\nThe frontend already has the master inbound in its dbInbounds list,\nso we only ship identifiers + the match path here.",
"properties": {
@@ -9781,25 +9882,71 @@
"tags": [
"Clients"
],
"summary": "Shift expiry and/or traffic quota for many clients in one call. addDays/addBytes may be negative. Clients with unlimited expiry (expiryTime=0) or unlimited traffic (totalGB=0) are skipped for the corresponding field — bulk extend never converts unlimited to limited. A client that was auto-disabled solely because it was depleted (expired or over quota) is automatically re-enabled — locally and on its node — when the adjustment lifts it out of depletion; a manually-disabled or still-depleted client is left disabled. The optional flow directive sets the XTLS flow on every client: \"none\" clears it, \"xtls-rprx-vision\"/\"xtls-rprx-vision-udp443\" set it where the inbound supports it (omit or \"\" to leave it unchanged). The optional limitHwid sets maximum registered devices (0 = unlimited). The optional adTag sets MTProto Telegram sponsor channel (\"none\" clears). Returns the adjusted count and per-email skip reasons.",
"summary": "Shift expiry and/or traffic quota for many clients in one call. addDays/addBytes may be negative. Clients with unlimited expiry (expiryTime=0) or unlimited traffic (totalGB=0) are skipped for the corresponding field — bulk extend never converts unlimited to limited. A client that was auto-disabled solely because it was depleted (expired or over quota) is automatically re-enabled — locally and on its node — when the adjustment lifts it out of depletion; a manually-disabled or still-depleted client is left disabled. The optional flow directive sets the XTLS flow on every client: \"none\" clears it, \"xtls-rprx-vision\"/\"xtls-rprx-vision-udp443\" set it where the inbound supports it (omit or \"\" to leave it unchanged). The optional limitHwid sets maximum registered devices (0 = unlimited). The optional adTag sets MTProto Telegram sponsor channel (\"none\" clears). Alternatively, send externalLinks to append external share links and http(s) subscriptions to each selected client in one transaction. This mode cannot be combined with other adjustments. Existing entries, metadata, and ordering are preserved. Duplicates match (kind, value) per client, including repeated input rows; the first entry wins. Missing clients are not written and appear in skipped. externalLinks.added counts inserted rows, externalLinks.skipped counts duplicate rows across found clients, externalLinks.errors counts missing clients, and adjusted counts clients receiving at least one new row. Validation or database failure aborts the whole append without writes. Repeating an append is idempotent and does not restart Xray.",
"operationId": "post_panel_api_clients_bulkAdjust",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object"
"type": "object",
"required": [
"emails"
],
"properties": {
"emails": {
"type": "array",
"items": {
"type": "string"
},
"minItems": 1
},
"addDays": {
"type": "integer"
},
"addBytes": {
"type": "integer"
},
"flow": {
"type": "string"
},
"limitHwid": {
"type": "integer",
"minimum": 0
},
"adTag": {
"type": "string"
},
"externalLinks": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/components/schemas/ExternalLinkInput"
}
}
}
},
"example": {
"emails": [
"alice",
"bob"
],
"addDays": 30,
"addBytes": 53687091200,
"flow": "xtls-rprx-vision",
"limitHwid": 2,
"adTag": "0123456789abcdef0123456789abcdef"
"externalLinks": [
{
"kind": "link",
"value": "vless://uuid@example.com:443",
"remark": "Backup",
"enable": true,
"expiryTime": 0
},
{
"kind": "subscription",
"value": "https://provider.example/sub",
"namePrefix": "[provider] ",
"enable": true,
"expiryTime": 0
}
]
}
}
}
@@ -9818,19 +9965,17 @@
"msg": {
"type": "string"
},
"obj": {}
"obj": {
"$ref": "#/components/schemas/BulkAdjustResult"
}
}
},
"example": {
"success": true,
"obj": {
"adjusted": 2,
"skipped": [
{
"email": "carol",
"reason": "unlimited expiry"
}
]
"externalLinks": null,
"skipped": []
}
}
}
+159 -14
View File
@@ -1758,6 +1758,73 @@
],
"type": "object"
},
"BulkAdjustReport": {
"properties": {
"email": {
"example": "carol",
"type": "string"
},
"reason": {
"example": "client not found",
"type": "string"
}
},
"required": [
"email",
"reason"
],
"type": "object"
},
"BulkAdjustResult": {
"description": "BulkAdjustResult reports changed clients and per-client skip reasons.\nExternalLinks contains row counts only for append requests.",
"properties": {
"adjusted": {
"example": 2,
"type": "integer"
},
"externalLinks": {
"allOf": [
{
"$ref": "#/components/schemas/BulkExternalLinksResult"
}
],
"nullable": true
},
"skipped": {
"example": [],
"items": {
"$ref": "#/components/schemas/BulkAdjustReport"
},
"type": "array"
}
},
"required": [
"adjusted"
],
"type": "object"
},
"BulkExternalLinksResult": {
"properties": {
"added": {
"example": 4,
"type": "integer"
},
"errors": {
"example": 0,
"type": "integer"
},
"skipped": {
"example": 0,
"type": "integer"
}
},
"required": [
"added",
"errors",
"skipped"
],
"type": "object"
},
"Client": {
"description": "Client represents a client configuration for Xray inbounds with traffic limits and settings.",
"properties": {
@@ -2566,6 +2633,40 @@
],
"type": "object"
},
"ExternalLinkInput": {
"description": "ExternalLinkInput is one row from the client form's Links tab.",
"properties": {
"enable": {
"example": true,
"nullable": true,
"type": "boolean"
},
"expiryTime": {
"example": 0,
"format": "int64",
"type": "integer"
},
"kind": {
"example": "link",
"type": "string"
},
"namePrefix": {
"type": "string"
},
"remark": {
"example": "Backup",
"type": "string"
},
"value": {
"example": "vless://uuid@example.com:443",
"type": "string"
}
},
"required": [
"value"
],
"type": "object"
},
"FallbackParentInfo": {
"description": "FallbackParentInfo carries everything the frontend needs to rewrite a\nchild inbound's client link: where to connect (the master's address\nand port) and which path matched on the master's fallbacks array.\nThe frontend already has the master inbound in its dbInbounds list,\nso we only ship identifiers + the match path here.",
"properties": {
@@ -9781,25 +9882,71 @@
"tags": [
"Clients"
],
"summary": "Shift expiry and/or traffic quota for many clients in one call. addDays/addBytes may be negative. Clients with unlimited expiry (expiryTime=0) or unlimited traffic (totalGB=0) are skipped for the corresponding field — bulk extend never converts unlimited to limited. A client that was auto-disabled solely because it was depleted (expired or over quota) is automatically re-enabled — locally and on its node — when the adjustment lifts it out of depletion; a manually-disabled or still-depleted client is left disabled. The optional flow directive sets the XTLS flow on every client: \"none\" clears it, \"xtls-rprx-vision\"/\"xtls-rprx-vision-udp443\" set it where the inbound supports it (omit or \"\" to leave it unchanged). The optional limitHwid sets maximum registered devices (0 = unlimited). The optional adTag sets MTProto Telegram sponsor channel (\"none\" clears). Returns the adjusted count and per-email skip reasons.",
"summary": "Shift expiry and/or traffic quota for many clients in one call. addDays/addBytes may be negative. Clients with unlimited expiry (expiryTime=0) or unlimited traffic (totalGB=0) are skipped for the corresponding field — bulk extend never converts unlimited to limited. A client that was auto-disabled solely because it was depleted (expired or over quota) is automatically re-enabled — locally and on its node — when the adjustment lifts it out of depletion; a manually-disabled or still-depleted client is left disabled. The optional flow directive sets the XTLS flow on every client: \"none\" clears it, \"xtls-rprx-vision\"/\"xtls-rprx-vision-udp443\" set it where the inbound supports it (omit or \"\" to leave it unchanged). The optional limitHwid sets maximum registered devices (0 = unlimited). The optional adTag sets MTProto Telegram sponsor channel (\"none\" clears). Alternatively, send externalLinks to append external share links and http(s) subscriptions to each selected client in one transaction. This mode cannot be combined with other adjustments. Existing entries, metadata, and ordering are preserved. Duplicates match (kind, value) per client, including repeated input rows; the first entry wins. Missing clients are not written and appear in skipped. externalLinks.added counts inserted rows, externalLinks.skipped counts duplicate rows across found clients, externalLinks.errors counts missing clients, and adjusted counts clients receiving at least one new row. Validation or database failure aborts the whole append without writes. Repeating an append is idempotent and does not restart Xray.",
"operationId": "post_panel_api_clients_bulkAdjust",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object"
"type": "object",
"required": [
"emails"
],
"properties": {
"emails": {
"type": "array",
"items": {
"type": "string"
},
"minItems": 1
},
"addDays": {
"type": "integer"
},
"addBytes": {
"type": "integer"
},
"flow": {
"type": "string"
},
"limitHwid": {
"type": "integer",
"minimum": 0
},
"adTag": {
"type": "string"
},
"externalLinks": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/components/schemas/ExternalLinkInput"
}
}
}
},
"example": {
"emails": [
"alice",
"bob"
],
"addDays": 30,
"addBytes": 53687091200,
"flow": "xtls-rprx-vision",
"limitHwid": 2,
"adTag": "0123456789abcdef0123456789abcdef"
"externalLinks": [
{
"kind": "link",
"value": "vless://uuid@example.com:443",
"remark": "Backup",
"enable": true,
"expiryTime": 0
},
{
"kind": "subscription",
"value": "https://provider.example/sub",
"namePrefix": "[provider] ",
"enable": true,
"expiryTime": 0
}
]
}
}
}
@@ -9818,19 +9965,17 @@
"msg": {
"type": "string"
},
"obj": {}
"obj": {
"$ref": "#/components/schemas/BulkAdjustResult"
}
}
},
"example": {
"success": true,
"obj": {
"adjusted": 2,
"skipped": [
{
"email": "carol",
"reason": "unlimited expiry"
}
]
"externalLinks": null,
"skipped": []
}
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
export { FormField, type FormFieldProps } from './FormField';
export { rhfZodValidate } from './rhfZodValidate';
export { rhfZodValidate, rhfZodValidateAsync } from './rhfZodValidate';
export { normalizeAntdOnChange, type ValueProp } from './normalizeAntdOnChange';
export { toDotted, type FieldName } from './toDotted';
@@ -7,3 +7,11 @@ export function rhfZodValidate<S extends z.ZodType>(schema: S) {
return result.error.issues[0]?.message ?? 'validation.invalid';
};
}
export function rhfZodValidateAsync<S extends z.ZodType>(schema: S) {
return async (value: unknown): Promise<string | true> => {
const result = await schema.safeParseAsync(value);
if (result.success) return true;
return result.error.issues[0]?.message ?? 'validation.invalid';
};
}
+22
View File
@@ -422,6 +422,20 @@ export const EXAMPLES: Record<string, unknown> = {
"code": "tools",
"detail": "awg"
},
"BulkAdjustReport": {
"email": "carol",
"reason": "client not found"
},
"BulkAdjustResult": {
"adjusted": 2,
"externalLinks": null,
"skipped": []
},
"BulkExternalLinksResult": {
"added": 4,
"errors": 0,
"skipped": 0
},
"Client": {
"adTag": "0123456789abcdef0123456789abcdef",
"allowedIPs": [
@@ -636,6 +650,14 @@ export const EXAMPLES: Record<string, unknown> = {
"onlineCount": 1,
"total": 2000
},
"ExternalLinkInput": {
"enable": true,
"expiryTime": 0,
"kind": "link",
"namePrefix": "",
"remark": "Backup",
"value": "vless://uuid@example.com:443"
},
"FallbackParentInfo": {
"masterId": 0,
"path": ""
+101
View File
@@ -1732,6 +1732,73 @@ export const SCHEMAS: Record<string, unknown> = {
],
"type": "object"
},
"BulkAdjustReport": {
"properties": {
"email": {
"example": "carol",
"type": "string"
},
"reason": {
"example": "client not found",
"type": "string"
}
},
"required": [
"email",
"reason"
],
"type": "object"
},
"BulkAdjustResult": {
"description": "BulkAdjustResult reports changed clients and per-client skip reasons.\nExternalLinks contains row counts only for append requests.",
"properties": {
"adjusted": {
"example": 2,
"type": "integer"
},
"externalLinks": {
"allOf": [
{
"$ref": "#/components/schemas/BulkExternalLinksResult"
}
],
"nullable": true
},
"skipped": {
"example": [],
"items": {
"$ref": "#/components/schemas/BulkAdjustReport"
},
"type": "array"
}
},
"required": [
"adjusted"
],
"type": "object"
},
"BulkExternalLinksResult": {
"properties": {
"added": {
"example": 4,
"type": "integer"
},
"errors": {
"example": 0,
"type": "integer"
},
"skipped": {
"example": 0,
"type": "integer"
}
},
"required": [
"added",
"errors",
"skipped"
],
"type": "object"
},
"Client": {
"description": "Client represents a client configuration for Xray inbounds with traffic limits and settings.",
"properties": {
@@ -2540,6 +2607,40 @@ export const SCHEMAS: Record<string, unknown> = {
],
"type": "object"
},
"ExternalLinkInput": {
"description": "ExternalLinkInput is one row from the client form's Links tab.",
"properties": {
"enable": {
"example": true,
"nullable": true,
"type": "boolean"
},
"expiryTime": {
"example": 0,
"format": "int64",
"type": "integer"
},
"kind": {
"example": "link",
"type": "string"
},
"namePrefix": {
"type": "string"
},
"remark": {
"example": "Backup",
"type": "string"
},
"value": {
"example": "vless://uuid@example.com:443",
"type": "string"
}
},
"required": [
"value"
],
"type": "object"
},
"FallbackParentInfo": {
"description": "FallbackParentInfo carries everything the frontend needs to rewrite a\nchild inbound's client link: where to connect (the master's address\nand port) and which path matched on the master's fallbacks array.\nThe frontend already has the master inbound in its dbInbounds list,\nso we only ship identifiers + the match path here.",
"properties": {
+26
View File
@@ -422,6 +422,23 @@ export interface Blocker {
detail?: string;
}
export interface BulkAdjustReport {
email: string;
reason: string;
}
export interface BulkAdjustResult {
adjusted: number;
externalLinks?: BulkExternalLinksResult | null;
skipped?: BulkAdjustReport[];
}
export interface BulkExternalLinksResult {
added: number;
errors: number;
skipped: number;
}
export interface Client {
adTag?: string;
allowedIPs?: string[];
@@ -590,6 +607,15 @@ export interface ClientsSummary {
total: number;
}
export interface ExternalLinkInput {
enable?: boolean | null;
expiryTime?: number;
kind?: string;
namePrefix?: string;
remark?: string;
value: string;
}
export interface FallbackParentInfo {
masterId: number;
path?: string;
+30
View File
@@ -446,6 +446,26 @@ export const BlockerSchema = z.object({
});
export type Blocker = z.infer<typeof BlockerSchema>;
export const BulkAdjustReportSchema = z.object({
email: z.string(),
reason: z.string(),
});
export type BulkAdjustReport = z.infer<typeof BulkAdjustReportSchema>;
export const BulkAdjustResultSchema = z.object({
adjusted: z.number().int(),
externalLinks: z.lazy(() => BulkExternalLinksResultSchema).nullable().optional(),
skipped: z.array(z.lazy(() => BulkAdjustReportSchema)).optional(),
});
export type BulkAdjustResult = z.infer<typeof BulkAdjustResultSchema>;
export const BulkExternalLinksResultSchema = z.object({
added: z.number().int(),
errors: z.number().int(),
skipped: z.number().int(),
});
export type BulkExternalLinksResult = z.infer<typeof BulkExternalLinksResultSchema>;
export const ClientSchema = z.object({
adTag: z.string().optional(),
allowedIPs: z.array(z.string()).optional(),
@@ -624,6 +644,16 @@ export const ClientsSummarySchema = z.object({
});
export type ClientsSummary = z.infer<typeof ClientsSummarySchema>;
export const ExternalLinkInputSchema = z.object({
enable: z.boolean().nullable().optional(),
expiryTime: z.number().int().optional(),
kind: z.string().optional(),
namePrefix: z.string().optional(),
remark: z.string().optional(),
value: z.string(),
});
export type ExternalLinkInput = z.infer<typeof ExternalLinkInputSchema>;
export const FallbackParentInfoSchema = z.object({
masterId: z.number().int(),
path: z.string().optional(),
+14 -9
View File
@@ -34,16 +34,10 @@ import {
} from '@/schemas/client';
import { DefaultsPayloadSchema } from '@/schemas/defaults';
import { TRAFFIC_POLL_INTERVAL_S } from '@/lib/traffic/poll-interval';
import { ExternalLinksAppendSchema, type ExternalLinkInput } from '@/schemas/external-link';
// One row sent to POST /clients/:email/externalLinks.
export type ExternalLinkInput = {
kind: 'link' | 'subscription';
value: string;
remark: string;
enable: boolean;
expiryTime: number;
namePrefix: string;
};
export type { ExternalLinkInput } from '@/schemas/external-link';
export type { ClientRecord, ClientTraffic, ClientsSummary, InboundOption, ExternalLink };
@@ -424,7 +418,9 @@ export function useClients(options: UseClientsOptions = {}) {
flow?: string;
limitHwid?: number | null;
adTag?: string;
externalLinks?: ExternalLinkInput[];
}): Promise<Msg<BulkAdjustResult>> => {
if (payload.externalLinks !== undefined) await ExternalLinksAppendSchema.parseAsync(payload);
const raw = await HttpUtil.post('/panel/api/clients/bulkAdjust', payload, JSON_HEADERS);
return parseMsg(raw, BulkAdjustResultSchema, 'clients/bulkAdjust');
},
@@ -599,9 +595,18 @@ export function useClients(options: UseClientsOptions = {}) {
flow = '',
limitHwid?: number | null,
adTag?: string,
externalLinks?: ExternalLinkInput[],
) => {
if (!Array.isArray(emails) || emails.length === 0) return Promise.resolve(null);
return bulkAdjustMut.mutateAsync({ emails, addDays, addBytes, flow, limitHwid, adTag });
return bulkAdjustMut.mutateAsync({
emails,
addDays,
addBytes,
flow,
limitHwid,
adTag,
externalLinks,
});
},
[bulkAdjustMut],
);
+42 -4
View File
@@ -1439,10 +1439,48 @@ export const sections: readonly Section[] = [
method: 'POST',
path: '/panel/api/clients/bulkAdjust',
summary:
'Shift expiry and/or traffic quota for many clients in one call. addDays/addBytes may be negative. Clients with unlimited expiry (expiryTime=0) or unlimited traffic (totalGB=0) are skipped for the corresponding field — bulk extend never converts unlimited to limited. A client that was auto-disabled solely because it was depleted (expired or over quota) is automatically re-enabled — locally and on its node — when the adjustment lifts it out of depletion; a manually-disabled or still-depleted client is left disabled. The optional flow directive sets the XTLS flow on every client: "none" clears it, "xtls-rprx-vision"/"xtls-rprx-vision-udp443" set it where the inbound supports it (omit or "" to leave it unchanged). The optional limitHwid sets maximum registered devices (0 = unlimited). The optional adTag sets MTProto Telegram sponsor channel ("none" clears). Returns the adjusted count and per-email skip reasons.',
body: '{\n "emails": ["alice", "bob"],\n "addDays": 30,\n "addBytes": 53687091200,\n "flow": "xtls-rprx-vision",\n "limitHwid": 2,\n "adTag": "0123456789abcdef0123456789abcdef"\n}',
response:
'{\n "success": true,\n "obj": {\n "adjusted": 2,\n "skipped": [\n { "email": "carol", "reason": "unlimited expiry" }\n ]\n }\n}',
'Shift expiry and/or traffic quota for many clients in one call. addDays/addBytes may be negative. Clients with unlimited expiry (expiryTime=0) or unlimited traffic (totalGB=0) are skipped for the corresponding field — bulk extend never converts unlimited to limited. A client that was auto-disabled solely because it was depleted (expired or over quota) is automatically re-enabled — locally and on its node — when the adjustment lifts it out of depletion; a manually-disabled or still-depleted client is left disabled. The optional flow directive sets the XTLS flow on every client: "none" clears it, "xtls-rprx-vision"/"xtls-rprx-vision-udp443" set it where the inbound supports it (omit or "" to leave it unchanged). The optional limitHwid sets maximum registered devices (0 = unlimited). The optional adTag sets MTProto Telegram sponsor channel ("none" clears). Alternatively, send externalLinks to append external share links and http(s) subscriptions to each selected client in one transaction. This mode cannot be combined with other adjustments. Existing entries, metadata, and ordering are preserved. Duplicates match (kind, value) per client, including repeated input rows; the first entry wins. Missing clients are not written and appear in skipped. externalLinks.added counts inserted rows, externalLinks.skipped counts duplicate rows across found clients, externalLinks.errors counts missing clients, and adjusted counts clients receiving at least one new row. Validation or database failure aborts the whole append without writes. Repeating an append is idempotent and does not restart Xray.',
requestSchema: {
type: 'object',
required: ['emails'],
properties: {
emails: { type: 'array', items: { type: 'string' }, minItems: 1 },
addDays: { type: 'integer' },
addBytes: { type: 'integer' },
flow: { type: 'string' },
limitHwid: { type: 'integer', minimum: 0 },
adTag: { type: 'string' },
externalLinks: {
type: 'array',
minItems: 1,
items: { $ref: '#/components/schemas/ExternalLinkInput' },
},
},
},
body: JSON.stringify(
{
emails: ['alice', 'bob'],
externalLinks: [
{
kind: 'link',
value: 'vless://uuid@example.com:443',
remark: 'Backup',
enable: true,
expiryTime: 0,
},
{
kind: 'subscription',
value: 'https://provider.example/sub',
namePrefix: '[provider] ',
enable: true,
expiryTime: 0,
},
],
},
null,
2,
),
responseSchema: 'BulkAdjustResult',
},
{
method: 'POST',
@@ -0,0 +1,4 @@
.client-bulk-adjust-tabs .ant-tabs-tab.ant-tabs-tab-active .ant-tabs-tab-btn {
color: var(--ant-color-text);
font-weight: 600;
}
@@ -0,0 +1,64 @@
import type { Meta, StoryObj } from '@storybook/react-vite';
import { expect, fn, within } from 'storybook/test';
import { ThemeProvider } from '@/hooks/useTheme';
import { setDatepicker } from '@/hooks/useDatepicker';
import ClientBulkAdjustModal from './ClientBulkAdjustModal';
import './ClientsPage.css';
const meta = {
title: 'Clients/Bulk Adjust',
component: ClientBulkAdjustModal,
tags: ['autodocs'],
decorators: [
(Story) => (
<ThemeProvider>
<Story />
</ThemeProvider>
),
],
beforeEach: () => {
setDatepicker('gregorian');
},
args: {
open: true,
count: 3,
onOpenChange: fn(),
onSubmit: fn().mockResolvedValue({
adjusted: 3,
externalLinks: { added: 6, skipped: 0, errors: 0 },
}),
},
argTypes: {
count: { description: 'Number of selected clients receiving the active adjustment.' },
onSubmit: {
description: 'Applies either settings adjustments or an append-only external-link batch.',
},
},
} satisfies Meta<typeof ClientBulkAdjustModal>;
export default meta;
type Story = StoryObj<typeof meta>;
export const AppendExternalLinks: Story = {
play: async ({ canvasElement, userEvent }) => {
const body = within(canvasElement.ownerDocument.body);
await userEvent.click(body.getByRole('tab', { name: 'Append external links' }));
await userEvent.click(body.getByRole('button', { name: 'Add External Link' }));
await userEvent.type(
body.getByPlaceholderText(
'vless:// · vmess:// · trojan:// · ss:// · hysteria2:// · wireguard://',
),
'vless://uuid@backup.example:443',
);
await userEvent.click(body.getByRole('button', { name: 'Add External Subscription' }));
await userEvent.type(
body.getByPlaceholderText('https://provider.example/sub/…'),
'https://provider.example/sub',
);
await userEvent.type(body.getByLabelText('Name prefix'), '[[backup] ');
await expect(body.getByLabelText('Name prefix')).toHaveValue('[backup] ');
await expect(body.getByRole('dialog', { name: 'Adjust 3 clients' })).toBeVisible();
},
};
@@ -1,22 +1,34 @@
import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Alert, Form, Input, InputNumber, Modal, Select, message } from 'antd';
import { Alert, Form, Input, InputNumber, Modal, Select, Tabs, message } from 'antd';
import { FormProvider, useForm } from 'react-hook-form';
import { ClientBulkAdjustFormSchema, type ClientBulkAdjustFormValues } from '@/schemas/client';
import {
ClientBulkAdjustFormSchema,
type ClientBulkAdjustFormValues,
type BulkAdjustResult,
} from '@/schemas/client';
import {
ExternalLinksAppendSchema,
type ExternalLinksFormValues,
type ExternalLinkInput,
} from '@/schemas/external-link';
import { TLS_FLOW_CONTROL } from '@/schemas/primitives/flow';
import { FormField } from '@/components/form/rhf';
import ClientExternalLinksFields from './ClientExternalLinksFields';
import './ClientBulkAdjustModal.css';
const GB = 1024 * 1024 * 1024;
const FLOW_CLEAR = 'none';
const EMPTY: ClientBulkAdjustFormValues = {
const EMPTY: ClientBulkAdjustFormValues & ExternalLinksFormValues = {
addDays: 0,
addGB: 0,
flow: '',
limitHwid: null,
adTag: '',
externalLinks: [],
};
interface ClientBulkAdjustModalProps {
@@ -29,7 +41,8 @@ interface ClientBulkAdjustModalProps {
flow: string,
limitHwid?: number | null,
adTag?: string,
) => Promise<{ adjusted: number; skipped?: { email: string; reason: string }[] } | null>;
externalLinks?: ExternalLinkInput[],
) => Promise<BulkAdjustResult | null>;
}
export default function ClientBulkAdjustModal({
@@ -41,39 +54,62 @@ export default function ClientBulkAdjustModal({
const { t } = useTranslation();
const [messageApi, messageContextHolder] = message.useMessage();
const [submitting, setSubmitting] = useState(false);
const methods = useForm<ClientBulkAdjustFormValues>({ defaultValues: EMPTY });
const [mode, setMode] = useState('adjust');
const methods = useForm<ClientBulkAdjustFormValues & ExternalLinksFormValues>({
defaultValues: EMPTY,
});
useEffect(() => {
if (open) methods.reset(EMPTY);
if (open) {
methods.reset(EMPTY);
}
}, [open, methods]);
async function handleOk() {
if (mode === 'links') await methods.trigger('externalLinks');
const values = methods.getValues();
const validated = ClientBulkAdjustFormSchema.safeParse({
addDays: Math.trunc(Number(values.addDays) || 0),
addGB: Number(values.addGB) || 0,
flow: values.flow,
limitHwid:
values.limitHwid !== null &&
values.limitHwid !== undefined &&
(values.limitHwid as unknown) !== ''
? Math.trunc(Number(values.limitHwid))
: null,
adTag: values.adTag?.trim() ?? '',
});
const validated =
mode === 'links'
? await ExternalLinksAppendSchema.safeParseAsync(values)
: ClientBulkAdjustFormSchema.safeParse({
addDays: Math.trunc(Number(values.addDays) || 0),
addGB: Number(values.addGB) || 0,
flow: values.flow,
limitHwid:
values.limitHwid !== null &&
values.limitHwid !== undefined &&
(values.limitHwid as unknown) !== ''
? Math.trunc(Number(values.limitHwid))
: null,
adTag: values.adTag?.trim() ?? '',
});
if (!validated.success) {
messageApi.warning(t(validated.error.issues[0]?.message ?? 'somethingWentWrong'));
return;
}
const { addDays: days, addGB: gb, flow: flowValue, limitHwid, adTag } = validated.data;
const data = validated.data;
const days = 'addDays' in data ? data.addDays : 0;
const gb = 'addGB' in data ? data.addGB : 0;
const flowValue = 'flow' in data ? data.flow : '';
const limitHwid = 'limitHwid' in data ? data.limitHwid : null;
const adTag = 'adTag' in data ? data.adTag : '';
const externalLinks =
'externalLinks' in data ? data.externalLinks.filter((row) => row.value !== '') : undefined;
setSubmitting(true);
try {
const bytes = Math.trunc(gb * GB);
const result = await onSubmit(days, bytes, flowValue, limitHwid, adTag);
const result = await onSubmit(days, bytes, flowValue, limitHwid, adTag, externalLinks);
if (!result) return;
const ok = result.adjusted ?? 0;
const skipped = result.skipped?.length ?? 0;
if (skipped === 0) {
if (result.externalLinks) {
const summary = t('pages.clients.toasts.bulkLinksAppended', {
clients: ok,
...result.externalLinks,
});
if (result.externalLinks.errors > 0) messageApi.warning(summary);
else messageApi.success(summary);
} else if (skipped === 0) {
messageApi.success(t('pages.clients.toasts.bulkAdjusted', { count: ok }));
} else {
const firstReason = result.skipped?.[0]?.reason ?? '';
@@ -84,6 +120,8 @@ export default function ClientBulkAdjustModal({
);
}
onOpenChange(false);
} catch {
messageApi.error(t('somethingWentWrong'));
} finally {
setSubmitting(false);
}
@@ -101,51 +139,83 @@ export default function ClientBulkAdjustModal({
onOk={handleOk}
onCancel={() => onOpenChange(false)}
destroyOnHidden
afterClose={() => setMode('adjust')}
width={mode === 'links' ? 800 : 520}
>
<Alert
type="info"
showIcon
style={{ marginBottom: 16 }}
title={t('pages.clients.bulkAdjustHint')}
/>
<FormProvider {...methods}>
<Form layout="vertical">
<FormField name="addDays" label={t('pages.clients.addDays')}>
<InputNumber style={{ width: '100%' }} step={1} precision={0} />
</FormField>
<FormField name="addGB" label={t('pages.clients.addTrafficGB')}>
<InputNumber style={{ width: '100%' }} step={1} />
</FormField>
<FormField name="flow" label={t('pages.clients.bulkFlow')}>
<Select
style={{ width: '100%' }}
options={[
{ value: '', label: t('pages.clients.bulkFlowNoChange') },
{ value: FLOW_CLEAR, label: t('pages.clients.bulkFlowDisable') },
...Object.values(TLS_FLOW_CONTROL).map((k) => ({ value: k, label: k })),
]}
/>
</FormField>
<FormField
name="limitHwid"
label={t('pages.clients.limitHwid')}
tooltip={t('pages.clients.limitHwidDesc')}
>
<InputNumber
style={{ width: '100%' }}
min={0}
step={1}
precision={0}
placeholder={t('pages.clients.bulkFlowNoChange')}
/>
</FormField>
<FormField
name="adTag"
label={t('pages.clients.mtprotoAdTag')}
extra={t('pages.clients.bulkAdTagHint')}
>
<Input placeholder={t('pages.clients.bulkFlowNoChange')} allowClear />
</FormField>
<Tabs
className="client-bulk-adjust-tabs"
activeKey={mode}
onChange={setMode}
items={[
{
key: 'adjust',
label: t('pages.clients.bulkAdjustSettings'),
children: (
<>
<Alert
type="info"
showIcon
style={{ marginBottom: 16 }}
title={t('pages.clients.bulkAdjustHint')}
/>
<FormField name="addDays" label={t('pages.clients.addDays')}>
<InputNumber style={{ width: '100%' }} step={1} precision={0} />
</FormField>
<FormField name="addGB" label={t('pages.clients.addTrafficGB')}>
<InputNumber style={{ width: '100%' }} step={1} />
</FormField>
<FormField name="flow" label={t('pages.clients.bulkFlow')}>
<Select
style={{ width: '100%' }}
options={[
{ value: '', label: t('pages.clients.bulkFlowNoChange') },
{ value: FLOW_CLEAR, label: t('pages.clients.bulkFlowDisable') },
...Object.values(TLS_FLOW_CONTROL).map((k) => ({ value: k, label: k })),
]}
/>
</FormField>
<FormField
name="limitHwid"
label={t('pages.clients.limitHwid')}
tooltip={t('pages.clients.limitHwidDesc')}
>
<InputNumber
style={{ width: '100%' }}
min={0}
step={1}
precision={0}
placeholder={t('pages.clients.bulkFlowNoChange')}
/>
</FormField>
<FormField
name="adTag"
label={t('pages.clients.mtprotoAdTag')}
extra={t('pages.clients.bulkAdTagHint')}
>
<Input placeholder={t('pages.clients.bulkFlowNoChange')} allowClear />
</FormField>
</>
),
},
{
key: 'links',
label: t('pages.clients.bulkAppendLinks'),
children: (
<>
<Alert
type="info"
showIcon
style={{ marginBottom: 16 }}
title={t('pages.clients.bulkAppendLinksHint')}
/>
<ClientExternalLinksFields showFetchStatus={false} />
</>
),
},
]}
/>
</Form>
</FormProvider>
</Modal>
@@ -0,0 +1,171 @@
import { Button, Input, Switch, Tooltip, Typography } from 'antd';
import { DeleteOutlined, PlusOutlined } from '@ant-design/icons';
import dayjs from 'dayjs';
import { Controller, useFieldArray, useFormContext } from 'react-hook-form';
import { useTranslation } from 'react-i18next';
import { DateTimePicker } from '@/components/form';
import { FormField, rhfZodValidateAsync } from '@/components/form/rhf';
import { resolveExternalLinkExpiry } from '@/lib/clients/external-link';
import {
ExternalShareLinkValueSchema,
ExternalSubscriptionValueSchema,
type ExternalLinksFormValues,
} from '@/schemas/external-link';
export default function ClientExternalLinksFields({
clientExpiry = 0,
showFetchStatus = true,
}: {
clientExpiry?: number;
showFetchStatus?: boolean;
}) {
const { t } = useTranslation();
const { control } = useFormContext<ExternalLinksFormValues>();
const { fields, append, remove } = useFieldArray({ control, name: 'externalLinks' });
return (
<>
{(['link', 'subscription'] as const).map((kind) => {
const rows = fields
.map((field, index) => ({ field, index }))
.filter(({ field }) => field.kind === kind);
return (
<div key={kind} style={{ marginBottom: kind === 'link' ? 24 : 0 }}>
<Button
type="primary"
icon={<PlusOutlined aria-hidden />}
onClick={() =>
append({
kind,
value: '',
remark: '',
enable: true,
expiryTime: 0,
namePrefix: '',
lastFetchAt: 0,
lastFetchError: '',
})
}
>
{t(
kind === 'link'
? 'pages.clients.addExternalLink'
: 'pages.clients.addExternalSubscription',
)}
</Button>
<div style={{ marginTop: 12 }}>
{rows.length === 0 ? (
<Typography.Text type="secondary">
{t(
kind === 'link'
? 'pages.clients.noExternalLinks'
: 'pages.clients.noExternalSubscriptions',
)}
</Typography.Text>
) : (
rows.map(({ field, index }) => (
<div key={field.id} className="external-link-card">
<div className="external-link-row">
<div className="external-link-enable">
<FormField
name={`externalLinks.${index}.enable`}
valueProp="checked"
noStyle
>
<Switch size="small" aria-label={t('enable')} />
</FormField>
<span>{t('enable')}</span>
</div>
<FormField
name={`externalLinks.${index}.value`}
style={{ flex: 1, minWidth: 0, marginBottom: 0 }}
rules={{
validate: rhfZodValidateAsync(
kind === 'link'
? ExternalShareLinkValueSchema
: ExternalSubscriptionValueSchema,
),
}}
>
<Input
aria-label={
kind === 'link'
? 'vless:// · vmess:// · trojan:// · ss:// · hysteria2:// · wireguard://'
: 'https://provider.example/sub/…'
}
placeholder={
kind === 'link'
? 'vless:// · vmess:// · trojan:// · ss:// · hysteria2:// · wireguard://'
: 'https://provider.example/sub/…'
}
/>
</FormField>
<Tooltip title={t('delete')}>
<Button
aria-label={t('delete')}
danger
icon={<DeleteOutlined aria-hidden />}
onClick={() => remove(index)}
/>
</Tooltip>
</div>
<div
className={`external-link-details ${kind === 'link' ? 'two-cols' : 'three-cols'}`}
>
<FormField name={`externalLinks.${index}.remark`} noStyle>
<Input aria-label={t('remark')} placeholder={t('remark')} />
</FormField>
{kind === 'subscription' && (
<FormField name={`externalLinks.${index}.namePrefix`} noStyle>
<Input
aria-label={t('pages.clients.namePrefix')}
placeholder={t('pages.clients.namePrefix')}
/>
</FormField>
)}
<Controller
control={control}
name={`externalLinks.${index}.expiryTime`}
render={({ field: expiryField }) => {
const displayed = resolveExternalLinkExpiry(
expiryField.value,
clientExpiry,
);
return (
<DateTimePicker
aria-label={t('pages.clients.expiryTime')}
value={displayed > 0 ? dayjs(displayed) : null}
onChange={(value) =>
expiryField.onChange(value ? value.valueOf() : 0)
}
placeholder={t('pages.inbounds.leaveBlankToNeverExpire')}
allowClear={Number(expiryField.value) > 0}
maxDate={clientExpiry > 0 ? dayjs(clientExpiry) : undefined}
/>
);
}}
/>
</div>
{kind === 'subscription' && showFetchStatus && (
<Typography.Text
type={field.lastFetchError ? 'danger' : 'secondary'}
className="external-link-fetch-status"
>
{field.lastFetchError
? `${t('pages.clients.lastFetchError')}: ${field.lastFetchError}`
: field.lastFetchAt > 0
? `${t('pages.clients.lastFetchAt')}: ${dayjs(field.lastFetchAt).format('YYYY-MM-DD HH:mm:ss')}`
: t('pages.clients.neverFetched')}
</Typography.Text>
)}
</div>
))
)}
</div>
</div>
);
})}
</>
);
}
+21 -205
View File
@@ -19,22 +19,17 @@ import {
Typography,
message,
} from 'antd';
import {
DeleteOutlined,
EyeOutlined,
PlusOutlined,
ReloadOutlined,
RetweetOutlined,
} from '@ant-design/icons';
import { EyeOutlined, ReloadOutlined, RetweetOutlined } from '@ant-design/icons';
import dayjs from 'dayjs';
import type { Dayjs } from 'dayjs';
import { Controller, FormProvider, useForm, useWatch, useFieldArray } from 'react-hook-form';
import { FormProvider, useForm, useWatch, type FieldPath } from 'react-hook-form';
import { HttpUtil, IntlUtil, RandomUtil, Wireguard } from '@/utils';
import { formatInboundLabel } from '@/lib/inbounds/label';
import { generateMtprotoSecret } from '@/lib/xray/inbound-defaults';
import { normalizeClientIps, type ClientIpInfo } from '@/lib/clients/ip-log';
import { resolveExternalLinkExpiry } from '@/lib/clients/external-link';
import { ExternalLinksFormSchema, type ExternalLinkRow } from '@/schemas/external-link';
import ClientExternalLinksFields from './ClientExternalLinksFields';
import { useDatepicker } from '@/hooks/useDatepicker';
import { useClientHwids } from '@/hooks/useClientHwids';
import { useRawHostsQuery } from '@/api/queries/useRawHostsQuery';
@@ -77,17 +72,6 @@ const MULTI_CLIENT_PROTOCOLS = new Set([
const CLIENT_FORM_MODAL_Z_INDEX = 1000;
const CLIENT_IP_LOG_MODAL_Z_INDEX = CLIENT_FORM_MODAL_Z_INDEX + 1;
interface ExternalLinkRow {
kind: 'link' | 'subscription';
value: string;
remark: string;
enable: boolean;
expiryTime: number;
namePrefix: string;
lastFetchAt: number;
lastFetchError: string;
}
interface ApiMsg<T = unknown> {
success?: boolean;
msg?: string;
@@ -286,13 +270,9 @@ export default function ClientFormModal({
const auth = useWatch({ control: methods.control, name: 'auth' });
const wgPrivateKey = useWatch({ control: methods.control, name: 'wgPrivateKey' });
const limitIp = useWatch({ control: methods.control, name: 'limitIp' });
const {
fields: externalLinkFields,
append: appendExternalLink,
remove: removeExternalLink,
} = useFieldArray({ control: methods.control, name: 'externalLinks' });
const [submitting, setSubmitting] = useState(false);
const [activeTab, setActiveTab] = useState('basic');
const [resetting, setResetting] = useState(false);
const [clientIps, setClientIps] = useState<ClientIpInfo[]>([]);
const [ipsLoading, setIpsLoading] = useState(false);
@@ -336,19 +316,6 @@ export default function ClientFormModal({
return ids;
}, [inbounds]);
function addExternalLinkRow(kind: 'link' | 'subscription') {
appendExternalLink({
kind,
value: '',
remark: '',
enable: true,
expiryTime: 0,
namePrefix: '',
lastFetchAt: 0,
lastFetchError: '',
});
}
useEffect(() => {
if (!open) return;
setIpsModalOpen(false);
@@ -646,13 +613,6 @@ export default function ClientFormModal({
[expiryDate],
);
const linkRows = externalLinkFields
.map((field, index) => ({ field, index }))
.filter((row) => row.field.kind === 'link');
const subscriptionRows = externalLinkFields
.map((field, index) => ({ field, index }))
.filter((row) => row.field.kind === 'subscription');
async function loadIps() {
if (!isEdit || !client?.email) return;
setIpsLoading(true);
@@ -713,7 +673,19 @@ export default function ClientFormModal({
}
async function onSubmit() {
await methods.trigger('externalLinks');
const values = methods.getValues();
const externalValidation = await ExternalLinksFormSchema.safeParseAsync(values);
if (!externalValidation.success) {
for (const issue of externalValidation.error.issues) {
methods.setError(issue.path.join('.') as FieldPath<Values>, {
type: 'validate',
message: issue.message,
});
}
setActiveTab('links');
return;
}
const unchangedLegacyKeepAlive =
isEdit &&
typeof client?.keepAlive === 'number' &&
@@ -906,6 +878,7 @@ export default function ClientFormModal({
body: { maxHeight: 'calc(100vh - 160px)', overflowY: 'auto', overflowX: 'hidden' },
}}
onCancel={close}
afterClose={() => setActiveTab('basic')}
footer={
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
{isEdit && resetTraffic && (
@@ -939,7 +912,8 @@ export default function ClientFormModal({
<FormProvider {...methods}>
<Form layout="vertical">
<Tabs
defaultActiveKey="basic"
activeKey={activeTab}
onChange={setActiveTab}
items={[
{
key: 'basic',
@@ -1546,165 +1520,7 @@ export default function ClientFormModal({
{t('pages.clients.linksHint')}
</Typography.Paragraph>
<Button
type="primary"
icon={<PlusOutlined aria-hidden />}
onClick={() => addExternalLinkRow('link')}
>
{t('pages.clients.addExternalLink')}
</Button>
<div style={{ marginTop: 12, marginBottom: 24 }}>
{linkRows.length === 0 ? (
<Typography.Text type="secondary">
{t('pages.clients.noExternalLinks')}
</Typography.Text>
) : (
linkRows.map(({ field, index }) => (
<div key={field.id} className="external-link-card">
<div className="external-link-row">
<div className="external-link-enable">
<FormField
name={`externalLinks.${index}.enable`}
valueProp="checked"
noStyle
>
<Switch size="small" aria-label={t('enable')} />
</FormField>
<span>{t('enable')}</span>
</div>
<FormField name={`externalLinks.${index}.value`} noStyle>
<Input
aria-label="vless:// · vmess:// · trojan:// · ss:// · hysteria2:// · wireguard://"
placeholder="vless:// · vmess:// · trojan:// · ss:// · hysteria2:// · wireguard://"
/>
</FormField>
<Tooltip title={t('delete')}>
<Button
aria-label={t('delete')}
danger
icon={<DeleteOutlined aria-hidden />}
onClick={() => removeExternalLink(index)}
/>
</Tooltip>
</div>
<div className="external-link-details two-cols">
<FormField name={`externalLinks.${index}.remark`} noStyle>
<Input aria-label={t('remark')} placeholder={t('remark')} />
</FormField>
<Controller
control={methods.control}
name={`externalLinks.${index}.expiryTime`}
render={({ field: expiryField }) => {
const displayedExpiry = resolveExternalLinkExpiry(
expiryField.value,
expiryDate,
);
const hasSpecificExpiry = Number(expiryField.value) > 0;
return (
<DateTimePicker
aria-label={t('pages.clients.expiryTime')}
value={displayedExpiry > 0 ? dayjs(displayedExpiry) : null}
onChange={(v) => expiryField.onChange(v ? v.valueOf() : 0)}
placeholder={t('pages.inbounds.leaveBlankToNeverExpire')}
allowClear={hasSpecificExpiry}
maxDate={expiryDate > 0 ? dayjs(expiryDate) : undefined}
/>
);
}}
/>
</div>
</div>
))
)}
</div>
<Button
type="primary"
icon={<PlusOutlined aria-hidden />}
onClick={() => addExternalLinkRow('subscription')}
>
{t('pages.clients.addExternalSubscription')}
</Button>
<div style={{ marginTop: 12 }}>
{subscriptionRows.length === 0 ? (
<Typography.Text type="secondary">
{t('pages.clients.noExternalSubscriptions')}
</Typography.Text>
) : (
subscriptionRows.map(({ field, index }) => (
<div key={field.id} className="external-link-card">
<div className="external-link-row">
<div className="external-link-enable">
<FormField
name={`externalLinks.${index}.enable`}
valueProp="checked"
noStyle
>
<Switch size="small" aria-label={t('enable')} />
</FormField>
<span>{t('enable')}</span>
</div>
<FormField name={`externalLinks.${index}.value`} noStyle>
<Input
aria-label="https://provider.example/sub/…"
placeholder="https://provider.example/sub/…"
/>
</FormField>
<Tooltip title={t('delete')}>
<Button
aria-label={t('delete')}
danger
icon={<DeleteOutlined aria-hidden />}
onClick={() => removeExternalLink(index)}
/>
</Tooltip>
</div>
<div className="external-link-details three-cols">
<FormField name={`externalLinks.${index}.remark`} noStyle>
<Input aria-label={t('remark')} placeholder={t('remark')} />
</FormField>
<FormField name={`externalLinks.${index}.namePrefix`} noStyle>
<Input
aria-label={t('pages.clients.namePrefix')}
placeholder={t('pages.clients.namePrefix')}
/>
</FormField>
<Controller
control={methods.control}
name={`externalLinks.${index}.expiryTime`}
render={({ field: expiryField }) => {
const displayedExpiry = resolveExternalLinkExpiry(
expiryField.value,
expiryDate,
);
const hasSpecificExpiry = Number(expiryField.value) > 0;
return (
<DateTimePicker
aria-label={t('pages.clients.expiryTime')}
value={displayedExpiry > 0 ? dayjs(displayedExpiry) : null}
onChange={(v) => expiryField.onChange(v ? v.valueOf() : 0)}
placeholder={t('pages.inbounds.leaveBlankToNeverExpire')}
allowClear={hasSpecificExpiry}
maxDate={expiryDate > 0 ? dayjs(expiryDate) : undefined}
/>
);
}}
/>
</div>
<Typography.Text
type={field.lastFetchError ? 'danger' : 'secondary'}
className="external-link-fetch-status"
>
{field.lastFetchError
? `${t('pages.clients.lastFetchError')}: ${field.lastFetchError}`
: field.lastFetchAt > 0
? `${t('pages.clients.lastFetchAt')}: ${dayjs(field.lastFetchAt).format('YYYY-MM-DD HH:mm:ss')}`
: t('pages.clients.neverFetched')}
</Typography.Text>
</div>
))
)}
</div>
<ClientExternalLinksFields clientExpiry={expiryDate} />
</>
),
},
+2 -1
View File
@@ -1983,7 +1983,7 @@ export default function ClientsPage() {
open={bulkAdjustOpen}
count={selectedRowKeys.length}
onOpenChange={setBulkAdjustOpen}
onSubmit={async (addDays, addBytes, flow, limitHwid, adTag) => {
onSubmit={async (addDays, addBytes, flow, limitHwid, adTag, externalLinks) => {
const msg = await bulkAdjust(
[...selectedRowKeys],
addDays,
@@ -1991,6 +1991,7 @@ export default function ClientsPage() {
flow,
limitHwid,
adTag,
externalLinks,
);
if (msg?.success) {
setSelectedRowKeys([]);
+3
View File
@@ -220,6 +220,9 @@ export const ClientHydrateSchema = z.object({
export const BulkAdjustResultSchema = z.object({
adjusted: z.number(),
skipped: z.array(z.object({ email: z.string(), reason: z.string() })).optional(),
externalLinks: z
.object({ added: z.number().int(), skipped: z.number().int(), errors: z.number().int() })
.optional(),
});
export const BulkDeleteResultSchema = z.object({
+60
View File
@@ -0,0 +1,60 @@
import { z } from 'zod';
import { parseOutboundLink } from '@/lib/xray/outbound-link-parser';
// Async since vpn:// keys are inflated through a stream: parse these schemas with the
// *Async methods; a synchronous parse throws rather than passing every link.
export const ExternalShareLinkValueSchema = z
.string()
.trim()
.refine(
async (value) => value === '' || (await parseOutboundLink(value)) !== null,
'pages.clients.externalLinkInvalid',
);
export const ExternalSubscriptionValueSchema = z
.string()
.trim()
.refine((value) => {
if (value === '') return true;
try {
const url = new URL(value);
return (url.protocol === 'http:' || url.protocol === 'https:') && url.hostname !== '';
} catch {
return false;
}
}, 'pages.clients.externalSubscriptionInvalid');
export const ExternalLinkInputSchema = z
.object({
kind: z.enum(['link', 'subscription']),
value: z.string().trim(),
remark: z.string().trim(),
enable: z.boolean(),
expiryTime: z.number().int().min(0),
namePrefix: z.string(),
})
.superRefine(async (row, ctx) => {
const schema =
row.kind === 'subscription' ? ExternalSubscriptionValueSchema : ExternalShareLinkValueSchema;
const result = await schema.safeParseAsync(row.value);
if (!result.success)
ctx.addIssue({ code: 'custom', path: ['value'], message: result.error.issues[0].message });
});
export const ExternalLinkFormSchema = ExternalLinkInputSchema.safeExtend({
lastFetchAt: z.number(),
lastFetchError: z.string(),
});
export const ExternalLinksFormSchema = z.object({ externalLinks: z.array(ExternalLinkFormSchema) });
export const ExternalLinksAppendSchema = z.object({
externalLinks: z
.array(ExternalLinkInputSchema)
.refine(
(rows) => rows.some((row) => row.value !== ''),
'pages.clients.bulkAppendLinksRequired',
),
});
export type ExternalLinkInput = z.infer<typeof ExternalLinkInputSchema>;
export type ExternalLinkRow = z.infer<typeof ExternalLinkFormSchema>;
export type ExternalLinksFormValues = z.infer<typeof ExternalLinksFormSchema>;
@@ -0,0 +1,180 @@
import { act, fireEvent, screen, waitFor } from '@testing-library/react';
import { expect, it, vi } from 'vitest';
import ClientBulkAdjustModal from '@/pages/clients/ClientBulkAdjustModal';
import ClientFormModal from '@/pages/clients/ClientFormModal';
import type { ClientRecord } from '@/schemas/client';
import { renderWithProviders } from './test-utils';
async function submit() {
const button = screen.getByRole('button', { name: /Confirm$/ });
await waitFor(() => expect(button.classList.contains('ant-btn-loading')).toBe(false));
await act(async () => {
fireEvent.click(button);
});
}
it('appends both link types with metadata and reports duplicates without sending hidden quota changes', async () => {
const onSubmit = vi.fn().mockResolvedValue({
adjusted: 2,
externalLinks: { added: 3, skipped: 1, errors: 0 },
});
const onOpenChange = vi.fn();
renderWithProviders(
<ClientBulkAdjustModal open count={2} onSubmit={onSubmit} onOpenChange={onOpenChange} />,
);
fireEvent.change(screen.getByLabelText('Add days'), { target: { value: '30' } });
fireEvent.click(screen.getByRole('tab', { name: 'Append external links' }));
expect(screen.getByRole('dialog').textContent).toContain('2');
fireEvent.click(screen.getByRole('button', { name: 'Add External Link' }));
fireEvent.change(
screen.getByPlaceholderText(
'vless:// · vmess:// · trojan:// · ss:// · hysteria2:// · wireguard://',
),
{ target: { value: 'vless://uuid@example.com:443' } },
);
fireEvent.click(screen.getByRole('button', { name: 'Add External Subscription' }));
fireEvent.change(screen.getByPlaceholderText('https://provider.example/sub/…'), {
target: { value: 'ftp://invalid.example/sub' },
});
await submit();
await waitFor(() =>
expect(
screen.getByPlaceholderText('https://provider.example/sub/…').closest('.ant-form-item')
?.textContent,
).toContain('Enter an http(s) subscription URL.'),
);
expect(onSubmit).not.toHaveBeenCalled();
fireEvent.change(screen.getByPlaceholderText('https://provider.example/sub/…'), {
target: { value: ' https://provider.example/sub ' },
});
fireEvent.change(screen.getByLabelText('Name prefix'), { target: { value: '[backup] ' } });
fireEvent.click(screen.getAllByRole('switch', { name: 'Enabled' })[1]);
await submit();
await waitFor(() =>
expect(onSubmit).toHaveBeenCalledWith(0, 0, '', null, '', [
{
kind: 'link',
value: 'vless://uuid@example.com:443',
remark: '',
enable: true,
expiryTime: 0,
namePrefix: '',
},
{
kind: 'subscription',
value: 'https://provider.example/sub',
remark: '',
enable: false,
expiryTime: 0,
namePrefix: '[backup] ',
},
]),
);
await waitFor(() =>
expect(
screen.getByText('2 clients updated: 3 added, 1 duplicates skipped, 0 clients not found.'),
).toBeTruthy(),
);
expect(onOpenChange).toHaveBeenCalledWith(false);
});
it('preserves existing quota adjustment submission and keeps a failed append open', async () => {
const onSubmit = vi.fn().mockResolvedValue(null);
const onOpenChange = vi.fn();
renderWithProviders(
<ClientBulkAdjustModal open count={3} onSubmit={onSubmit} onOpenChange={onOpenChange} />,
);
fireEvent.change(screen.getByLabelText('Add days'), { target: { value: '-7' } });
await submit();
await waitFor(() => expect(onSubmit).toHaveBeenCalledWith(-7, 0, '', null, '', undefined));
expect(onOpenChange).not.toHaveBeenCalled();
fireEvent.click(screen.getByRole('tab', { name: 'Append external links' }));
fireEvent.click(screen.getByRole('button', { name: 'Add External Link' }));
fireEvent.change(
screen.getByPlaceholderText(
'vless:// · vmess:// · trojan:// · ss:// · hysteria2:// · wireguard://',
),
{ target: { value: 'not-a-link' } },
);
await submit();
await waitFor(() =>
expect(
screen
.getByPlaceholderText(
'vless:// · vmess:// · trojan:// · ss:// · hysteria2:// · wireguard://',
)
.closest('.ant-form-item')?.textContent,
).toContain('Enter a supported share link.'),
);
expect(onSubmit).toHaveBeenCalledTimes(1);
fireEvent.change(
screen.getByPlaceholderText(
'vless:// · vmess:// · trojan:// · ss:// · hysteria2:// · wireguard://',
),
{ target: { value: 'trojan://pw@example.com:443' } },
);
await submit();
await waitFor(() => expect(onSubmit).toHaveBeenCalledTimes(2));
expect(onOpenChange).not.toHaveBeenCalled();
});
it('opens the existing client Links tab and blocks all writes for an invalid entry', async () => {
const save = vi.fn().mockResolvedValue(null);
renderWithProviders(
<ClientFormModal
open
mode="edit"
client={{ email: 'editor', uuid: 'uuid', subId: 'editor', enable: true } as ClientRecord}
inbounds={[]}
attachedExternalLinks={[
{
id: 1,
kind: 'link',
value: 'invalid-link',
remark: 'keep',
enable: true,
expiryTime: 0,
namePrefix: '',
lastFetchAt: 0,
lastFetchError: '',
},
]}
save={save}
onOpenChange={() => {}}
/>,
);
fireEvent.click(screen.getByRole('button', { name: 'Save' }));
await waitFor(() =>
expect(
screen
.getByPlaceholderText(
'vless:// · vmess:// · trojan:// · ss:// · hysteria2:// · wireguard://',
)
.closest('.ant-form-item')?.textContent,
).toContain('Enter a supported share link.'),
);
expect(save).not.toHaveBeenCalled();
fireEvent.change(
screen.getByPlaceholderText(
'vless:// · vmess:// · trojan:// · ss:// · hysteria2:// · wireguard://',
),
{ target: { value: 'trojan://pw@example.com:443' } },
);
fireEvent.click(screen.getByRole('button', { name: 'Save' }));
await waitFor(() => expect(save).toHaveBeenCalledTimes(1));
expect(save.mock.calls[0][1]).toEqual(
expect.objectContaining({
externalLinks: [
{
kind: 'link',
value: 'trojan://pw@example.com:443',
remark: 'keep',
enable: true,
expiryTime: 0,
namePrefix: '',
},
],
}),
);
});
+19 -7
View File
@@ -375,12 +375,13 @@ func (a *ClientController) resetAllTraffics(c *gin.Context) {
}
type bulkAdjustRequest struct {
Emails []string `json:"emails"`
AddDays int `json:"addDays"`
AddBytes int64 `json:"addBytes"`
Flow string `json:"flow"`
LimitHwid *int `json:"limitHwid"`
AdTag string `json:"adTag"`
Emails []string `json:"emails"`
AddDays int `json:"addDays"`
AddBytes int64 `json:"addBytes"`
Flow string `json:"flow"`
LimitHwid *int `json:"limitHwid"`
AdTag string `json:"adTag"`
ExternalLinks []service.ExternalLinkInput `json:"externalLinks"`
}
func (a *ClientController) bulkAdjust(c *gin.Context) {
@@ -389,7 +390,18 @@ func (a *ClientController) bulkAdjust(c *gin.Context) {
jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err)
return
}
result, needRestart, err := a.clientService.BulkAdjust(&a.inboundService, req.Emails, req.AddDays, req.AddBytes, req.Flow, req.LimitHwid, req.AdTag)
var result service.BulkAdjustResult
var needRestart bool
var err error
if req.ExternalLinks != nil {
if req.AddDays != 0 || req.AddBytes != 0 || req.Flow != "" || req.LimitHwid != nil || req.AdTag != "" {
jsonMsg(c, "append external links separately from other adjustments", errors.New("externalLinks cannot be combined with other adjustments"))
return
}
result, err = a.clientService.BulkAppendExternalLinks(req.Emails, req.ExternalLinks)
} else {
result, needRestart, err = a.clientService.BulkAdjust(&a.inboundService, req.Emails, req.AddDays, req.AddBytes, req.Flow, req.LimitHwid, req.AdTag)
}
if err != nil {
jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err)
return
@@ -0,0 +1,96 @@
package controller
import (
"encoding/json"
"net/http"
"net/http/httptest"
"path/filepath"
"strings"
"testing"
"github.com/gin-gonic/gin"
"github.com/mhsanaei/3x-ui/v3/internal/database"
"github.com/mhsanaei/3x-ui/v3/internal/database/dbtest"
"github.com/mhsanaei/3x-ui/v3/internal/database/model"
)
func TestBulkAdjustAppendsExternalLinksHTTP(t *testing.T) {
dbtest.InitDB(t, filepath.Join(t.TempDir(), "x-ui.db"))
clients := []model.ClientRecord{{Email: "alice"}, {Email: "bob"}, {Email: "unselected"}}
if err := database.GetDB().Create(&clients).Error; err != nil {
t.Fatal(err)
}
router := gin.New()
NewClientController(router.Group("/panel/api/clients"))
body := `{"emails":["alice","bob"],"externalLinks":[{"kind":"link","value":"vless://uuid@example.com:443"},{"kind":"subscription","value":"https://provider.example/sub"}]}`
for attempt := range 2 {
w := httptest.NewRecorder()
r := httptest.NewRequest(http.MethodPost, "/panel/api/clients/bulkAdjust", strings.NewReader(body))
r.Header.Set("Content-Type", "application/json")
router.ServeHTTP(w, r)
var response struct {
Success bool `json:"success"`
Obj struct {
Adjusted int `json:"adjusted"`
ExternalLinks struct {
Added int `json:"added"`
Skipped int `json:"skipped"`
Errors int `json:"errors"`
} `json:"externalLinks"`
} `json:"obj"`
}
if err := json.Unmarshal(w.Body.Bytes(), &response); err != nil {
t.Fatal(err)
}
wantAdded, wantSkipped, wantAdjusted := 4, 0, 2
if attempt == 1 {
wantAdded, wantSkipped, wantAdjusted = 0, 4, 0
}
if w.Code != http.StatusOK || !response.Success || response.Obj.Adjusted != wantAdjusted || response.Obj.ExternalLinks.Added != wantAdded || response.Obj.ExternalLinks.Skipped != wantSkipped || response.Obj.ExternalLinks.Errors != 0 {
t.Fatalf("attempt %d: response = %s, want adjusted=%d added=%d skipped=%d errors=0", attempt, w.Body.String(), wantAdjusted, wantAdded, wantSkipped)
}
}
var rows []model.ClientExternalLink
if err := database.GetDB().Order("client_id, sort_index").Find(&rows).Error; err != nil {
t.Fatal(err)
}
if len(rows) != 4 || rows[0].ClientId != clients[0].Id || rows[1].ClientId != clients[0].Id || rows[2].ClientId != clients[1].Id || rows[3].ClientId != clients[1].Id {
t.Fatalf("persisted links = %+v, want two rows per selected client only", rows)
}
}
func TestBulkAdjustRejectsMixedAppendBeforeAnyChanges(t *testing.T) {
dbtest.InitDB(t, filepath.Join(t.TempDir(), "x-ui.db"))
client := model.ClientRecord{Email: "alice", LimitHwid: 2}
if err := database.GetDB().Create(&client).Error; err != nil {
t.Fatal(err)
}
router := gin.New()
NewClientController(router.Group("/panel/api/clients"))
w := httptest.NewRecorder()
r := httptest.NewRequest(http.MethodPost, "/panel/api/clients/bulkAdjust", strings.NewReader(`{"emails":["alice"],"limitHwid":9,"externalLinks":[{"kind":"link","value":"trojan://pw@example.com:443"}]}`))
r.Header.Set("Content-Type", "application/json")
router.ServeHTTP(w, r)
var response struct {
Success bool `json:"success"`
Msg string `json:"msg"`
}
if err := json.Unmarshal(w.Body.Bytes(), &response); err != nil {
t.Fatal(err)
}
if response.Success || !strings.Contains(response.Msg, "externalLinks cannot be combined with other adjustments") {
t.Fatalf("mixed request response = %s", w.Body.String())
}
var after model.ClientRecord
if err := database.GetDB().First(&after, client.Id).Error; err != nil {
t.Fatal(err)
}
var count int64
if err := database.GetDB().Model(&model.ClientExternalLink{}).Count(&count).Error; err != nil {
t.Fatal(err)
}
if after.LimitHwid != 2 || count != 0 {
t.Fatalf("rejected request changed limitHwid/links = %d/%d, want 2/0", after.LimitHwid, count)
}
}
+7 -7
View File
@@ -288,17 +288,17 @@ type inboundApplyOutcome struct {
err error
}
// BulkAdjustResult is returned by BulkAdjust to report how many clients were
// successfully updated and which were skipped (typically because the field
// being adjusted was unlimited for that client) or failed.
// BulkAdjustResult reports changed clients and per-client skip reasons.
// ExternalLinks contains row counts only for append requests.
type BulkAdjustResult struct {
Adjusted int `json:"adjusted"`
Skipped []BulkAdjustReport `json:"skipped,omitempty"`
Adjusted int `json:"adjusted" example:"2"`
Skipped []BulkAdjustReport `json:"skipped,omitempty" example:"[]"`
ExternalLinks *BulkExternalLinksResult `json:"externalLinks,omitempty"`
}
type BulkAdjustReport struct {
Email string `json:"email"`
Reason string `json:"reason"`
Email string `json:"email" example:"carol"`
Reason string `json:"reason" example:"client not found"`
}
type bulkAdjustEntry struct {
@@ -0,0 +1,102 @@
package service
import (
"sort"
"github.com/mhsanaei/3x-ui/v3/internal/database"
"github.com/mhsanaei/3x-ui/v3/internal/database/model"
"github.com/mhsanaei/3x-ui/v3/internal/util/common"
"gorm.io/gorm"
"gorm.io/gorm/clause"
)
type BulkExternalLinksResult struct {
Added int `json:"added" example:"4"`
Skipped int `json:"skipped" example:"0"`
Errors int `json:"errors" example:"0"`
}
// BulkAppendExternalLinks appends panel-local subscription entries atomically.
// Client row locks serialize concurrent appends; no runtime configuration changes.
func (s *ClientService) BulkAppendExternalLinks(emails []string, inputs []ExternalLinkInput) (BulkAdjustResult, error) {
result := BulkAdjustResult{ExternalLinks: &BulkExternalLinksResult{}}
rows, err := normalizeExternalLinks(inputs)
if err != nil {
return result, err
}
if len(rows) == 0 {
return result, common.NewError("at least one external link or subscription is required")
}
cleanEmails := trimmedUniqueEmails(emails)
if len(cleanEmails) == 0 {
return result, common.NewError("client emails are required")
}
sort.Strings(cleanEmails)
err = database.GetDB().Transaction(func(tx *gorm.DB) error {
records, err := clientRecordsByEmail(tx.Clauses(clause.Locking{Strength: "UPDATE"}).Order("id ASC"), cleanEmails)
if err != nil {
return err
}
ids := make([]int, 0, len(records))
for _, email := range cleanEmails {
if rec := records[email]; rec != nil {
ids = append(ids, rec.Id)
} else {
result.Skipped = append(result.Skipped, BulkAdjustReport{Email: email, Reason: "client not found"})
result.ExternalLinks.Errors++
}
}
type linkKey struct{ kind, value string }
seen := make(map[int]map[linkKey]bool, len(ids))
nextSort := make(map[int]int, len(ids))
for _, batch := range chunkInts(ids, sqlInChunk) {
var existing []model.ClientExternalLink
if err := tx.Where("client_id IN ?", batch).Find(&existing).Error; err != nil {
return err
}
for _, row := range existing {
if seen[row.ClientId] == nil {
seen[row.ClientId] = make(map[linkKey]bool)
}
seen[row.ClientId][linkKey{row.Kind, row.Value}] = true
if row.SortIndex >= nextSort[row.ClientId] {
nextSort[row.ClientId] = row.SortIndex + 1
}
}
}
pending := make([]model.ClientExternalLink, 0)
for _, id := range ids {
if seen[id] == nil {
seen[id] = make(map[linkKey]bool)
}
changed := false
for _, row := range rows {
key := linkKey{row.Kind, row.Value}
if seen[id][key] {
result.ExternalLinks.Skipped++
continue
}
seen[id][key] = true
row.ClientId, row.SortIndex = id, nextSort[id]
nextSort[id]++
pending = append(pending, row)
changed = true
}
if changed {
result.Adjusted++
}
}
if len(pending) > 0 {
if err := tx.CreateInBatches(&pending, 200).Error; err != nil {
return err
}
}
result.ExternalLinks.Added = len(pending)
return nil
})
if err != nil {
return BulkAdjustResult{ExternalLinks: &BulkExternalLinksResult{}}, err
}
return result, nil
}
@@ -0,0 +1,71 @@
package service
import (
"fmt"
"strings"
"sync"
"testing"
"github.com/mhsanaei/3x-ui/v3/internal/database/model"
)
func TestBulkAppendExternalLinks_PostgresCommitFailureAndConcurrentRetries(t *testing.T) {
db := durablePostgresDB(t)
emails := make([]string, sqlInChunk+1)
clients := make([]model.ClientRecord, len(emails))
for i := range clients {
emails[i] = fmt.Sprintf("bulk-append-%04d@pg", i)
clients[i].Email = emails[i]
}
cleanup := func() {
if err := db.Exec("DELETE FROM client_external_links WHERE client_id IN (SELECT id FROM clients WHERE email IN ?)", emails).Error; err != nil {
t.Errorf("clean external links: %v", err)
}
if err := db.Where("email IN ?", emails).Delete(&model.ClientRecord{}).Error; err != nil {
t.Errorf("clean clients: %v", err)
}
}
cleanup()
t.Cleanup(cleanup)
if err := db.CreateInBatches(&clients, sqlInChunk).Error; err != nil {
t.Fatal(err)
}
results := make(chan BulkAdjustResult, 2)
errors := make(chan error, 2)
var wg sync.WaitGroup
for range 2 {
wg.Go(func() {
result, err := (&ClientService{}).BulkAppendExternalLinks(emails, []ExternalLinkInput{{Kind: "subscription", Value: "https://provider.example/sub"}})
results <- result
errors <- err
})
}
wg.Wait()
close(results)
close(errors)
for err := range errors {
if err != nil {
t.Fatal(err)
}
}
added, skipped := 0, 0
for result := range results {
added += result.ExternalLinks.Added
skipped += result.ExternalLinks.Skipped
}
if added != len(clients) || skipped != len(clients) {
t.Fatalf("concurrent append: added=%d skipped=%d, want %d/%d", added, skipped, len(clients), len(clients))
}
installDeferredCommitFailure(t, db, "create", "bulk:external_link_commit_failure", "client_external_links", "bulk_link_parent", "bulk_link_child")
result, err := (&ClientService{}).BulkAppendExternalLinks(emails[:1], []ExternalLinkInput{{Kind: "link", Value: "trojan://pw@example.com:443"}})
if err == nil || !strings.Contains(strings.ToLower(err.Error()), "foreign key") || result.Adjusted != 0 || result.ExternalLinks.Added != 0 {
t.Fatalf("commit result/error = %+v/%v, want zero committed rows and deferred foreign-key failure", result, err)
}
var rows []model.ClientExternalLink
if err := db.Where("client_id IN (SELECT id FROM clients WHERE email IN ?)", emails).Order("client_id").Find(&rows).Error; err != nil {
t.Fatal(err)
}
if len(rows) != len(clients) || rows[0].Kind != "subscription" || rows[len(rows)-1].Kind != "subscription" {
t.Fatalf("rollback changed existing links: %+v", rows)
}
}
@@ -0,0 +1,250 @@
package service
import (
"fmt"
"reflect"
"strings"
"sync"
"testing"
"gorm.io/gorm"
"github.com/mhsanaei/3x-ui/v3/internal/database"
"github.com/mhsanaei/3x-ui/v3/internal/database/model"
)
func TestBulkAppendExternalLinksPreservesExistingRowsAndSkipsDuplicates(t *testing.T) {
setupBulkDB(t)
db := database.GetDB()
clients := []model.ClientRecord{{Email: "alice"}, {Email: "bob"}, {Email: "unselected"}}
if err := db.Create(&clients).Error; err != nil {
t.Fatal(err)
}
existing := []model.ClientExternalLink{
{ClientId: clients[0].Id, Kind: "link", Value: "trojan://pw@old.example:443", SortIndex: 7, Remark: "keep", Enable: new(false), ExpiryTime: 123, NamePrefix: "prefix", LastFetchAt: 456, LastFetchError: "timeout"},
{ClientId: clients[0].Id, Kind: "subscription", Value: "https://provider.example/sub", SortIndex: 12, Remark: "original", Enable: new(true)},
{ClientId: clients[2].Id, Kind: "link", Value: "trojan://pw@old.example:443", SortIndex: 99, Enable: new(true)},
}
if err := db.Create(&existing).Error; err != nil {
t.Fatal(err)
}
inputs := []ExternalLinkInput{
{Kind: "subscription", Value: " https://provider.example/sub ", Remark: "new", Enable: new(false), ExpiryTime: 789, NamePrefix: "provider "},
{Kind: "link", Value: "vless://uuid@new.example:443", Remark: "backup"},
{Kind: "link", Value: "vless://uuid@new.example:443", Remark: "duplicate must not replace"},
}
svc := &ClientService{}
result, err := svc.BulkAppendExternalLinks([]string{" alice ", "bob", "alice", "missing"}, inputs)
if err != nil {
t.Fatal(err)
}
wantResult := BulkAdjustResult{Adjusted: 2, Skipped: []BulkAdjustReport{{Email: "missing", Reason: "client not found"}}, ExternalLinks: &BulkExternalLinksResult{Added: 3, Skipped: 3, Errors: 1}}
if !reflect.DeepEqual(result, wantResult) {
t.Fatalf("result = %+v, want %+v", result, wantResult)
}
var after []model.ClientExternalLink
if err := db.Where("id IN ?", []int{existing[0].Id, existing[1].Id, existing[2].Id}).Order("id").Find(&after).Error; err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(after, existing) {
t.Fatalf("existing rows changed: %+v, want %+v", after, existing)
}
alice, err := svc.GetExternalLinksForRecord(clients[0].Id)
if err != nil {
t.Fatal(err)
}
if len(alice) != 3 || alice[2].Value != inputs[1].Value || alice[2].SortIndex != 13 || alice[2].Remark != "backup" {
t.Fatalf("alice links = %+v", alice)
}
bob, err := svc.GetExternalLinksForRecord(clients[1].Id)
if err != nil {
t.Fatal(err)
}
if len(bob) != 2 || bob[0].Kind != "subscription" || bob[0].Value != strings.TrimSpace(inputs[0].Value) || bob[0].Remark != "new" || *bob[0].Enable || bob[0].ExpiryTime != 789 || bob[0].NamePrefix != "provider " || bob[0].SortIndex != 0 || bob[1].SortIndex != 1 {
t.Fatalf("bob links = %+v", bob)
}
repeated, err := svc.BulkAppendExternalLinks([]string{"alice", "bob"}, inputs)
if err != nil {
t.Fatal(err)
}
if repeated.Adjusted != 0 || *repeated.ExternalLinks != (BulkExternalLinksResult{Skipped: 6}) {
t.Fatalf("repeat = %+v", repeated)
}
var count int64
if err := db.Model(&model.ClientExternalLink{}).Count(&count).Error; err != nil {
t.Fatal(err)
}
if count != 6 {
t.Fatalf("row count = %d, want 6", count)
}
}
func TestBulkAppendExternalLinksValidatesAllInputsBeforeWriting(t *testing.T) {
for _, tt := range []struct {
name string
input ExternalLinkInput
want string
}{
{"link", ExternalLinkInput{Kind: "link", Value: "https://wrong.example"}, "unsupported or invalid share link: https://wrong.example\n"},
{"subscription", ExternalLinkInput{Kind: "subscription", Value: "ftp://wrong.example"}, "external subscription must be an http(s) URL: ftp://wrong.example\n"},
{"kind", ExternalLinkInput{Kind: "unknown", Value: "value"}, "unknown external link kind: unknown\n"},
{"expiry", ExternalLinkInput{Kind: "subscription", Value: "https://provider.example/sub", ExpiryTime: -1}, "external link expiryTime must be 0 (never) or a future unix millisecond timestamp: https://provider.example/sub\n"},
} {
t.Run(tt.name, func(t *testing.T) {
setupBulkDB(t)
rec := model.ClientRecord{Email: "alice"}
if err := database.GetDB().Create(&rec).Error; err != nil {
t.Fatal(err)
}
result, err := (&ClientService{}).BulkAppendExternalLinks([]string{"alice"}, []ExternalLinkInput{{Kind: "link", Value: "trojan://pw@valid.example:443"}, tt.input})
if err == nil || err.Error() != tt.want || result.Adjusted != 0 {
t.Fatalf("result/error = %+v/%v, want %q", result, err, tt.want)
}
var count int64
if err := database.GetDB().Model(&model.ClientExternalLink{}).Count(&count).Error; err != nil {
t.Fatal(err)
}
if count != 0 {
t.Fatalf("invalid batch wrote %d rows", count)
}
})
}
}
func TestBulkAppendExternalLinksRejectsEmptySelectionAndRows(t *testing.T) {
setupBulkDB(t)
for _, tt := range []struct {
name string
emails []string
inputs []ExternalLinkInput
want string
}{
{"no links", []string{"alice"}, nil, "at least one external link or subscription is required\n"},
{"blank rows", []string{"alice"}, []ExternalLinkInput{{Kind: "link", Value: " \t"}}, "at least one external link or subscription is required\n"},
{"empty selection", []string{"", " "}, []ExternalLinkInput{{Kind: "link", Value: "trojan://pw@example.com:443"}}, "client emails are required\n"},
} {
t.Run(tt.name, func(t *testing.T) {
result, err := (&ClientService{}).BulkAppendExternalLinks(tt.emails, tt.inputs)
if err == nil || err.Error() != tt.want || result.Adjusted != 0 || *result.ExternalLinks != (BulkExternalLinksResult{}) {
t.Fatalf("result/error = %+v/%v, want no writes and %q", result, err, tt.want)
}
})
}
result, err := (&ClientService{}).BulkAppendExternalLinks([]string{"missing"}, []ExternalLinkInput{{Kind: "link", Value: "trojan://pw@example.com:443"}})
want := BulkAdjustResult{Skipped: []BulkAdjustReport{{Email: "missing", Reason: "client not found"}}, ExternalLinks: &BulkExternalLinksResult{Errors: 1}}
if err != nil || !reflect.DeepEqual(result, want) {
t.Fatalf("all missing result/error = %+v/%v, want %+v", result, err, want)
}
}
func TestBulkAppendExternalLinksRollsBackEarlierInsertBatches(t *testing.T) {
setupBulkDB(t)
db := database.GetDB()
clients := []model.ClientRecord{{Email: "alice"}, {Email: "bob"}}
if err := db.Create(&clients).Error; err != nil {
t.Fatal(err)
}
if err := db.Exec(fmt.Sprintf(`CREATE TRIGGER reject_bulk_link BEFORE INSERT ON client_external_links WHEN NEW.client_id = %d AND NEW.value = 'trojan://pw@server.example:443#119' BEGIN SELECT RAISE(ABORT, 'injected link failure'); END`, clients[1].Id)).Error; err != nil {
t.Fatal(err)
}
inputs := make([]ExternalLinkInput, 120)
for i := range inputs {
inputs[i] = ExternalLinkInput{Kind: "link", Value: fmt.Sprintf("trojan://pw@server.example:443#%d", i)}
}
result, err := (&ClientService{}).BulkAppendExternalLinks([]string{"alice", "bob"}, inputs)
if err == nil || !strings.Contains(err.Error(), "injected link failure") || result.Adjusted != 0 || result.ExternalLinks.Added != 0 {
t.Fatalf("rollback result/error = %+v/%v", result, err)
}
var count int64
if err := db.Model(&model.ClientExternalLink{}).Count(&count).Error; err != nil {
t.Fatal(err)
}
if count != 0 {
t.Fatalf("rollback left %d rows", count)
}
}
func TestBulkAppendExternalLinksBatchesReadsAndConcurrentRetries(t *testing.T) {
setupBulkDB(t)
db := database.GetDB()
clients := make([]model.ClientRecord, 60)
emails := make([]string, len(clients))
for i := range clients {
emails[i] = fmt.Sprintf("client-%03d", i)
clients[i].Email = emails[i]
}
if err := db.Create(&clients).Error; err != nil {
t.Fatal(err)
}
queries := 0
if err := db.Callback().Query().After("gorm:query").Register("count_bulk_link_reads", func(tx *gorm.DB) { queries++ }); err != nil {
t.Fatal(err)
}
input := []ExternalLinkInput{{Kind: "subscription", Value: "https://provider.example/sub"}}
result, err := (&ClientService{}).BulkAppendExternalLinks(emails, input)
if err := db.Callback().Query().Remove("count_bulk_link_reads"); err != nil {
t.Fatal(err)
}
if err != nil || result.ExternalLinks.Added != 60 || queries != 2 {
t.Fatalf("result/error/reads = %+v/%v/%d, want added=60 and 2 reads", result, err, queries)
}
var wg sync.WaitGroup
results := make(chan BulkAdjustResult, 2)
errors := make(chan error, 2)
for range 2 {
wg.Go(func() {
res, err := (&ClientService{}).BulkAppendExternalLinks(emails, []ExternalLinkInput{{Kind: "link", Value: "trojan://pw@new.example:443"}})
results <- res
errors <- err
})
}
wg.Wait()
close(results)
close(errors)
for err := range errors {
if err != nil {
t.Fatal(err)
}
}
added, skipped := 0, 0
for res := range results {
added += res.ExternalLinks.Added
skipped += res.ExternalLinks.Skipped
}
if added != 60 || skipped != 60 {
t.Fatalf("concurrent results: added=%d skipped=%d, want 60/60", added, skipped)
}
}
func TestBulkAppendExternalLinksCrossesClientQueryChunks(t *testing.T) {
setupBulkDB(t)
db := database.GetDB()
clients := make([]model.ClientRecord, sqlInChunk+1)
emails := make([]string, len(clients))
for i := range clients {
emails[i] = fmt.Sprintf("chunk-client-%04d", i)
clients[i].Email = emails[i]
}
if err := db.CreateInBatches(&clients, sqlInChunk).Error; err != nil {
t.Fatal(err)
}
queries := 0
if err := db.Callback().Query().After("gorm:query").Register("count_chunk_link_reads", func(_ *gorm.DB) { queries++ }); err != nil {
t.Fatal(err)
}
result, err := (&ClientService{}).BulkAppendExternalLinks(emails, []ExternalLinkInput{{Kind: "subscription", Value: "https://provider.example/sub"}})
if err := db.Callback().Query().Remove("count_chunk_link_reads"); err != nil {
t.Fatal(err)
}
want := BulkAdjustResult{Adjusted: len(clients), ExternalLinks: &BulkExternalLinksResult{Added: len(clients)}}
if err != nil || !reflect.DeepEqual(result, want) || queries != 4 {
t.Fatalf("chunked result/error/reads = %+v/%v/%d, want %+v and 4 reads", result, err, queries, want)
}
var rows []model.ClientExternalLink
if err := db.Order("client_id").Find(&rows).Error; err != nil {
t.Fatal(err)
}
if len(rows) != len(clients) || rows[len(rows)-1].ClientId != clients[len(clients)-1].Id {
t.Fatalf("chunked rows = %d, last = %+v, want links for every selected client", len(rows), rows[len(rows)-1])
}
}
+6 -6
View File
@@ -14,12 +14,12 @@ import (
// ExternalLinkInput is one row from the client form's Links tab.
type ExternalLinkInput struct {
Kind string `json:"kind"`
Value string `json:"value"`
Remark string `json:"remark"`
Enable *bool `json:"enable"`
ExpiryTime int64 `json:"expiryTime"`
NamePrefix string `json:"namePrefix"`
Kind string `json:"kind,omitempty" example:"link"`
Value string `json:"value" example:"vless://uuid@example.com:443"`
Remark string `json:"remark,omitempty" example:"Backup"`
Enable *bool `json:"enable,omitempty" example:"true"`
ExpiryTime int64 `json:"expiryTime,omitempty" example:"0"`
NamePrefix string `json:"namePrefix,omitempty"`
}
func (s *ClientService) GetExternalLinksForRecord(id int) ([]model.ClientExternalLink, error) {
+3 -1
View File
@@ -305,7 +305,9 @@ func clientRecordsByEmail(tx *gorm.DB, emails []string) (map[string]*model.Clien
var records []model.ClientRecord
for _, batch := range chunkStrings(emails, sqlInChunk) {
var rows []model.ClientRecord
if err := tx.Where("email IN ?", batch).Find(&rows).Error; err != nil {
// Scoped transactions can reuse their Statement; clone each chunk so
// WHERE clauses from earlier chunks cannot accumulate.
if err := tx.Session(&gorm.Session{}).Where("email IN ?", batch).Find(&rows).Error; err != nil {
return nil, err
}
records = append(records, rows...)
+9 -2
View File
@@ -1044,7 +1044,8 @@
"delDepleted": "تم حذف {count} عميل منتهٍ",
"delOrphans": "تم حذف {count} عميل غير مرتبط",
"imported": "تم استيراد {count} عميل",
"importedMixed": "{ok} تم استيرادهم، {failed} تم تخطيهم"
"importedMixed": "{ok} تم استيرادهم، {failed} تم تخطيهم",
"bulkLinksAppended": "تم تحديث {clients} عميل: أُضيف {added}، وتُخطي {skipped} مكرر، ولم يُعثر على {errors} عميل."
},
"renewMax": "الحد الأقصى للتجديدات",
"renewMaxDesc": "عدد المرات التي يمكن أن يعمل فيها التجديد التلقائي قبل ترك العميل ينتهي. القيمة 0 تعني بلا حد. تعويض عدة فترات فائتة يستهلك تجديدًا واحدًا لكل فترة.",
@@ -1072,7 +1073,13 @@
"renewsUsed": "التجديدات المستخدمة",
"bulkAdTagHint": "أدخل علامة من 32 حرفًا ست عشريًا للتعيين، أو 'none' للمسح في منافذ MTProto.",
"renewIntervalDesc": "بعد انتهاء الصلاحية، يُضاف عدد الأيام المحدد (24 ساعة لكل يوم) إلى الموعد النهائي السابق ويُعاد تعيين استهلاك العميل. أبقِ إعادة تعيين الاستهلاك المستقلة معطلة ما لم تكن تريد إعادة تعيين إضافية.",
"renewWeeklyDesc": "يتم التجديد التقويمي عند منتصف الليل بتوقيت اللوحة ويُعاد أيضًا تعيين استهلاك العميل. أبقِ إعادة تعيين الاستهلاك المستقلة معطلة ما لم تكن تريد إعادة تعيين إضافية."
"renewWeeklyDesc": "يتم التجديد التقويمي عند منتصف الليل بتوقيت اللوحة ويُعاد أيضًا تعيين استهلاك العميل. أبقِ إعادة تعيين الاستهلاك المستقلة معطلة ما لم تكن تريد إعادة تعيين إضافية.",
"bulkAdjustSettings": "الحدود والإعدادات",
"bulkAppendLinks": "إضافة روابط خارجية",
"bulkAppendLinksHint": "تُضاف إلى كل العملاء المحددين. تُحفظ الروابط الحالية وإعداداتها وتُتخطى القيم المكررة من النوع نفسه. طبّق التعديلات الأخرى بشكل منفصل.",
"bulkAppendLinksRequired": "أضف رابطًا خارجيًا أو اشتراكًا واحدًا على الأقل.",
"externalLinkInvalid": "أدخل رابط مشاركة مدعومًا.",
"externalSubscriptionInvalid": "أدخل عنوان اشتراك باستخدام http أو https."
},
"groups": {
"name": "الاسم",
+9 -2
View File
@@ -1044,7 +1044,8 @@
"delDepleted": "{count} depleted clients deleted",
"delOrphans": "{count} unattached clients deleted",
"imported": "{count} clients imported",
"importedMixed": "{ok} imported, {failed} skipped"
"importedMixed": "{ok} imported, {failed} skipped",
"bulkLinksAppended": "{clients} clients updated: {added} added, {skipped} duplicates skipped, {errors} clients not found."
},
"renewMax": "Max renewals",
"renewMaxDesc": "How many times auto-renew may fire before the client is left to expire. 0 means no limit. Catching up several missed periods spends one renewal per period.",
@@ -1072,7 +1073,13 @@
"renewsUsed": "Renewals used",
"bulkAdTagHint": "Enter a 32-character hex tag to set, or 'none' to clear sponsor channel on MTProto inbounds.",
"renewIntervalDesc": "Adds the configured number of 24-hour days to the previous cutoff after expiry and resets the client's traffic. Keep independent traffic resets disabled unless an additional reset is intended.",
"renewWeeklyDesc": "Calendar renewal uses midnight in the panel timezone and also resets the client's traffic. Keep independent traffic resets disabled unless an additional reset is intended."
"renewWeeklyDesc": "Calendar renewal uses midnight in the panel timezone and also resets the client's traffic. Keep independent traffic resets disabled unless an additional reset is intended.",
"bulkAdjustSettings": "Limits and settings",
"bulkAppendLinks": "Append external links",
"bulkAppendLinksHint": "Append to every selected client. Existing entries and their settings stay unchanged; duplicate kind and value pairs are skipped. Apply other adjustments separately.",
"bulkAppendLinksRequired": "Add at least one external link or subscription.",
"externalLinkInvalid": "Enter a supported share link.",
"externalSubscriptionInvalid": "Enter an http(s) subscription URL."
},
"groups": {
"name": "Name",
+9 -2
View File
@@ -1044,7 +1044,8 @@
"delDepleted": "{count} clientes agotados eliminados",
"delOrphans": "{count} clientes sin entrante eliminados",
"imported": "{count} clientes importados",
"importedMixed": "{ok} importados, {failed} omitidos"
"importedMixed": "{ok} importados, {failed} omitidos",
"bulkLinksAppended": "{clients} clientes actualizados: {added} añadidos, {skipped} duplicados omitidos, {errors} clientes no encontrados."
},
"renewMax": "Renovaciones máximas",
"renewMaxDesc": "Cuántas veces puede activarse la renovación automática antes de dejar que el cliente caduque. 0 significa sin límite. Recuperar varios periodos perdidos consume una renovación por periodo.",
@@ -1072,7 +1073,13 @@
"renewsUsed": "Renovaciones usadas",
"bulkAdTagHint": "Introduce una etiqueta hexadecimal de 32 caracteres para asignar, o 'none' para borrarla en MTProto.",
"renewIntervalDesc": "Tras expirar, añade el número configurado de días de 24 horas al vencimiento anterior y reinicia el tráfico del cliente. Mantén desactivados los reinicios de tráfico independientes salvo que quieras un reinicio adicional.",
"renewWeeklyDesc": "La renovación por calendario se realiza a medianoche en la zona horaria del panel y también reinicia el tráfico del cliente. Mantén desactivados los reinicios de tráfico independientes salvo que quieras un reinicio adicional."
"renewWeeklyDesc": "La renovación por calendario se realiza a medianoche en la zona horaria del panel y también reinicia el tráfico del cliente. Mantén desactivados los reinicios de tráfico independientes salvo que quieras un reinicio adicional.",
"bulkAdjustSettings": "Límites y ajustes",
"bulkAppendLinks": "Añadir enlaces externos",
"bulkAppendLinksHint": "Se añaden a todos los clientes seleccionados. Se conservan las entradas y los ajustes existentes; se omiten los pares de tipo y valor duplicados. Aplica los demás ajustes por separado.",
"bulkAppendLinksRequired": "Añade al menos un enlace o una suscripción externa.",
"externalLinkInvalid": "Introduce un enlace compartido compatible.",
"externalSubscriptionInvalid": "Introduce una URL de suscripción http(s)."
},
"groups": {
"name": "Nombre",
+9 -2
View File
@@ -1044,7 +1044,8 @@
"delDepleted": "{count} کلاینت اتمام‌یافته حذف شد",
"delOrphans": "{count} کلاینت بدون اینباند حذف شد",
"imported": "{count} کلاینت وارد شد",
"importedMixed": "{ok} وارد شد، {failed} رد شد"
"importedMixed": "{ok} وارد شد، {failed} رد شد",
"bulkLinksAppended": "{clients} کلاینت به‌روزرسانی شد: {added} مورد افزوده، {skipped} مورد تکراری رد و {errors} کلاینت پیدا نشد."
},
"renewMax": "حداکثر تعداد تمدید",
"renewMaxDesc": "تمدید خودکار حداکثر چند بار اجرا شود پیش از آنکه کلاینت منقضی بماند. مقدار ۰ یعنی بدون محدودیت. جبران چند دورهٔ ازدست‌رفته، برای هر دوره یک تمدید مصرف می‌کند.",
@@ -1072,7 +1073,13 @@
"renewsUsed": "تمدیدهای استفاده‌شده",
"bulkAdTagHint": "یک برچسب هگز ۳۲ کاراکتری برای تنظیم وارد کنید، یا 'none' برای پاک کردن در MTProto.",
"renewIntervalDesc": "پس از انقضا، تعداد روزهای تعیین‌شده (هر روز ۲۴ ساعت) به مهلت قبلی اضافه و ترافیک کاربر بازنشانی می‌شود. بازنشانی مستقل ترافیک را غیرفعال نگه دارید، مگر اینکه بازنشانی دیگری می‌خواهید.",
"renewWeeklyDesc": "تمدید تقویمی در نیمه‌شب به وقت پنل انجام می‌شود و ترافیک کاربر را نیز بازنشانی می‌کند. بازنشانی مستقل ترافیک را غیرفعال نگه دارید، مگر اینکه بازنشانی دیگری می‌خواهید."
"renewWeeklyDesc": "تمدید تقویمی در نیمه‌شب به وقت پنل انجام می‌شود و ترافیک کاربر را نیز بازنشانی می‌کند. بازنشانی مستقل ترافیک را غیرفعال نگه دارید، مگر اینکه بازنشانی دیگری می‌خواهید.",
"bulkAdjustSettings": "محدودیت‌ها و تنظیمات",
"bulkAppendLinks": "افزودن لینک‌های خارجی",
"bulkAppendLinksHint": "به همه کلاینت‌های انتخاب‌شده اضافه می‌شود. لینک‌ها و تنظیمات فعلی حفظ و موارد تکراری با نوع و مقدار یکسان رد می‌شوند. سایر تغییرات را جداگانه اعمال کنید.",
"bulkAppendLinksRequired": "حداقل یک لینک یا اشتراک خارجی اضافه کنید.",
"externalLinkInvalid": "یک لینک اشتراک پشتیبانی‌شده وارد کنید.",
"externalSubscriptionInvalid": "نشانی اشتراک با پروتکل http یا https وارد کنید."
},
"groups": {
"name": "نام",
+9 -2
View File
@@ -1044,7 +1044,8 @@
"delDepleted": "{count} klien habis dihapus",
"delOrphans": "{count} klien tanpa inbound dihapus",
"imported": "{count} klien diimpor",
"importedMixed": "{ok} diimpor, {failed} dilewati"
"importedMixed": "{ok} diimpor, {failed} dilewati",
"bulkLinksAppended": "{clients} klien diperbarui: {added} ditambahkan, {skipped} duplikat dilewati, {errors} klien tidak ditemukan."
},
"renewMax": "Maksimum perpanjangan",
"renewMaxDesc": "Berapa kali perpanjangan otomatis boleh berjalan sebelum klien dibiarkan kedaluwarsa. 0 berarti tanpa batas. Mengejar beberapa periode yang terlewat menghabiskan satu perpanjangan per periode.",
@@ -1072,7 +1073,13 @@
"renewsUsed": "Perpanjangan terpakai",
"bulkAdTagHint": "Masukkan tag heksadesimal 32 karakter untuk mengatur, atau 'none' untuk menghapus pada MTProto.",
"renewIntervalDesc": "Setelah kedaluwarsa, menambahkan jumlah hari yang ditentukan (24 jam per hari) ke batas waktu sebelumnya dan mereset trafik klien. Nonaktifkan reset trafik terpisah kecuali Anda menginginkan reset tambahan.",
"renewWeeklyDesc": "Perpanjangan kalender dilakukan pada tengah malam menurut zona waktu panel dan juga mereset trafik klien. Nonaktifkan reset trafik terpisah kecuali Anda menginginkan reset tambahan."
"renewWeeklyDesc": "Perpanjangan kalender dilakukan pada tengah malam menurut zona waktu panel dan juga mereset trafik klien. Nonaktifkan reset trafik terpisah kecuali Anda menginginkan reset tambahan.",
"bulkAdjustSettings": "Batas dan pengaturan",
"bulkAppendLinks": "Tambahkan tautan eksternal",
"bulkAppendLinksHint": "Tambahkan ke semua klien yang dipilih. Entri dan pengaturan yang ada dipertahankan; pasangan jenis dan nilai duplikat dilewati. Terapkan penyesuaian lain secara terpisah.",
"bulkAppendLinksRequired": "Tambahkan setidaknya satu tautan atau langganan eksternal.",
"externalLinkInvalid": "Masukkan tautan berbagi yang didukung.",
"externalSubscriptionInvalid": "Masukkan URL langganan http(s)."
},
"groups": {
"name": "Nama",
+9 -2
View File
@@ -1044,7 +1044,8 @@
"delDepleted": "使い切った {count} 件のクライアントを削除しました",
"delOrphans": "未アタッチの {count} 件のクライアントを削除しました",
"imported": "{count} 件のクライアントをインポートしました",
"importedMixed": "{ok} 件インポート、{failed} 件スキップ"
"importedMixed": "{ok} 件インポート、{failed} 件スキップ",
"bulkLinksAppended": "{clients}クライアントを更新:{added}件追加、重複{skipped}件をスキップ、{errors}クライアントが見つかりません。"
},
"renewMax": "最大更新回数",
"renewMaxDesc": "自動更新が実行される最大回数です。これを超えるとクライアントはそのまま失効します。0 は無制限。複数の未処理期間をまとめて処理する場合、1 期間につき 1 回消費します。",
@@ -1072,7 +1073,13 @@
"renewsUsed": "使用済み更新回数",
"bulkAdTagHint": "設定するには 32 文字の 16 進数タグを入力し、クリアするには 'none' を入力します (MTProto 用)。",
"renewIntervalDesc": "期限切れ後、前回の期限に指定日数(1 日 24 時間)を加算し、クライアントの通信量をリセットします。追加のリセットが不要なら、独立した通信量リセットは無効にしてください。",
"renewWeeklyDesc": "カレンダー更新はパネルのタイムゾーンの午前 0 時に行われ、クライアントの通信量もリセットします。追加のリセットが不要なら、独立した通信量リセットは無効にしてください。"
"renewWeeklyDesc": "カレンダー更新はパネルのタイムゾーンの午前 0 時に行われ、クライアントの通信量もリセットします。追加のリセットが不要なら、独立した通信量リセットは無効にしてください。",
"bulkAdjustSettings": "制限と設定",
"bulkAppendLinks": "外部リンクを追加",
"bulkAppendLinksHint": "選択したすべてのクライアントに追加します。既存の項目と設定を保持し、種類と値が同じ項目はスキップします。他の調整は別に適用してください。",
"bulkAppendLinksRequired": "外部リンクまたはサブスクリプションを1件以上追加してください。",
"externalLinkInvalid": "対応する共有リンクを入力してください。",
"externalSubscriptionInvalid": "http(s)のサブスクリプションURLを入力してください。"
},
"groups": {
"name": "名前",
+9 -2
View File
@@ -1044,7 +1044,8 @@
"delDepleted": "{count} clientes esgotados excluídos",
"delOrphans": "{count} clientes sem inbound excluídos",
"imported": "{count} clientes importados",
"importedMixed": "{ok} importados, {failed} ignorados"
"importedMixed": "{ok} importados, {failed} ignorados",
"bulkLinksAppended": "{clients} clientes atualizados: {added} adicionados, {skipped} duplicados ignorados, {errors} clientes não encontrados."
},
"renewMax": "Renovações máximas",
"renewMaxDesc": "Quantas vezes a renovação automática pode ocorrer antes de o cliente ser deixado a expirar. 0 significa sem limite. Recuperar vários períodos perdidos consome uma renovação por período.",
@@ -1072,7 +1073,13 @@
"renewsUsed": "Renovações usadas",
"bulkAdTagHint": "Insira uma tag hexadecimal de 32 caracteres para definir ou 'none' para limpar no MTProto.",
"renewIntervalDesc": "Após a expiração, adiciona o número configurado de dias de 24 horas ao prazo anterior e redefine o tráfego do cliente. Mantenha as redefinições independentes de tráfego desativadas, a menos que queira uma redefinição adicional.",
"renewWeeklyDesc": "A renovação por calendário ocorre à meia-noite no fuso horário do painel e também redefine o tráfego do cliente. Mantenha as redefinições independentes de tráfego desativadas, a menos que queira uma redefinição adicional."
"renewWeeklyDesc": "A renovação por calendário ocorre à meia-noite no fuso horário do painel e também redefine o tráfego do cliente. Mantenha as redefinições independentes de tráfego desativadas, a menos que queira uma redefinição adicional.",
"bulkAdjustSettings": "Limites e configurações",
"bulkAppendLinks": "Adicionar links externos",
"bulkAppendLinksHint": "Adiciona a todos os clientes selecionados. Preserva as entradas e configurações existentes; ignora pares de tipo e valor duplicados. Aplique outros ajustes separadamente.",
"bulkAppendLinksRequired": "Adicione pelo menos um link ou assinatura externa.",
"externalLinkInvalid": "Insira um link de compartilhamento compatível.",
"externalSubscriptionInvalid": "Insira uma URL de assinatura http(s)."
},
"groups": {
"name": "Nome",
+9 -2
View File
@@ -1044,7 +1044,8 @@
"delDepleted": "Удалено исчерпанных клиентов: {count}",
"delOrphans": "Удалено клиентов без входящего: {count}",
"imported": "Импортировано клиентов: {count}",
"importedMixed": "Импортировано: {ok}, пропущено: {failed}"
"importedMixed": "Импортировано: {ok}, пропущено: {failed}",
"bulkLinksAppended": "Обновлено клиентов: {clients}. Добавлено: {added}, пропущено повторов: {skipped}, не найдено клиентов: {errors}."
},
"renewMax": "Лимит продлений",
"renewMaxDesc": "Сколько раз автопродление может сработать, прежде чем клиент будет оставлен истекать. 0 — без ограничения. Догон нескольких пропущенных периодов расходует по одному продлению на период.",
@@ -1072,7 +1073,13 @@
"renewsUsed": "Продлений израсходовано",
"bulkAdTagHint": "Введите 32-значный hex-тег для установки или 'none' для очистки спонсорского канала на MTProto.",
"renewIntervalDesc": "После истечения срока добавляет указанное число 24-часовых дней к предыдущему сроку и сбрасывает трафик клиента. Оставьте независимый сброс трафика выключенным, если дополнительный сброс не нужен.",
"renewWeeklyDesc": "Календарное продление выполняется в полночь по часовому поясу панели и также сбрасывает трафик клиента. Оставьте независимый сброс трафика выключенным, если дополнительный сброс не нужен."
"renewWeeklyDesc": "Календарное продление выполняется в полночь по часовому поясу панели и также сбрасывает трафик клиента. Оставьте независимый сброс трафика выключенным, если дополнительный сброс не нужен.",
"bulkAdjustSettings": "Лимиты и настройки",
"bulkAppendLinks": "Добавить внешние ссылки",
"bulkAppendLinksHint": "Добавить всем выбранным клиентам. Существующие записи и настройки сохраняются; повторы с одинаковыми типом и значением пропускаются. Остальные изменения применяйте отдельно.",
"bulkAppendLinksRequired": "Добавьте хотя бы одну внешнюю ссылку или подписку.",
"externalLinkInvalid": "Введите поддерживаемую ссылку подключения.",
"externalSubscriptionInvalid": "Введите URL подписки http(s)."
},
"groups": {
"name": "Имя",
+9 -2
View File
@@ -1044,7 +1044,8 @@
"delDepleted": "Odstránení ukončení klienti: {count}",
"delOrphans": "Odstránení nepriradení klienti: {count}",
"imported": "Importovaní klienti: {count}",
"importedMixed": "Importované: {ok}, preskočené: {failed}"
"importedMixed": "Importované: {ok}, preskočené: {failed}",
"bulkLinksAppended": "Aktualizovaní klienti: {clients}; pridané: {added}, preskočené duplicity: {skipped}, nenájdení klienti: {errors}."
},
"renewMax": "Najviac obnovení",
"renewMaxDesc": "Koľkokrát sa môže platnosť automaticky obnoviť, než účet zostane neplatný. Hodnota 0 znamená bez obmedzenia. Pri dobiehaní zmeškaných období sa každé obdobie počíta ako jedno obnovenie.",
@@ -1072,7 +1073,13 @@
"renewsUsed": "Použité obnovenia",
"bulkAdTagHint": "Zadajte 32-znakovú hexadecimálnu značku alebo 'none' na odstránenie sponzorovaného kanála zo vstupov MTProto.",
"renewIntervalDesc": "Po skončení platnosti pridá nastavený počet 24-hodinových dní k predchádzajúcemu koncu platnosti a vynuluje spotrebu klienta. Samostatné nulovanie spotreby nechajte vypnuté, ak nechcete ďalšie nulovanie navyše.",
"renewWeeklyDesc": "Kalendárne obnovenie prebieha o polnoci v časovom pásme panelu a vynuluje aj spotrebu klienta. Samostatné nulovanie spotreby nechajte vypnuté, ak nechcete ďalšie nulovanie navyše."
"renewWeeklyDesc": "Kalendárne obnovenie prebieha o polnoci v časovom pásme panelu a vynuluje aj spotrebu klienta. Samostatné nulovanie spotreby nechajte vypnuté, ak nechcete ďalšie nulovanie navyše.",
"bulkAdjustSettings": "Limity a nastavenia",
"bulkAppendLinks": "Pridať externé odkazy",
"bulkAppendLinksHint": "Pridá všetkým vybraným klientom. Existujúce záznamy a nastavenia sa zachovajú; duplicitné dvojice typu a hodnoty sa preskočia. Ostatné úpravy použite samostatne.",
"bulkAppendLinksRequired": "Pridajte aspoň jeden externý odkaz alebo odber.",
"externalLinkInvalid": "Zadajte podporovaný odkaz na zdieľanie.",
"externalSubscriptionInvalid": "Zadajte URL odberu http(s)."
},
"groups": {
"name": "Názov",
+9 -2
View File
@@ -1044,7 +1044,8 @@
"delDepleted": "{count} tükenmiş kullanıcı silindi",
"delOrphans": "{count} bağsız kullanıcı silindi",
"imported": "{count} kullanıcı içe aktarıldı",
"importedMixed": "{ok} içe aktarıldı, {failed} atlandı"
"importedMixed": "{ok} içe aktarıldı, {failed} atlandı",
"bulkLinksAppended": "{clients} istemci güncellendi: {added} eklendi, {skipped} tekrar atlandı, {errors} istemci bulunamadı."
},
"renewMax": "En fazla yenileme",
"renewMaxDesc": "İstemcinin süresi dolmaya bırakılmadan önce otomatik yenilemenin kaç kez çalışabileceği. 0 sınırsız demektir. Kaçırılan birden fazla dönemi telafi etmek, dönem başına bir yenileme harcar.",
@@ -1072,7 +1073,13 @@
"renewsUsed": "Kullanılan yenileme",
"bulkAdTagHint": "Aramak için 32 karakterlik onaltılık etiket girin veya MTProto üzerinde temizlemek için 'none' yazın.",
"renewIntervalDesc": "Süre dolduktan sonra önceki bitiş zamanına belirlenen sayıda 24 saatlik gün ekler ve istemci trafiğini sıfırlar. Ek bir sıfırlama istemiyorsanız bağımsız trafik sıfırlamalarını devre dışı bırakın.",
"renewWeeklyDesc": "Takvim yenilemesi panelin saat diliminde gece yarısı gerçekleşir ve istemci trafiğini de sıfırlar. Ek bir sıfırlama istemiyorsanız bağımsız trafik sıfırlamalarını devre dışı bırakın."
"renewWeeklyDesc": "Takvim yenilemesi panelin saat diliminde gece yarısı gerçekleşir ve istemci trafiğini de sıfırlar. Ek bir sıfırlama istemiyorsanız bağımsız trafik sıfırlamalarını devre dışı bırakın.",
"bulkAdjustSettings": "Sınırlar ve ayarlar",
"bulkAppendLinks": "Harici bağlantılar ekle",
"bulkAppendLinksHint": "Seçilen tüm istemcilere eklenir. Mevcut girdiler ve ayarları korunur; aynı tür ve değere sahip tekrarlar atlanır. Diğer ayarlamaları ayrı uygulayın.",
"bulkAppendLinksRequired": "En az bir harici bağlantı veya abonelik ekleyin.",
"externalLinkInvalid": "Desteklenen bir paylaşım bağlantısı girin.",
"externalSubscriptionInvalid": "Bir http(s) abonelik URL’si girin."
},
"groups": {
"name": "İsim",
+9 -2
View File
@@ -1044,7 +1044,8 @@
"delDepleted": "Видалено вичерпаних клієнтів: {count}",
"delOrphans": "Видалено клієнтів без вхідного: {count}",
"imported": "Імпортовано клієнтів: {count}",
"importedMixed": "Імпортовано: {ok}, пропущено: {failed}"
"importedMixed": "Імпортовано: {ok}, пропущено: {failed}",
"bulkLinksAppended": "Оновлено клієнтів: {clients}. Додано: {added}, пропущено повторів: {skipped}, не знайдено клієнтів: {errors}."
},
"renewMax": "Ліміт подовжень",
"renewMaxDesc": "Скільки разів автоподовження може спрацювати, перш ніж клієнта буде залишено спливати. 0 — без обмеження. Надолуження кількох пропущених періодів витрачає по одному подовженню на період.",
@@ -1072,7 +1073,13 @@
"renewsUsed": "Подовжень витрачено",
"bulkAdTagHint": "Введіть 32-значний hex-тег для встановлення або 'none' для очищення спонсорського каналу на MTProto.",
"renewIntervalDesc": "Після завершення строку додає вказану кількість 24-годинних днів до попереднього терміну та скидає трафік клієнта. Залиште незалежне скидання трафіку вимкненим, якщо додаткове скидання не потрібне.",
"renewWeeklyDesc": "Календарне подовження відбувається опівночі за часовим поясом панелі й також скидає трафік клієнта. Залиште незалежне скидання трафіку вимкненим, якщо додаткове скидання не потрібне."
"renewWeeklyDesc": "Календарне подовження відбувається опівночі за часовим поясом панелі й також скидає трафік клієнта. Залиште незалежне скидання трафіку вимкненим, якщо додаткове скидання не потрібне.",
"bulkAdjustSettings": "Ліміти та налаштування",
"bulkAppendLinks": "Додати зовнішні посилання",
"bulkAppendLinksHint": "Додається всім вибраним клієнтам. Наявні записи та налаштування зберігаються; повтори з однаковими типом і значенням пропускаються. Інші зміни застосовуйте окремо.",
"bulkAppendLinksRequired": "Додайте хоча б одне зовнішнє посилання або підписку.",
"externalLinkInvalid": "Введіть підтримуване посилання підключення.",
"externalSubscriptionInvalid": "Введіть URL підписки http(s)."
},
"groups": {
"name": "Назва",
+9 -2
View File
@@ -1044,7 +1044,8 @@
"delDepleted": "Đã xóa {count} khách hàng hết hạn mức",
"delOrphans": "Đã xóa {count} khách hàng không gắn inbound",
"imported": "Đã nhập {count} khách hàng",
"importedMixed": "Đã nhập {ok}, bỏ qua {failed}"
"importedMixed": "Đã nhập {ok}, bỏ qua {failed}",
"bulkLinksAppended": "Đã cập nhật {clients} máy khách: thêm {added}, bỏ qua {skipped} mục trùng, không tìm thấy {errors} máy khách."
},
"renewMax": "Số lần gia hạn tối đa",
"renewMaxDesc": "Gia hạn tự động được phép chạy bao nhiêu lần trước khi để khách hàng hết hạn. 0 nghĩa là không giới hạn. Bù lại nhiều kỳ đã bỏ lỡ sẽ tiêu tốn một lần gia hạn cho mỗi kỳ.",
@@ -1072,7 +1073,13 @@
"renewsUsed": "Số lần gia hạn đã dùng",
"bulkAdTagHint": "Nhập thẻ hex 32 ký tự để đặt hoặc 'none' để xóa kênh tài trợ trên MTProto.",
"renewIntervalDesc": "Sau khi hết hạn, cộng số ngày đã đặt (mỗi ngày 24 giờ) vào thời điểm hết hạn trước đó và đặt lại lưu lượng của khách hàng. Tắt việc đặt lại lưu lượng độc lập trừ khi bạn muốn đặt lại thêm.",
"renewWeeklyDesc": "Gia hạn theo lịch diễn ra lúc nửa đêm theo múi giờ của bảng điều khiển và cũng đặt lại lưu lượng của khách hàng. Tắt việc đặt lại lưu lượng độc lập trừ khi bạn muốn đặt lại thêm."
"renewWeeklyDesc": "Gia hạn theo lịch diễn ra lúc nửa đêm theo múi giờ của bảng điều khiển và cũng đặt lại lưu lượng của khách hàng. Tắt việc đặt lại lưu lượng độc lập trừ khi bạn muốn đặt lại thêm.",
"bulkAdjustSettings": "Giới hạn và cài đặt",
"bulkAppendLinks": "Thêm liên kết ngoài",
"bulkAppendLinksHint": "Thêm vào mọi máy khách đã chọn. Giữ nguyên mục và cài đặt hiện có; bỏ qua các cặp loại và giá trị trùng lặp. Áp dụng các điều chỉnh khác riêng biệt.",
"bulkAppendLinksRequired": "Thêm ít nhất một liên kết hoặc đăng ký ngoài.",
"externalLinkInvalid": "Nhập liên kết chia sẻ được hỗ trợ.",
"externalSubscriptionInvalid": "Nhập URL đăng ký http(s)."
},
"groups": {
"name": "Tên",
+9 -2
View File
@@ -1044,7 +1044,8 @@
"delDepleted": "已删除 {count} 个已耗尽的客户端",
"delOrphans": "已删除 {count} 个未关联的客户端",
"imported": "已导入 {count} 个客户端",
"importedMixed": "已导入 {ok} 个,跳过 {failed} 个"
"importedMixed": "已导入 {ok} 个,跳过 {failed} 个",
"bulkLinksAppended": "已更新 {clients} 个客户端:新增 {added} 条,跳过 {skipped} 条重复项,{errors} 个客户端未找到。"
},
"renewMax": "最大续期次数",
"renewMaxDesc": "自动续期最多可触发的次数,达到后客户端将自然到期。填 0 表示不限制。补齐多个错过的周期时,每个周期消耗一次续期。",
@@ -1072,7 +1073,13 @@
"renewsUsed": "已用续期次数",
"bulkAdTagHint": "输入 32 位十六进制标签以设置,或输入 'none' 清除 MTProto 赞助频道。",
"renewIntervalDesc": "到期后从上次截止时间增加指定天数(每天 24 小时),并重置客户端流量。若不需要额外重置,请关闭独立的流量重置。",
"renewWeeklyDesc": "日历续期按面板时区的午夜执行,并重置客户端流量。若不需要额外重置,请关闭独立的流量重置。"
"renewWeeklyDesc": "日历续期按面板时区的午夜执行,并重置客户端流量。若不需要额外重置,请关闭独立的流量重置。",
"bulkAdjustSettings": "限额与设置",
"bulkAppendLinks": "追加外部链接",
"bulkAppendLinksHint": "追加到所有选中的客户端。保留现有条目及其设置,跳过类型和值相同的重复条目。其他调整请单独应用。",
"bulkAppendLinksRequired": "请至少添加一个外部链接或订阅。",
"externalLinkInvalid": "请输入支持的分享链接。",
"externalSubscriptionInvalid": "请输入 http(s) 订阅地址。"
},
"groups": {
"name": "名称",
+9 -2
View File
@@ -1044,7 +1044,8 @@
"delDepleted": "已刪除 {count} 個已耗盡的客戶端",
"delOrphans": "已刪除 {count} 個未關聯的客戶端",
"imported": "已匯入 {count} 個客戶端",
"importedMixed": "已匯入 {ok} 個,跳過 {failed} 個"
"importedMixed": "已匯入 {ok} 個,跳過 {failed} 個",
"bulkLinksAppended": "已更新 {clients} 個用戶端:新增 {added} 筆,略過 {skipped} 筆重複項目,找不到 {errors} 個用戶端。"
},
"renewMax": "最大續期次數",
"renewMaxDesc": "自動續期最多可觸發的次數,達到後用戶端將自然到期。填 0 表示不限制。補齊多個錯過的週期時,每個週期消耗一次續期。",
@@ -1072,7 +1073,13 @@
"renewsUsed": "已用續期次數",
"bulkAdTagHint": "輸入 32 位十六進位標籤以設定,或輸入 'none' 清除 MTProto 贊助頻道。",
"renewIntervalDesc": "到期後從上次截止時間增加指定天數(每天 24 小時),並重置客戶端流量。若不需要額外重置,請關閉獨立的流量重置。",
"renewWeeklyDesc": "日曆續期按面板時區的午夜執行,並重置客戶端流量。若不需要額外重置,請關閉獨立的流量重置。"
"renewWeeklyDesc": "日曆續期按面板時區的午夜執行,並重置客戶端流量。若不需要額外重置,請關閉獨立的流量重置。",
"bulkAdjustSettings": "限額與設定",
"bulkAppendLinks": "附加外部連結",
"bulkAppendLinksHint": "附加至所有選取的用戶端。保留現有項目及其設定,略過類型和值相同的重複項目。其他調整請單獨套用。",
"bulkAppendLinksRequired": "請至少新增一個外部連結或訂閱。",
"externalLinkInvalid": "請輸入支援的分享連結。",
"externalSubscriptionInvalid": "請輸入 http(s) 訂閱網址。"
},
"groups": {
"name": "名稱",
+4
View File
@@ -100,6 +100,10 @@ func run(root, outDir string) error {
"ClientRenewalPreviewRequest",
"ClientRenewalPreview",
"ClientPageResponse",
"BulkAdjustResult",
"BulkAdjustReport",
"BulkExternalLinksResult",
"ExternalLinkInput",
"ClientsSummary",
"InboundTrafficSummary",
"LogEntry",