Created
June 4, 2013 21:10
-
-
Save phuongdh/5709633 to your computer and use it in GitHub Desktop.
avalon_pilot.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while read uri; do | |
saveIFS=$IFS | |
IFS='=&' | |
parm=($uri) | |
IFS=$saveIFS | |
raw=`curl -s "http://palm.dlib.indiana.edu/authorize.txt?token=${parm[1]}"` | |
resp="${raw//[[:space:]]/}" | |
valid=`echo ${parm[1]} | grep ^${resp}` | |
if [ -n "${valid}" ] && [ -n "${resp}" ]; then | |
echo $uri | |
else | |
echo '/avalon_pilot/forbidden' | |
fi | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule mod_disk_cache.c> | |
CacheEnable disk /avalon_pilot | |
</IfModule> | |
RewriteEngine on | |
RewriteLock /tmp/avalon_pilot_rewrite_lock | |
RewriteMap avalon_pilot_auth prg:/srv/adobe/ams/Apache2.2/bin/avalon_pilot_auth | |
RewriteCond %{QUERY_STRING} audio-only=true | |
RewriteCond %{QUERY_STRING} codec=aac | |
RewriteCond %{QUERY_STRING} token=([^&]+) | |
RewriteRule ^/avalon_pilot/(.+).m3u8$ /avalon_pilot/audio-only-aac/$1.m3u8?token=%1 [R=301,L] | |
RewriteCond %{QUERY_STRING} audio-only=true | |
RewriteCond %{QUERY_STRING} token=([^&]+) | |
RewriteRule ^/avalon_pilot/(.+).m3u8$ /avalon_pilot/audio-only/$1.m3u8?token=%1 [R=301,L] | |
RewriteCond %{QUERY_STRING} token=([^&]+) | |
RewriteRule ^/avalon_pilot ${avalon_pilot_auth:%{REQUEST_URI}?token=%1} | |
RewriteCond %{REQUEST_URI} !(.+).ts$ | |
RewriteCond %{QUERY_STRING} !token= | |
RewriteRule ^/avalon_pilot - [F] | |
RewriteRule ^/avalon_pilot/forbidden - [F] | |
<Location /avalon_pilot> | |
HLSHttpStreamingEnabled true | |
HLSMediaFileDuration 2000 | |
HttpStreamingContentPath "../webroot/avalon_pilot" | |
HLSFmsDirPath ".." | |
HLSJITConfAllowed true | |
HLSM3U8MaxAge 86400 | |
HLSTSSegmentMaxAge 86400 | |
HLSMetaMaxAge 3600 | |
Options -Indexes FollowSymLinks | |
</Location> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment