Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#5668 Add Thunderbird attachment decryption #5828

Open
wants to merge 44 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
2789340
wip
martgil Sep 12, 2024
7922ee0
Merge remote-tracking branch 'origin/master' into issue-5668-add-thun…
martgil Oct 7, 2024
79e807d
Merge remote-tracking branch 'origin/master' into issue-5668-add-thun…
martgil Oct 16, 2024
0bdd951
simplified detection for ASCII armored data
martgil Oct 16, 2024
ebbf1bd
wip
martgil Oct 16, 2024
aa4feac
bind event handler to attachment download button
martgil Oct 16, 2024
2fdeba4
add new background message for obtaining current tab
martgil Oct 16, 2024
07a96bf
add attachment download event handler (baseline)
martgil Oct 16, 2024
6127160
add attachment decryption
martgil Oct 17, 2024
66d0baa
add decrypted attachment download
martgil Oct 17, 2024
5e9a946
wip
martgil Oct 17, 2024
bb50a72
wip
martgil Oct 17, 2024
4a95af1
add ui adjustment
martgil Oct 17, 2024
d68265b
added ui improvements
martgil Oct 18, 2024
409f2ad
simplified message detection
martgil Oct 18, 2024
463d454
wip
martgil Oct 18, 2024
886f932
remove unneeded todo
martgil Oct 18, 2024
7f393d4
Merge remote-tracking branch 'origin/master' into issue-5668-add-thun…
martgil Oct 21, 2024
449aa30
Add additional support to: encryptedMsg and detached message attachments
martgil Oct 21, 2024
ab132c9
refactor: remove redundancy
martgil Oct 21, 2024
ec654e1
Merge remote-tracking branch 'origin/master' into issue-5668-add-thun…
martgil Oct 24, 2024
e25fb01
cleanup
martgil Oct 24, 2024
85cf5f9
added reliable attachment type recognition
martgil Oct 24, 2024
7eae082
cleanup
martgil Oct 24, 2024
ae3e7bc
fix missing icon for generic filetype
martgil Oct 24, 2024
f707f6f
fix incorrect logic for obtaining message attachments
martgil Oct 24, 2024
67522cf
remove code duplicates
martgil Oct 24, 2024
8c6555a
cleanup
martgil Oct 24, 2024
29e9f82
refactor
martgil Oct 24, 2024
e33693f
cleanup
martgil Oct 24, 2024
b185b22
add prompt for missing pubkeys
martgil Oct 24, 2024
f2ea24f
wip
martgil Oct 25, 2024
7969a2c
added detached signature verification?
martgil Oct 25, 2024
74a99f3
Merge branch 'master' into issue-5668-add-thunderbird-attachments-sup…
martgil Nov 15, 2024
e299957
Merge remote-tracking branch 'origin/master' into issue-5668-add-thun…
martgil Nov 21, 2024
8c091b7
Merge branch 'master' into issue-5668-add-thunderbird-attachments-sup…
martgil Nov 26, 2024
35a4663
Merge remote-tracking branch 'origin/master' into issue-5668-add-thun…
martgil Dec 3, 2024
55d7e62
pr review: cleanup
martgil Nov 15, 2024
5ef5e8b
pr review: code cleanup
martgil Nov 15, 2024
8a36e6c
pr review: remove check for non-optional object
martgil Nov 15, 2024
12046d3
Merge branch 'master' into issue-5668-add-thunderbird-attachments-sup…
martgil Dec 4, 2024
06f5bc0
Merge remote-tracking branch 'origin/master' into issue-5668-add-thun…
martgil Dec 5, 2024
e3a9756
Merge branch 'master' into issue-5668-add-thunderbird-attachments-sup…
martgil Dec 9, 2024
211be40
Merge branch 'master' into issue-5668-add-thunderbird-attachments-sup…
martgil Dec 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions extension/css/cryptup.css
Original file line number Diff line number Diff line change
Expand Up @@ -3502,6 +3502,64 @@ body#settings div.webmail_notifications div.webmail_notification a:hover {
text-decoration: none;
}

/* thunderbird ui css */

.thunderbird_attachment_root {
margin: 0 7px 7px 0;
padding: 6px 4px;
background: #fff;
border: 1px solid #d8d8d8;
color: #444;
text-overflow: ellipsis;
align-items: center;
align-content: center;
width: 240px;
max-width: 270px;
display: inline-flex;
cursor: pointer;
position: relative;
border-radius: 2px;
height: 40px;
font-size: 16px;
}

.thunderbird_attachment_root div {
display: inline-block;
}

.thunderbird_attachment_root .thunderbird_attachment_name {
margin: 0 2px;
}

.thunderbird_attachment_root .thunderbird_attachment_icon {
height: 40px;
width: 40px;
background: #fff;
overflow: hidden;
opacity: 0.4;
}

.thunderbird_attachment_root .thunderbird_attachment_download {
display: none;
padding: 6px;
height: 30px;
width: 30px;
right: 0;
position: absolute;
background: #333;
opacity: 0.88;
border-radius: 2px;
margin: 3px 6px;
}

