From 7187d3c5502609b1360ce8a39b97d5101bdba586 Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 15 Mar 2017 15:55:55 +0100 Subject: [PATCH] implement getUserChannelList --- www/common/cryptpad-common.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 190b05508..f0b63d83e 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -987,6 +987,28 @@ define([ }); */ }; + + var getUserChannelList = common.getUserChannelList = function () { + var store = common.getStore(); + var proxy = store.getProxy(); + var fo = proxy.fo; + + var list = fo.getFilesDataFiles().map(function (href) { + var parsed = Cryptpad.parsePadUrl(href); + if (!parsed || !parsed.hash) { return; } + + parsed = Cryptpad.parseHash(parsed.hash); + + var channel = parsed.channel; + if (!channel) { return; } + + var hex = Cryptpad.base64ToHex(channel); + return hex; + }).filter(function (x) { return x; }).sort(); + + return list; + }; + var createButton = common.createButton = function (type, rightside, data, callback) { var button; var size = "17px";