finicky
finicky copied to clipboard
Default protocol
Is your feature request related to a problem? Please describe. Finicky can change all URLs with http to https. As there are still many URLs workin with http only, we have to make a list to bypassing it. The code is not straightforward.
Describe the solution you'd like Just like default browser, we can introduce concept "default protocol". The default protocol can be "https". the user can put a section matching URLs and set the protocol to "http".
Here is an example.
module.exports = {
defaultBrowser: "Google Chrome",
defaultPrototcol: "https",
rewrite: [
{
match: "example.org/*",
url: "http://example.com",
},
],
handlers: [
{
match: "apple.com/*",
browser: "Safari",
},
{
match: "example.com/*",
browser: "Safari",
protocol: "http",
},
],
};
Please note, there is a special case that some protocol doesn't have domain. So we need to remove the 1st "/". See example at https://github.com/johnste/finicky/issues/173
Hm, I don't think this is happening. I would rather have this handled in explicit rules. Changing protocols feels like a very specific thing to add.
If I wanted to add this to a config I would probably do something like:
// At the top of .finicky.js
const httpHosts = ["example.com"];
// Rewrite rule
{
match: ({ url }) => {
if (!httpHosts.includes(url.host)) {
return;
}
return url.protocol === "http";
},
url: {
protocol: "https",
},
},