forked from codegram/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
finicky.js
88 lines (84 loc) · 2.24 KB
/
finicky.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// Save as ~/.finicky.js
module.exports = {
defaultBrowser: "Safari",
handlers: [
{
match: /^https?:\/\/meet\.google\.com\/.*$/,
browser: {
name: "Google Chrome"
}
},
{
match: /^https?:\/\/app\.datadoghq\.eu\/.*$/,
browser: {
name: "Google Chrome",
}
},
{
match: /^https?:\/\/sentry\.io\/.*$/,
browser: {
name: "Google Chrome",
}
},
{
match: /^https?:\/\/device\.sso\.eu\-central\-1\.amazonaws\.com\/.*$/,
browser: {
name: "Google Chrome",
}
},
{
match: /^https?:\/\/dashboard\.stripe\.com\/.*$/,
browser: {
name: "Google Chrome",
}
},
{
match: /^https?:\/\/factorial\.sentry\.io\/.*$/,
browser: {
name: "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"
};
},
}
]
}