Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- First, sort out rules which only match a certain subdomain (only five in my case, so I'm adding them manually). For the others, convert the list to "include patterns" for Redirector:
- sed -i -r -e 's/\./\\\\\./g' -e 's/\*/\(\.\*\)/g' -e 's/^\\\\\./http\:\/\/\(\.\*\\\\\.\)\?/g' -e 's/$/\(\/\.\*\)\?\$/' noscript-https-converting-for-redirector.txt
- Now the difficult part: Generating the "redirect URL". Entries without TLD will need to be added manually.
- sed -i -r -e 's/^http\:\/\/\(\.\*\\\\\.\)\?(.*)\\\\\.([a-z]{2,8})\(\/\.\*\)\?\$$/\0\nhttps\:\/\/\$1\1\.\2\$2/g' noscript-https-converting-for-redirector.txt
- On entries with wildcards, you now need to replace "(.*)\" by "$2" and adjust the "$2" on the end of the line to "$3". (Done manually)
- Almost done, just place the JSON skeleton around this list:
- sed -i -r -e 's/^http\:.*$/\{\n \"includePattern\"\: \"\0\"\,/g' -e 's/^https\:.*/ \"redirectUrl\"\: \"\0\"\,\n \"patternType\"\: \"R\"\,\n \"appliesTo\"\:\[\"main_frame\"\,\"sub_frame\"\,\"stylesheet\"\,\"script\"\,\"image\"\,\"object\"\,\"xmlhttprequest\"\,\"other\"\]\n\},/g' noscript-https-converting-for-redirector.txt
- And as the last step, complete the JSON by adding
- { "redirects": [
- as the first line to the file, remove the comma in the last line and add "]}" instead. Congratulations, you should now have a file importable to the addon Redirector.
- For the exclusion rules, I'm adding them manually to the redirects they belong to. Since the list is searchable (I used to copy the old NoScript list into a text editor if I was searching for an entry) this is quite easy, and I can take this opportunity to check whether the sites are actually still unavailable over HTTPS.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement