1
0
Fork 0
mirror of https://github.com/Phantop/dotfiles synced 2024-11-21 14:22:45 +00:00

qute: adjust for arista and redo redirects

This commit is contained in:
Phantop 2024-07-16 12:20:10 -04:00
parent ed708d1be3
commit 5adfebeba8
9 changed files with 129 additions and 132 deletions

View file

@ -120,8 +120,8 @@ for i in (cut -d ' ' -f1 < ~/.config/qutebrowser/quickmarks)
a $i "qutebrowser / \":open $i\""
end
for i in deemix encodec git-sim lightnovel-crawler mandown mangadex-downloader\
mathicsscript pdf2docx portablemc ratarmount scdl soundscrape spleeter
for i in bandcamp-downloader deemix encodec git-sim lightnovel-crawler mandown\
mangadex-downloader mathicsscript pdf2docx portablemc ratarmount scdl spleeter
a $i "pipx run $i"
end
a in2csv 'pipx run --spec csvkit in2csv'

View file

@ -52,6 +52,7 @@
g = clone
gr = clone --recursive
l = log
open = remote -v
p = pull
pu = push
puf = push -f

View file

@ -10,6 +10,7 @@ close_on_child_death yes
initial_window_width 80c
initial_window_height 24c
allow_remote_control yes
hide_window_decorations yes
map shift+page_up scroll_page_up
map shift+page_down scroll_page_down

12
qutebrowser/arista.py Normal file
View file

@ -0,0 +1,12 @@
c.url.searchengines['aid'] = 'http://aid/{}'
c.url.searchengines['go'] = 'http://go/{}'
c.url.searchengines['group'] = 'http://groups/{}'
config.bind('A', ':cmd-set-text -s :open -t aid')
config.bind('a', ':cmd-set-text -s :open aid')
config.bind('E', ':cmd-set-text -s :open -t go')
config.bind('e', ':cmd-set-text -s :open go')
c.content.user_stylesheets = ['css/user.css']
c.fonts.default_size = '13pt'
c.url.default_page = 'https://docs.google.com/document/d/1LGHPp5h5lu-aCFSSZHOZkz5OZrJv5xd7jtq6Wsa3ZKU/mobilebasic'

View file

