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