mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-08-12 06:10:58 +00:00
fix(inbounds): show remark first, else inbound tag, in client labels
Revert formatInboundLabel to the pre-#5151 behavior: display the inbound remark when set, otherwise the inbound tag, instead of "tag (remark)". Affects the Attach clients / Attached inbounds views and client lists. Routing keeps its own tag (remark) formatting.
This commit is contained in:
@@ -1,12 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* Display label for an inbound: `tag (remark)` when a distinct remark exists,
|
* Display label for an inbound: the remark when one is set, otherwise the
|
||||||
* otherwise just the tag. Falls back to the remark when no tag is set, and to an
|
* inbound tag. Falls back to an empty string when neither is present.
|
||||||
* empty string when neither is present.
|
|
||||||
*/
|
*/
|
||||||
export function formatInboundLabel(tag?: string, remark?: string): string {
|
export function formatInboundLabel(tag?: string, remark?: string): string {
|
||||||
const tagText = (tag || '').trim();
|
|
||||||
const remarkText = (remark || '').trim();
|
const remarkText = (remark || '').trim();
|
||||||
if (!tagText) return remarkText;
|
if (remarkText) return remarkText;
|
||||||
if (!remarkText || remarkText === tagText) return tagText;
|
return (tag || '').trim();
|
||||||
return `${tagText} (${remarkText})`;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -418,7 +418,7 @@ func GetApiToken(getApiToken bool) {
|
|||||||
if len(tokens) > 0 {
|
if len(tokens) > 0 {
|
||||||
fmt.Printf("There are %d API token(s) configured. Existing tokens cannot be retrieved in plaintext because only hashes are stored.\n", len(tokens))
|
fmt.Printf("There are %d API token(s) configured. Existing tokens cannot be retrieved in plaintext because only hashes are stored.\n", len(tokens))
|
||||||
fmt.Println("If you have lost your token, you can manage and generate new tokens through the Panel UI (Settings -> API Tokens).")
|
fmt.Println("If you have lost your token, you can manage and generate new tokens through the Panel UI (Settings -> API Tokens).")
|
||||||
|
|
||||||
// Create a new fallback token so the CLI is still useful without the UI
|
// Create a new fallback token so the CLI is still useful without the UI
|
||||||
fallbackName := fmt.Sprintf("cli-fallback-%d", time.Now().Unix())
|
fallbackName := fmt.Sprintf("cli-fallback-%d", time.Now().Unix())
|
||||||
created, err := apiTokenService.Create(fallbackName)
|
created, err := apiTokenService.Create(fallbackName)
|
||||||
|
|||||||
Reference in New Issue
Block a user