@ -37,7 +37,7 @@ bind = {
'E': 'config-cycle -p content.javascript.enabled ;; reload',
's1': 'download-open',
'sa': 'open -t archive.is/submit/?url={url}',
'sb': 'spawn -u priviblur',
'pb': 'spawn -u priviblur',
'sc': 'toggle-dark',
'sd': "spawn fish -c 'dl; open (ls -a | rofi -dmenu -b -i || exit 0)'",
'sg': 'debug-dump-page ~/Downloads/dump.html',

View file

@ -1,8 +1,14 @@
import platform
config.load_autoconfig(False)
config.source('adblock.py')
config.source('bindings.py')
config.source('redirects.py')
config.source('search.py')
config.source('sites.py')
config.source('theme.py')
config.source('ui.py')
if platform.system() != 'Darwin':
config.source('redirects.py')
config.source('sites.py')
else:
config.source('arista.py')

View file

@ -1,7 +1,7 @@
#hnmain { // hacker news
zoom: 120%;
.title a:link, .c00, .c00 a:link {color: #FFF }
.title a:link, .c00, .c00 a:link {color: #FFF}
[action="comment"] {display:none}
zoom: 120%;
}
#app-mount { //discord
@ -12,43 +12,55 @@
--background-secondary-alt: var(--background-primary);
--channeltextarea-background: var(--background-primary);
font-family: "Ubuntu Mono";
$aria: gift, Help, Inbox;
@each $i in $aria {[aria-label$="#{$i}"] {display: none}}
[class^="private"] [class^="search"], [href="/store"], [href="/shop"] {display: none}
[aria-label="Servers"] ~ div { display: none }
[class^="private"] [class^="search"], [href="/store"], [href="/shop"] {display: none}
font-family: "Ubuntu Mono";
}
div.doc-container div.doc div {max-width: 666pt !important; margin: auto} // better docs mobile
.docs-gm > #sheets-viewport > div { display: unset !important; }
// .bridge-card { form, h5 {display:revert} .showmore {display:none} } // show rss-bridges
#years-table { .detail-view-container { display: flex } td { background-image: unset } } //quatalog detailed view
.doc-content {max-width: 666pt !important; margin: auto} // better docs mobile
body>nav:nth-child(1), .docs-ml-header {position: absolute} // lock sticky navbars
ul.js-show-external { display: unset } // show annas external
// .bridge-card { form, h5 {display:revert} .showmore {display:none} } // show rss-bridges
/* hide ads and invidious recommends */
$class: ad-frame-container, ad-panel, ad-slot, adsbygoogle, adbox, adunit,
adunit-wrapper, b_ad, leaderboard, "pure-u-lg-1-5:nth-child(3)", verified-icon;
@each $i in $class {.#{$i} {display:none}}
/* hide ads */
$class: -frame-container, -panel, -slot, sbygoogle, box, unit, unit-wrapper;
$id: ads, leaderboard, player-ads, rc-row-container;
$div: 'class*=-ad-container', 'class*=ad-wrapper', 'id*=_ad_native',
'id^=div-gpt-ad', 'id^=google_ads_', 'id^=netboard_', 'id^=skyscraper';
@each $i in $class {.ad#{$i} {display:none}}
@each $i in $div {div[#{$i}] {display:none}}
$id: ads, leaderboard, player-ads, rc-row-container;
@each $i in $id {##{$i} {display:none}}
/* --------------------------------- */
div.container > div.conversation > div#r.replies { display: none } //nitter replies
body>nav:nth-child(1):not([class]) {position: absolute} // nitter/libreddit/librex
// arista aids
body:has(> p.author) { max-width: 60em; margin: auto; zoom: 110%; }
div#outer.wrapper { //ao3
#admin-banner, #header ul.primary, #bookmark-form fieldset > dl {display:none}
#workskin {zoom: 125%; max-width: 40em;}
p.kudos {overflow-wrap: break-word}
select { background: none; color: #FFF; }
zoom: 110%;
ul.work { // modified work header w/ nav and epub
.download li:not(:nth-child(2)), a.collapsed, li.share {display: none}
ul.secondary { border: none; display: unset; position: static; }
}
}
[data-csrf-token] { // miniflux
--body-background: #000;
--current-item-border-color: #c88aff;
--text-color: #EEE;
@media (prefers-color-scheme: dark) {
--body-background: #000;
--current-item-border-color: #c88aff;
--text-color: #EEE;
--entry-content-color: var(--text-color);
--link-color: var(--text-color);
--title-color: var(--text-color);
--entry-content-color: var(--text-color);
--link-color: var(--text-color);
--title-color: var(--text-color);
}
.logo a span, .logo a:hover { color: var(--current-item-border-color) }
@ -58,32 +70,9 @@ body>nav:nth-child(1):not([class]) {position: absolute} // nitter/libreddit/libr
}
#grease-anchor {
margin-inline-start: 4px;
color: var(--category-link-color);
display: none;
margin-inline-start: 4px;
}
h1, h2, h3, h4, h5, h6 {
&:hover {
#grease-anchor { display: unset }
}
}
}
div#outer.wrapper { //ao3
#admin-banner, #header > nav > ul.primary {display:none}
#bookmark-form fieldset > dl {display:none}
#workskin {zoom: 125%; max-width: 40em;}
p.kudos {overflow-wrap: break-word}
select {background: none }
zoom: 110%;
ul.work {
.download li:not(:nth-child(2)) {display: none}
a.collapsed {display: none}
li.share {display: none}
ul.secondary {
border: none;
display: unset;
position: static;
}
}
h1, h2, h3, h4, h5, h6 { &:hover #grease-anchor {display: unset}}
}

View file

@ -1,96 +1,82 @@
from qutebrowser.api import interceptor
from urllib.parse import urljoin
from PyQt6.QtCore import QUrl
import operator
o = operator.methodcaller
s = 'setHost'
basic = {
'tumblr.com' : 'priviblur.fly.dev',
'www.tumblr.com' : 'priviblur.fly.dev',
def farside(url: QUrl, i) -> bool:
url.setHost('farside.link')
p = url.path().strip('/')
url.setPath(urljoin(i, p))
return True
'avatar.wiki' : 'avatar.antifandom.com',
'portal.wiki' : 'theportalwiki.com',
'tardis.fandom.com' : 'tardis.wiki',
'zelda.fandom.com' : 'zeldawiki.wiki',
def twitter(url: QUrl) -> bool:
return farside(url, '/nitter/')
def imgur(url: QUrl) -> bool:
return farside(url, '/rimgo/')
def medium(url: QUrl) -> bool:
return farside(url, '/scribe/')
def youtube(url: QUrl) -> bool:
return farside(url, '/invidious/')
def reddit(url: QUrl) -> bool:
return farside(url, '/libreddit/')
def instagram(url: QUrl) -> bool:
return farside(url, '/proxigram/')
def translate(url: QUrl) -> bool:
return farside(url, '/simplytranslate/')
def tiktok(url: QUrl) -> bool:
return farside(url, '/proxitok/')
def quora (url: QUrl) -> bool:
return farside(url, '/querte/')
def fandom(url: QUrl) -> bool:
return farside(url, '/breezewiki/')
def genius(url: QUrl) -> bool:
return farside(url, '/dumb/')
def stackoverflow (url: QUrl) -> bool:
return farside(url, '/anonymousoverflow/')
def wikipedia(url: QUrl) -> bool:
return farside(url, '/wikiless/')
def github(url: QUrl) -> bool:
return farside(url, '/gothub/')
'discord.com' : 'canary.discord.com',
'news.ycombinator.com' : 'news.workers.tools',
'www.goodreads.com' : 'bl.vern.cc',
'www.npr.org' : 'text.npr.org',
'www.pixiv.net' : 'pixivfe.exozy.me',
'www.twitch.tv' : 'twineo.exozy.me',
}
farside = {
'music.youtube.com': 'invidious',
'www.youtube.com': 'invidious',
'youtu.be': 'invidious',
'youtube.com': 'invidious',
#twitter = o(s, 'unrollnow.com')
'old.reddit.com': 'redlib',
'reddit.com': 'redlib',
'www.reddit.com': 'redlib',
m = {
"reddit.com": reddit,
"www.reddit.com": reddit,
"old.reddit.com": reddit,
'mobile.twitter.com': 'nitter',
'twitter.com': 'nitter',
'x.com': 'nitter',
"youtu.be": youtube,
"youtube.com": youtube,
"www.youtube.com": youtube,
"music.youtube.com": youtube,
'vm.tiktok.com' : 'proxitok',
'www.tiktok.com' : 'proxitok',
"twitter.com": twitter,
"mobile.twitter.com": twitter,
"x.com": twitter,
'en.wikipedia.org' : 'wikiless',
'genius.com' : 'dumb',
'gothub.com' : 'gothub',
'imgur.com' : 'rimgo',
'medium.com' : 'scribe',
'stackoverflow.com' : 'anonymousoverflow',
'translate.google.com' : 'simplytranslate',
'www.instagram.com': 'proxigram',
'www.quora.com': 'querte',
}
"imgur.com" : imgur,
"medium.com" : medium,
"www.instagram.com": instagram,
"translate.google.com" : translate,
"vm.tiktok.com" : tiktok,
"www.tiktok.com" : tiktok,
"www.quora.com": quora,
"fandom.com": fandom,
"www.fandom.com": fandom,
"genius.com" : genius,
"stackoverflow.com" : stackoverflow,
"en.wikipedia.org" : wikipedia,
"gothub.com" : github,
def dosub(url: QUrl, host, sub):
url.setHost(host)
url.setPath('/' + sub + url.path())
def fandom(url: QUrl, sub):
dosub(url, 'farside.link', 'breezewiki/' + sub)
def tumblr(url: QUrl, sub):
dosub(url, 'priviblur.fly.dev', sub)
"tumblr.com" : o(s, 'priviblur.fly.dev'),
"www.tumblr.com" : o(s, 'priviblur.fly.dev'),
subs = {
'fandom.com' : fandom,
'tumblr.com' : tumblr,
}
"avatar.wiki" : o(s, 'avatar.antifandom.com'),
"tardis.fandom.com" : o(s, 'tardis.wiki'),
"zelda.fandom.com" : o(s, 'zeldawiki.wiki'),
"discord.com" : o(s, 'canary.discord.com'),
"news.ycombinator.com" : o(s, 'news.workers.tools'),
"www.goodreads.com" : o(s, 'bl.vern.cc'),
"www.npr.org" : o(s, 'text.npr.org'),
"www.pixiv.net" : o(s, 'pixivfe.exozy.me'),
"www.twitch.tv" : o(s, 'twineo.exozy.me'),
}
def rewrite(info: interceptor.Request):
if (info.resource_type != interceptor.ResourceType.main_frame or
info.request_url.scheme() in {"data", "blob"}):
return
url = info.request_url
redir = m.get(url.host())
if redir is not None and redir(url) is not False:
host = url.host()
base = '.'.join(host.split('.')[-2:])
bredir = basic.get(host)
fredir = farside.get(host)
sredir = subs.get(base)
if bredir is not None:
url.setHost(bredir)
info.redirect(url)
elif fredir is not None:
url.setHost('farside.link')
url.setPath('/' + fredir + url.path())
info.redirect(url)
elif sredir is not None:
sub = host.split('.')[0]
sredir(url, sub)
info.redirect(url)
interceptor.register(rewrite)

View file

@ -3,4 +3,6 @@ c.confirm_quit = ['downloads']
c.content.fullscreen.window = True
c.content.prefers_reduced_motion = True
c.content.user_stylesheets = ['css/adblock.css', 'css/ao3.css', 'css/laserwave.css', 'css/twitter_dark.css', 'css/user.css']
c.qt.highdpi = True
c.tabs.show = 'multiple'
c.window.hide_decoration = True