.thunderbird_attachment_root:hover .thunderbird_attachment_download {
display: inline-block;
}

.thunderbird_attachment_download img {
width: 100%;
}

/* print class */
@media screen {
.printable {
Expand Down
13 changes: 10 additions & 3 deletions extension/js/common/browser/browser-msg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { Ui } from './ui.js';
import { AuthRes } from '../api/authentication/generic/oauth.js';
import { GlobalStore } from '../platform/store/global-store.js';
import { BgUtils } from '../../service_worker/bgutils.js';
import { ThunderbirdAttachment } from '../core/attachment.js';

export type GoogleAuthWindowResult$result = 'Success' | 'Denied' | 'Error' | 'Closed';
export type ScreenDimensions = { width: number; height: number; availLeft: number; availTop: number };
Expand Down Expand Up @@ -98,6 +99,7 @@ export namespace Bm {
export type PgpBlockRetry = { frameId: string; messageSender: Dest };
export type PgpBlockReady = { frameId: string; messageSender: Dest };
export type ThunderbirdOpenPassphraseDialog = { acctEmail: string; longids: string };
export type ThunderbirdInitiateAttachmentDownload = { decryptedFileName: string; decryptedContent: Buf };

export namespace Res {
export type GetActiveTabInfo = {
Expand All @@ -114,9 +116,10 @@ export namespace Bm {
export type ExpirationCacheGet<V> = Promise<V | undefined>;
export type ExpirationCacheSet = Promise<void>;
export type ExpirationCacheDeleteExpired = Promise<void>;
export type ThunderbirdGetDownloadableAttachment = { from: string; processableAttachments: ThunderbirdAttachment[] };
export type ThunderbirdGetCurrentUser = string | undefined;
export type ThunderbirdMsgGet = messenger.messages.MessagePart | undefined;
export type ThunderbirdOpenPassphraseDialog = Promise<void>;
export type ThunderbirdInitiateAttachmentDownload = Promise<void>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type Db = any; // not included in Any below
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand All @@ -134,7 +137,7 @@ export namespace Bm {
| ExpirationCacheDeleteExpired
| AjaxGmailAttachmentGetChunk
| ConfirmationResult
| ThunderbirdMsgGet;
| ThunderbirdGetDownloadableAttachment;
}

export type AnyRequest =
Expand Down Expand Up @@ -176,6 +179,7 @@ export namespace Bm {
| PgpBlockRetry
| ConfirmationResult
| ThunderbirdOpenPassphraseDialog
| ThunderbirdInitiateAttachmentDownload
| Ajax;

export type AsyncRespondingHandler = (req: AnyRequest) => Promise<Res.Any>;
Expand Down Expand Up @@ -239,9 +243,12 @@ export class BrowserMsg {
BrowserMsg.sendAwait(undefined, 'expirationCacheSet', bm, true) as Promise<Bm.Res.ExpirationCacheSet>,
expirationCacheDeleteExpired: (bm: Bm.ExpirationCacheDeleteExpired) =>
BrowserMsg.sendAwait(undefined, 'expirationCacheDeleteExpired', bm, true) as Promise<Bm.Res.ExpirationCacheDeleteExpired>,
thunderbirdGetDownloadableAttachment: () =>
BrowserMsg.sendAwait(undefined, 'thunderbirdGetDownloadableAttachment', undefined, true) as Promise<Bm.Res.ThunderbirdGetDownloadableAttachment>,
thunderbirdInitiateAttachmentDownload: (bm: Bm.ThunderbirdInitiateAttachmentDownload) =>
BrowserMsg.sendAwait(undefined, 'thunderbirdInitiateAttachmentDownload', bm, true) as Promise<Bm.Res.ThunderbirdInitiateAttachmentDownload>,
thunderbirdGetCurrentUser: () =>
BrowserMsg.sendAwait(undefined, 'thunderbirdGetCurrentUser', undefined, true) as Promise<Bm.Res.ThunderbirdGetCurrentUser>,
thunderbirdMsgGet: () => BrowserMsg.sendAwait(undefined, 'thunderbirdMsgGet', undefined, true) as Promise<Bm.Res.ThunderbirdMsgGet>,
thunderbirdOpenPassphraseDiaglog: (bm: Bm.ThunderbirdOpenPassphraseDialog) =>
BrowserMsg.sendAwait(undefined, 'thunderbirdOpenPassphraseDialog', bm, true) as Promise<Bm.Res.ThunderbirdOpenPassphraseDialog>,
},
Expand Down
6 changes: 6 additions & 0 deletions extension/js/common/core/attachment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ export type AttachmentProperties = {
contentDescription?: string;
contentTransferEncoding?: ContentTransferEncoding;
};
export type ThunderbirdAttachment = {
name: string;
contentType: string;
data: Buf;
treatAs: Attachment$treatAs;
};
export type AttachmentMeta = (AttachmentId | { data: Uint8Array }) & AttachmentProperties;

export type FcAttachmentLinkData = { name: string; type: string; size: number };
Expand Down
Loading
Loading