1
0
Fork 0
mirror of https://github.com/Phantop/dotfiles synced 2025-01-12 07:07:04 +00:00

Qute: clean up redirects, hosts, and the rest

This commit is contained in:
Phantop 2021-02-02 22:20:48 -05:00
parent 0233bf99c8
commit cab5d6136c
5 changed files with 35 additions and 30 deletions

View file

@ -29,15 +29,15 @@ cct.pinned.selected.odd.bg = accent
cct.selected.even.bg = accent cct.selected.even.bg = accent
cct.selected.odd.bg = accent cct.selected.odd.bg = accent
cct.selected.even.fg = 'black' cc.messages.warning.fg = 'white'
cct.selected.odd.fg = 'black'
cct.pinned.selected.even.fg = 'black' cct.pinned.selected.even.fg = 'black'
cct.pinned.selected.odd.fg = 'black' cct.pinned.selected.odd.fg = 'black'
cc.messages.warning.fg = 'white' cct.selected.even.fg = 'black'
cct.selected.odd.fg = 'black'
cc.messages.warning.bg = 'red'
cc.messages.warning.border = 'red'
ccc.even.bg = '#29353B' ccc.even.bg = '#29353B'
ccc.odd.bg = '#243035' ccc.odd.bg = '#243035'
c.hints.border = '1px solid #00A5BA' c.hints.border = '1px solid #00A5BA'
cc.hints.bg = 'rgba(0, 226, 255, 0.8)' cc.hints.bg = 'rgba(0, 226, 255, 0.8)'
cc.messages.warning.bg = 'red'
cc.messages.warning.border = 'red'

View file

@ -11,13 +11,13 @@ bind = {
';M': 'hint links run mpv4 {hint-url}', ';M': 'hint links run mpv4 {hint-url}',
's1': 'download-open', 's1': 'download-open',
'sa': 'open https://archive.is/?run=1&url={url}', 'sa': 'open -t archive.is/?run=1&url={url}',
'sc': 'config-cycle -t content.user_stylesheets adapta.css ""', 'sc': 'config-cycle content.user_stylesheets adapta.css ""',
'sd': "spawn fish -c 'dl; open (ls | rofi -dmenu -b -i || exit 0)'", 'sd': "spawn fish -c 'dl; open (ls | rofi -dmenu -b -i || exit 0)'",
'sg': 'debug-dump-page ~/Downloads/dump.html', 'sg': 'debug-dump-page ~/Downloads/dump.html',
'sq': 'spawn -u qr', 'sq': 'spawn -u qr',
'sr': 'remove-sticky', 'sr': 'remove-sticky',
'st': 'config-cycle -t content.proxy socks://localhost:9050/ system', 'st': 'config-cycle content.proxy socks://localhost:9050/ system',
} }
for a, b in bind.items(): for a, b in bind.items():
config.bind(a, b) config.bind(a, b)

View file

@ -33,11 +33,11 @@ c.aliases['mpv4'] = mpv + ' --ytdl-format=bestvideo[vcodec^=avc1]+bestaudio'
c.aliases['remove-sticky'] = 'jseval -q !function(){var e,o=document.querySelectorAll("body *");for(e=0;e<o.length;e++)["sticky","fixed"].includes(getComputedStyle(o[e]).position)&&o[e].parentNode.removeChild(o[e])}();' c.aliases['remove-sticky'] = 'jseval -q !function(){var e,o=document.querySelectorAll("body *");for(e=0;e<o.length;e++)["sticky","fixed"].includes(getComputedStyle(o[e]).position)&&o[e].parentNode.removeChild(o[e])}();'
c.content.blocking.method = "both" c.content.blocking.method = "both"
hosts = c.content.blocking.hosts.lists host = c.content.blocking.hosts.lists.append
hosts.append("https://github.com/Perflyst/PiHoleBlocklist/raw/master/AmazonFireTV.txt") host("https://github.com/Perflyst/PiHoleBlocklist/raw/master/AmazonFireTV.txt")
hosts.append("https://github.com/jmdugan/blocklists/raw/master/corporations/twitter/all") host("https://github.com/jmdugan/blocklists/raw/master/corporations/twitter/all")
hosts.append("https://github.com/jmdugan/blocklists/raw/master/corporations/microsoft/all") host("https://github.com/jmdugan/blocklists/raw/master/corporations/microsoft/all")
hosts.append("https://github.com/jmdugan/blocklists/raw/master/corporations/facebook/all-but-whatsapp") host("https://github.com/jmdugan/blocklists/raw/master/corporations/facebook/all-but-whatsapp")
config.set('content.persistent_storage', True, 'https://mega.nz') config.set('content.persistent_storage', True, 'https://mega.nz')
config.set('content.desktop_capture', True, 'https://discord.com') config.set('content.desktop_capture', True, 'https://discord.com')

