invidious: only allow "known" URLs
This commit is contained in:
parent
0a7dd126e8
commit
7f89a0aaf8
@ -28,6 +28,16 @@ api()
|
|||||||
printf "https://%s%s\n" "$INVIDIOUS" "$*"
|
printf "https://%s%s\n" "$INVIDIOUS" "$*"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
known_site()
|
||||||
|
{
|
||||||
|
printf "%s\n" "$1" | grep -Eq \
|
||||||
|
-e "^https://(www\.)?youtube\.com/" \
|
||||||
|
-e "^https://youtu\.be/" \
|
||||||
|
-e "^https://(www\.)?invidio\.us/" \
|
||||||
|
-e "^https://invidious\.snopyta\.org/" \
|
||||||
|
-e "^https://yewtu\.be/"
|
||||||
|
}
|
||||||
|
|
||||||
: ${INVIDIOUS:=invidious.snopyta.org}
|
: ${INVIDIOUS:=invidious.snopyta.org}
|
||||||
|
|
||||||
torsocks=torsocks
|
torsocks=torsocks
|
||||||
@ -42,8 +52,8 @@ done
|
|||||||
shift $((OPTIND - 1))
|
shift $((OPTIND - 1))
|
||||||
[ $# -eq 1 ] || usage
|
[ $# -eq 1 ] || usage
|
||||||
|
|
||||||
# XXX check URL for known sites
|
|
||||||
url=$1
|
url=$1
|
||||||
|
known_site "$url" || err "Unknown site: $url"
|
||||||
|
|
||||||
oldIFS=$IFS
|
oldIFS=$IFS
|
||||||
IFS="&"
|
IFS="&"
|
||||||
|
Loading…
Reference in New Issue
Block a user