Skip to content

Commit be02546

Browse files
author
Tim Mickel
committed
Merge pull request scratchfoundation#81 from tmickel/killproxy
Remove proxy
2 parents 385046d + 5b79ac6 commit be02546

File tree

5 files changed

+4
-97
lines changed

5 files changed

+4
-97
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ Thank you for your interest in helping out with the Scratch HTML5 Player. [@scl
1919

2020
## Installation
2121

22-
Running the HTML5 player on your own website, or locally, you will need to have
23-
PHP so that the `proxy.php` file can be used to load assets from the same domain. This is done to be compatible with Javascript security models in today's browsers. To test the HTML5 player against the Flash player you can use the compare.html web page.
22+
Special headers are sent on the Scratch asset servers to allow for cross-origin image manipulation. A proxy is no longer needed provided you are using projects hosted on the Scratch website. This is compatible with Javascript security models in today's browsers. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image) for more information. To test the HTML5 player against the Flash player you can use the compare.html web page.
2423

2524
See the file `TESTING.md` for more details.
2625

TESTING.md

Lines changed: 2 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,3 @@
1-
Running the HTML5 player on your own website, or locally, you will need to have
2-
PHP so that the `proxy.php` file can be used to load assets from the same domain. This is done to be compatible with Javascript security models in today's browsers. To test the HTML5 player against the Flash player you can use the compare.html web page.
1+
To set up the player for testing and development, simply download the source and open [index.html](https://github.com/LLK/scratch-html5/blob/master/index.html) in a recent web browser (Chrome, Firefox, Safari and other Webkit/Gecko-based browsers work best). You can also compare performance and features to the production Flash player by opening [compare.html](https://github.com/LLK/scratch-html5/blob/master/compare.html).
32

4-
# Ubuntu
5-
6-
If you're using Ubuntu, you can follow the following steps to set up the proxy correctly. You'll need to type the following commands in Terminal.
7-
8-
Install PHP and Apache for running the proxy file:
9-
10-
$ sudo apt-get install apache2 php5
11-
12-
Fork this repository on Github, and then clone it into your home folder somewhere (replacing `<username>` with your Github username):
13-
14-
$ git clone https://github.com/<username>/scratch-html5
15-
16-
We'd like to add a new localhost domain, so that we can access the player from our web browser. Something like `scratch.localhost`. Run this command to edit the `/etc/hosts` file:
17-
18-
$ sudo nano /etc/hosts
19-
20-
Add the following line:
21-
22-
127.0.0.1 scratch.localhost
23-
24-
Use <key>Ctrl-O</key>, <key>Return</key>, <key>Ctrl-X</key> to quit.
25-
26-
Now we want to add a new Apache configuration for the new domain. Run the following:
27-
28-
$ cd /etc/apache2/sites-available/
29-
$ sudo nano scratch
30-
31-
And type in the following, replacing `user` with your username, and making sure the `DocumentRoot` matches where you cloned the repository earlier:
32-
33-
<VirtualHost *:80>
34-
ServerName scratch.localhost
35-
DocumentRoot /home/user/scratch-html5
36-
</VirtualHost>
37-
38-
Finally, run the following commands to enable the site:
39-
40-
$ sudo a2ensite scratch
41-
$ sudo service apache2 reload
42-
43-
Now when you go to <http://scratch.localhost/>, the project should play. If you get a "Forbidden" error message, you may need to check the permissions of the folders that the player code is in.
44-
45-
Now you can go fix bugs in the HTML5 player!
3+
The Scratch HTML5 player is no longer dependent on a local proxy.

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<link rel=stylesheet href=player.css>
1111
<link rel=stylesheet href=index.css>
1212

13-
<script src=//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js></script>
13+
<script src=http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js></script>
1414

1515

1616
<script type="text/javascript">

js/IO.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@
2424

2525
var IO = function() {
2626
this.data = null;
27-
// In production, simply use the local path (no proxy)
28-
// since we won't be hampered by the same-origin policy.
29-
this.base = 'proxy.php?resource=internalapi/';
30-
//this.base = 'http://scratch.mit.edu/internalapi/'; // Final base
3127
this.project_base = 'http://projects.scratch.mit.edu/internalapi/project/';
3228
this.project_suffix = '/get/';
3329
this.asset_base = 'http://cdn.scratch.mit.edu/internalapi/asset/';

proxy.php

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)