Implement Extensions #5
@ -1,17 +1,33 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Determining MIME type of $1:"
|
||||
echo "Loading extensions..."
|
||||
|
||||
MIME=$(curl -I -s "$1" | sed -n -e 's/^[cC]ontent-[tT]ype: //p' | sed -e 's/;.\+//g' | tr -d '\r')
|
||||
INPUT=$(echo $1)
|
||||
|
||||
for EXT in xdg-sanity/extensions/*.sh
|
||||
do
|
||||
echo "Found extension $EXT"
|
||||
TYPE=$(cat $EXT | sed -ne 's/^# EXT-TYPE=//p' | tr -d '\n')
|
||||
echo "Modifying $INPUT..."
|
||||
if [ "$TYPE" = "pre" ]
|
||||
then
|
||||
MOD=$($EXT "$INPUT")
|
||||
INPUT=$(echo $MOD)
|
||||
fi
|
||||
echo "Got $INPUT"
|
||||
done
|
||||
|
||||
echo "Determining MIME type of $INPUT:"
|
||||
|
||||
MIME=$(curl -I -s "$INPUT" | sed -ne 's/^[cC]ontent-[tT]ype: //p' | sed -e 's/;.\+//g' | tr -d '\r')
|
||||
|
||||
echo $MIME
|
||||
|
||||
BROWSER=$(cat /etc/xdg-sanity.conf | sed -n -e 's/^browser = //p' )
|
||||
BROWSER=$(cat /etc/xdg-sanity.conf | sed -ne 's/^browser = //p' )
|
||||
|
||||
if [ "$MIME" = "text/html" ]
|
||||
then
|
||||
$BROWSER $1
|
||||
|
||||
$BROWSER $INPUT
|
||||
else
|
||||
handlr launch "$MIME" -- "$1"
|
||||
handlr launch "$MIME" -- "$INPUT"
|
||||
fi
|
5
xdg-sanity/extensions/youtube-replace.sample
Executable file
5
xdg-sanity/extensions/youtube-replace.sample
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
# EXT-TYPE=pre
|
||||
|
||||
echo $1 | sed -ne 's/youtube.com/piped.mint.lgbt/p'
|
Loading…
Reference in New Issue
Block a user