View file

@ -1,30 +1,35 @@
invid = 'invidious.fdn.fr' invid = 'invidiou.site'
nitter = 'nitter.snopyta.org' nitter = 'nitter.snopyta.org'
reddit = 'teddit.net' reddit = 'teddit.net'
from qutebrowser.api import interceptor from qutebrowser.api import interceptor
import operator, typing import operator, typing
REDIRECT_MAP = { o = operator.methodcaller
"reddit.com": operator.methodcaller('setHost', reddit), s = 'setHost'
"www.reddit.com": operator.methodcaller('setHost', reddit), MAP = {
"old.reddit.com": operator.methodcaller('setHost', reddit), "reddit.com": o(s, reddit),
"twitter.com": operator.methodcaller('setHost', nitter), "www.reddit.com": o(s, reddit),
"api.twitter.com": operator.methodcaller('setHost', nitter), "old.reddit.com": o(s, reddit),
"platform.twitter.com": operator.methodcaller('setHost', nitter),
"www.platform.twitter.com": operator.methodcaller('setHost', nitter), "twitter.com": o(s, nitter),
"mobile.twitter.com": operator.methodcaller('setHost', nitter), "api.twitter.com": o(s, nitter),
"www.youtube.com": operator.methodcaller('setHost', invid), "mobile.twitter.com": o(s, nitter),
"youtube.com": operator.methodcaller('setHost', invid), "platform.twitter.com": o(s, nitter),
"youtu.be": operator.methodcaller('setHost', invid), "www.platform.twitter.com": o(s, nitter),
"www.instagram.com": operator.methodcaller('setHost', 'bibliogram.snopyta.org'),
"youtu.be": o(s, invid),
"youtube.com": o(s, invid),
"www.youtube.com": o(s, invid),
"www.instagram.com": o(s, 'bibliogram.art'),
"www.amazon.com": o(s, 'smile.amazon.com'),
} }
def int_fn(info: interceptor.Request): def int_fn(info: interceptor.Request):
"""Block the given request if necessary."""
if (info.resource_type != interceptor.ResourceType.main_frame or if (info.resource_type != interceptor.ResourceType.main_frame or
info.request_url.scheme() in {"data", "blob"}): info.request_url.scheme() in {"data", "blob"}):
return return
url = info.request_url url = info.request_url
redir = REDIRECT_MAP.get(url.host()) redir = MAP.get(url.host())
if redir is not None and redir(url) is not False: if redir is not None and redir(url) is not False:
info.redirect(url) info.redirect(url)
interceptor.register(int_fn) interceptor.register(int_fn)

2
.setup
View file

@ -15,7 +15,7 @@ web="arcanist aria2 deluge qutebrowser openssh-server speedtest-cli subliminal"
sudo eopkg it $audio $dev $gui $media $rice $term $web sudo eopkg it $audio $dev $gui $media $rice $term $web
sudo eopkg rm --ignore-dependency tracker sudo eopkg rm --ignore-dependency tracker
pip3 install --user adblock pipipxx readability-lxml sh parallel pip3 install --user --upgrade ::: adblock pipipxx readability-lxml sh
parallel pipx install ::: deemix soundscrape tldr parallel pipx install ::: deemix soundscrape tldr
rm ~/.bashrc rm ~/.bashrc