mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-04 16:34:52 +03:00
fix(groups): page client dialogs and submit server-resolved scopes
Keep group client tables and bulk requests bounded with paged queries, frozen selections, and a streamed subscription export. Reuse existing bulk mutations and preserve the explicit-email contracts.
This commit is contained in:
+434
-19
@@ -2120,6 +2120,10 @@
|
||||
"$ref": "#/components/schemas/BulkAdjustReport"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"skippedCount": {
|
||||
"example": 0,
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -2127,6 +2131,43 @@
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"BulkDeleteReport": {
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"reason": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"email",
|
||||
"reason"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"BulkDeleteResult": {
|
||||
"description": "BulkDeleteResult mirrors BulkAdjustResult: total deleted plus per-email\nskip reasons when an email could not be processed.",
|
||||
"properties": {
|
||||
"deleted": {
|
||||
"type": "integer"
|
||||
},
|
||||
"skipped": {
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/BulkDeleteReport"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"skippedCount": {
|
||||
"example": 0,
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"deleted"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"BulkExternalLinksResult": {
|
||||
"properties": {
|
||||
"added": {
|
||||
@@ -3354,6 +3395,104 @@
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"GroupClientPage": {
|
||||
"properties": {
|
||||
"items": {
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/GroupClientRow"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"maxId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"scopeToken": {
|
||||
"type": "string"
|
||||
},
|
||||
"total": {
|
||||
"example": 120,
|
||||
"format": "int64",
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"items",
|
||||
"total"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"GroupClientRow": {
|
||||
"properties": {
|
||||
"comment": {
|
||||
"example": "Example client",
|
||||
"type": "string"
|
||||
},
|
||||
"email": {
|
||||
"example": "alice",
|
||||
"type": "string"
|
||||
},
|
||||
"enable": {
|
||||
"example": true,
|
||||
"type": "boolean"
|
||||
},
|
||||
"group": {
|
||||
"example": "staff",
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"example": 1,
|
||||
"type": "integer"
|
||||
},
|
||||
"inScope": {
|
||||
"example": true,
|
||||
"type": "boolean"
|
||||
},
|
||||
"subId": {
|
||||
"example": "example-sub-id",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"comment",
|
||||
"email",
|
||||
"enable",
|
||||
"group",
|
||||
"id",
|
||||
"inScope",
|
||||
"subId"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"GroupClientSelection": {
|
||||
"properties": {
|
||||
"clientIds": {
|
||||
"items": {
|
||||
"type": "integer"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"excludedClientIds": {
|
||||
"items": {
|
||||
"type": "integer"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"mode": {
|
||||
"example": "allMatching",
|
||||
"type": "string"
|
||||
},
|
||||
"scopeToken": {
|
||||
"type": "string"
|
||||
},
|
||||
"search": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"mode"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"HappLinkResult": {
|
||||
"properties": {
|
||||
"encryptedLink": {
|
||||
@@ -11862,14 +12001,24 @@
|
||||
],
|
||||
"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",
|
||||
"description": "Send emails for explicit clients or group for server-resolved members. Optionally send an unfiltered remove scopeToken from clientPage to reject stale membership while excluding clients created after the scope was frozen. Group responses include skippedCount when clients are skipped and at most 20 representative skip records.",
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"emails"
|
||||
"oneOf": [
|
||||
{
|
||||
"required": [
|
||||
"emails"
|
||||
]
|
||||
},
|
||||
{
|
||||
"required": [
|
||||
"group"
|
||||
]
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"emails": {
|
||||
@@ -11879,6 +12028,13 @@
|
||||
},
|
||||
"minItems": 1
|
||||
},
|
||||
"group": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"scopeToken": {
|
||||
"type": "string"
|
||||
},
|
||||
"addDays": {
|
||||
"type": "integer"
|
||||
},
|
||||
@@ -11953,7 +12109,8 @@
|
||||
"obj": {
|
||||
"adjusted": 2,
|
||||
"externalLinks": null,
|
||||
"skipped": []
|
||||
"skipped": [],
|
||||
"skippedCount": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12083,14 +12240,45 @@
|
||||
"tags": [
|
||||
"Clients"
|
||||
],
|
||||
"summary": "Delete many clients in one call. The server processes the list sequentially so each delete sees the committed state of the previous one — avoids the race the per-email fan-out had on the panel side. Pass keepTraffic=true to retain the xray_client_traffic rows after deletion.",
|
||||
"summary": "Delete clients identified by emails or by a server-resolved group. Set keepTraffic to retain client counters.",
|
||||
"operationId": "post_panel_api_clients_bulkDel",
|
||||
"description": "For group deletion, optionally send an unfiltered remove scopeToken from clientPage to reject stale membership before deletion. Newer clients outside the frozen scope are excluded. Group responses include skippedCount when clients are skipped and at most 20 representative skip records.",
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object"
|
||||
"type": "object",
|
||||
"oneOf": [
|
||||
{
|
||||
"required": [
|
||||
"emails"
|
||||
]
|
||||
},
|
||||
{
|
||||
"required": [
|
||||
"group"
|
||||
]
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"emails": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"group": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"scopeToken": {
|
||||
"type": "string"
|
||||
},
|
||||
"keepTraffic": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"example": {
|
||||
"emails": [
|
||||
@@ -12116,19 +12304,22 @@
|
||||
"msg": {
|
||||
"type": "string"
|
||||
},
|
||||
"obj": {}
|
||||
"obj": {
|
||||
"$ref": "#/components/schemas/BulkDeleteResult"
|
||||
}
|
||||
}
|
||||
},
|
||||
"example": {
|
||||
"success": true,
|
||||
"obj": {
|
||||
"deleted": 2,
|
||||
"deleted": 0,
|
||||
"skipped": [
|
||||
{
|
||||
"email": "carol",
|
||||
"reason": "client not found"
|
||||
"email": "",
|
||||
"reason": ""
|
||||
}
|
||||
]
|
||||
],
|
||||
"skippedCount": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12221,21 +12412,58 @@
|
||||
"tags": [
|
||||
"Clients"
|
||||
],
|
||||
"summary": "Add many clients to a group in one call. Updates clients.group_name and patches the matching client entry inside every owning inbound's settings JSON in a single transaction. If the group name does not yet exist (in client_groups or as a derived label), it is auto-created as a persistent group. To clear the group label, use /groups/bulkRemove instead.",
|
||||
"summary": "Move clients into a group and update every owning inbound's settings in the same transaction.",
|
||||
"operationId": "post_panel_api_clients_groups_bulkAdd",
|
||||
"description": "Send one of emails, inboundId, or selection with the target group. Emails and inboundId can create the group. A picker selection targets an existing group and excludes current members. Explicit selections use clientIds. Frozen selections use scopeToken, the original search and up to 1,000 excludedClientIds. A stale selection makes no changes.",
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object"
|
||||
"type": "object",
|
||||
"required": [
|
||||
"group"
|
||||
],
|
||||
"oneOf": [
|
||||
{
|
||||
"required": [
|
||||
"emails"
|
||||
]
|
||||
},
|
||||
{
|
||||
"required": [
|
||||
"inboundId"
|
||||
]
|
||||
},
|
||||
{
|
||||
"required": [
|
||||
"selection"
|
||||
]
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"group": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"emails": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"inboundId": {
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
},
|
||||
"selection": {
|
||||
"$ref": "#/components/schemas/GroupClientSelection"
|
||||
}
|
||||
}
|
||||
},
|
||||
"example": {
|
||||
"emails": [
|
||||
"alice",
|
||||
"bob"
|
||||
],
|
||||
"group": "customer-a"
|
||||
"group": "customer-a",
|
||||
"inboundId": 7
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12274,14 +12502,43 @@
|
||||
"tags": [
|
||||
"Clients"
|
||||
],
|
||||
"summary": "Clear the group label on many clients in one call. Inverse of /groups/bulkAdd. Clients themselves are kept — only the group label is cleared from clients.group_name and from each owning inbound's settings JSON. Groups become empty if all their members are removed.",
|
||||
"summary": "Clear group membership and preserve the clients. Use either emails or a selection scoped to the named group.",
|
||||
"operationId": "post_panel_api_clients_groups_bulkRemove",
|
||||
"description": "Explicit selections use clientIds. Frozen selections use scopeToken, the original search and up to 1,000 excludedClientIds. Only members of the selected group are eligible. A stale selection makes no changes.",
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object"
|
||||
"type": "object",
|
||||
"oneOf": [
|
||||
{
|
||||
"required": [
|
||||
"emails"
|
||||
]
|
||||
},
|
||||
{
|
||||
"required": [
|
||||
"group",
|
||||
"selection"
|
||||
]
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"group": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"emails": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"selection": {
|
||||
"$ref": "#/components/schemas/GroupClientSelection"
|
||||
}
|
||||
}
|
||||
},
|
||||
"example": {
|
||||
"emails": [
|
||||
@@ -12705,6 +12962,164 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/panel/api/clients/groups/clientPage": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Clients"
|
||||
],
|
||||
"summary": "Page through group candidates, members or subscription IDs. Pages are one-based with a fixed size of 100 and an exact total.",
|
||||
"operationId": "get_panel_api_clients_groups_clientPage",
|
||||
"description": "Add mode excludes current members. Remove mode selects current members. Links mode selects members with a subscription ID. Search matches email, comment and group. freeze=true returns only the matching count, a scope token and the maximum ID for an add or remove selection. For subsequent pages, send maxId and scopeSearch to mark rows inside the frozen filter.",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "group",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"description": "Group name.",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "mode",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"description": "",
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"add",
|
||||
"remove",
|
||||
"links"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "page",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"description": "",
|
||||
"schema": {
|
||||
"type": "integer",
|
||||
"default": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "search",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"description": "",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "freeze",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"description": "",
|
||||
"schema": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "scopeSearch",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"description": "",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "maxId",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"description": "",
|
||||
"schema": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful response",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"success": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"msg": {
|
||||
"type": "string"
|
||||
},
|
||||
"obj": {
|
||||
"$ref": "#/components/schemas/GroupClientPage"
|
||||
}
|
||||
}
|
||||
},
|
||||
"example": {
|
||||
"success": true,
|
||||
"obj": {
|
||||
"items": [
|
||||
{
|
||||
"comment": "Example client",
|
||||
"email": "alice",
|
||||
"enable": true,
|
||||
"group": "staff",
|
||||
"id": 1,
|
||||
"inScope": true,
|
||||
"subId": "example-sub-id"
|
||||
}
|
||||
],
|
||||
"maxId": 0,
|
||||
"scopeToken": "",
|
||||
"total": 120
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/panel/api/clients/groups/subLinks/export": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Clients"
|
||||
],
|
||||
"summary": "Stream all subscription links for a group as tab-separated text. Each row has an email and regular link, followed by a JSON link when enabled.",
|
||||
"operationId": "get_panel_api_clients_groups_subLinks_export",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "group",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"description": "Group name.",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Complete subscription link export.",
|
||||
"content": {
|
||||
"text/plain": {
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Missing group or subscriptions disabled."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/panel/api/clients/groups/{name}/emails": {
|
||||
"get": {
|
||||
"tags": [
|
||||
|
||||
Reference in New Issue
Block a user