Redesign Raw handling as encodeRawKey/decodeRawKey doesn't need encryption

This commit is contained in:
the-djmaze 2023-03-07 13:53:52 +01:00
parent 402de0d569
commit bd7f9856f2
8 changed files with 73 additions and 115 deletions

View file

@ -1,7 +1,8 @@
import ko from 'ko';
import { FileInfo, FileType } from 'Common/File';
import { stopEvent } from 'Common/Globals';
import { stopEvent, SettingsGet, SettingsCapa } from 'Common/Globals';
import { b64EncodeJSONSafe } from 'Common/Utils';
import {
attachmentDownload,
serverRequestRaw
@ -23,10 +24,8 @@ export class AttachmentModel extends AbstractModel {
this.fileName = '';
this.fileNameExt = '';
this.fileType = FileType.Unknown;
this.isThumbnail = false;
this.cId = '';
this.contentLocation = '';
this.download = '';
this.folder = '';
this.uid = '';
this.url = '';
@ -126,6 +125,17 @@ export class AttachmentModel extends AbstractModel {
);
}
get download() {
return b64EncodeJSONSafe({
folder: this.folder,
uid: this.uid,
mimeIndex: this.mimeIndex,
mimeType: this.mimeType,
fileName: this.fileName,
accountHash: SettingsGet('accountHash')
});
}
/**
* @returns {string}
*/
@ -144,7 +154,7 @@ export class AttachmentModel extends AbstractModel {
* @returns {boolean}
*/
hasThumbnail() {
return this.isThumbnail && !this.isLinked();
return SettingsCapa('AttachmentThumbnails') && this.isImage() && !this.isLinked();
}
/**