feat: Add emoji and alot of other fixes

This commit is contained in:
2026-06-05 05:40:18 +02:00
parent ca069e2f61
commit 6865147e8f
72 changed files with 3885 additions and 413 deletions

View File

@@ -25,10 +25,46 @@ export class AttachmentStorageService {
return !!electronApi?.readFileChunk && !!electronApi.getFileSize;
}
canCopyFiles(): boolean {
const electronApi = this.electronBridge.getApi();
return !!electronApi?.copyFile && !!electronApi.ensureDir && !!electronApi.getAppDataPath;
}
async resolveExistingPath(
attachment: Pick<Attachment, 'filePath' | 'savedPath'>
): Promise<string | null> {
return this.findExistingPath([attachment.filePath, attachment.savedPath]);
return this.findExistingPath([attachment.savedPath, attachment.filePath]);
}
async resolveCanonicalStoredPath(
attachment: Pick<Attachment, 'id' | 'filename' | 'mime'>,
roomName: string
): Promise<string | null> {
const appDataPath = await this.resolveAppDataPath();
if (!appDataPath) {
return null;
}
const directoryPath = this.resolveStorageDirectoryPath(appDataPath, roomName, attachment.mime);
const diskPath = `${directoryPath}/${resolveAttachmentStoredFilename(attachment.id, attachment.filename)}`;
return this.findExistingPath([diskPath]);
}
async copyFile(sourceFilePath: string, destinationFilePath: string): Promise<boolean> {
const electronApi = this.electronBridge.getApi();
if (!electronApi?.copyFile || !sourceFilePath || !destinationFilePath) {
return false;
}
try {
return await electronApi.copyFile(sourceFilePath, destinationFilePath);
} catch {
return false;
}
}
async resolveLegacyImagePath(filename: string, roomName: string): Promise<string | null> {