From 993d10aaad341372ba0fe536c4a5634e00c1e47f Mon Sep 17 00:00:00 2001
From: Nathan Dinsmore <nfdins@gmail.com>
Date: Mon, 5 May 2014 08:20:09 -0400
Subject: [PATCH] Fixed subdomains

---
 js/IO.js  | 4 ++--
 proxy.php | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/js/IO.js b/js/IO.js
index 26ef3c6..ddf561d 100644
--- a/js/IO.js
+++ b/js/IO.js
@@ -28,9 +28,9 @@ var IO = function() {
     // since we won't be hampered by the same-origin policy.
     this.base = 'proxy.php?resource=internalapi/';
     //this.base = 'http://scratch.mit.edu/internalapi/'; // Final base
-    this.project_base = this.base + 'project/';
+    this.project_base = 'proxy.php?domain=projects.scratch.mit.edu&resource=internalapi/project/';
     this.project_suffix = '/get/';
-    this.asset_base = this.base + 'asset/';
+    this.asset_base = 'proxy.php?domain=cdn.scratch.mit.edu&resource=internalapi/asset/';
     this.asset_suffix = '/get/';
     this.soundbank_base = 'soundbank/';
     this.spriteLayerCount = 0;
diff --git a/proxy.php b/proxy.php
index 7c541c4..cdbc420 100644
--- a/proxy.php
+++ b/proxy.php
@@ -6,7 +6,7 @@
 * proxy.php should be removed from the server.
 */
 
-$resource = 'http://scratch.mit.edu/' . $_GET['resource'];
+$resource = 'http://' . (isset($_GET['domain']) ? $_GET['domain'] : 'scratch.mit.edu') . '/' . $_GET['resource'];
 
 // Strip the /get/ suffix for calculating the extension
 // and then get the file extension to pass on to the browser.