Created
June 24, 2019 19:43
-
-
Save johnste/2883aa088fe46b926bda5afc3eb32953 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const regex = /^https?:\/\/twitter\.com\/(?:#!\/)?(\w+)\/status(?:es)?\/(\d+)(?:\/.*)?$/ | |
module.exports = { | |
defaultBrowser: "Google Chrome", | |
rewrite: [ | |
{ | |
match: ({urlString}) => { | |
const matches = urlString.match(regex); | |
finicky.log(JSON.stringify(matches, null, 2)) | |
return matches && matches[2]; | |
}, | |
url: ({ urlString }) => { | |
const [_, user, statusId] = urlString.match(regex); | |
return `tweetbot://${user}/status/${statusId}`; | |
} | |
} | |
], | |
handlers: [ | |
{ | |
match: ({ url }) => url.protocol === "tweetbot", | |
browser: "com.tapbots.Tweetbot3Mac" | |
}, | |
] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment