From 450ef82d9b1620cf8b0ad1bdcb97aa3336560f19 Mon Sep 17 00:00:00 2001 From: tastytea Date: Tue, 26 Apr 2022 17:53:18 +0200 Subject: [PATCH] Add support for paste.centos.org to readwwwlog --- .config/zsh/functions/readwwwlog | 9 +++++---- .local/bin/urlhandler | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.config/zsh/functions/readwwwlog b/.config/zsh/functions/readwwwlog index 171933a..b5ed24c 100755 --- a/.config/zsh/functions/readwwwlog +++ b/.config/zsh/functions/readwwwlog @@ -21,20 +21,21 @@ local default_cmd="firefox" local termopts="" for url in ${urls}; do + local id=${url##*/} # Most paste services have the ID as the last element + if [[ ${url} =~ 'dpaste\.com' && ! ${url[-4,-1]} == ".txt" ]]; then url+=".txt" elif [[ ${url} =~ 'pastebin\.com' && ! ${url} =~ '/raw/' ]]; then - local id=${url##*/} url="https://pastebin.com/raw/${id}" elif [[ ${url} =~ 'irccloud\.com' && ! ${url} =~ '/raw/' ]]; then - local id=${${(@s:/:)url}[4]} + id=${${(@s:/:)url}[4]} url="https://www.irccloud.com/pastebin/raw/${id}" elif [[ ${url} =~ 'bpa\.st' && ! ${url} =~ '/download-archive/' ]]; then - local id=${url##*/} url="https://bpa.st/download-archive/${id}" elif [[ ${url} =~ 'paste\.debian\.net' && ! ${url} =~ '/plain/' ]]; then - local id=${url##*/} url="https://paste.debian.net/plain/${id}" + elif [[ ${url} =~ 'paste\.centos\.org' && ! ${url} =~ '/raw/' ]]; then + url="https://paste.centos.org/view/raw/${id}" fi if [[ ${TERMINAL} =~ "alacritty|xfce4-terminal" ]]; then diff --git a/.local/bin/urlhandler b/.local/bin/urlhandler index 2c70ebe..53c3650 100755 --- a/.local/bin/urlhandler +++ b/.local/bin/urlhandler @@ -32,6 +32,7 @@ local -A assignments=( '^https?://bpa\.st/' "readwwwlog" '^https?://sprunge\.us/' "readwwwlog" '^https?://paste\.debian\.net/' "readwwwlog" + '^https://paste\.centos\.org/' "readwwwlog" '\.(webm|png|jpe?g|gif|svg|bmp|xcf)(\?.+)?$' "openwwwimg" '(^magnet:|\.torrent$)' "transmission-remote-gtk" )