### Install Go 1.23.4 Source: https://github.com/johnste/finicky/wiki/Building-Finicky-from-source Install the specified version of Go. Ensure your system meets the requirements for Go 1.23.4. ```bash 1. Install Go 1.23.4 ``` -------------------------------- ### Run Install Script Source: https://github.com/johnste/finicky/wiki/Building-Finicky-from-source Execute the install script to download and set up project dependencies. Run this from the base directory of the project. ```bash 1. Run ./scripts/install.sh from base folder to install dependencies ``` -------------------------------- ### Run Build Script Source: https://github.com/johnste/finicky/wiki/Building-Finicky-from-source Execute the build script to compile the Finicky project. This should be run after all dependencies are installed. ```bash 1. Run ./scripts/build.sh from base folder to build Finicky ``` -------------------------------- ### Open Installed Desktop Apps Instead of Web Apps Source: https://github.com/johnste/finicky/wiki/Configuration-ideas Configure Finicky to open links for installed desktop applications like Figma, Linear, and Slite by rewriting URLs and setting the browser to 'Finder'. ```javascript handlers: [{ match: ({url}) => !url.protocol.match(/^https?$/), browser: "Finder" }], rewrite: [{ match: ({url}) => url.host.split('.').some((c) => ['figma', 'linear', 'slite'].includes(c)), url: ({url}) => { const protocol = url.host.match(/\.?(\w+)\.\w\w\w?$/)[1]; const exceptions = { 'linear': ['uploads.linear.app'] }; if (!(protocol in exceptions) || !exceptions[protocol].includes(url.host)) { return {...url, protocol }; } return url; } }] ``` -------------------------------- ### Complete Finicky Configuration Example Source: https://github.com/johnste/finicky/wiki/Configuration-(v4) A comprehensive Finicky configuration demonstrating default browser settings, options, URL rewriting rules, and browser selection handlers. ```javascript export default { defaultBrowser: "Google Chrome", options: { checkForUpdates: true, logRequests: true, }, // URL rewriting rules rewrite: [ { match: "old.example.com/*", url: "https://new.example.com", }, { match: /^https?:\/\/redirect\.example\.com\/(.*)/, url: (url) => { const newUrl = new URL("https://target.example.com"); newUrl.pathname = url.pathname; return newUrl; }, }, ], // Browser selection rules handlers: [ { match: "work.example.com/*", browser: { name: "Google Chrome", profile: "Work", openInBackground: true, }, }, { match: "personal.example.com/*", browser: "Google Chrome:Personal", }, { match: "safari.example.com/*", browser: "Safari", }, { match: (url) => url.host.endsWith(".dev"), browser: "Firefox", }, ], }; ``` -------------------------------- ### Finicky URL Rewriting Examples Source: https://github.com/johnste/finicky/wiki/Configuration-(v4) Shows how to rewrite URLs before they are opened, using simple string replacement, URL objects, or dynamic modification functions. ```javascript export default { rewrite: [ // Simple string replacement { match: "example.org/*", url: "https://gitlab.com", }, // Using URL instance { match: "example.org/*", url: new URL("https://example.com"), }, // Dynamic URL modification { match: "example.org/*", url: (url) => { url.pathname = "/hello"; return url; }, }, // Complex URL transformation { match: /^https?::\/\/old\.example\.com\/(.*)/, url: (url) => { const newUrl = new URL("https://new.example.com"); newUrl.pathname = url.pathname; newUrl.search = url.search; return newUrl; }, }, ], }; ``` -------------------------------- ### Install Node 22 Source: https://github.com/johnste/finicky/wiki/Building-Finicky-from-source Install Node.js version 22. This is required for managing JavaScript dependencies and running build tools. ```bash 1. Install Node 22 ``` -------------------------------- ### Finicky Get System Info Utility Source: https://github.com/johnste/finicky/wiki/Configuration-(v4) Retrieves general system information, including its localized and system names. ```javascript const systemInfo = finicky.getSystemInfo(); // Get system information // Returns: { // localizedName: string, // Localized system name // name: string // System name // } ``` -------------------------------- ### Finicky Get Power Info Utility Source: https://github.com/johnste/finicky/wiki/Configuration-(v4) Retrieves power and battery information, such as charging status, power connection, and battery percentage. ```javascript const powerInfo = finicky.getPowerInfo(); // Get power/battery information // Returns: { // isCharging: boolean, // Is device charging? // isConnected: boolean, // Is power connected? // percentage: number | null // Battery percentage (null if not available) // } ``` -------------------------------- ### Open Figma Links in Figma App Source: https://github.com/johnste/finicky/wiki/Configuration-ideas This handler opens Figma file links directly in the Figma native application. It matches URLs starting with 'https://www.figma.com/file/'. ```javascript handlers: [{ match: "https://www.figma.com/file/*", browser: "Figma", }] ``` -------------------------------- ### Finicky Get Modifier Keys Utility Source: https://github.com/johnste/finicky/wiki/Configuration-(v4) Retrieves the current state of modifier keys (Shift, Option, Command, Control, Caps Lock, Fn). ```javascript // System information const modifiers = finicky.getModifierKeys(); // Get current modifier key states // Returns: { // shift: boolean, // Is shift key pressed? // option: boolean, // Is option/alt key pressed? // command: boolean, // Is command key pressed? // control: boolean, // Is control key pressed? // capsLock: boolean, // Is caps lock on? // fn: boolean // Is fn key pressed? // } ``` -------------------------------- ### Open Specific Example.com URLs in Firefox Source: https://github.com/johnste/finicky/wiki/Configuration-ideas This handler opens links from example.com that also contain 'Finicky' in their path in Firefox. It uses a combination of host and pathname matching. ```javascript handlers: [{ match: ({url}) => url.host.includes("example.com") && url.pathname.includes("Finicky"), browser: "Firefox" }] ``` -------------------------------- ### Create Finicky Config File Source: https://github.com/johnste/finicky/wiki/Getting-started Use this command to create the default Finicky configuration file in your home directory. ```bash touch ~/.finicky.js ``` -------------------------------- ### Basic Finicky Configuration Source: https://github.com/johnste/finicky/wiki/Getting-started A minimal configuration to set Firefox as the default browser and open specific domains in Google Chrome. ```javascript export default { defaultBrowser: "Firefox", handlers: [ { // Open these urls in Chrome match: ["example.com/*", "github.com/*"], browser: "Google Chrome" } ] } ``` -------------------------------- ### Finicky URL Matching Utility Source: https://github.com/johnste/finicky/wiki/Configuration-(v4) Shows how to use the `matchHostnames` utility function to specify hostnames for URL matching. ```javascript // URL matching finicky.matchHostnames(["example.com", "*.example.org"]); ``` -------------------------------- ### Finicky Logging Utilities Source: https://github.com/johnste/finicky/wiki/Configuration-(v4) Demonstrates how to use console logging functions provided by Finicky for debugging and information. ```javascript // Logging console.log("Log message to console"); console.warn("Log warning message to console"); console.error("Log error message to console"); ``` -------------------------------- ### Basic Finicky Configuration Source: https://github.com/johnste/finicky/blob/main/README.md This JavaScript configuration sets a default browser, rewrites URLs for specific domains, and defines handlers to open certain URLs in specific browsers. Ensure this file is saved as ~/.finicky.js. ```javascript // ~/.finicky.js export default { defaultBrowser: "Google Chrome", rewrite: [ { // Redirect all x.com urls to use xcancel.com match: "x.com/*", url: (url) => { url.host = "xcancel.com"; return url; }, }, ], handlers: [ { // Open all bsky.app urls in Firefox match: "bsky.app/*", browser: "Firefox", }, { // Open google.com and *.google.com urls in Google Chrome match: [ "google.com/*", // match google.com urls "*.google.com*", // also match google.com subdomains ], browser: "Google Chrome", }, ], }; ``` -------------------------------- ### Open Jitsi Links in Jitsi Desktop App Source: https://github.com/johnste/finicky/wiki/Configuration-ideas Configure Finicky to open Jitsi links from specified domains in the Jitsi Meet desktop application on macOS. ```javascript handlers: [{ match: ({url}) => url.host.includes("jitsi.your-selfhosted-server.com") || url.host.includes("meet.jit.si"), url: ({url}) => { return { ...url, protocol: "jitsi-meet", host: url.host, pathname: url.pathname }; }, browser: "/Applications/Jitsi\ Meet.app" }] ``` -------------------------------- ### Finicky Browser Selection Methods Source: https://github.com/johnste/finicky/wiki/Configuration-(v4) Illustrates different ways to specify a browser, including by name, bundle ID, path, and using profiles for Chromium-based browsers. ```javascript browser: "Google Chrome"; // By app name browser: "com.google.Chrome"; // By bundle ID browser: "/Applications/Firefox.app"; // By app path ``` ```javascript browser: "Google Chrome:Personal" // Profile name after colon browser: { name: "Google Chrome", profile: "Personal" } ``` ```javascript browser: { name: "Google Chrome", appType: "appName", // Force name type: "appName", "bundleId" or "path" openInBackground: true, // Open in background instead of foreground profile: "Work", } ``` ```javascript browser: (url) => { if (url.host === "example.com") return "Google Chrome"; if (url.host === "work.example.com") return "Firefox"; return "Safari"; }; // Or with dynamic background opening: browser: (url) => ({ name: "Google Chrome", openInBackground: url.href.includes("facebook"), }); ``` -------------------------------- ### Finicky URL Matching Methods Source: https://github.com/johnste/finicky/wiki/Configuration-(v4) Demonstrates various ways to match URLs, including string wildcards, regular expressions, and custom functions. Can be combined for complex matching. ```javascript match: "http://example.com/*"; // Matches any path after example.com match: "*.example.com/*"; // Matches any subdomain of example.com ``` ```javascript match: /^https?::\/\/example\.com/.*$/ // Matches http or https URLs from example.com match: /\.(dev|test)\.example\.com$/ // Matches specific subdomains ``` ```javascript match: (url) => url.host === "example.com"; match: (url) => url.pathname.startsWith("/api/"); ``` ```javascript match: [ "https://example.com", /^http:\/\/example.(org|com)\/.*$/, (url) => url.pathname.includes("/hello"), ]; ``` -------------------------------- ### Configure ClickUp Links to Open in Desktop App Source: https://github.com/johnste/finicky/wiki/Configuration-ideas This snippet defines handlers and rewrite rules for Finicky. It matches ClickUp URLs and rewrites them to use the 'clickup' protocol, directing them to the desktop app. It handles both direct app links and links from email notifications. ```javascript module.exports = { handlers: [ { match: ({ url }) => url.protocol === "clickup", browser: "ClickUp" }, ], rewrite: [ { match: "https://link-inbox.clickup.com/CL0/*", url: ({ url }) => ({ ...url, protocol: "clickup", host: "", // Links from e-mail notifications: // https://link-inbox.clickup.com/CL0/https:%2F%2Fapp.clickup.com%2Ft%2F86c1au25p%3Fcomment=90150095296062%26threadedComment=90150095416601%26utm_source=email-notifications%26utm_type=2%26utm_field=comment/1/010001943ba132c9-6ba4ceb3-9da1-4771-8022-60d330932eb7-000000/U4wqDVk2GS865NI30mhkcQc0HqXDzSuXR5-V2AnWBDg=386 // URL unescape, remove header, remove CL0, remove https:// pathname: url.pathname.slice(1).replaceAll("%2F", "/").replaceAll("%3F", "?").replaceAll("%26", "&").replace("CL0/https://", "") }) }, { match: "https://app.clickup.com/*", url: ({ url }) => ({ ...url, protocol: "clickup", host: "", pathname: url.pathname.slice(1) }) }, ], }; ``` -------------------------------- ### Default Finicky Configuration Source: https://github.com/johnste/finicky/wiki/Configuration-(v4) Sets the default browser and configures options like update checks and request logging. Includes basic rewrite and handler rules. ```javascript export default { defaultBrowser: "Google Chrome", options: { // Check for updates. Default: true checkForUpdates: true, // Log every request to file. Default: false logRequests: false, // Keep Finicky running in the background keepRunning: false, // Hide the Finicky icon from the menu bar hideIcon: false }, rewrite: [ { match: "example.org/*", url: "http://example.com", }, ], handlers: [ { match: "apple.com/*", browser: "Safari", }, ], }; ``` -------------------------------- ### Match Multiple Conditions for URL Handling Source: https://github.com/johnste/finicky/wiki/Configuration-ideas Use this to open specific URLs in a designated browser only when they are opened from a particular application. ```javascript handlers: [{ // Open Google Drive in Firefox if opened from Slack match: ({opener, url}) => opener.bundleId === "com.tinyspeck.slackmacgap" && url.host.includes("drive.google.com"), browser: "Firefox" }] ``` -------------------------------- ### Create Bookmarks to Open Finicky URLs Source: https://github.com/johnste/finicky/wiki/Configuration-ideas This rewrite rule supports custom bookmarks that launch Finicky with a specific URL. It parses the URL from the bookmark and returns the target URL to be opened. ```javascript rewrite: [{ // Support bookmarks like finicky://open?url=https://example.com match: "finicky://open?url=*", url: (url) => { const target = url.searchParams.get("url"); return target; }, }] ``` -------------------------------- ### Open Discord Links in Discord App Source: https://github.com/johnste/finicky/wiki/Configuration-ideas Configure Finicky to open Discord links directly in the Discord desktop application. ```javascript handlers: [{ match: "https://discord.com/*", url: { protocol: "discord" }, browser: "Discord", }] ``` -------------------------------- ### Log Incoming Requests with Finicky Source: https://github.com/johnste/finicky/wiki/Troubleshooting-&-Tips Use the `logRequests` option to log all incoming requests to the Finicky console for debugging purposes. This helps in identifying the correct application name or bundle ID. ```bash Mac:~ me$ mdls /Applications/iPhoto.app | grep kMDItemCF kMDItemCFBundleIdentifier = "com.apple.iPhoto" ``` -------------------------------- ### Log All Parameters in URL Rewrites Source: https://github.com/johnste/finicky/wiki/Troubleshooting-&-Tips Implement a URL rewrite handler to log the entire object containing all incoming parameters to the finicky console. This is useful for understanding the data passed to URL handling functions. ```javascript module.exports = { defaultBrowser: "Safari", rewrite: [ { match(all) { finicky.log(JSON.stringify(all, null, 2)); return false; }, url: ({ url }) => url, }, ], }; ``` -------------------------------- ### Match One of Multiple Domains Source: https://github.com/johnste/finicky/wiki/Configuration-ideas Use this to open URLs from any of a group of specified domains in a particular browser. ```javascript handlers: [ { match: (url) => { const chromeDomains = ["office.com", "box.com", "microsoft.com"]; return chromeDomains.some(domain => url.host.endsWith(domain)); }, browser: "Google Chrome", }, ] ``` -------------------------------- ### Open Spotify Links in Spotify App Source: https://github.com/johnste/finicky/wiki/Configuration-ideas This handler opens links from 'open.spotify.com' directly in the Spotify native application. It uses `finicky.matchDomains` for matching. ```javascript handlers: [{ match: finicky.matchDomains("open.spotify.com"), browser: "Spotify" }] ``` -------------------------------- ### Finicky Simple Browser Selection Source: https://github.com/johnste/finicky/wiki/Configuration-(v4) Sets a default browser and specifies a different browser for URLs matching a condition. Requires the `handlers` array. ```javascript export default { defaultBrowser: "Safari", handlers: [ { match: (url) => url.host.endsWith("example.org"), browser: "Firefox", }, ], }; ``` -------------------------------- ### Finicky Is App Running Utility Source: https://github.com/johnste/finicky/wiki/Configuration-(v4) Checks if a specified application is currently running on the system. ```javascript // App state const isRunning = finicky.isAppRunning("Google Chrome"); // Check if an app is running // Returns: boolean // true if the app is running, false otherwise ``` -------------------------------- ### Open Trello Links in Trello App Source: https://github.com/johnste/finicky/wiki/Configuration-ideas This handler opens Trello.com links in the Trello native application by setting the protocol to 'trello'. It uses `finicky.matchDomains` to identify Trello URLs. ```javascript handlers: [{ match: finicky.matchDomains(["trello.com"]), url: ({url}) => ({...url, protocol: "trello"}), browser: "Trello" }] ``` -------------------------------- ### Open Slack Login URLs in Browser Selector Source: https://github.com/johnste/finicky/wiki/Configuration-ideas Configure Finicky to use a browser selector (like Browserosaurus) for Slack login URLs. This allows manual selection of the browser for specific actions. ```javascript const browsers = { personal: { name: 'org.mozilla.firefox', openInBackground: false, }, work: { name: 'com.google.Chrome', openInBackground: false, }, selector: { name: 'com.browserosaurus', openInBackground: false, } } module.exports = { handlers = [ { // Select browser when slack wants to login // https://app.slack.com/ssb/add?s=1&v=4.41.90&ssb_vid=.&ssb_instance_id= match: [ "app.slack.com/ssb/*" ], browser: browsers.selector, }, ] } ``` -------------------------------- ### Open Chrome PWA Apps with Correct URL Source: https://github.com/johnste/finicky/wiki/Configuration-ideas Launch Chrome PWAs with specific app IDs and launch URLs by passing arguments to the Chrome browser. Requires Finicky v4.2.1+. ```javascript handlers: [{ match: /^https?::\/\/meet\.google\.com\//, browser: (url) => ({ name: "Google Chrome", profile: "Default", args: [ "--app-id=kjgfgldnnfoeklkmfkjfagphfepbbdan", `--app-launch-url-for-shortcuts-menu-item=${url.toString()}` ] }) }] ``` -------------------------------- ### Match Apps by Bundle ID Source: https://github.com/johnste/finicky/wiki/Configuration-ideas This handler configuration opens links in Google Chrome if they originate from Mail or Outlook, identified by their bundle IDs. Ensure the opener's bundle ID is correctly specified. ```javascript handlers: [{ // Open any link clicked in Mail & Outlook in Google Chrome match: (_url, {opener}) => ["com.apple.mail", "com.microsoft.Outlook"].includes(opener?.bundleId ?? ""), browser: "Google Chrome" }] ``` -------------------------------- ### Update Finicky Config: CommonJS to ECMAScript Module Syntax Source: https://github.com/johnste/finicky/wiki/Use-Modern-ECMAScript-Module-Syntax Use ECMAScript module syntax (export default) for your Finicky configuration file. CommonJS syntax (module.exports) is deprecated and will be removed in a future version. ```js module.exports = { defaultBrowser: "Firefox", // ... configuration }; ``` ```js export default { defaultBrowser: "Firefox", // ... configuration }; ``` -------------------------------- ### Match Apps by Name Source: https://github.com/johnste/finicky/wiki/Configuration-ideas This handler configuration opens links in Google Chrome if they originate from applications named 'Mail' or 'Microsoft Outlook'. This is an alternative to matching by bundle ID. ```javascript handlers: [{ // Open any link clicked in Mail & Outlook in Google Chrome match: (_url, {opener}) => ["Mail", "Microsoft Outlook"].includes(opener.name), browser: "Google Chrome" }] ``` -------------------------------- ### Open Apple Music Links in Music App Source: https://github.com/johnste/finicky/wiki/Configuration-ideas This handler opens Apple Music links from 'music.apple.com' and 'geo.music.apple.com' directly in the Music app. It sets the protocol to 'itmss'. ```javascript handlers: [{ // Open Apple Music links directly in Music.app match: [ "music.apple.com*", "geo.music.apple.com*", ], url: { protocol: "itmss" }, browser: "Music", }] ``` -------------------------------- ### Jump to #report on Spamcop Pages Source: https://github.com/johnste/finicky/wiki/Configuration-ideas Use Finicky's rewrite functionality to automatically jump to the '#report' hash on www.spamcop.net pages. ```javascript rewrite: [{ match: finicky.matchHostnames("www.spamcop.net"), url: { hash: "report" } }] ``` -------------------------------- ### Open Microsoft Teams Links in Native App Source: https://github.com/johnste/finicky/wiki/Configuration-ideas This handler opens Microsoft Teams links in the native Teams application ('com.microsoft.teams'). It matches hostnames and sets the protocol to 'msteams'. ```javascript handlers: [{ match: finicky.matchHostnames(['teams.microsoft.com']), browser: 'com.microsoft.teams', url: ({url}) => ({...url, protocol: 'msteams'}), }] ``` -------------------------------- ### Force HTTPS for all URLs Source: https://github.com/johnste/finicky/wiki/Configuration-ideas Use this rewrite rule to ensure all HTTP links are automatically upgraded to HTTPS. It matches any URL with an HTTP protocol and modifies it to use HTTPS. ```javascript rewrite: [{ match: ({url}) => url.protocol === "http", url: (url) => { url.protocol = "https"; return url; } }] ``` -------------------------------- ### Rewrite TikTok Videos to Proxitok Proxies Source: https://github.com/johnste/finicky/wiki/Configuration-ideas Redirect TikTok video links to use Proxitok public proxies. This configuration matches TikTok domains and prepends a placeholder to the pathname to align with ProxiTok URL structures. ```javascript rewrite: [{ // Redirect Tiktok video links to use Proxitok public proxies match: ({ url }) => (url.host.endsWith("tiktok.com") && url.pathname.startsWith('/@')) || url.host.endsWith("vm.tiktok.com"), url: ({ url }) => { // See more https://github.com/pablouser1/ProxiTok/wiki/Public-instances const selectRandomTikTokProxy = () => { const TIKTOK_PROXIES = [ "proxitok.pabloferreiro.es", // Official "proxitok.pussthecat.org", "tok.habedieeh.re", "proxitok.esmailelbob.xyz", "proxitok.privacydev.net", "tok.artemislena.eu", "tok.adminforge.de", "tt.vern.cc", "cringe.whatever.social", "proxitok.lunar.icu", "proxitok.privacy.com.de", "cringe.seitan-ayoub.lol", "cringe.datura.network", "tt.opnxng.com", "tiktok.wpme.pl", "proxitok.r4fo.com", "proxitok.belloworld.it", ] return TIKTOK_PROXIES[Math.floor(Math.random() * TIKTOK_PROXIES.length)] } return { protocol: "https", host: selectRandomTikTokProxy(), // Prepend pathname with /@placeholder/video to match ProkiTok urls pathname: (url.pathname.startsWith('/@') ? url.pathname : "/@placeholder/video${url.pathname}") } } }] ``` -------------------------------- ### Finicky Callback Function Parameters Source: https://github.com/johnste/finicky/wiki/Configuration-(v4) Defines the type for callback functions used in Finicky, specifying the parameters they receive: a URL object and an options object containing opener information. ```typescript type CallbackFunc = ( url: URL, // The URL to be handled options: { opener: { name: string; // Name of the app that opened the URL bundleId: string; // Bundle ID of the opener path: string; // Path to the opener app } | null; } ) => boolean; ``` -------------------------------- ### Finicky TypeScript Type Checking Source: https://github.com/johnste/finicky/wiki/Configuration-(v4) Provides type checking for Finicky configurations in TypeScript by importing the necessary type definitions. ```typescript // ~/.finicky.ts import type { FinickyConfig } from "/Applications/Finicky.app/Contents/Resources/finicky.d.ts"; export default { // ... your configuration here } satisfies FinickyConfig; ``` -------------------------------- ### Open Zoom Links in Zoom App Source: https://github.com/johnste/finicky/wiki/Configuration-ideas This configuration handles Zoom links, opening them in the Zoom app. It supports URLs with or without passwords and correctly formats the URL for the Zoom app, including conference numbers and passwords. ```javascript handlers: [{ match: /zoom\.us\/join/, browser: "us.zoom.xos" }], rewrite: [{ match: (url) => url.host.includes("zoom.us") && url.pathname.includes("/j/"), url: (url) => { try { const match = url.search.match(/pwd=(\w*)/); var pass = match ? '&pwd=' + match[1] : ''; } catch { var pass = ""; } const pathMatch = url.pathname.match(/\/j\/(\d+)/); var conf = 'confno=' + (pathMatch ? pathMatch[1] : ''); url.search = conf + pass; url.pathname = '/join'; url.protocol = "zoommtg"; return url; } }] ``` -------------------------------- ### Finicky JavaScript Type Checking Source: https://github.com/johnste/finicky/wiki/Configuration-(v4) Enables type checking for Finicky configurations in JavaScript using JSDoc annotations. ```javascript // @ts-check /** * @typedef {import('/Applications/Finicky.app/Contents/Resources/finicky.d.ts').FinickyConfig} FinickyConfig */ /** * @type {FinickyConfig} */ export default { // ... your configuration here }; ``` -------------------------------- ### Deep Link Slack URLs Source: https://github.com/johnste/finicky/wiki/Configuration-ideas Rewrite Slack web URLs to open directly in the Slack application using deep links. Configure team mappings for different Slack workspaces. ```javascript const workSlackTeamMapping = { // 'subdomain': 'TXXXXXXX', // 'acmecorp.enterprise': 'EXXXXXXX', // 'acmecorp': 'EXXXXXXX', }; const personalSlackMapping = { // personal slacks }; const slackSubdomainMapping = { ...workSlackTeamMapping, ...personalSlackMapping, }; const slackRewriter = { match: ["*.slack.com/*"], url: function (urlObj) { const subdomain = urlObj.host.slice(0, -10); // before .slack.com const pathParts = urlObj.pathname.split("/"); let team, patterns = {}; if (subdomain != "app") { if (!Object.keys(slackSubdomainMapping).includes(subdomain)) { console.log( `No Slack team ID found for ${urlObj.host}`, `Add a correct team ID to ~/.finicky.js to allow direct linking to Slack.` ); return urlObj; } team = slackSubdomainMapping[subdomain]; if (subdomain.slice(-11) == ".enterprise") { patterns = { file: [(/\/files\/\w+\/(?\w+)/)], }; } else { patterns = { file: [(/\/messages\/\w+\/files\/(?\w+)/)], team: [(/\/(?:messages\/\w+)?\/team\/(?\w+)/)], channel: [ (/\/(?:messages|archives)\/\w+(?:\/(?p\d+))?/), ], }; } } else { patterns = { file: [ (/\/client\/(?\w+)\/\w+\/files\/(?\w+)/), (/\/docs\/(?\w+)\/\w+\/\w+\/(?\w+)/), ], team: [(/\/client\/(?\w+)\/\w+\/user_profile\/(?\w+)/)], channel: [ (/\/client\/(?\w+)\/\w+(?:\/(?[\d.]+))?/), ], }; } for (let [host, host_patterns] of Object.entries(patterns)) { for (let pattern of host_patterns) { let match = pattern.exec(urlObj.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 outputStr = `slack://${host}?${search}`; console.log( `Rewrote Slack URL ${urlObj.href} to deep link ${outputStr}` ); return new URL(outputStr); } } } return urlObj; }, }; module.exports = { defaultBrowser: "Google Chrome", rewrite: [slackRewriter], handlers: [ { match: ({ url }) => { // Check for both 'slack:' and 'slack' since the property might not include the colon return url.protocol === "slack:" || url.protocol === "slack"; }, browser: "Slack", }, { // Optional. If these work url cannot be converted, open them is work browser // Login in work workspace unfortunately lands on the personal browser, just copy the link to the work browser match: ({ url }) => { const workDomains = Object.keys(workSlackTeamMapping).map(subdomain => subdomain + ".slack.com"); return workDomains.includes(url.host); }, browser: "Google Chrome", // your work browser }, ], }; ``` -------------------------------- ### Skip vk.com Link Tracking Source: https://github.com/johnste/finicky/wiki/Configuration-ideas This rewrite rule skips tracking parameters on vk.com 'away.php' links. It extracts the original URL from the 'to' parameter and decodes it. ```javascript rewrite: [{ match: /vk\.com\/away.php/, url: ({url}) => { const match = url.search.match(/to=(.+)/) return !match ? url : decodeURIComponent(decodeURIComponent(match[1])); } }] ``` -------------------------------- ### Redirect Google Links to DuckDuckGo Source: https://github.com/johnste/finicky/wiki/Configuration-ideas This rewrite rule redirects all links from google.com domains to duckduckgo.com. It uses `finicky.matchDomains` for efficient domain matching. ```javascript rewrite: [{ match: finicky.matchDomains(["google.com"]), url: "https://duckduckgo.com" }] ``` -------------------------------- ### Remove Marketing and Tracking Parameters from URLs Source: https://github.com/johnste/finicky/wiki/Configuration-ideas This comprehensive rewrite rule removes common marketing and tracking parameters from URLs. It handles various parameter names and prefixes, including 'utm_', 'ga_', and specific identifiers like 'fbclid'. ```javascript rewrite: [ { match: m => true, url: url => { const lower = s => String(s || "").toLowerCase(); const removeExact = new Set(["fbclid", "gclid", "dclid", "gbraid", "wbraid", "msclkid", "ttclid", "twclid", "li_fat_id", "mkt_tok", "mc_cid", "mc_eid", "igsh", "si", "feature", "ref", "ref_src", "spm"]); const removePrefixes = ["utm_", "uta_", "ga_", "pk_", "vero_"]; const removeByValue = new Set(["share", "social", "social_media", "social_network"]); const keys = [...url.searchParams.keys()]; for (const key of keys) { const k = lower(key), v = lower(url.searchParams.get(key)); const isExact = removeExact.has(k); const isPrefix = removePrefixes.some(p => k.startsWith(p)); const isValueNoise = (k === "source" || k === "src" || k === "medium") && removeByValue.has(v); if (isExact || isPrefix || isValueNoise) { url.searchParams.delete(key); } } return url.href; }, }, ], ``` -------------------------------- ### Open Links from Telegram in Specific Edge Profile Source: https://github.com/johnste/finicky/wiki/Configuration-ideas Since version 3.2.0, specify a browser profile to open links clicked in Telegram with a particular Microsoft Edge profile. ```javascript { match: ({opener}) => ["Telegram"].includes(opener.name), browser: { name: "Microsoft Edge", profile: "Profile 1", }; } ``` -------------------------------- ### Replace Amazon Domain with Smile Amazon Source: https://github.com/johnste/finicky/wiki/Configuration-ideas This rewrite rule redirects any URL matching 'amazon.com/*' to 'smile.amazon.com'. It's useful for ensuring users are always directed to the smile version of Amazon. ```javascript rewrite: [{ match: "amazon.com/*", url: { host: "smile.amazon.com" } }] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.