mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2025-12-11 20:15:30 +01:00
Detect SD-encrypted files and display them as such (#511)
* add encrypted file magic bytes/extension * use archive icon for encrypted files temporarily * use pascal case for encrypted extensions Co-authored-by: Brendan Allan <brendonovich@outlook.com>
This commit is contained in:
parent
d3b400be6f
commit
9f45d04bec
@ -178,15 +178,16 @@ extension_category_enum! {
|
||||
Cfg,
|
||||
}
|
||||
}
|
||||
|
||||
// encrypted file extensions
|
||||
extension_category_enum! {
|
||||
EncryptedExtension _ALL_ENCRYPTED_EXTENSIONS {
|
||||
// Spacedrive encrypted file
|
||||
Bit = [0x73, 0x64, 0x62, 0x69, 0x74],
|
||||
SdEnc = [0x62, 0x61, 0x6C, 0x6C, 0x61, 0x70, 0x70],
|
||||
// Spacedrive container
|
||||
Box = [0x73, 0x64, 0x62, 0x6F, 0x78],
|
||||
SdContainer = [0x73, 0x64, 0x62, 0x6F, 0x78],
|
||||
// Spacedrive block storage,
|
||||
Block = [0x73, 0x64, 0x62, 0x6C, 0x6F, 0x63, 0x6B],
|
||||
SdBlock = [0x73, 0x64, 0x62, 0x6C, 0x6F, 0x63, 0x6B],
|
||||
}
|
||||
}
|
||||
|
||||
@ -303,7 +304,7 @@ mod test {
|
||||
|
||||
let mut file = File::open(path).await.unwrap();
|
||||
|
||||
Extension::resolve_conflicting(&subpath.split(".").last().unwrap(), &mut file, true)
|
||||
Extension::resolve_conflicting(subpath.split('.').last().unwrap(), &mut file, true)
|
||||
.await
|
||||
}
|
||||
// Video extension tests
|
||||
|
||||
@ -6,9 +6,9 @@ import video from '@sd/assets/images/Video.png';
|
||||
import { ExplorerItem } from '@sd/client';
|
||||
import clsx from 'clsx';
|
||||
import { Suspense, lazy, useMemo } from 'react';
|
||||
|
||||
import { useExplorerStore } from '~/hooks/useExplorerStore';
|
||||
import { usePlatform } from '~/util/Platform';
|
||||
|
||||
import { Folder } from '../icons/Folder';
|
||||
import { isObject, isPath } from './utils';
|
||||
|
||||
@ -45,8 +45,8 @@ export default function FileThumb({ data, ...props }: Props) {
|
||||
const has_thumbnail = isObject(data)
|
||||
? data.has_thumbnail
|
||||
: isPath(data)
|
||||
? data.object?.has_thumbnail
|
||||
: !!store.newThumbnails[cas_id];
|
||||
? data.object?.has_thumbnail
|
||||
: !!store.newThumbnails[cas_id];
|
||||
|
||||
const url = platform.getThumbnailUrlById(cas_id);
|
||||
|
||||
@ -67,6 +67,7 @@ export default function FileThumb({ data, ...props }: Props) {
|
||||
else if (props.kind === 'Video') icon = video;
|
||||
else if (props.kind === 'Document' && data.extension === 'pdf') icon = documentPdf;
|
||||
else if (props.kind === 'Executable') icon = executable;
|
||||
else if (props.kind === 'Encrypted') icon = archive;
|
||||
|
||||
return <img src={icon} className={clsx('overflow-hidden h-full', props.iconClassNames)} />;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user