Show hint on Razer Forge TV account registration
[stouyapi.git] / www / .htaccess
index 0396ea87977ed645fca16d9ea90956b23fd6c65b..7469bae162be2d600b989957a8e54569537b406f 100644 (file)
@@ -1,14 +1,89 @@
+#no iso-2022-cn charset for "com.cis.ouya.oth.htm"
+#"RemoveCharset" does not work, so we have to override with AddCharset
+AddCharset UTF-8 .iso2022-cn .cis
+#Fix game/art.var.pgo.htm
+AddHandler default-handler .var
+
+DirectorySlash Off
+
 RewriteEngine on
+RewriteBase /
+
+<Files "firmware_builds">
+    ExpiresActive On
+    ExpiresDefault "access plus 1 day"
+</Files>
 
 #rewrite details GET parameter
 RewriteCond %{QUERY_STRING} ^app=([^&]+)
-RewriteRule ^api/v1/details /api/v1/details-data/%1.json?
+RewriteCond %{DOCUMENT_ROOT}/api/v1/details-data/%1.json -f
+RewriteRule ^api/v1/details /api/v1/details-data/%1.json? [END]
+
+# details for unknown apps. Also see .htaccess in the dummy dir
+RewriteRule ^api/v1/details /api/v1/details-dummy/404? [END]
 
 RewriteRule ^api/v1/apps/(.*)/download$ /api/v1/apps/$1-download.json? [END]
 RewriteRule ^api/v1/apps/(.*)$ /api/v1/apps/$1.json? [END]
 
+#rewrite developer products "only" GET parameter
+RewriteCond %{QUERY_STRING} &only=([^&]+)
+RewriteCond %{DOCUMENT_ROOT}/api/v1/developers/$1/products/%1.json -f
+RewriteRule ^api/v1/developers/(.+)/products/ /api/v1/developers/$1/products/%1.json? [END]
+
 RewriteRule ^api/v1/discover/?$ /api/v1/discover-data/discover.json [END]
 RewriteRule ^api/v1/discover/(.+)$ /api/v1/discover-data/$1.json [END]
 
+#if directoryslash is on, gamers gets redirected to gamers/ (dir index)
+# the ouya registration does not support redirects there
+#TODO: Use that only for the api/v1/gamers path, not for all
+ErrorDocument 400 /api/v1/gamers/register-error.json
+RewriteRule ^api/v1/gamers$ /api/v1/gamers/register-error.json [R=400,END]
+RewriteRule ^api/razer/gamer$ /api/v1/gamers/register-error.json [R=400,END]
+
+#prevent redirect from gamers/me to gamers/me/
+<Files "me">
+    DirectorySlash Off
+</Files>
+
+#Disable the next three lines to have static usernames only
+RewriteRule ^api/razer/session$ /api/razer/session.php [END]
+RewriteRule ^api/v1/gamers/me$ /api/v1/gamers/me.php [END]
+RewriteRule ^api/v1/sessions$ /api/v1/sessions.php [END]
+
+RewriteRule ^api/v1/gamers/me$ /api/v1/gamers/me.json [END]
+
+#partner builds
+RewriteCond %{HTTP_USER_AGENT} "razer/pearlyn/pearlyn"
+RewriteRule ^api/v1/partner_builds$ /api/v1/partner_builds.razer-forge-tv.json [END]
+
+RewriteRule ^api/v1/partner_builds$ /api/v1/partner_builds.json [END]
+
+#purchased games/products
+# active buy requests
+RewriteCond %{REQUEST_METHOD} POST
+RewriteRule ^api/v1/games/(.+)/purchases?$ /api/v1/games/purchase.php [END]
+
+RewriteCond %{REQUEST_FILENAME} !-f
+RewriteRule ^api/v1/games/(.+)/purchases?$ /api/v1/games/purchases-empty.json [END]
+
+#search
+# q is first parameter
+RewriteCond %{QUERY_STRING} ^q=([^&]+)
+RewriteCond %{DOCUMENT_ROOT}/api/v1/search-data/%1.json -f
+RewriteRule ^api/v1/search /api/v1/search-data/%1.json? [END]
+# q is not the first parameter
+RewriteCond %{QUERY_STRING} &q=([^&]+)
+RewriteCond %{DOCUMENT_ROOT}/api/v1/search-data/%1.json -f
+RewriteRule ^api/v1/search /api/v1/search-data/%1.json? [END]
+
+# for http://clients3.google.com/generate_204
+RewriteRule ^generate_204$ /api/v1/status
+
 #this one wants a 204 status code
 RewriteRule ^api/v1/status$ - [R=204,L]
+
+#push-to-my-ouya needs php scripting support
+RewriteRule ^api/v1/queued_downloads?$ /api/v1/queued_downloads.php [END]
+
+RewriteCond %{REQUEST_METHOD} DELETE
+RewriteRule ^api/v1/queued_downloads/(.+)?$ /api/v1/queued_downloads_delete.php?game=$1 [END]