Diffstat (limited to 'frontend/delta/js/Clipperz/PM/Proxy') (more/less context) (ignore whitespace changes)
-rwxr-xr-x | frontend/delta/js/Clipperz/PM/Proxy/Proxy.JSON.js | 4 | ||||
-rw-r--r-- | frontend/delta/js/Clipperz/PM/Proxy/Proxy.Offline.LocalStorageDataStore.js | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/frontend/delta/js/Clipperz/PM/Proxy/Proxy.JSON.js b/frontend/delta/js/Clipperz/PM/Proxy/Proxy.JSON.js index 1638d99..6deee3d 100755 --- a/frontend/delta/js/Clipperz/PM/Proxy/Proxy.JSON.js +++ b/frontend/delta/js/Clipperz/PM/Proxy/Proxy.JSON.js | |||
@@ -12,75 +12,75 @@ refer to http://www.clipperz.com. | |||
12 | (at your option) any later version. | 12 | (at your option) any later version. |
13 | 13 | ||
14 | * Clipperz is distributed in the hope that it will be useful, but | 14 | * Clipperz is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
18 | 18 | ||
19 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
21 | 21 | ||
22 | */ | 22 | */ |
23 | 23 | ||
24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
26 | 26 | ||
27 | //============================================================================= | 27 | //============================================================================= |
28 | 28 | ||
29 | Clipperz.PM.Proxy.JSON = function(args) { | 29 | Clipperz.PM.Proxy.JSON = function(args) { |
30 | Clipperz.PM.Proxy.JSON.superclass.constructor.call(this, args); | 30 | Clipperz.PM.Proxy.JSON.superclass.constructor.call(this, args); |
31 | 31 | ||
32 | this._url = args.url || Clipperz.Base.exception.raise('MandatoryParameter'); | 32 | this._url = args.url || Clipperz.Base.exception.raise('MandatoryParameter'); |
33 | 33 | ||
34 | return this; | 34 | return this; |
35 | } | 35 | } |
36 | 36 | ||
37 | Clipperz.Base.extend(Clipperz.PM.Proxy.JSON, Clipperz.PM.Proxy, { | 37 | Clipperz.Base.extend(Clipperz.PM.Proxy.JSON, Clipperz.PM.Proxy, { |
38 | 38 | ||
39 | 'toString': function() { | 39 | 'toString': function() { |
40 | return "Clipperz.PM.Proxy.JSON"; | 40 | return "Clipperz.PM.Proxy.JSON"; |
41 | }, | 41 | }, |
42 | 42 | ||
43 | //========================================================================= | 43 | //========================================================================= |
44 | 44 | ||
45 | 'url': function () { | 45 | 'url': function () { |
46 | return this._url; | 46 | return this._url; |
47 | }, | 47 | }, |
48 | 48 | ||
49 | //========================================================================= | 49 | //========================================================================= |
50 | 50 | ||
51 | '_sendMessage': function(aFunctionName, aVersion, someParameters) { | 51 | '_sendMessage': function(aFunctionName, aVersion, someParameters) { |
52 | vardeferredResult; | 52 | vardeferredResult; |
53 | var parameters; | 53 | var parameters; |
54 | 54 | ||
55 | parameters = { | 55 | parameters = { |
56 | method: aFunctionName, | 56 | method: aFunctionName, |
57 | version: aVersion, | 57 | version: aVersion, |
58 | parameters: Clipperz.Base.serializeJSON(someParameters) | 58 | parameters: Clipperz.Base.serializeJSON(someParameters) |
59 | }; | 59 | }; |
60 | 60 | console.log("PROXY.JSON._sendMessage", parameters); | |
61 | deferredResult = new Clipperz.Async.Deferred("Proxy.JSON.sendMessage", {trace:false}); | 61 | deferredResult = new Clipperz.Async.Deferred("Proxy.JSON._sendMessage", {trace:false}); |
62 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'remoteRequestSent'); | 62 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'remoteRequestSent'); |
63 | deferredResult.addCallback(MochiKit.Async.doXHR, this.url(), { | 63 | deferredResult.addCallback(MochiKit.Async.doXHR, this.url(), { |
64 | method:'POST', | 64 | method:'POST', |
65 | sendContent:MochiKit.Base.queryString(parameters), | 65 | sendContent:MochiKit.Base.queryString(parameters), |
66 | headers:{"Content-Type":"application/x-www-form-urlencoded"} | 66 | headers:{"Content-Type":"application/x-www-form-urlencoded"} |
67 | }); | 67 | }); |
68 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'remoteRequestReceived'); | 68 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'remoteRequestReceived'); |
69 | deferredResult.addCallback(MochiKit.Base.itemgetter('responseText')); | 69 | deferredResult.addCallback(MochiKit.Base.itemgetter('responseText')); |
70 | deferredResult.addCallback(Clipperz.Base.evalJSON); | 70 | deferredResult.addCallback(Clipperz.Base.evalJSON); |
71 | deferredResult.addCallback(function (someValues) { | 71 | deferredResult.addCallback(function (someValues) { |
72 | if (someValues['result'] == 'EXCEPTION') { | 72 | if (someValues['result'] == 'EXCEPTION') { |
73 | throw someValues['message']; | 73 | throw someValues['message']; |
74 | } | 74 | } |
75 | 75 | ||
76 | return someValues; | 76 | return someValues; |
77 | }) | 77 | }) |
78 | deferredResult.callback(); | 78 | deferredResult.callback(); |
79 | 79 | ||
80 | return deferredResult; | 80 | return deferredResult; |
81 | }, | 81 | }, |
82 | 82 | ||
83 | //========================================================================= | 83 | //========================================================================= |
84 | __syntaxFix__: "syntax fix" | 84 | __syntaxFix__: "syntax fix" |
85 | 85 | ||
86 | }); | 86 | }); |
diff --git a/frontend/delta/js/Clipperz/PM/Proxy/Proxy.Offline.LocalStorageDataStore.js b/frontend/delta/js/Clipperz/PM/Proxy/Proxy.Offline.LocalStorageDataStore.js index a3c238c..3f16f70 100644 --- a/frontend/delta/js/Clipperz/PM/Proxy/Proxy.Offline.LocalStorageDataStore.js +++ b/frontend/delta/js/Clipperz/PM/Proxy/Proxy.Offline.LocalStorageDataStore.js | |||
@@ -1,81 +1,83 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2013 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz, the online password manager. | 5 | This file is part of Clipperz, the online password manager. |
6 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
7 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
8 | 8 | ||
9 | * Clipperz is free software: you can redistribute it and/or modify it | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
10 | under the terms of the GNU Affero General Public License as published | 10 | under the terms of the GNU Affero General Public License as published |
11 | by the Free Software Foundation, either version 3 of the License, or | 11 | by the Free Software Foundation, either version 3 of the License, or |
12 | (at your option) any later version. | 12 | (at your option) any later version. |
13 | 13 | ||
14 | * Clipperz is distributed in the hope that it will be useful, but | 14 | * Clipperz is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
18 | 18 | ||
19 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
21 | 21 | ||
22 | */ | 22 | */ |
23 | 23 | ||
24 | try { if (typeof(Clipperz.PM.Proxy.Offline.DataStore) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.PM.Proxy.Offline.DataStore) == 'undefined') { throw ""; }} catch (e) { |
25 | throw "Clipperz.PM.Proxy.Offline.LocalStorageDataStore depends on Clipperz.PM.Proxy.Offline.DataStore!"; | 25 | throw "Clipperz.PM.Proxy.Offline.LocalStorageDataStore depends on Clipperz.PM.Proxy.Offline.DataStore!"; |
26 | } | 26 | } |
27 | 27 | ||
28 | //============================================================================= | 28 | //============================================================================= |
29 | 29 | ||
30 | Clipperz.PM.Proxy.Offline.LocalStorageDataStore = function(args) { | 30 | Clipperz.PM.Proxy.Offline.LocalStorageDataStore = function(args) { |
31 | args = args || {}; | 31 | args = args || {}; |
32 | 32 | ||
33 | this._data = args.data || (typeof(_clipperz_dump_data_) != 'undefined' ? _clipperz_dump_data_ : null); | 33 | //this._data = args.data || (typeof(_clipperz_dump_data_) != 'undefined' ? _clipperz_dump_data_ : null); |
34 | this._data = JSON.parse(localStorage.getItem('clipperz_dump_data')); | ||
35 | |||
34 | this._isReadOnly = (typeof(args.readOnly) == 'undefined' ? true : args.readOnly); | 36 | this._isReadOnly = (typeof(args.readOnly) == 'undefined' ? true : args.readOnly); |
35 | this._shouldPayTolls = args.shouldPayTolls || false; | 37 | this._shouldPayTolls = args.shouldPayTolls || false; |
36 | 38 | ||
37 | this._tolls = {}; | 39 | this._tolls = {}; |
38 | this._currentStaticConnection = null; | 40 | this._currentStaticConnection = null; |
39 | 41 | ||
40 | //Clipperz.PM.Proxy.Offline.LocalStorageDataStore.superclass.constructor.apply(this, arguments); | 42 | //Clipperz.PM.Proxy.Offline.LocalStorageDataStore.superclass.constructor.apply(this, arguments); |
41 | 43 | ||
42 | return this; | 44 | return this; |
43 | } | 45 | } |
44 | 46 | ||
45 | Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.LocalStorageDataStore, Clipperz.PM.Proxy.Offline.DataStore, { | 47 | Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.LocalStorageDataStore, Clipperz.PM.Proxy.Offline.DataStore, { |
46 | 48 | ||
47 | //========================================================================= | 49 | //========================================================================= |
48 | 50 | ||
49 | '_knock': function(aConnection, someParameters) { | 51 | '_knock': function(aConnection, someParameters) { |
50 | var result; | 52 | var result; |
51 | 53 | ||
52 | result = { | 54 | result = { |
53 | toll: this.getTollForRequestType(someParameters['requestType']) | 55 | toll: this.getTollForRequestType(someParameters['requestType']) |
54 | } | 56 | } |
55 | 57 | ||
56 | return result; | 58 | return result; |
57 | }, | 59 | }, |
58 | 60 | ||
59 | //------------------------------------------------------------------------- | 61 | //------------------------------------------------------------------------- |
60 | 62 | ||
61 | '_registration': function(aConnection, someParameters) { | 63 | '_registration': function(aConnection, someParameters) { |
62 | throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly; | 64 | throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly; |
63 | }, | 65 | }, |
64 | 66 | ||
65 | //------------------------------------------------------------------------- | 67 | //------------------------------------------------------------------------- |
66 | 68 | ||
67 | '_handshake': function(aConnection, someParameters) { | 69 | '_handshake': function(aConnection, someParameters) { |
68 | var result; | 70 | var result; |
69 | varnextTollRequestType; | 71 | varnextTollRequestType; |
70 | 72 | ||
71 | result = {}; | 73 | result = {}; |
72 | if (someParameters.message == "connect") { | 74 | if (someParameters.message == "connect") { |
73 | var userData; | 75 | var userData; |
74 | var randomBytes; | 76 | var randomBytes; |
75 | var v; | 77 | var v; |
76 | 78 | ||
77 | userData = this.data()['users'][someParameters.parameters.C]; | 79 | userData = this.data()['users'][someParameters.parameters.C]; |
78 | 80 | ||
79 | if ((typeof(userData) != 'undefined') && (userData['version'] == someParameters.version)) { | 81 | if ((typeof(userData) != 'undefined') && (userData['version'] == someParameters.version)) { |
80 | aConnection['userData'] = userData; | 82 | aConnection['userData'] = userData; |
81 | aConnection['C'] = someParameters.parameters.C; | 83 | aConnection['C'] = someParameters.parameters.C; |