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\"" a $i "qutebrowser / \":open $i\""
end end
for i in deemix encodec git-sim lightnovel-crawler mandown mangadex-downloader\ for i in bandcamp-downloader deemix encodec git-sim lightnovel-crawler mandown\
mathicsscript pdf2docx portablemc ratarmount scdl soundscrape spleeter mangadex-downloader mathicsscript pdf2docx portablemc ratarmount scdl spleeter
a $i "pipx run $i" a $i "pipx run $i"
end end
a in2csv 'pipx run --spec csvkit in2csv' a in2csv 'pipx run --spec csvkit in2csv'

View file

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

View file

@ -10,6 +10,7 @@ close_on_child_death yes
initial_window_width 80c initial_window_width 80c
initial_window_height 24c initial_window_height 24c
allow_remote_control yes allow_remote_control yes
hide_window_decorations yes
map shift+page_up scroll_page_up map shift+page_up scroll_page_up
map shift+page_down scroll_page_down 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', 'E': 'config-cycle -p content.javascript.enabled ;; reload',
's1': 'download-open', 's1': 'download-open',
'sa': 'open -t archive.is/submit/?url={url}', 'sa': 'open -t archive.is/submit/?url={url}',
'sb': 'spawn -u priviblur', 'pb': 'spawn -u priviblur',
'sc': 'toggle-dark', 'sc': 'toggle-dark',
'sd': "spawn fish -c 'dl; open (ls -a | rofi -dmenu -b -i || exit 0)'", 'sd': "spawn fish -c 'dl; open (ls -a | rofi -dmenu -b -i || exit 0)'",
'sg': 'debug-dump-page ~/Downloads/dump.html', 'sg': 'debug-dump-page ~/Downloads/dump.html',

View file

@ -1,8 +1,14 @@
import platform
config.load_autoconfig(False) config.load_autoconfig(False)
config.source('adblock.py') config.source('adblock.py')
config.source('bindings.py') config.source('bindings.py')
config.source('redirects.py')
config.source('search.py') config.source('search.py')
config.source('sites.py')
config.source('theme.py') config.source('theme.py')
config.source('ui.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 #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} [action="comment"] {display:none}
zoom: 120%;
} }
#app-mount { //discord #app-mount { //discord
@ -12,43 +12,55 @@
--background-secondary-alt: var(--background-primary); --background-secondary-alt: var(--background-primary);
--channeltextarea-background: var(--background-primary); --channeltextarea-background: var(--background-primary);
font-family: "Ubuntu Mono";
$aria: gift, Help, Inbox; $aria: gift, Help, Inbox;
@each $i in $aria {[aria-label$="#{$i}"] {display: none}} @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 } [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; } .docs-gm > #sheets-viewport > div { display: unset !important; }
// .bridge-card { form, h5 {display:revert} .showmore {display:none} } // show rss-bridges .doc-content {max-width: 666pt !important; margin: auto} // better docs mobile
#years-table { .detail-view-container { display: flex } td { background-image: unset } } //quatalog detailed view body>nav:nth-child(1), .docs-ml-header {position: absolute} // lock sticky navbars
ul.js-show-external { display: unset } // show annas external 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 */ /* hide ads */
$class: ad-frame-container, ad-panel, ad-slot, adsbygoogle, adbox, adunit, $class: -frame-container, -panel, -slot, sbygoogle, box, unit, unit-wrapper;
adunit-wrapper, b_ad, leaderboard, "pure-u-lg-1-5:nth-child(3)", verified-icon; $id: ads, leaderboard, player-ads, rc-row-container;
@each $i in $class {.#{$i} {display:none}}
$div: 'class*=-ad-container', 'class*=ad-wrapper', 'id*=_ad_native', $div: 'class*=-ad-container', 'class*=ad-wrapper', 'id*=_ad_native',
'id^=div-gpt-ad', 'id^=google_ads_', 'id^=netboard_', 'id^=skyscraper'; '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}} @each $i in $div {div[#{$i}] {display:none}}
$id: ads, leaderboard, player-ads, rc-row-container;
@each $i in $id {##{$i} {display:none}} @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 [data-csrf-token] { // miniflux
--body-background: #000; @media (prefers-color-scheme: dark) {
--current-item-border-color: #c88aff; --body-background: #000;
--text-color: #EEE; --current-item-border-color: #c88aff;
--text-color: #EEE;
--entry-content-color: var(--text-color); --entry-content-color: var(--text-color);
--link-color: var(--text-color); --link-color: var(--text-color);
--title-color: var(--text-color); --title-color: var(--text-color);
}
.logo a span, .logo a:hover { color: var(--current-item-border-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 { #grease-anchor {
margin-inline-start: 4px;
color: var(--category-link-color); color: var(--category-link-color);
display: none; display: none;
margin-inline-start: 4px;
} }
h1, h2, h3, h4, h5, h6 { h1, h2, h3, h4, h5, h6 { &:hover #grease-anchor {display: unset}}
&: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;
}
}
} }

View file

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

View file

@ -3,4 +3,6 @@ c.confirm_quit = ['downloads']
c.content.fullscreen.window = True c.content.fullscreen.window = True
c.content.prefers_reduced_motion = 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.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.tabs.show = 'multiple'
c.window.hide_decoration = True