Created
February 22, 2023 12:59
-
-
Save oriolgual/75bc16e755cc0c998f0527958e30fbd0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Save as ~/.finicky.js | |
module.exports = { | |
defaultBrowser: "Safari", | |
handlers: [ | |
{ | |
match: /^https?:\/\/meet\.google\.com\/.*$/, | |
browser: "Google Chrome" | |
}, | |
{ | |
match: /^https?:\/\/app\.datadoghq\.eu\/.*$/, | |
browser: "Google Chrome" | |
}, | |
{ | |
match: /^https?:\/\/sentry\.io\/.*$/, | |
browser: "Google Chrome" | |
}, | |
{ | |
match: /^https?:\/\/device\.sso\.eu\-central\-1\.amazonaws\.com\/.*$/, | |
browser: "Google Chrome" | |
}, | |
{ | |
match: /^https?:\/\/dashboard\.stripe\.com\/.*$/, | |
browser: "Google Chrome" | |
}, | |
{ | |
match: /^https?:\/\/factorial\.sentry\.io\/.*$/, | |
browser: "Google Chrome" | |
}, | |
{ | |
match: "https://www.figma.com/file/*", | |
browser: "Figma", | |
}, | |
{ | |
match: /zoom\.us\/join/, | |
browser: "us.zoom.xos" | |
} | |
], | |
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("&"), | |
}; | |
}, | |
}, | |
{ | |
match: ({ url }) => url.host.includes("zoom.us") && url.pathname.includes("/j/"), | |
url: ({ url }) => { | |
try { | |
var pass = '&pwd=' + url.search.match(/pwd=(\w*)/)[1]; | |
} catch { | |
var pass = "" | |
} | |
var conf = 'confno=' + url.pathname.match(/\/j\/(\d+)/)[1]; | |
return { | |
search: conf + pass, | |
pathname: '/join', | |
protocol: "zoommtg" | |
}; | |
}, | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment