Merge branch 'msg' into staging
This commit is contained in:
@@ -10,6 +10,7 @@ define([
|
||||
'/common/common-userlist.js',
|
||||
'/common/common-title.js',
|
||||
'/common/common-metadata.js',
|
||||
'/common/common-messaging.js',
|
||||
'/common/common-codemirror.js',
|
||||
'/common/common-file.js',
|
||||
'/file/file-crypto.js',
|
||||
@@ -19,7 +20,7 @@ define([
|
||||
'/customize/application_config.js',
|
||||
'/common/media-tag.js',
|
||||
], function ($, Config, Messages, Store, Util, Hash, UI, History, UserList, Title, Metadata,
|
||||
CodeMirror, Files, FileCrypto, Clipboard, Pinpad, AppConfig, MediaTag) {
|
||||
Messaging, CodeMirror, Files, FileCrypto, Clipboard, Pinpad, AppConfig, MediaTag) {
|
||||
|
||||
/* This file exposes functionality which is specific to Cryptpad, but not to
|
||||
any particular pad type. This includes functions for committing metadata
|
||||
@@ -107,6 +108,17 @@ define([
|
||||
common.findWeaker = Hash.findWeaker;
|
||||
common.findStronger = Hash.findStronger;
|
||||
common.serializeHash = Hash.serializeHash;
|
||||
common.createInviteUrl = Hash.createInviteUrl;
|
||||
|
||||
// Messaging
|
||||
common.initMessaging = Messaging.init;
|
||||
common.addDirectMessageHandler = Messaging.addDirectMessageHandler;
|
||||
common.inviteFromUserlist = Messaging.inviteFromUserlist;
|
||||
common.createOwnedChannel = Messaging.createOwnedChannel;
|
||||
common.getFriendList = Messaging.getFriendList;
|
||||
common.getFriendChannelsList = Messaging.getFriendChannelsList;
|
||||
common.getFriendListUI = Messaging.getFriendListUI;
|
||||
common.createData = Messaging.createData;
|
||||
|
||||
// Userlist
|
||||
common.createUserList = UserList.create;
|
||||
@@ -148,6 +160,14 @@ define([
|
||||
}
|
||||
return;
|
||||
};
|
||||
common.getUserlist = function () {
|
||||
if (store) {
|
||||
if (store.getProxy() && store.getProxy().info) {
|
||||
return store.getProxy().info.userList;
|
||||
}
|
||||
}
|
||||
return;
|
||||
};
|
||||
common.getProfileUrl = function () {
|
||||
if (store && store.getProfile()) {
|
||||
return store.getProfile().view;
|
||||
@@ -158,6 +178,12 @@ define([
|
||||
return store.getProfile().avatar;
|
||||
}
|
||||
};
|
||||
common.getDisplayName = function () {
|
||||
if (getProxy()) {
|
||||
return getProxy()[common.displayNameKey] || '';
|
||||
}
|
||||
return '';
|
||||
};
|
||||
|
||||
var randomToken = function () {
|
||||
return Math.random().toString(16).replace(/0./, '');
|
||||
@@ -330,6 +356,21 @@ define([
|
||||
typeof(proxy.edPublic) === 'string';
|
||||
};
|
||||
|
||||
common.hasCurveKeys = function (proxy) {
|
||||
return typeof(proxy) === 'object' &&
|
||||
typeof(proxy.curvePrivate) === 'string' &&
|
||||
typeof(proxy.curvePublic) === 'string';
|
||||
};
|
||||
|
||||
common.getPublicKeys = function (proxy) {
|
||||
proxy = proxy || common.getProxy();
|
||||
if (!proxy || !proxy.edPublic || !proxy.curvePublic) { return; }
|
||||
return {
|
||||
curve: proxy.curvePublic,
|
||||
ed: proxy.edPublic,
|
||||
};
|
||||
};
|
||||
|
||||
common.isArray = $.isArray;
|
||||
|
||||
/*
|
||||
@@ -737,6 +778,11 @@ define([
|
||||
if (avatarChan) { list.push(avatarChan); }
|
||||
}
|
||||
|
||||
if (getProxy().friends) {
|
||||
var fList = common.getFriendChannelsList(common);
|
||||
list = list.concat(fList);
|
||||
}
|
||||
|
||||
list.push(common.base64ToHex(userChannel));
|
||||
list.sort();
|
||||
|
||||
@@ -1211,7 +1257,6 @@ define([
|
||||
return button;
|
||||
};
|
||||
|
||||
|
||||
var emoji_patt = /([\uD800-\uDBFF][\uDC00-\uDFFF])/;
|
||||
var isEmoji = function (str) {
|
||||
return emoji_patt.test(str);
|
||||
@@ -1731,6 +1776,8 @@ define([
|
||||
Store.ready(function (err, storeObj) {
|
||||
store = common.store = env.store = storeObj;
|
||||
|
||||
common.addDirectMessageHandler(common);
|
||||
|
||||
var proxy = getProxy();
|
||||
var network = getNetwork();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user