Skip to content

Instantly share code, notes, and snippets.

@gerwitz
Last active July 3, 2022 19:49
Show Gist options
  • Save gerwitz/e9bd2730b03977879893a3eb7bfa9c9f to your computer and use it in GitHub Desktop.
Save gerwitz/e9bd2730b03977879893a3eb7bfa9c9f to your computer and use it in GitHub Desktop.
Configuration file for Finicky: https://github.com/johnste/finicky
module.exports = {
defaultBrowser: "Safari",
handlers: [
{
// Open Teams in Teams
match: /^https?:\/\/teams\.microsoft\.com\/l\/meetup\-join\/.*$/,
browser: "Microsoft Teams"
},
{
// Use Edge for Miro
match: /^https?:\/\/miro\.com\/.*$/,
browser: "Microsoft Edge"
},
{
// Keep links from work apps on Edge
match: ({opener}) =>
["Microsoft Teams", "Microsoft Outlook"].includes(opener.name),
browser: "Microsoft Edge"
},
{
// Keep Philips GitHub on Edge
match: ({url}) =>
url.host.includes("github.com") && url.pathname.includes("philips"),
browser: "Microsoft Edge"
}
],
rewrite: [{
match: () => true, // Execute rewrite on all incoming urls to make this example easier to understand
url: ({url}) => {
const removeKeysStartingWith = ["utm_", "uta_"]; // Remove all query parameters beginning with these strings
const removeKeys = ["fbclid", "gclid"]; // Remove all query parameters matching these keys
const search = url.search
.split("&")
.map((parameter) => parameter.split("="))
.filter(([key]) => !removeKeysStartingWith.some((startingWith) => key.startsWith(startingWith)))
.filter(([key]) => !removeKeys.some((removeKey) => key === removeKey));
return {
...url,
search: search.map((parameter) => parameter.join("=")).join("&"),
};
},
}],
options: {
urlShorteners: (list) => [...list, "eur01.safelinks.protection.outlook.com", "mandrillapp.miro.com"]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment