diff --git a/dev/Common/File.js b/dev/Common/File.js index beffa01d2..28bc2943f 100644 --- a/dev/Common/File.js +++ b/dev/Common/File.js @@ -11,113 +11,109 @@ const sizes = ['B', 'KiB', 'MiB', 'GiB', 'TiB'], exts = { - eml: 'message/rfc822', - mime: 'message/rfc822', - rtx: 'text/richtext', - vcard: 'text/vcard', - vcf: 'text/vcard', - htm: 'text/html', - html: 'text/html', - csv: 'text/csv', - ics: 'text/calendar', - ifb: 'text/calendar', - xml: 'text/xml', - json: app+'json', - p10: app+'pkcs10', - p7c: app+'pkcs7-mime', - p7m: app+'pkcs7-mime', - p7s: app+'pkcs7-signature', - torrent: app+'x-bittorrent', + eml: 'message/rfc822', + mime: 'message/rfc822', + vcard: 'text/vcard', + vcf: 'text/vcard', + htm: 'text/html', + html: 'text/html', + csv: 'text/csv', + ics: 'text/calendar', + xml: 'text/xml', + json: app+'json', + asc: app+'pgp-signature', + p10: app+'pkcs10', + p7c: app+'pkcs7-mime', + p7m: app+'pkcs7-mime', + p7s: app+'pkcs7-signature', + torrent: app+'x-bittorrent', - // scripts - js: app+'javascript', - pl: 'text/perl', - css: 'text/css', - asp: 'text/asp', - php: app+'x-httpd-php', - phtml: app+'x-httpd-php', + // scripts + js: app+'javascript', + pl: 'text/perl', + css: 'text/css', + asp: 'text/asp', + php: app+'x-php', - // images - jpg: 'image/jpeg', - ico: 'image/x-icon', - tif: 'image/tiff', - svg: 'image/svg+xml', - svgz: 'image/svg+xml', + // images + jpg: 'image/jpeg', + ico: 'image/x-icon', + tif: 'image/tiff', + svg: 'image/svg+xml', + svgz: 'image/svg+xml', - // archives - zip: app+'zip', - '7z': app+'x-7z-compressed', - rar: app+'x-rar-compressed', - cab: app+'vnd.ms-cab-compressed', - gz: app+'x-gzip', - tgz: app+'x-gzip', - bz: app+'x-bzip', - bz2: app+'x-bzip2', - deb: app+'x-debian-package', + // archives + zip: app+'zip', + '7z': app+'x-7z-compressed', + rar: app+'x-rar-compressed', + cab: app+'vnd.ms-cab-compressed', + gz: app+'x-gzip', + tgz: app+'x-gzip', + bz: app+'x-bzip', + bz2: app+'x-bzip2', + deb: app+'x-debian-package', - // audio - mp3: 'audio/mpeg', - wav: 'audio/x-wav', - mp4a: 'audio/mp4', - weba: 'audio/webm', - m3u: 'audio/x-mpegurl', + // audio + mp3: 'audio/mpeg', + wav: 'audio/x-wav', + mp4a: 'audio/mp4', + weba: 'audio/webm', + m3u: 'audio/x-mpegurl', - // video - qt: 'video/quicktime', - mov: 'video/quicktime', - wmv: 'video/windows-media', - avi: 'video/x-msvideo', - '3gp': 'video/3gpp', - '3g2': 'video/3gpp2', - mp4v: 'video/mp4', - mpg4: 'video/mp4', - ogv: 'video/ogg', - m4v: 'video/x-m4v', - asf: 'video/x-ms-asf', - asx: 'video/x-ms-asf', - wm: 'video/x-ms-wm', - wmx: 'video/x-ms-wmx', - wvx: 'video/x-ms-wvx', - movie: 'video/x-sgi-movie', + // video + qt: 'video/quicktime', + mov: 'video/quicktime', + wmv: 'video/windows-media', + avi: 'video/x-msvideo', + '3gp': 'video/3gpp', + '3g2': 'video/3gpp2', + mp4v: 'video/mp4', + mpg4: 'video/mp4', + ogv: 'video/ogg', + m4v: 'video/x-m4v', + asf: 'video/x-ms-asf', + asx: 'video/x-ms-asf', + wm: 'video/x-ms-wm', + wmx: 'video/x-ms-wmx', + wvx: 'video/x-ms-wvx', + movie: 'video/x-sgi-movie', - // adobe - pdf: app+'pdf', - psd: 'image/vnd.adobe.photoshop', - ai: app+'postscript', - eps: app+'postscript', - ps: app+'postscript', + // adobe + pdf: app+'pdf', + psd: 'image/vnd.adobe.photoshop', + ai: app+'postscript', + eps: app+'postscript', + ps: app+'postscript', - // ms office - doc: app+'msword', - rtf: app+'rtf', - xls: app+'vnd.ms-excel', - ppt: app+'vnd.ms-powerpoint', - docx: msOffice+'wordprocessingml.document', - xlsx: msOffice+'spreadsheetml.sheet', - dotx: msOffice+'wordprocessingml.template', - pptx: msOffice+'presentationml.presentation', + // ms office + doc: app+'msword', + rtf: app+'rtf', + xls: app+'vnd.ms-excel', + ppt: app+'vnd.ms-powerpoint', + docx: msOffice+'wordprocessingml.document', + xlsx: msOffice+'spreadsheetml.sheet', + dotx: msOffice+'wordprocessingml.template', + pptx: msOffice+'presentationml.presentation', - // open office - odt: openDoc+'text', - ods: openDoc+'spreadsheet', - odp: openDoc+'presentation' -}; + // open office + odt: openDoc+'text', + ods: openDoc+'spreadsheet', + odp: openDoc+'presentation' + }; export const FileType = { Unknown: 'unknown', Text: 'text', - Html: 'html', Code: 'code', Eml: 'eml', - WordText: 'word-text', + Word: 'word', Pdf: 'pdf', Image: 'image', Audio: 'audio', Video: 'video', - Sheet: 'sheet', + Spreadsheet: 'spreadsheet', Presentation: 'presentation', Certificate: 'certificate', - CertificateBin: 'certificate-bin', Archive: 'archive' }; @@ -138,7 +134,7 @@ export const FileInfo = { return app + 'ms-tnef'; } let ext = fileName.split('.').pop(); - if (/^(txt|text|def|list|in|ini|log|sql|cfg|conf|asc)$/.test(ext)) + if (/^(txt|text|def|list|in|ini|log|sql|cfg|conf)$/.test(ext)) return 'text/plain'; if (/^(mpe?g|mpe|m1v|m2v)$/.test(ext)) return 'video/mpeg'; @@ -186,15 +182,12 @@ export const FileInfo = { case 'video' == mimeTypeParts[0] || 'mkv' == ext || 'avi' == ext: result = FileType.Video; break; - case ['php', 'js', 'css'].includes(ext): + case ['php', 'js', 'css', 'xml', 'html'].includes(ext) || 'text/html' == mimeType: result = FileType.Code; break; case 'eml' == ext || ['message/delivery-status', 'message/rfc822'].includes(mimeType): result = FileType.Eml; break; - case 'text/html' == mimeType || 'html' == ext: - result = FileType.Html; - break; case 'text' == mimeTypeParts[0] || 'txt' == ext || 'log' == ext: result = FileType.Text; break; @@ -204,19 +197,17 @@ export const FileInfo = { case 'pdf' == type || 'pdf' == ext: result = FileType.Pdf; break; - case [app+'pgp-signature', app+'pgp-keys'].includes(mimeType) || - ['asc', 'pem', 'ppk'].includes(ext): + case [app+'pgp-signature', app+'pgp-keys'].includes(mimeType) + || ['asc', 'pem', 'ppk'].includes(ext) + || [app+'pkcs7-signature'].includes(mimeType) || 'p7s' == ext: result = FileType.Certificate; break; - case [app+'pkcs7-signature'].includes(mimeType) || 'p7s' == ext: - result = FileType.CertificateBin; - break; case match(msOffice+'.wordprocessingml') || match(openDoc+'.text') || match('vnd.ms-word') || ['rtf', 'msword', 'vnd.msword'].includes(type): - result = FileType.WordText; + result = FileType.Word; break; case match(msOffice+'.spreadsheetml') || match(openDoc+'.spreadsheet') || match('ms-excel'): - result = FileType.Sheet; + result = FileType.Spreadsheet; break; case match(msOffice+'.presentationml') || match(openDoc+'.presentation') || match('ms-powerpoint'): result = FileType.Presentation; @@ -232,43 +223,22 @@ export const FileInfo = { * @returns {string} */ getTypeIconClass: fileType => { - let result = ['icon-file', '']; + let result = 'icon-file'; switch (fileType) { case FileType.Text: case FileType.Eml: - case FileType.WordText: - result[0] += '-text'; - break; - case FileType.Html: - case FileType.Code: - result[0] += '-code'; - break; - case FileType.Image: - result[0] += '-image'; - break; - case FileType.Audio: - result[0] += '-music'; - break; - case FileType.Video: - result[0] += '-movie'; - break; - case FileType.Archive: - result[0] += '-zip'; - break; - case FileType.Certificate: - case FileType.CertificateBin: - result[0] += '-certificate'; - break; - case FileType.Sheet: - result[0] += '-excel'; - break; - case FileType.Presentation: - result[0] += '-chart-graph'; - break; case FileType.Pdf: - result[1] = 'pdf'; - break; - // no default + case FileType.Word: + return result + '-text'; + case FileType.Code: + case FileType.Image: + case FileType.Audio: + case FileType.Video: + case FileType.Archive: + case FileType.Certificate: + case FileType.Spreadsheet: + case FileType.Presentation: + return result + '-' + fileType; } return result; }, @@ -282,7 +252,7 @@ export const FileInfo = { getCombinedIconClass: data => { if (isNonEmptyArray(data)) { let icons = data - .map(item => item ? FileInfo.getIconClass(FileInfo.getExtension(item[0]), item[1])[0] : '') + .map(item => item ? FileInfo.getIconClass(FileInfo.getExtension(item[0]), item[1]) : '') .validUnique(); return (icons && 1 === icons.length && 'icon-file' !== icons[0]) diff --git a/dev/Model/Attachment.js b/dev/Model/Attachment.js index 880090761..4c2573857 100644 --- a/dev/Model/Attachment.js +++ b/dev/Model/Attachment.js @@ -10,8 +10,6 @@ import { AbstractModel } from 'Knoin/AbstractModel'; import { SMAudio } from 'Common/Audio'; -const bAllowPdfPreview = undefined !== navigator.mimeTypes['application/pdf']; - export class AttachmentModel extends AbstractModel { constructor() { super(); @@ -92,27 +90,21 @@ export class AttachmentModel extends AbstractModel { * @returns {boolean} */ isText() { - return ( - FileType.Text === this.fileType || - FileType.Eml === this.fileType || - FileType.Certificate === this.fileType || - FileType.Html === this.fileType || - FileType.Code === this.fileType - ); + return FileType.Text === this.fileType || FileType.Eml === this.fileType; } /** * @returns {boolean} */ - isPdf() { - return FileType.Pdf === this.fileType; + pdfPreview() { + return null != navigator.mimeTypes['application/pdf'] && FileType.Pdf === this.fileType; } /** * @returns {boolean} */ hasPreview() { - return this.isImage() || (this.isPdf() && bAllowPdfPreview) || this.isText(); + return this.isImage() || this.pdfPreview() || this.isText(); } /** @@ -155,13 +147,6 @@ export class AttachmentModel extends AbstractModel { return link ? 'background:url(' + link + ')' : ''; } - /** - * @returns {string} - */ - linkPreviewAsPlain() { - return serverRequestRaw('ViewAsPlain', this.download); - } - /** * @returns {string} */ @@ -169,11 +154,11 @@ export class AttachmentModel extends AbstractModel { let result = ''; switch (true) { case this.isImage(): - case this.isPdf() && bAllowPdfPreview: + case this.pdfPreview(): result = this.linkPreview(); break; case this.isText(): - result = this.linkPreviewAsPlain(); + result = serverRequestRaw('ViewAsPlain', this.download); break; // no default } @@ -181,18 +166,6 @@ export class AttachmentModel extends AbstractModel { return result; } - /** - * @returns {string} - */ - generateTransferDownloadUrl() { - let link = this.linkDownload(); - if ('http' !== link.substr(0, 4)) { - link = location.protocol + '//' + location.host + location.pathname + link; - } - - return this.mimeType + ':' + this.fileName + ':' + link; - } - /** * @param {AttachmentModel} attachment * @param {*} event @@ -201,7 +174,11 @@ export class AttachmentModel extends AbstractModel { eventDragStart(attachment, event) { const localEvent = event.originalEvent || event; if (attachment && localEvent && localEvent.dataTransfer && localEvent.dataTransfer.setData) { - localEvent.dataTransfer.setData('DownloadURL', this.generateTransferDownloadUrl()); + let link = this.linkDownload(); + if ('http' !== link.substr(0, 4)) { + link = location.protocol + '//' + location.host + location.pathname + link; + } + localEvent.dataTransfer.setData('DownloadURL', this.mimeType + ':' + this.fileName + ':' + link); } return true; @@ -211,13 +188,6 @@ export class AttachmentModel extends AbstractModel { * @returns {string} */ iconClass() { - return FileInfo.getTypeIconClass(this.fileType)[0]; - } - - /** - * @returns {string} - */ - iconText() { - return FileInfo.getTypeIconClass(this.fileType)[1]; + return FileInfo.getTypeIconClass(this.fileType); } } diff --git a/dev/Model/ComposeAttachment.js b/dev/Model/ComposeAttachment.js index 6ee36dade..231e1deb4 100644 --- a/dev/Model/ComposeAttachment.js +++ b/dev/Model/ComposeAttachment.js @@ -96,13 +96,6 @@ export class ComposeAttachmentModel extends AbstractModel { * @returns {string} */ iconClass() { - return FileInfo.getIconClass(this.fileExt(), this.mimeType())[0]; - } - - /** - * @returns {string} - */ - iconText() { - return FileInfo.getIconClass(this.fileExt(), this.mimeType())[1]; + return FileInfo.getIconClass(this.fileExt(), this.mimeType()); } } diff --git a/dev/Styles/Attachmnets.less b/dev/Styles/Attachmnets.less index de7271c2a..85ddab889 100644 --- a/dev/Styles/Attachmnets.less +++ b/dev/Styles/Attachmnets.less @@ -103,16 +103,6 @@ } } - .attachmentIconText { - display: inline-block; - font-size: 28px; - width: 60px; - height: 56px; - color: #aaa; - line-height: 56px; - font-style: normal; - } - /* .attachmentIconParent.hasPreview.isImage { .iconMain { diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Base/Utils.php b/snappymail/v/0.0.0/app/libraries/MailSo/Base/Utils.php index abbb19d7b..053a12f6b 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Base/Utils.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Base/Utils.php @@ -744,7 +744,6 @@ END; 'sql' => 'text/plain', 'cfg' => 'text/plain', 'conf' => 'text/plain', - 'asc' => 'text/plain', 'rtx' => 'text/richtext', 'vcard' => 'text/vcard', 'vcf' => 'text/vcard', @@ -759,6 +758,7 @@ END; 'hlp' => 'application/winhlp', 'wgt' => 'application/widget', 'chm' => 'application/vnd.ms-htmlhelp', + 'asc' => 'application/pgp-signature', 'p10' => 'application/pkcs10', 'p7c' => 'application/pkcs7-mime', 'p7m' => 'application/pkcs7-mime', @@ -770,11 +770,7 @@ END; 'pl' => 'text/perl', 'css' => 'text/css', 'asp' => 'text/asp', - 'php' => 'application/x-httpd-php', - 'php3' => 'application/x-httpd-php', - 'php4' => 'application/x-httpd-php', - 'php5' => 'application/x-httpd-php', - 'phtml' => 'application/x-httpd-php', + 'php' => 'application/x-php', // images 'png' => 'image/png', diff --git a/snappymail/v/0.0.0/app/templates/Views/User/MailMessageView.html b/snappymail/v/0.0.0/app/templates/Views/User/MailMessageView.html index ecb1fafa4..30ad24e94 100644 --- a/snappymail/v/0.0.0/app/templates/Views/User/MailMessageView.html +++ b/snappymail/v/0.0.0/app/templates/Views/User/MailMessageView.html @@ -278,15 +278,13 @@
- - +
- - +
👁
@@ -294,7 +292,7 @@
- +
@@ -316,8 +314,8 @@ - + diff --git a/snappymail/v/0.0.0/app/templates/Views/User/PopupsCompose.html b/snappymail/v/0.0.0/app/templates/Views/User/PopupsCompose.html index 6ee35cd1d..f87d884b5 100644 --- a/snappymail/v/0.0.0/app/templates/Views/User/PopupsCompose.html +++ b/snappymail/v/0.0.0/app/templates/Views/User/PopupsCompose.html @@ -171,8 +171,7 @@
  • - - +
    diff --git a/vendors/fontastic/styles.css b/vendors/fontastic/styles.css index b2cd0bfea..936093faa 100644 --- a/vendors/fontastic/styles.css +++ b/vendors/fontastic/styles.css @@ -55,13 +55,13 @@ .icon-file-code::before { content: "\e030"; } -.icon-file-chart-graph::before { +.icon-file-presentation::before { content: "\e031"; /* 📊 */ } -.icon-file-zip::before { +.icon-file-archive::before { content: "\e032"; } -.icon-file-music::before { +.icon-file-audio::before { content: "\e033"; } .icon-file-text::before { @@ -76,10 +76,10 @@ .icon-attachment::before { content: "📎"; } -.icon-file-excel::before { +.icon-file-spreadsheet::before { content: "\e03a"; } -.icon-file-movie::before { +.icon-file-video::before { content: "\e03b"; } .icon-folder-add::before {