mirror of
https://github.com/shuaiplus/nodewarden.git
synced 2026-06-20 13:00:39 +00:00
feat: add archiving functionality for ciphers
- Introduced `archive` and `unarchive` endpoints in the API for ciphers. - Implemented bulk archiving and unarchiving of ciphers in the vault. - Updated the storage schema to include `archived_at` timestamps for ciphers. - Enhanced user interface to support archiving actions in the vault. - Added necessary translations for archive-related actions. - Updated user and device models to accommodate new fields related to archiving.
This commit is contained in:
@@ -16,6 +16,7 @@ export type VaultSortMode = 'edited' | 'created' | 'name';
|
||||
export type SidebarFilter =
|
||||
| { kind: 'all' }
|
||||
| { kind: 'favorite' }
|
||||
| { kind: 'archive' }
|
||||
| { kind: 'trash' }
|
||||
| { kind: 'duplicates' }
|
||||
| { kind: 'type'; value: TypeFilter }
|
||||
@@ -71,6 +72,34 @@ export function cipherTypeKey(type: number): TypeFilter {
|
||||
return 'ssh';
|
||||
}
|
||||
|
||||
function cipherDeletedValue(cipher: Cipher): boolean {
|
||||
return !!(cipher.deletedDate || (cipher as { deletedAt?: string | null }).deletedAt);
|
||||
}
|
||||
|
||||
function cipherArchivedValue(cipher: Cipher): boolean {
|
||||
return !!(cipher.archivedDate || (cipher as { archivedAt?: string | null }).archivedAt);
|
||||
}
|
||||
|
||||
export function isCipherDeleted(cipher: Cipher): boolean {
|
||||
return cipherDeletedValue(cipher);
|
||||
}
|
||||
|
||||
export function isCipherArchived(cipher: Cipher): boolean {
|
||||
return cipherArchivedValue(cipher) && !cipherDeletedValue(cipher);
|
||||
}
|
||||
|
||||
export function isCipherVisibleInNormalVault(cipher: Cipher): boolean {
|
||||
return !cipherDeletedValue(cipher) && !cipherArchivedValue(cipher);
|
||||
}
|
||||
|
||||
export function isCipherVisibleInArchive(cipher: Cipher): boolean {
|
||||
return !cipherDeletedValue(cipher) && cipherArchivedValue(cipher);
|
||||
}
|
||||
|
||||
export function isCipherVisibleInTrash(cipher: Cipher): boolean {
|
||||
return cipherDeletedValue(cipher);
|
||||
}
|
||||
|
||||
export function cipherTypeLabel(type: number): string {
|
||||
if (type === 1) return t('txt_login');
|
||||
if (type === 3) return t('txt_card');
|
||||
|
||||
Reference in New Issue
Block a user