;;; ycp-web.el -- My config for web related -*- lexical-binding: t -*- ;; Copyright (C) 2023 Free Software Foundation. ;; Author: Yuchen Pei ;; Package-Requires: ((emacs "28.2")) ;; This file is part of dotfiles. ;; dotfiles is free software: you can redistribute it and/or modify it under ;; the terms of the GNU Affero General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; dotfiles is distributed in the hope that it will be useful, but WITHOUT ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General ;; Public License for more details. ;; You should have received a copy of the GNU Affero General Public ;; License along with dotfiles. If not, see . ;;; Commentary: ;; My config for web related. Covers cookies, web browsing, clients to ;; web services like osm and openlibrary ;;; Code: ;; disable cookies (setq url-cookie-untrusted-urls ".*") (ignore-errors (cancel-timer url-cookie-timer)) (setq shr-cookie-policy nil) (my-package luwak (:delay 10) (:install t) (require 'luwak-org) (require 'my-utils) (setq luwak-url-rewrite-function 'url-rw) (setq luwak-tor-switch t) ) ;;; openlibrary (my-package my-openlibrary (:delay 15)) (my-package osm (:install t) (:delay 30) (require 'my-osm) (my-keybind osm-mode-map "C-" nil "C-" nil "C-" nil "C-" nil "c" #'my-osm-show-center) ) (my-package bom (:delay 30)) (my-package url-rewrite (setq my-nitter-hosts '("nitter.net" "nitter.nixnet.services" "nitter.unixfox.eu" "nitter.mint.lgbt" "nitter.esmailelbob.xyz" "nitter.poast.org" "nitter.cz" "nitter.privacydev.net" "nitter.projectsegfau.lt" "nitter.eu.projectsegfau.lt" "nitter.in.projectsegfau.lt" "nitter.us.projectsegfau.lt" "nitter.soopy.moe" "nitter.rawbit.ninja" "nitter.d420.de" "bird.habedieeh.re" "nitter.x86-64-unknown-linux-gnu.zip" "nitter.woodland.cafe" "nitter.dafriser.be" "nitter.catsarch.com" "nitter.perennialte.ch" "nitter.salastil.com" "n.populas.no" "nt.ggtyler.dev" "nitter.uni-sonia.com" "n.opnxng.com" "nitter.ktachibana.party" "nitter.tinfoil-hat.net")) (setq my-invidious-hosts '("yewtu.be" "invidious.io.lol" "invidious.slipfox.xyz" "invidious.drgns.space" "invidious.protokolla.fi" "invidious.flokinet.to" "iv.ggtyler.dev" "yt.drgnz.club" "invidious.lunar.icu" "invidious.private.coffee" "invidious.fdn.fr" "vid.puffyan.us" "invidious.asir.dev" "onion.tube" "iv.melmac.space" "invidious.projectsegfau.lt" "inv.in.projectsegfau.lt" "invidious.privacydev.net" "iv.datura.network" "inv.tux.pizza" "iv.nboeck.de" "invidious.perennialte.ch" "yt.oelrichsgarcia.de" "inv.citw.lgbt" "inv.zzls.xyz" "invidious.einfachzocken.eu" "yt.cdaut.de" "yt.artemislena.eu" "vid.priv.au" "anontube.lvkaszus.pl" "invidious.no-logs.com")) (setq url-rw-rules '((:name ddg-result :description "duckduckgo result transform." :match (concat url-rw-www-re (rx "duckduckgo.com/l/?uddg=")) :actions ((replace-by-redirect "uddg"))) (:name google-docs-odt :description "Download Google docs document as odt." :match (concat url-rw-www-re (rx "docs.google.com/document/d/")) :actions ((replace-path-regexp "\\(/document/d/.*?\\)/.*" "\\1/export") (put-query "format" "odt"))) (:name google-slides-odp :description "Download Google slides as odp." :match (concat url-rw-www-re (rx "docs.google.com/presentation/d/")) :actions ((replace-path-regexp "\\(/document/d/.*?\\)/.*" "\\1/export") (put-query "format" "odp"))) (:name google-to-ddg :description "Google search to duckduckgo html." :match (concat url-rw-www-re (rx "google.com/search?q=")) :actions ((replace-host "html.duckduckgo.com") (replace-path "/html"))) (:name reddit-to-old :description "Reddit to old Reddit" :match (concat url-rw-www-re (rx "reddit.com")) :actions ((replace-host "old.reddit.com"))) (:name strip-utm :description "Strip utm_* queries." :match "\\" . ,(lambda (url &rest args) (my-open-spectator-au url))) (my-mastodon-url-p . ,(lambda (url &rest args) (mastorg-open url))) (my-hacker-news-url-p . ,(lambda (url &rest args) (hnreader-comment url))) (reddio-reddit-url-p . ,(lambda (url &rest args) (reddio-open-url url))) (my-stack-overflow-url-p . ,(lambda (url &rest args) (sx-open-link url))) (stringp . browse-url-firefox))) ) (my-package my-semantic-scholar (:delay 60)) (my-package rt-liberation (:delay 60) (:install t) (my-setq-from-local rt-liber-username rt-liber-rest-url rt-liber-base-url) (require 'my-rtliber) (my-override rt-liber-viewer-visit-in-browser) ) (my-package rt-liberation-org (:delay 60)) (my-package rt-liberation-gnus (:delay 60) (my-setq-from-local rt-liber-gnus-address rt-liber-gnus-comment-address rt-liber-gnus-subject-name) (require 'my-rtliber) (my-keybind global-map "C-c t m" #'my-rt-liber-my-open-tickets "C-c t M" #'my-rt-liber-my-tickets "C-c t b" #'my-rt-liber-backlog "C-c t i" #'my-rt-liber-get-ticket-by-id "C-c t q" #'my-rt-liber-query-by-subject) ) ;; sx: a stack exchange client (my-package sx (:delay 60) (require 'sx-load)) ;; mastodon.el (add-to-list 'load-path (locate-user-emacs-file "lisp/mastodon.el/lisp")) (my-package mastodon (my-setq-from-local mastodon-active-user mastodon-instance-url) ;; auto fill is a bit glitchy when composing a toot (add-hook 'mastodon-toot-mode-hook (lambda () (turn-off-auto-fill))) (mastodon)) (my-package mastorg (:delay 60)) (add-to-list 'load-path (locate-user-emacs-file "lisp/servall/lisp")) (my-package servall-wikipedia (:delay 60) (require 'servall-ytdl) (my-setq-from-local servall-endpoint) (require 'my-servall) (my-keybind servall-wikipedia-view-mode-map "C-'" 'my-servall-wikipedia-grok) ) (my-package my-libgen (:delay 60) (require 'my-utils) (my-setq-from-local my-libgen-hosts my-libgen-alt-hosts my-libgen-library-hosts my-libgen-onion-host ) (setq my-libgen-download-dir my-document-incoming-dir my-libfic-download-dir my-document-incoming-dir) (my-libgen-set-random-hosts)) (my-package my-scihub (:delay 60) (my-setq-from-local my-scihub-host)) (my-package w3m (:delay 60) (my-keybind w3m-mode-map "o" #'w3m-browse-url "n" #'scroll-up-line "p" #'scroll-down-line "w" #'w3m-print-this-url "l" #'w3m-view-previous-page "r" #'w3m-view-next-page "g" #'w3m-reload-this-page ) (require 'w3m-load)) (my-package exitter (:delay 60) (my-setq-from-local exitter-oauth-consumer-key exitter-oauth-consumer-secret exitter-access-token exitter-username exitter-password exitter-email exitter-oauth-token exitter-oauth-token-secret exitter-oauth-token-ctime) (setq exitter-debug t) ) (provide 'ycp-web)