This repository has been archived by the owner on Feb 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfig.js
45 lines (43 loc) · 1.75 KB
/
config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
var config = {};
config.host = "http://2cloudapp.appspot.com/";
config.secureHost = "https://2cloudapp.appspot.com/";
config.key = "";
config.secret = "";
config.callback = "callback/";
config.identifier = "Chrome";
config.debug = false;
config.save = function(settings) {
if(typeof settings.host != "undefined")
localStorage['config.host'] = settings.host;
if(typeof settings.secureHost != "undefined")
localStorage['config.secureHost'] = settings.secureHost;
if(typeof settings.key != "undefined")
localStorage['config.key'] = settings.key;
if(typeof settings.secret != "undefined")
localStorage['config.secret'] = settings.secret;
if(typeof settings.callback != "undefined")
localStorage['config.callback'] = settings.callback;
if(typeof settings.identifier != "undefined")
localStorage['config.identifier'] = settings.identifier;
if(typeof settings.debug != "undefined")
localStorage['config.debug'] = settings.debug;
config.load();
}
config.load = function() {
config.host = localStorage['config.host'];
config.secureHost = config.host.replace("http://", "https://");
if(localStorage.getItem('config.host') !== null)
config.secureHost = localStorage['config.secureHost'];
config.key = "anonymous";
config.secret = "anonymous";
config.callback = "callback/";
if(localStorage.getItem('config.key') !== null && localStorage.getItem('config.secret')) {
config.key = localStorage['config.key'];
config.secret = localStorage['config.secret'];
}
if(localStorage.getItem('config.callback') !== null)
config.callback = localStorage['config.callback'];
config.identifier = localStorage['config.identifier'];
if(localStorage.getItem('config.debug') !== null)
config.debug = localStorage['config.debug'];
}