diff --git a/customize.dist/translations/messages.fr.js b/customize.dist/translations/messages.fr.js index 2d01fd007..4565af03f 100644 --- a/customize.dist/translations/messages.fr.js +++ b/customize.dist/translations/messages.fr.js @@ -395,6 +395,9 @@ define(function () { out.fm_viewGridButton = "Grille"; out.fm_renamedPad = "Vous avez renommé ce pad dans votre Drive. Son titre est:
{0}"; out.fm_prop_tagsList = "Mots-clés"; + out.fm_burnThisDriveButton = "Effacer toutes les informations stockées par CryptPad dans votre navigateur"; + out.fm_burnThisDrive = "Êtes-vous sûr de vouloir supprimmer tout ce qui est stocké par CryptPad dans votre navigateur ?
" + + "Cette action supprimera votre CryptDrive et son historique de votre navigateur, mais les pads existeront toujours (de manière chiffrée) sur notre serveur."; // File - Context menu out.fc_newfolder = "Nouveau dossier"; out.fc_rename = "Renommer"; diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js index b70635d48..e19be756c 100644 --- a/customize.dist/translations/messages.js +++ b/customize.dist/translations/messages.js @@ -397,6 +397,9 @@ define(function () { out.fm_viewGridButton = "Grid view"; out.fm_renamedPad = "You've set a custom name for this pad. Its shared title is:
{0}"; out.fm_prop_tagsList = "Tags"; + out.fm_burnThisDriveButton = "Erase all information stored by CryptPad in your browser"; + out.fm_burnThisDrive = "Are you sure you want to remove everything stored by CryptPad in your browser?
" + + "This will remove your CryptDrive and its history from your browser, but your pads will still exist (encrypted) on our server."; // File - Context menu out.fc_newfolder = "New folder"; out.fc_rename = "Rename"; diff --git a/www/common/sframe-protocol.js b/www/common/sframe-protocol.js index 3f4e56b19..b63e516bc 100644 --- a/www/common/sframe-protocol.js +++ b/www/common/sframe-protocol.js @@ -194,4 +194,7 @@ define({ // Store the language selected in the iframe into localStorage outside 'Q_LANGUAGE_SET': true, + + // Anonymous users can empty their drive and remove FS_hash from localStorage + 'EV_BURN_ANON_DRIVE': true, }); diff --git a/www/drive/inner.js b/www/drive/inner.js index cd3f2d316..38e7dcb77 100644 --- a/www/drive/inner.js +++ b/www/drive/inner.js @@ -1826,6 +1826,9 @@ define([ .appendTo($toolbar); var $hist = common.createButton('history', true, {histConfig: APP.histConfig}); $rightside.append($hist); + if (APP.$burnThisDrive) { + $rightside.append(APP.$burnThisDrive); + } return $toolbar; }; @@ -2989,10 +2992,12 @@ define([ APP.$displayName = APP.$bar.find('.' + Toolbar.constants.username); /* add the usage */ - common.createUsageBar(function (err, $limitContainer) { - if (err) { return void logError(err); } - APP.$limit = $limitContainer; - }, true); + if (APP.loggedIn) { + common.createUsageBar(function (err, $limitContainer) { + if (err) { return void logError(err); } + APP.$limit = $limitContainer; + }, true); + } /* add a history button */ APP.histConfig = { @@ -3009,6 +3014,18 @@ define([ $toolbar: APP.$bar, }; + // Add a "Burn this drive" button + if (!APP.loggedIn) { + APP.$burnThisDrive = common.createButton(null, true).click(function () { + UI.confirm(Messages.fm_burnThisDrive, function (yes) { + if (!yes) { return; } + common.getSframeChannel().event('EV_BURN_ANON_DRIVE'); + }, null, true); + }).attr('title', Messages.fm_burnThisDriveButton) + .removeClass('fa-question') + .addClass('fa-ban'); + } + metadataMgr.onChange(function () { var name = metadataMgr.getUserData().name || Messages.anonymous; APP.$displayName.text(name); diff --git a/www/drive/main.js b/www/drive/main.js index 438290f34..1e3ff3589 100644 --- a/www/drive/main.js +++ b/www/drive/main.js @@ -43,11 +43,20 @@ define([ Utils.LocalStore.getFSHash(); return Utils.Hash.getSecrets('drive', hash); }; + var addRpc = function (sframeChan, Cryptpad, Utils) { + sframeChan.on('EV_BURN_ANON_DRIVE', function () { + if (Utils.LocalStore.isLoggedIn()) { return; } + Utils.LocalStore.setFSHash(''); + Utils.LocalStore.clearThumbnail(); + window.location.reload(); + }); + }; Netflux.connect(NetConfig.getWebsocketURL()).then(function (network) { SFCommonO.start({ getSecrets: getSecrets, newNetwork: network, - noHash: true + noHash: true, + addRpc: addRpc }); }, function (err) { console.error(err); }); });