Skip to content
Snippets Groups Projects
Commit ddc0c70f authored by David Byers's avatar David Byers
Browse files

Clean up names and comments.

parent cf5ff307
No related branches found
No related tags found
1 merge request!8Beta
Pipeline #33043 passed
# 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.
// 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
/**
......
// 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 {
......
// 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
......
// 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
......
// 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
......
/*
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
......
// 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
......
// 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
......
// 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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment