Skip to content

Commit 2e953b4

Browse files
committed
make cloud storage support optional
(currently not supported on FF-webext and MS Edge)
1 parent fff8e71 commit 2e953b4

4 files changed

Lines changed: 25 additions & 13 deletions

File tree

src/css/dashboard-common.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ div > p:last-child {
3737
input[type="number"] {
3838
width: 5em;
3939
}
40-
40+
input[type="checkbox"][disabled] + label {
41+
opacity: 0.4;
42+
}
4143
.para {
4244
width: 40em;
4345
}

src/js/messaging.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -648,16 +648,18 @@ vAPI.messaging.listen('elementPicker', onMessage);
648648

649649
/******************************************************************************/
650650

651-
var µb = µBlock;
652-
653-
/******************************************************************************/
654-
655651
var onMessage = function(request, sender, callback) {
652+
// Cloud storage support is optional.
653+
if ( vAPI.cloud instanceof Object === false ) {
654+
callback();
655+
return;
656+
}
657+
656658
// Async
657659
switch ( request.what ) {
658660
case 'cloudGetOptions':
659661
vAPI.cloud.getOptions(function(options) {
660-
options.enabled = µb.userSettings.cloudStorageEnabled === true;
662+
options.enabled = µBlock.userSettings.cloudStorageEnabled === true;
661663
callback(options);
662664
});
663665
return;
@@ -722,7 +724,8 @@ var getLocalData = function(callback) {
722724
lastRestoreFile: o.lastRestoreFile,
723725
lastRestoreTime: o.lastRestoreTime,
724726
lastBackupFile: o.lastBackupFile,
725-
lastBackupTime: o.lastBackupTime
727+
lastBackupTime: o.lastBackupTime,
728+
cloudStorageSupported: vAPI.cloud instanceof Object
726729
});
727730
};
728731

src/js/settings.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ var onLocalDataReceived = function(details) {
138138
uDom('#localData > ul > li:nth-of-type(3) > ul > li:nth-of-type(2)').text(lastRestoreFile);
139139
uDom('#localData > ul > li:nth-of-type(3)').css('display', '');
140140
}
141+
142+
if ( details.cloudStorageSupported === false ) {
143+
uDom('#cloud-storage-enabled').attr('disabled', '');
144+
}
141145
};
142146

143147
/******************************************************************************/

src/js/start.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,15 @@ var onAllReady = function() {
6767
// for launch time.
6868
µb.assets.remoteFetchBarrier -= 1;
6969

70-
vAPI.cloud.start([
71-
'tpFiltersPane',
72-
'myFiltersPane',
73-
'myRulesPane',
74-
'whitelistPane'
75-
]);
70+
// vAPI.cloud is optional.
71+
if ( vAPI.cloud instanceof Object ) {
72+
vAPI.cloud.start([
73+
'tpFiltersPane',
74+
'myFiltersPane',
75+
'myRulesPane',
76+
'whitelistPane'
77+
]);
78+
}
7679

7780
//quickProfiler.stop(0);
7881

0 commit comments

Comments
 (0)