mirror of
https://github.com/aliasvault/aliasvault.git
synced 2026-05-18 13:28:12 -04:00
Refactor folder names (#1465)
This commit is contained in:
committed by
Leendert de Borst
parent
9f2e6a0ab7
commit
3a374bd2d6
@@ -9,9 +9,9 @@ import {
|
||||
PASSKEY_PROVIDER_ENABLED_KEY,
|
||||
PASSKEY_DISABLED_SITES_KEY
|
||||
} from '@/utils/Constants';
|
||||
import { extractDomain, extractRootDomain } from '@/utils/credentialMatcher/CredentialMatcher';
|
||||
import type { PasskeyWithItem } from '@/utils/db/mappers/PasskeyMapper';
|
||||
import { EncryptionUtility } from '@/utils/EncryptionUtility';
|
||||
import { extractDomain, extractRootDomain } from '@/utils/itemMatcher/ItemMatcher';
|
||||
import { PasskeyHelper } from '@/utils/passkey/PasskeyHelper';
|
||||
import type {
|
||||
PasskeyPopupResponse,
|
||||
|
||||
@@ -344,7 +344,7 @@ export async function handleGetFilteredItems(
|
||||
const sqliteClient = await createVaultSqliteClient();
|
||||
const allItems = sqliteClient.items.getAll();
|
||||
|
||||
const { filterItems, AutofillMatchingMode } = await import('@/utils/credentialMatcher/CredentialMatcher');
|
||||
const { filterItems, AutofillMatchingMode } = await import('@/utils/itemMatcher/ItemMatcher');
|
||||
|
||||
// Parse matching mode from string
|
||||
let matchingMode = AutofillMatchingMode.DEFAULT;
|
||||
|
||||
@@ -3,11 +3,11 @@ import { sendMessage } from 'webext-bridge/content-script';
|
||||
import { fillItem } from '@/entrypoints/contentScript/Form';
|
||||
|
||||
import { DISABLED_SITES_KEY, TEMPORARY_DISABLED_SITES_KEY, GLOBAL_AUTOFILL_POPUP_ENABLED_KEY, VAULT_LOCKED_DISMISS_UNTIL_KEY, AUTOFILL_MATCHING_MODE_KEY, CUSTOM_EMAIL_HISTORY_KEY, CUSTOM_USERNAME_HISTORY_KEY, PLACEHOLDER_ICON_SVG } from '@/utils/Constants';
|
||||
import { AutofillMatchingMode } from '@/utils/credentialMatcher/CredentialMatcher';
|
||||
import { CreateIdentityGenerator, IdentityHelperUtils } from '@/utils/dist/core/identity-generator';
|
||||
import type { Item, ItemField } from '@/utils/dist/core/models/vault';
|
||||
import { ItemTypes, FieldKey, createSystemField } from '@/utils/dist/core/models/vault';
|
||||
import { CreatePasswordGenerator, PasswordGenerator, PasswordSettings } from '@/utils/dist/core/password-generator';
|
||||
import { AutofillMatchingMode } from '@/utils/itemMatcher/ItemMatcher';
|
||||
import { ClickValidator } from '@/utils/security/ClickValidator';
|
||||
import { ServiceDetectionUtility } from '@/utils/serviceDetection/ServiceDetectionUtility';
|
||||
import { SqliteClient } from '@/utils/SqliteClient';
|
||||
|
||||
@@ -2,9 +2,6 @@ import React, { useState, useEffect, useCallback, useMemo, useRef } from 'react'
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useNavigate, useParams, useSearchParams } from 'react-router-dom';
|
||||
|
||||
import AttachmentUploader from '@/entrypoints/popup/components/Credentials/Details/AttachmentUploader';
|
||||
import PasskeyEditor from '@/entrypoints/popup/components/Credentials/Details/PasskeyEditor';
|
||||
import TotpEditor from '@/entrypoints/popup/components/Credentials/Details/TotpEditor';
|
||||
import Modal from '@/entrypoints/popup/components/Dialogs/Modal';
|
||||
import AddFieldMenu, { type OptionalSection } from '@/entrypoints/popup/components/Forms/AddFieldMenu';
|
||||
import EditableFieldLabel from '@/entrypoints/popup/components/Forms/EditableFieldLabel';
|
||||
@@ -16,6 +13,9 @@ import PasswordField from '@/entrypoints/popup/components/Forms/PasswordField';
|
||||
import UsernameField from '@/entrypoints/popup/components/Forms/UsernameField';
|
||||
import HeaderButton from '@/entrypoints/popup/components/HeaderButton';
|
||||
import { HeaderIconType } from '@/entrypoints/popup/components/Icons/HeaderIcons';
|
||||
import AttachmentUploader from '@/entrypoints/popup/components/Items/Details/AttachmentUploader';
|
||||
import PasskeyEditor from '@/entrypoints/popup/components/Items/Details/PasskeyEditor';
|
||||
import TotpEditor from '@/entrypoints/popup/components/Items/Details/TotpEditor';
|
||||
import ItemNameInput from '@/entrypoints/popup/components/Items/ItemNameInput';
|
||||
import ItemTypeSelector from '@/entrypoints/popup/components/Items/ItemTypeSelector';
|
||||
import LoadingSpinner from '@/entrypoints/popup/components/LoadingSpinner';
|
||||
|
||||
@@ -2,14 +2,14 @@ import React, { useState, useEffect, useCallback } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useNavigate, useParams } from 'react-router-dom';
|
||||
|
||||
import HeaderButton from '@/entrypoints/popup/components/HeaderButton';
|
||||
import { HeaderIconType } from '@/entrypoints/popup/components/Icons/HeaderIcons';
|
||||
import {
|
||||
TotpBlock,
|
||||
AttachmentBlock,
|
||||
FieldBlock,
|
||||
PasskeyBlock
|
||||
} from '@/entrypoints/popup/components/Credentials/Details';
|
||||
import HeaderButton from '@/entrypoints/popup/components/HeaderButton';
|
||||
import { HeaderIconType } from '@/entrypoints/popup/components/Icons/HeaderIcons';
|
||||
} from '@/entrypoints/popup/components/Items/Details';
|
||||
import ItemIcon from '@/entrypoints/popup/components/Items/ItemIcon';
|
||||
import { useDb } from '@/entrypoints/popup/context/DbContext';
|
||||
import { useHeaderButtons } from '@/entrypoints/popup/context/HeaderButtonsContext';
|
||||
|
||||
@@ -11,7 +11,7 @@ import { useLoading } from '@/entrypoints/popup/context/LoadingContext';
|
||||
import { useVaultLockRedirect } from '@/entrypoints/popup/hooks/useVaultLockRedirect';
|
||||
|
||||
import { PASSKEY_DISABLED_SITES_KEY } from '@/utils/Constants';
|
||||
import { extractDomain, extractRootDomain } from '@/utils/credentialMatcher/CredentialMatcher';
|
||||
import { extractDomain, extractRootDomain } from '@/utils/itemMatcher/ItemMatcher';
|
||||
import { PasskeyAuthenticator } from '@/utils/passkey/PasskeyAuthenticator';
|
||||
import { PasskeyHelper } from '@/utils/passkey/PasskeyHelper';
|
||||
import type { GetRequest, PasskeyGetCredentialResponse, PendingPasskeyGetRequest, StoredPasskeyRecord } from '@/utils/passkey/types';
|
||||
|
||||
@@ -15,9 +15,9 @@ import { useVaultLockRedirect } from '@/entrypoints/popup/hooks/useVaultLockRedi
|
||||
import { useVaultMutate } from '@/entrypoints/popup/hooks/useVaultMutate';
|
||||
|
||||
import { PASSKEY_DISABLED_SITES_KEY } from '@/utils/Constants';
|
||||
import { extractDomain, extractRootDomain, filterItems, AutofillMatchingMode } from '@/utils/credentialMatcher/CredentialMatcher';
|
||||
import type { Item, Passkey } from '@/utils/dist/core/models/vault';
|
||||
import { FieldKey, ItemTypes, getFieldValue, createSystemField } from '@/utils/dist/core/models/vault';
|
||||
import { extractDomain, extractRootDomain, filterItems, AutofillMatchingMode } from '@/utils/itemMatcher/ItemMatcher';
|
||||
import { PasskeyAuthenticator } from '@/utils/passkey/PasskeyAuthenticator';
|
||||
import { PasskeyHelper } from '@/utils/passkey/PasskeyHelper';
|
||||
import type { CreateRequest, PasskeyCreateCredentialResponse, PendingPasskeyCreateRequest } from '@/utils/passkey/types';
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
TEMPORARY_DISABLED_SITES_KEY,
|
||||
AUTOFILL_MATCHING_MODE_KEY
|
||||
} from '@/utils/Constants';
|
||||
import { AutofillMatchingMode } from '@/utils/credentialMatcher/CredentialMatcher';
|
||||
import { AutofillMatchingMode } from '@/utils/itemMatcher/ItemMatcher';
|
||||
|
||||
import { storage, browser } from "#imports";
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
PASSKEY_PROVIDER_ENABLED_KEY,
|
||||
PASSKEY_DISABLED_SITES_KEY
|
||||
} from '@/utils/Constants';
|
||||
import { extractDomain, extractRootDomain } from '@/utils/credentialMatcher/CredentialMatcher';
|
||||
import { extractDomain, extractRootDomain } from '@/utils/itemMatcher/ItemMatcher';
|
||||
|
||||
import { storage, browser } from "#imports";
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
*/
|
||||
import { browser } from 'wxt/browser';
|
||||
|
||||
import type { Credential, Item } from '@/utils/dist/core/models/vault';
|
||||
import type { Item } from '@/utils/dist/core/models/vault';
|
||||
import { FieldKey } from '@/utils/dist/core/models/vault';
|
||||
import init, {
|
||||
filterCredentials as wasmFilterCredentials,
|
||||
filterCredentials as wasmFilterItems,
|
||||
extractDomain as wasmExtractDomain,
|
||||
extractRootDomain as wasmExtractRootDomain
|
||||
} from '@/utils/dist/core/rust/aliasvault_core.js';
|
||||
@@ -46,7 +46,7 @@ function getFieldValue(item: Item, fieldKey: string): string | undefined {
|
||||
|
||||
/**
|
||||
* Filter items by URL/title. Returns max 3 matches.
|
||||
* Uses the same Rust WASM filtering logic but maps Item fields to the expected structure.
|
||||
* Uses Rust WASM filtering logic, mapping Item fields to the expected structure.
|
||||
*/
|
||||
export async function filterItems(
|
||||
items: Item[],
|
||||
@@ -57,7 +57,7 @@ export async function filterItems(
|
||||
await ensureInit();
|
||||
|
||||
// Map Items to the format expected by the WASM filter
|
||||
const result = wasmFilterCredentials({
|
||||
const result = wasmFilterItems({
|
||||
credentials: items.map(item => ({
|
||||
Id: item.Id,
|
||||
ServiceName: item.Name ?? '',
|
||||
@@ -88,31 +88,3 @@ export async function extractRootDomain(domain: string): Promise<string> {
|
||||
await ensureInit();
|
||||
return wasmExtractRootDomain(domain);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter credentials by URL/title. Returns max 3 matches.
|
||||
* Uses the same Rust WASM filtering logic with the Credential type.
|
||||
*/
|
||||
export async function filterCredentials(
|
||||
credentials: Credential[],
|
||||
currentUrl: string,
|
||||
pageTitle: string,
|
||||
matchingMode: AutofillMatchingMode = AutofillMatchingMode.DEFAULT
|
||||
): Promise<Credential[]> {
|
||||
await ensureInit();
|
||||
|
||||
const result = wasmFilterCredentials({
|
||||
credentials: credentials.map(cred => ({
|
||||
Id: cred.Id,
|
||||
ServiceName: cred.ServiceName ?? '',
|
||||
ServiceUrl: cred.ServiceUrl
|
||||
})),
|
||||
current_url: currentUrl,
|
||||
page_title: pageTitle,
|
||||
matching_mode: matchingMode
|
||||
}) as { matched_ids: string[] };
|
||||
|
||||
return result.matched_ids
|
||||
.map(id => credentials.find(cred => cred.Id === id))
|
||||
.filter((cred): cred is Credential => cred !== undefined);
|
||||
}
|
||||
Reference in New Issue
Block a user