mirror of
https://github.com/Routstr/routstrd.git
synced 2026-08-11 12:38:01 +00:00
fix: standardize on hyphen instead of underscore for client ID suffix
This commit is contained in:
@@ -88,7 +88,7 @@ export async function fetchUsage(limit = 10000): Promise<UsageStats | null> {
|
||||
const entries = result.output as UsageTrackingEntry[] | undefined;
|
||||
const entriesArray = Array.isArray(entries) ? entries : [];
|
||||
const suffix = getNpubSuffix(await loadConfig());
|
||||
const suffixStr = suffix ? `_${suffix}` : null;
|
||||
const suffixStr = suffix ? `-${suffix}` : null;
|
||||
const visibleEntries = suffixStr
|
||||
? entriesArray
|
||||
.filter((entry) => entry.client?.endsWith(suffixStr))
|
||||
|
||||
@@ -34,7 +34,7 @@ export function addSuffixToId(id: string, suffix: string): string {
|
||||
* Remove suffix from a client ID if present.
|
||||
*/
|
||||
export function removeSuffixFromId(id: string, suffix: string): string {
|
||||
const suffixStr = `_${suffix}`;
|
||||
const suffixStr = `-${suffix}`;
|
||||
if (id.endsWith(suffixStr)) {
|
||||
return id.slice(0, -suffixStr.length);
|
||||
}
|
||||
@@ -109,7 +109,7 @@ export async function getClientsList(): Promise<ClientEntry[]> {
|
||||
const suffix = config.daemonUrl ? getNpubSuffix(config) : null;
|
||||
|
||||
return clients
|
||||
.filter((c) => !suffix || c.id.endsWith(`_${suffix}`))
|
||||
.filter((c) => !suffix || c.id.endsWith(`-${suffix}`))
|
||||
.map((c) => ({
|
||||
clientId: suffix ? removeSuffixFromId(c.id, suffix) : c.id,
|
||||
name: c.name,
|
||||
|
||||
Reference in New Issue
Block a user