diff --git a/README.md b/README.md index 580cee758df54c1e02aa296af8f03e2fe36499ef..1a42a0991e98f289711b82ccd80bc62d700dd072 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,30 @@ -# Microsoft ATP Safe Links Cleaner for Thunderbird +# ATP Safe Links Cleaner -This Thunderbird extension cleans up the display of links rewritten by -Microsoft Advanced Threat Protection. Unlike many similar extensions -it does not change the links, but does ensure that they are displayed -in such a way that the original link is accessible. +This extension cleans up the display of links rewritten by Microsoft +Defender for Office 365 Advanced Threat Protection. Unlike many +similar extensions it does not change the links, but does ensure that +they are displayed in such a way that the original link is accessible. + +The extension currently builds for Thunderbird and Firefox (it will +only affect links on outlook.com). * Links in plain text email are changed so the original link is displayed. -* A tooltip showing the original link is atted to all rewritten links. +* A tooltip showing the original link is added to all rewritten links. * The context menu for rewritten links has a "copy original link item". -* When responding to a message, rewritten links are replaced by the - original links. +* When responding to a message in Thunderbird, rewritten links are + replaced by the original links. ## Known issues * Since only the *display* is changed, links that have the URL as the link text will now have link text that differs from the link target. - Thunderbird picks up on this when you click a link and asks if you + This may be picked up on this when you click a link and asks if you want to visit the original link or the safe link. -* When composing a message the original links are restored. This - process could potentially change text that isn't meant to be - changed but looks almost like a valid safe link. +* When composing a message in Thunderbird the original links are + restored. This process could potentially change text that isn't + meant to be changed but looks almost like a valid safe link. diff --git a/firefox/content.js b/firefox/content.js index 3fe7f87d02be8f47f4abf4354bed7a9ea51534ff..ecbb37e3ad7ca84c6175c3235cc5a8ae0567982a 100644 --- a/firefox/content.js +++ b/firefox/content.js @@ -1,4 +1,4 @@ -// Microsoft ATP Safe Links Cleaner +// ATP Safe Links Cleaner // Copyright 2021 David Byers <david.byers@liu.se> // // Permission is hereby granted, free of charge, to any person obtaining a copy @@ -19,7 +19,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -// Display script +// Content script /** diff --git a/firefox/mutation.js b/firefox/mutation.js index 746dbb7c40bcc9a324e62a630e4e80f755ea0cab..781085a2ba3c4ed8c940b6776df2ee1a78a1869d 100644 --- a/firefox/mutation.js +++ b/firefox/mutation.js @@ -1,6 +1,33 @@ +// ATP Safe Links Cleaner +// Copyright 2021 David Byers <david.byers@liu.se> +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +// Mutation observer for web browsers + + let mutationObserver = null; +/** + * Enable the mutation observer, creating it is necessary. + */ function enableMutationObserver() { console.log('enter enableMutationObserver'); if (!mutationObserver) { @@ -13,6 +40,9 @@ function enableMutationObserver() { console.log('exit enableMutationObserver'); } +/** + * Disable the mutation observer if it is enabled + */ function disableMutationObserver() { console.log('enter disableMutationObserver'); if (mutationObserver) { @@ -21,6 +51,12 @@ function disableMutationObserver() { console.log('exit disableMutationObserver'); } +/** + * Wrap a function in code that disables the mutation observer. + * + * @param {function} func - The function to wrap. + * @returns {function} The wrapped function. + */ function withoutMutationObserver(func) { return (...args) => { try { diff --git a/shared/links.js b/shared/links.js index 27ffc309ee29aceead251a81938944737ce962a2..b277fd433432a6a57e5e935ca52062403c0f38df 100644 --- a/shared/links.js +++ b/shared/links.js @@ -1,4 +1,4 @@ -// Microsoft ATP Safe Links Cleaner +// ATP Safe Links Cleaner // Copyright 2021 David Byers <david.byers@liu.se> // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/shared/menu.js b/shared/menu.js index 3f774163410c47fcabfe62467e5fdcb694609870..a4f766de6522e08b37602bd85f4dec472c40c9df 100644 --- a/shared/menu.js +++ b/shared/menu.js @@ -1,4 +1,4 @@ -// Microsoft ATP Safe Links Cleaner +// ATP Safe Links Cleaner // Copyright 2021 David Byers <david.byers@liu.se> // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/shared/popup.js b/shared/popup.js index d1a6aec4ffe8b3ba51ec776abd0de535b97a7528..052db2de08fc881342da09a5250f4b2fdc8b2026 100644 --- a/shared/popup.js +++ b/shared/popup.js @@ -1,4 +1,4 @@ -// Microsoft ATP Safe Links Cleaner +// ATP Safe Links Cleaner // Copyright 2021 David Byers <david.byers@liu.se> // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/shared/style.css b/shared/style.css index 95f271cbd0983e90529959308997a5bc6a2ef07a..3ba19a964c6ebb0a104d7b9924d15eec36b38297 100644 --- a/shared/style.css +++ b/shared/style.css @@ -1,5 +1,5 @@ /* -Microsoft ATP Safe Links Cleaner +ATP Safe Links Cleaner Copyright 2021 David Byers <david.byers@liu.se> Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/thunderbird/background.js b/thunderbird/background.js index e85a04292a55b30cee03f7e4935b066ee9e8b03c..f6b76b6fac42bc8c18b9ca9c849f772886b87308 100644 --- a/thunderbird/background.js +++ b/thunderbird/background.js @@ -1,4 +1,4 @@ -// Microsoft ATP Safe Links Cleaner +// ATP Safe Links Cleaner // Copyright 2021 David Byers <david.byers@liu.se> // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/thunderbird/compose.js b/thunderbird/compose.js index 7cb6213c60238da1cbb2381d386df9858c899175..f9a8c15d9e9af9ae070b61e0240f7cee037d7d2d 100644 --- a/thunderbird/compose.js +++ b/thunderbird/compose.js @@ -1,4 +1,4 @@ -// Microsoft ATP Safe Links Cleaner +// ATP Safe Links Cleaner // Copyright 2021 David Byers <david.byers@liu.se> // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/thunderbird/display.js b/thunderbird/display.js index 2f8061b9aa5cab2d7009caf9ef67bfc4091b26df..813f6b8af66c27b3c485a46bdc08e559c8f48b55 100644 --- a/thunderbird/display.js +++ b/thunderbird/display.js @@ -1,4 +1,4 @@ -// Microsoft ATP Safe Links Cleaner +// ATP Safe Links Cleaner // Copyright 2021 David Byers <david.byers@liu.se> // // Permission is hereby granted, free of charge, to any person obtaining a copy