mirror of
https://github.com/shuaiplus/nodewarden.git
synced 2026-06-20 13:00:39 +00:00
feat: optimize path trimming and clean up unused imports in VaultPage component
This commit is contained in:
@@ -46,7 +46,10 @@ function encodePathSegments(path: string): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function trimSlashes(value: string): string {
|
function trimSlashes(value: string): string {
|
||||||
return String(value || '').replace(/^\/+|\/+$/g, '');
|
let next = String(value || '');
|
||||||
|
while (next.startsWith('/')) next = next.slice(1);
|
||||||
|
while (next.endsWith('/')) next = next.slice(0, -1);
|
||||||
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildJoinedPath(...segments: string[]): string {
|
function buildJoinedPath(...segments: string[]): string {
|
||||||
@@ -138,7 +141,7 @@ function buildCanonicalQueryString(url: URL): string {
|
|||||||
return aKey.localeCompare(bKey);
|
return aKey.localeCompare(bKey);
|
||||||
});
|
});
|
||||||
return params
|
return params
|
||||||
.map(([key, value]) => `${encodeURIComponent(key).replace(/%20/g, '%20')}=${encodeURIComponent(value).replace(/%20/g, '%20')}`)
|
.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
|
||||||
.join('&');
|
.join('&');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,34 +5,24 @@ import VaultEditor from '@/components/vault/VaultEditor';
|
|||||||
import VaultListPanel from '@/components/vault/VaultListPanel';
|
import VaultListPanel from '@/components/vault/VaultListPanel';
|
||||||
import VaultSidebar from '@/components/vault/VaultSidebar';
|
import VaultSidebar from '@/components/vault/VaultSidebar';
|
||||||
import {
|
import {
|
||||||
CREATE_TYPE_OPTIONS,
|
|
||||||
MOBILE_LAYOUT_QUERY,
|
MOBILE_LAYOUT_QUERY,
|
||||||
TOTP_PERIOD_SECONDS,
|
|
||||||
TOTP_RING_CIRCUMFERENCE,
|
|
||||||
VAULT_LIST_OVERSCAN,
|
VAULT_LIST_OVERSCAN,
|
||||||
VAULT_LIST_ROW_HEIGHT,
|
VAULT_LIST_ROW_HEIGHT,
|
||||||
VAULT_SORT_STORAGE_KEY,
|
VAULT_SORT_STORAGE_KEY,
|
||||||
cipherTypeKey,
|
cipherTypeKey,
|
||||||
cipherTypeLabel,
|
cipherTypeLabel,
|
||||||
copyToClipboard,
|
|
||||||
createEmptyDraft,
|
createEmptyDraft,
|
||||||
creationTimeValue,
|
creationTimeValue,
|
||||||
draftFromCipher,
|
draftFromCipher,
|
||||||
firstCipherUri,
|
firstCipherUri,
|
||||||
firstPasskeyCreationTime,
|
firstPasskeyCreationTime,
|
||||||
formatAttachmentSize,
|
|
||||||
formatHistoryTime,
|
|
||||||
formatTotp,
|
|
||||||
maskSecret,
|
|
||||||
openUri,
|
|
||||||
parseFieldType,
|
|
||||||
sortTimeValue,
|
sortTimeValue,
|
||||||
type SidebarFilter,
|
type SidebarFilter,
|
||||||
type VaultSortMode,
|
type VaultSortMode,
|
||||||
} from '@/components/vault/vault-page-helpers';
|
} from '@/components/vault/vault-page-helpers';
|
||||||
import { calcTotpNow } from '@/lib/crypto';
|
import { calcTotpNow } from '@/lib/crypto';
|
||||||
import { computeSshFingerprint, generateDefaultSshKeyMaterial } from '@/lib/ssh';
|
import { computeSshFingerprint, generateDefaultSshKeyMaterial } from '@/lib/ssh';
|
||||||
import { ChevronLeft, X } from 'lucide-preact';
|
import { ChevronLeft } from 'lucide-preact';
|
||||||
import type { Cipher, CustomFieldType, Folder, VaultDraft, VaultDraftField } from '@/lib/types';
|
import type { Cipher, CustomFieldType, Folder, VaultDraft, VaultDraftField } from '@/lib/types';
|
||||||
import { t } from '@/lib/i18n';
|
import { t } from '@/lib/i18n';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user