Skip to content

Instantly share code, notes, and snippets.

@mathieutu
Created September 21, 2022 09:07
Show Gist options
  • Save mathieutu/d597d1483a7a2766e9c281ca8e724fa5 to your computer and use it in GitHub Desktop.
Save mathieutu/d597d1483a7a2766e9c281ca8e724fa5 to your computer and use it in GitHub Desktop.
Finicky config
module.exports= {
defaultBrowser: "Browserosaurus",
handlers: [
{
match: "meet.google.com/*",
browser: {
name: "Arc",
},
},
{
match: "www.notion.so/*",
browser: "Notion"
},
{
match: "www.figma.com/*",
browser: "Figma"
},
{
match: "github.com/*",
browser: "Firefox Developer Edition"
},
{
match: "*latticehq.com/*",
browser: "Firefox Developer Edition"
},
{
match: "twitter.com/*",
browser: "Firefox Developer Edition"
},
{
match: "circleci.com/*",
browser: "Firefox Developer Edition"
},
{
match: "*.slack.com/*",
browser: "Firefox Developer Edition"
},
{
match: "linear.app/*",
browser: "Linear"
},
// {
// match: ({ url }) => url.protocol === "slack",
// browser: "Slack"
// }
],
// rewrite: [
// {
// match: [
// '*.slack.com/*',
// ],
// url: function({ url, urlString }) {
// const subdomain = url.host.slice(0, -10)
// const pathParts = url.pathname.split("/")
// let team, patterns = {}
// if (subdomain != 'app') {
// switch (subdomain) {
// case 'alanhealth':
// team = 'T053BSKET'
// break
// default:
// finicky.notify(
// `No Slack team ID found for ${url.host}`,
// `Add the team ID to ~/.finicky.js to allow direct linking to Slack.`
// )
// return url
// }
// if (subdomain.slice(-11) == '.enterprise') {
// patterns = {
// 'file': [/\/files\/\w+\/(?<id>\w+)/]
// }
// } else {
// patterns = {
// 'file': [/\/messages\/\w+\/files\/(?<id>\w+)/],
// 'team': [/(?:\/messages\/\w+)?\/team\/(?<id>\w+)/],
// 'channel': [/\/(?:messages|archives)\/(?<id>\w+)(?:\/(?<message>p\d+))?/]
// }
// }
// } else {
// patterns = {
// 'file': [
// /\/client\/(?<team>\w+)\/\w+\/files\/(?<id>\w+)/,
// /\/docs\/(?<team>\w+)\/(?<id>\w+)/
// ],
// 'team': [/\/client\/(?<team>\w+)\/\w+\/user_profile\/(?<id>\w+)/],
// 'channel': [/\/client\/(?<team>\w+)\/(?<id>\w+)(?:\/(?<message>[\d.]+))?/]
// }
// }
// for (let [host, host_patterns] of Object.entries(patterns)) {
// for (let pattern of host_patterns) {
// let match = pattern.exec(url.pathname)
// if (match) {
// let search = `team=${team || match.groups.team}`
// if (match.groups.id) {
// search += `&id=${match.groups.id}`
// }
// if (match.groups.message) {
// let message = match.groups.message
// if (message.charAt(0) == 'p') {
// message = message.slice(1, 11) + '.' + message.slice(11)
// }
// search += `&message=${message}`
// }
// let output = {
// protocol: "slack",
// username: "",
// password: "",
// host: host,
// port: null,
// pathname: "",
// search: search,
// hash: ""
// }
// let outputStr = `${output.protocol}://${output.host}?${output.search}`
// finicky.log(`Rewrote Slack URL ${urlString} to deep link ${outputStr}`)
// return output
// }
// }
// }
// return url
// }
// }
// ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment