kopia lustrzana https://github.com/backface/turtlestitch
accessing a shared projects requires lowercasing the username - this is now automatically taken care ofpull/3/merge
rodzic
d278b2b150
commit
f541b776ea
16
cloud.js
16
cloud.js
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
/*global modules, IDE_Morph, SnapSerializer, hex_sha512, alert, nop*/
|
/*global modules, IDE_Morph, SnapSerializer, hex_sha512, alert, nop*/
|
||||||
|
|
||||||
modules.cloud = '2013-May-10';
|
modules.cloud = '2013-September-17';
|
||||||
|
|
||||||
// Global stuff
|
// Global stuff
|
||||||
|
|
||||||
|
@ -579,6 +579,18 @@ Cloud.prototype.parseResponse = function (src) {
|
||||||
return ans;
|
return ans;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Cloud.prototype.parseDict = function (src) {
|
||||||
|
var dict = {};
|
||||||
|
if (!src) {return dict; }
|
||||||
|
src.split("&").forEach(function (entry) {
|
||||||
|
var pair = entry.split("="),
|
||||||
|
key = decodeURIComponent(pair[0]),
|
||||||
|
val = decodeURIComponent(pair[1]);
|
||||||
|
dict[key] = val;
|
||||||
|
});
|
||||||
|
return dict;
|
||||||
|
};
|
||||||
|
|
||||||
Cloud.prototype.encodeDict = function (dict) {
|
Cloud.prototype.encodeDict = function (dict) {
|
||||||
var str = '',
|
var str = '',
|
||||||
pair,
|
pair,
|
||||||
|
@ -589,7 +601,7 @@ Cloud.prototype.encodeDict = function (dict) {
|
||||||
pair = encodeURIComponent(key)
|
pair = encodeURIComponent(key)
|
||||||
+ '='
|
+ '='
|
||||||
+ encodeURIComponent(dict[key]);
|
+ encodeURIComponent(dict[key]);
|
||||||
if (pair.length > 0) {
|
if (str.length > 0) {
|
||||||
str += '&';
|
str += '&';
|
||||||
}
|
}
|
||||||
str += pair;
|
str += pair;
|
||||||
|
|
12
gui.js
12
gui.js
|
@ -68,7 +68,7 @@ sb, CommentMorph, CommandBlockMorph*/
|
||||||
|
|
||||||
// Global stuff ////////////////////////////////////////////////////////
|
// Global stuff ////////////////////////////////////////////////////////
|
||||||
|
|
||||||
modules.gui = '2013-September-16';
|
modules.gui = '2013-September-17';
|
||||||
|
|
||||||
// Declarations
|
// Declarations
|
||||||
|
|
||||||
|
@ -298,6 +298,7 @@ IDE_Morph.prototype.openIn = function (world) {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function interpretUrlAnchors() {
|
function interpretUrlAnchors() {
|
||||||
|
var dict;
|
||||||
if (location.hash.substr(0, 6) === '#open:') {
|
if (location.hash.substr(0, 6) === '#open:') {
|
||||||
hash = location.hash.substr(6);
|
hash = location.hash.substr(6);
|
||||||
if (hash.charAt(0) === '%'
|
if (hash.charAt(0) === '%'
|
||||||
|
@ -335,8 +336,13 @@ IDE_Morph.prototype.openIn = function (world) {
|
||||||
this.shield.setExtent(this.parent.extent());
|
this.shield.setExtent(this.parent.extent());
|
||||||
this.parent.add(this.shield);
|
this.parent.add(this.shield);
|
||||||
myself.showMessage('Fetching project\nfrom the cloud...');
|
myself.showMessage('Fetching project\nfrom the cloud...');
|
||||||
|
|
||||||
|
// make sure to lowercase the username
|
||||||
|
dict = SnapCloud.parseDict(location.hash.substr(9));
|
||||||
|
dict.Username = dict.Username.toLowerCase();
|
||||||
|
|
||||||
SnapCloud.getPublicProject(
|
SnapCloud.getPublicProject(
|
||||||
location.hash.substr(9),
|
SnapCloud.encodeDict(dict),
|
||||||
function (projectData) {
|
function (projectData) {
|
||||||
var msg;
|
var msg;
|
||||||
myself.nextSteps([
|
myself.nextSteps([
|
||||||
|
@ -3735,7 +3741,7 @@ IDE_Morph.prototype.setCloudURL = function () {
|
||||||
'https://snapcloud.miosoft.com/miocon/app/' +
|
'https://snapcloud.miosoft.com/miocon/app/' +
|
||||||
'login?_app=SnapCloud',
|
'login?_app=SnapCloud',
|
||||||
'local network lab' :
|
'local network lab' :
|
||||||
'192.168.2.110:8087/miocon/app/login?_app=SnapCloud',
|
'192.168.2.107:8087/miocon/app/login?_app=SnapCloud',
|
||||||
'local network office' :
|
'local network office' :
|
||||||
'192.168.186.167:8087/miocon/app/login?_app=SnapCloud',
|
'192.168.186.167:8087/miocon/app/login?_app=SnapCloud',
|
||||||
'localhost dev' :
|
'localhost dev' :
|
||||||
|
|
|
@ -1905,3 +1905,8 @@ ______
|
||||||
* GUI: prompt() - invocation fixes (null-choices)
|
* GUI: prompt() - invocation fixes (null-choices)
|
||||||
* GUI: synchronous URL fetching simplifications for libraries and example projects
|
* GUI: synchronous URL fetching simplifications for libraries and example projects
|
||||||
* GUI: fixed #115 - prevent loading several instances of the same block definition
|
* GUI: fixed #115 - prevent loading several instances of the same block definition
|
||||||
|
|
||||||
|
130917
|
||||||
|
------
|
||||||
|
* Cloud: encodeDict() fix and new parseDict() method - used for accessing shared projects
|
||||||
|
* GUI: fixed #119, #149 (accessing a shared projects requires lowercasing the username)
|
||||||
|
|
Ładowanie…
Reference in New Issue