mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-05 18:32:30 +01:00
fix #2477
This commit is contained in:
parent
b3d210c866
commit
510eba6bc4
@ -776,15 +776,12 @@ var backupUserData = function(callback) {
|
|||||||
var filename = vAPI.i18n('aboutBackupFilename')
|
var filename = vAPI.i18n('aboutBackupFilename')
|
||||||
.replace('{{datetime}}', µb.dateNowToSensibleString())
|
.replace('{{datetime}}', µb.dateNowToSensibleString())
|
||||||
.replace(/ +/g, '_');
|
.replace(/ +/g, '_');
|
||||||
|
|
||||||
vAPI.download({
|
|
||||||
'url': 'data:text/plain;charset=utf-8,' + encodeURIComponent(JSON.stringify(userData, null, ' ')),
|
|
||||||
'filename': filename
|
|
||||||
});
|
|
||||||
µb.restoreBackupSettings.lastBackupFile = filename;
|
µb.restoreBackupSettings.lastBackupFile = filename;
|
||||||
µb.restoreBackupSettings.lastBackupTime = Date.now();
|
µb.restoreBackupSettings.lastBackupTime = Date.now();
|
||||||
vAPI.storage.set(µb.restoreBackupSettings);
|
vAPI.storage.set(µb.restoreBackupSettings);
|
||||||
getLocalData(callback);
|
getLocalData(function(localData) {
|
||||||
|
callback({ localData: localData, userData: userData });
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
µb.assets.get(µb.userFiltersPath, onUserFiltersReady);
|
µb.assets.get(µb.userFiltersPath, onUserFiltersReady);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
|
||||||
uBlock Origin - a browser extension to block requests.
|
uBlock Origin - a browser extension to block requests.
|
||||||
Copyright (C) 2014-2016 Raymond Hill
|
Copyright (C) 2014-2017 Raymond Hill
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -105,7 +105,20 @@ var startImportFilePicker = function() {
|
|||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
var exportToFile = function() {
|
var exportToFile = function() {
|
||||||
messaging.send('dashboard', { what: 'backupUserData' }, onLocalDataReceived);
|
messaging.send('dashboard', { what: 'backupUserData' }, function(response) {
|
||||||
|
if (
|
||||||
|
response instanceof Object === false ||
|
||||||
|
response.userData instanceof Object === false
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
vAPI.download({
|
||||||
|
'url': 'data:text/plain;charset=utf-8,' +
|
||||||
|
encodeURIComponent(JSON.stringify(response.userData, null, ' ')),
|
||||||
|
'filename': response.localData.lastBackupFile
|
||||||
|
});
|
||||||
|
onLocalDataReceived(response.localData);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
Loading…
Reference in New Issue
Block a user