clean up serverside and clientside pinning logic
This commit is contained in:
@@ -10,12 +10,16 @@ define([
|
||||
};
|
||||
|
||||
var synchronize = function (call) {
|
||||
var localHash = call.localChannelsHash();
|
||||
// provide a sorted list of unique channels
|
||||
var list = Cryptpad.deduplicateString(Cryptpad.getUserChannelList())
|
||||
.sort();
|
||||
|
||||
var localHash = call.hashChannelList(list);
|
||||
var serverHash;
|
||||
|
||||
call.getFileListSize(function (e, bytes) {
|
||||
if (e) { return void console.error(e); }
|
||||
console.log("%s total bytes used", bytes);
|
||||
console.log("total %sK bytes used", bytes / 1000);
|
||||
});
|
||||
|
||||
call.getServerHash(function (e, hash) {
|
||||
@@ -26,7 +30,7 @@ define([
|
||||
return console.log("all your pads are pinned. There is nothing to do");
|
||||
}
|
||||
|
||||
call.reset(function (e, response) {
|
||||
call.reset(list, function (e, response) {
|
||||
if (e) { return console.error(e); }
|
||||
else {
|
||||
return console.log('reset pin list. new hash is [%s]', response);
|
||||
@@ -37,7 +41,10 @@ define([
|
||||
|
||||
$(function () {
|
||||
Cryptpad.ready(function (err, env) {
|
||||
Pinpad.create(function (e, call) {
|
||||
var network = Cryptpad.getNetwork();
|
||||
var proxy = Cryptpad.getStore().getProxy().proxy;
|
||||
|
||||
Pinpad.create(network, proxy, function (e, call) {
|
||||
if (e) { return void console.error(e); }
|
||||
synchronize(call);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user