Merge branch 'staging' into responsiveContextmenu
commit
6bcf9f13d3
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
Binary file not shown.
Binary file not shown.
@ -0,0 +1,86 @@
|
||||
@import (reference) "./colortheme-all.less";
|
||||
.support_main () {
|
||||
@ticket-bg: #F7F7F7;
|
||||
@msg-bg: #eee;
|
||||
@fromme-bg: #ddd;
|
||||
.cp-support-form-container {
|
||||
[type="text"] {
|
||||
width: @sidebar_button-width;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
textarea {
|
||||
width: 2*@sidebar_button-width;
|
||||
max-width: 90%;
|
||||
padding: 10px 15px;
|
||||
height: 300px;
|
||||
}
|
||||
}
|
||||
.cp-support-container {
|
||||
.cp-support-list-ticket {
|
||||
display: flex;
|
||||
flex-flow: column;
|
||||
background-color: @ticket-bg;
|
||||
padding: 10px;
|
||||
width: 1200px;
|
||||
max-width: 90%;
|
||||
margin: 5px auto;
|
||||
.cp-support-list-message {
|
||||
background-color: @msg-bg;
|
||||
margin: 2px;
|
||||
padding: 2px 5px;
|
||||
.cp-support-fromme {
|
||||
background-color: @fromme-bg;
|
||||
}
|
||||
.cp-support-showdata {
|
||||
cursor: pointer;
|
||||
background-color: @fromme-bg;
|
||||
.cp-support-message-data {
|
||||
display: none;
|
||||
cursor: default;
|
||||
}
|
||||
}
|
||||
.cp-support-message-time {
|
||||
float: right;
|
||||
}
|
||||
pre {
|
||||
margin-bottom: 0;
|
||||
white-space: pre-wrap;
|
||||
&.cp-support-message-content {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.cp-support-list-actions {
|
||||
order: 3;
|
||||
.cp-support-hide {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
.cp-support-form-container {
|
||||
order: 2;
|
||||
}
|
||||
&.cp-support-list-closed {
|
||||
.cp-support-list-actions {
|
||||
display: block !important;
|
||||
.cp-support-answer, .cp-support-close {
|
||||
display: none;
|
||||
}
|
||||
.cp-support-hide {
|
||||
display: inline;
|
||||
}
|
||||
}
|
||||
.cp-support-form-container {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
button {
|
||||
margin-left: 2px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,25 @@
|
||||
/* jshint esversion: 6, node: true */
|
||||
|
||||
const Nacl = require('tweetnacl');
|
||||
|
||||
const keyPair = Nacl.box.keyPair();
|
||||
console.log("You've just generated a new key pair for your support mailbox.");
|
||||
|
||||
console.log("The public key should first be added to your config.js file ('supportMailboxPublicKey'), then save and restart the server.");
|
||||
console.log("Once restarted, administrators (specified with 'adminKeys' in config.js too) will be able to add the private key into their account. This can be done using the administration panel.");
|
||||
console.log("You will have to send the private key to each administrator manually so that they can add it to their account.");
|
||||
console.log();
|
||||
console.log("WARNING: the public and private keys must come from the same key pair to have a working encrypted support mailbox.");
|
||||
console.log();
|
||||
console.log("NOTE: You can change the key pair at any time if you want to revoke access to the support mailbox. You just have to generate a new key pair using this file, and replace the value in config.js, and then send the new private key to the administrators of your choice.");
|
||||
|
||||
|
||||
console.log();
|
||||
console.log();
|
||||
console.log("Your public key (add it to config.js):");
|
||||
console.log(Nacl.util.encodeBase64(keyPair.publicKey));
|
||||
|
||||
console.log();
|
||||
console.log();
|
||||
console.log("Your private key (store it in a safe place and send it to your instance's admins):");
|
||||
console.log(Nacl.util.encodeBase64(keyPair.secretKey));
|
@ -1,51 +0,0 @@
|
||||
define([
|
||||
'/common/curve.js',
|
||||
'/bower_components/chainpad-listmap/chainpad-listmap.js',
|
||||
], function (Curve, Listmap) {
|
||||
var Edit = {};
|
||||
|
||||
Edit.create = function (config, cb) { //network, channel, theirs, mine, cb) {
|
||||
var network = config.network;
|
||||
var channel = config.channel;
|
||||
var keys = config.keys;
|
||||
|
||||
try {
|
||||
var encryptor = Curve.createEncryptor(keys);
|
||||
var lm = Listmap.create({
|
||||
network: network,
|
||||
data: {},
|
||||
channel: channel,
|
||||
readOnly: false,
|
||||
validateKey: keys.validateKey || undefined,
|
||||
crypto: encryptor,
|
||||
userName: 'lol',
|
||||
logLevel: 1,
|
||||
});
|
||||
|
||||
var done = function () {
|
||||
// TODO make this abort and disconnect the session after the
|
||||
// user has finished making changes to the object, and they
|
||||
// have propagated.
|
||||
};
|
||||
|
||||
lm.proxy
|
||||
.on('create', function () {
|
||||
console.log('created');
|
||||
})
|
||||
.on('ready', function () {
|
||||
console.log('ready');
|
||||
cb(lm, done);
|
||||
})
|
||||
.on('disconnect', function () {
|
||||
console.log('disconnected');
|
||||
})
|
||||
.on('change', [], function (o, n, p) {
|
||||
console.log(o, n, p);
|
||||
});
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
};
|
||||
|
||||
return Edit;
|
||||
});
|
@ -1,20 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="cp">
|
||||
<!-- If this file is not called customize.dist/src/template.html, it is generated -->
|
||||
<head>
|
||||
<title data-localization="main_title">CryptPad: Zero Knowledge, Collaborative Real Time Editing</title>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<link rel="icon" type="image/png" href="/customize/main-favicon.png" id="favicon"/>
|
||||
<script async data-bootload="/customize/template.js" data-main="/common/boot.js?ver=1.0" src="/bower_components/requirejs/require.js?ver=2.3.5"></script>
|
||||
|
||||
<link rel="stylesheet" href="/bower_components/codemirror/lib/codemirror.css">
|
||||
<link rel="stylesheet" href="/bower_components/codemirror/addon/dialog/dialog.css">
|
||||
<link rel="stylesheet" href="/bower_components/codemirror/addon/fold/foldgutter.css" />
|
||||
</head>
|
||||
<body class="html">
|
||||
<noscript>
|
||||
<p><strong>OOPS</strong> In order to do encryption in your browser, Javascript is really <strong>really</strong> required.</p>
|
||||
<p><strong>OUPS</strong> Afin de pouvoir réaliser le chiffrement dans votre navigateur, Javascript est <strong>vraiment</strong> nécessaire.</p>
|
||||
</noscript>
|
||||
</html>
|
@ -1,88 +0,0 @@
|
||||
define([
|
||||
'jquery',
|
||||
'/common/cryptpad-common.js',
|
||||
'/common/common-interface.js',
|
||||
//'/common/common-hash.js',
|
||||
//'/bower_components/chainpad-listmap/chainpad-listmap.js',
|
||||
//'/common/curve.js',
|
||||
'less!/invite/main.less',
|
||||
], function ($, Cryptpad, UI/*, Hash , Listmap, Curve*/) {
|
||||
var Messages = Cryptpad.Messages;
|
||||
var comingSoon = function () {
|
||||
return $('<div>', {
|
||||
'class': 'coming-soon',
|
||||
})
|
||||
.text(Messages.comingSoon)
|
||||
.append('<br>');
|
||||
};
|
||||
|
||||
$(function () {
|
||||
UI.removeLoadingScreen();
|
||||
console.log("wut");
|
||||
$('body #mainBlock').append(comingSoon());
|
||||
});
|
||||
return;
|
||||
|
||||
/* jshint ignore:start */
|
||||
var APP = window.APP = {};
|
||||
|
||||
//var Messages = Cryptpad.Messages;
|
||||
var onInit = function () {};
|
||||
|
||||
var onDisconnect = function () {};
|
||||
var onChange = function () {};
|
||||
|
||||
var andThen = function () {
|
||||
var hash = window.location.hash.slice(1);
|
||||
|
||||
var info = Hash.parseTypeHash('invite', hash);
|
||||
console.log(info);
|
||||
|
||||
if (!info.pubkey) {
|
||||
UI.removeLoadingScreen();
|
||||
UI.alert('invalid invite');
|
||||
return;
|
||||
}
|
||||
|
||||
var proxy = Cryptpad.getProxy();
|
||||
var mySecret = proxy.curvePrivate;
|
||||
|
||||
var keys = Curve.deriveKeys(info.pubkey, mySecret);
|
||||
var encryptor = Curve.createEncryptor(keys);
|
||||
|
||||
UI.removeLoadingScreen();
|
||||
|
||||
var listmapConfig = {
|
||||
data: {},
|
||||
network: Cryptpad.getNetwork(),
|
||||
channel: info.channel,
|
||||
readOnly: false,
|
||||
validateKey: keys.validateKey,
|
||||
crypto: encryptor,
|
||||
userName: 'profile',
|
||||
logLevel: 1,
|
||||
};
|
||||
var lm = APP.lm = Listmap.create(listmapConfig);
|
||||
lm.proxy.on('create', onInit)
|
||||
.on('ready', function () {
|
||||
APP.initialized = true;
|
||||
console.log(JSON.stringify(lm.proxy));
|
||||
})
|
||||
.on('disconnect', onDisconnect)
|
||||
.on('change', [], onChange);
|
||||
};
|
||||
|
||||
$(function () {
|
||||
var $main = $('#mainBlock');
|
||||
|
||||
// main block is hidden in case javascript is disabled
|
||||
$main.removeClass('hidden');
|
||||
|
||||
APP.$container = $('#container');
|
||||
|
||||
Cryptpad.ready(function () {
|
||||
andThen();
|
||||
});
|
||||
});
|
||||
/* jshint ignore:end */
|
||||
});
|
@ -1,150 +0,0 @@
|
||||
/*
|
||||
.cp {
|
||||
#mainBlock {
|
||||
z-index: 1;
|
||||
width: 1000px;
|
||||
max-width: 90%;
|
||||
margin: auto;
|
||||
#container {
|
||||
font-size: 25px;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
#header {
|
||||
display: flex;
|
||||
#rightside {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-flow: column;
|
||||
}
|
||||
}
|
||||
#avatar {
|
||||
width: 300px;
|
||||
//height: 350px;
|
||||
margin: 10px;
|
||||
margin-right: 20px;
|
||||
text-align: center;
|
||||
&> span {
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
height: 300px;
|
||||
width: 300px;
|
||||
border: 1px solid black;
|
||||
border-radius: 10px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
.delete {
|
||||
right: 0;
|
||||
position: absolute;
|
||||
opacity: 0.7;
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
img {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
vertical-align: top;
|
||||
}
|
||||
media-tag {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
img {
|
||||
min-width: 100%;
|
||||
min-height: 100%;
|
||||
max-width: none;
|
||||
max-height: none;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
button {
|
||||
height: 40px;
|
||||
margin: 5px;
|
||||
}
|
||||
}
|
||||
#displayName, #link {
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
margin: 10px 0;
|
||||
input {
|
||||
width: 100%;
|
||||
font-size: 20px;
|
||||
box-sizing: border-box;
|
||||
padding-right: 30px;
|
||||
}
|
||||
input:focus ~ .edit {
|
||||
display: none;
|
||||
}
|
||||
.edit {
|
||||
position: absolute;
|
||||
margin-left: -25px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
.temp {
|
||||
font-weight: 400;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
.displayName {
|
||||
font-weight: bold;
|
||||
font-size: 30px;
|
||||
}
|
||||
.displayName, .link {
|
||||
line-height: 40px;
|
||||
}
|
||||
}
|
||||
#description {
|
||||
position: relative;
|
||||
font-size: 16px;
|
||||
border: 1px solid #DDD;
|
||||
margin-bottom: 20px;
|
||||
.rendered {
|
||||
padding: 0 15px;
|
||||
}
|
||||
.ok, .spin {
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
right: 2px;
|
||||
display: none;
|
||||
z-index: 1000;
|
||||
}
|
||||
textarea {
|
||||
width: 100%;
|
||||
height: 300px;
|
||||
}
|
||||
.CodeMirror {
|
||||
border: 1px solid #DDD;
|
||||
font-family: monospace;
|
||||
font-size: 16px;
|
||||
line-height: initial;
|
||||
pre {
|
||||
margin: 0;
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
line-height: inherit;
|
||||
}
|
||||
}
|
||||
}
|
||||
#createProfile {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-flow: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
.coming-soon {
|
||||
text-align: center;
|
||||
font-size: 25px;
|
||||
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-flow: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
@ -0,0 +1,142 @@
|
||||
@import (reference) '../../customize/src/less2/include/framework.less';
|
||||
@import (reference) '../../customize/src/less2/include/sidebar-layout.less';
|
||||
|
||||
&.cp-app-notifications {
|
||||
|
||||
.framework_min_main(
|
||||
@bg-color: @colortheme_notifications-bg,
|
||||
@warn-color: @colortheme_notifications-warn,
|
||||
@color: @colortheme_notifications-color
|
||||
);
|
||||
.sidebar-layout_main();
|
||||
|
||||
display: flex;
|
||||
flex-flow: column;
|
||||
|
||||
.cp-clickable {
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
background-color: rgba(0,0,0,0.1);
|
||||
}
|
||||
}
|
||||
|
||||
.cp-app-notifications-panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
align-items: stretch;
|
||||
width: 100%;
|
||||
|
||||
.cp-app-notifications-panel-titlebar {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
// border-radius: 5px 5px 0 0;
|
||||
background-color: #888;
|
||||
color: #fff;
|
||||
|
||||
.cp-app-notifications-panel-title {
|
||||
flex-grow: 1;
|
||||
margin: 1rem 1rem;
|
||||
}
|
||||
|
||||
.cp-app-notifications-panel-titlebar-buttons {
|
||||
align-self: stretch;
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-end;
|
||||
align-items: stretch;
|
||||
|
||||
.cp-app-notifications-dismissall {
|
||||
align-self: stretch;
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 3rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.cp-app-notifications-panel-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
align-items: stretch;
|
||||
border: 1px solid #ccc;
|
||||
border-top: none;
|
||||
// border-radius: 0 0 5px 5px;
|
||||
overflow: hidden;
|
||||
|
||||
.cp-notification {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
background-color: #ffffff;
|
||||
&.no-notifications {
|
||||
display: none;
|
||||
padding: 1rem 1rem;
|
||||
font-style: italic;
|
||||
color: #777;
|
||||
&:only-child {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
&.cp-app-notification-archived {
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
&:not(:first-child) {
|
||||
border-top: 1px solid #ccc;
|
||||
}
|
||||
&.dismissed {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.cp-notification-content {
|
||||
flex-grow: 1;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
p {
|
||||
display: inline-block;
|
||||
margin: 1rem 1rem;
|
||||
}
|
||||
.notification-time {
|
||||
margin: 1rem 1rem;
|
||||
color: grey;
|
||||
margin-left: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.cp-notification-dismiss {
|
||||
align-self: stretch;
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-left: 1px solid #ccc;
|
||||
width: 3rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.cp-app-notification-loadmore {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
padding: 0.5rem;
|
||||
border: 1px solid #ccc;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CryptPad</title>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="referrer" content="no-referrer" />
|
||||
<script async data-bootload="main.js" data-main="/common/boot.js?ver=1.0" src="/bower_components/requirejs/require.js?ver=2.3.5"></script>
|
||||
<link href="/customize/src/outer.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
<iframe id="sbox-iframe">
|
@ -0,0 +1,18 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="cp-app-noscroll">
|
||||
<head>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
||||
<script async data-bootload="/notifications/inner.js" data-main="/common/sframe-boot.js?ver=1.6" src="/bower_components/requirejs/require.js?ver=2.3.5"></script>
|
||||
<style>
|
||||
.loading-hidden { display: none; }
|
||||
</style>
|
||||
</head>
|
||||
<body class="cp-app-notifications">
|
||||
<div id="cp-toolbar" class="cp-toolbar-container"></div>
|
||||
<div id="cp-sidebarlayout-container"></div>
|
||||
<noscript>
|
||||
<p><strong>OOPS</strong> In order to do encryption in your browser, Javascript is really <strong>really</strong> required.</p>
|
||||
<p><strong>OUPS</strong> Afin de pouvoir réaliser le chiffrement dans votre navigateur, Javascript est <strong>vraiment</strong> nécessaire.</p>
|
||||
</noscript>
|
||||
</body>
|
||||
|
@ -0,0 +1,265 @@
|
||||
define([
|
||||
'jquery',
|
||||
'/api/config',
|
||||
'/bower_components/chainpad-crypto/crypto.js',
|
||||
'/common/toolbar3.js',
|
||||
'/bower_components/nthen/index.js',
|
||||
'/common/sframe-common.js',
|
||||
'/common/hyperscript.js',
|
||||
'/customize/messages.js',
|
||||
'/common/common-interface.js',
|
||||
|
||||
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
|
||||
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
|
||||
'less!/notifications/app-notifications.less',
|
||||
], function (
|
||||
$,
|
||||
ApiConfig,
|
||||
Crypto,
|
||||
Toolbar,
|
||||
nThen,
|
||||
SFCommon,
|
||||
h,
|
||||
Messages,
|
||||
UI
|
||||
)
|
||||
{
|
||||
var APP = {};
|
||||
|
||||
var common;
|
||||
var sFrameChan;
|
||||
|
||||
var categories = {
|
||||
'all': [
|
||||
'cp-notifications-all',
|
||||
],
|
||||
'friends': [
|
||||
'cp-notifications-friends',
|
||||
],
|
||||
'pads': [
|
||||
'cp-notifications-pads',
|
||||
],
|
||||
'archived': [
|
||||
'cp-notifications-archived',
|
||||
],
|
||||
};
|
||||
|
||||
var notifsAllowedTypes = ["FRIEND_REQUEST", "FRIEND_REQUEST_ACCEPTED", "FRIEND_REQUEST_DECLINED", "SHARE_PAD", "REQUEST_PAD_ACCESS"];
|
||||
|
||||
var create = {};
|
||||
|
||||
var unreadData;
|
||||
|
||||
// create the list of notifications
|
||||
// show only notifs with type in filterTypes array
|
||||
var makeNotificationList = function (key, filterTypes) {
|
||||
filterTypes = filterTypes || [];
|
||||
var safeKey = key.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); });
|
||||
var categoryName = Messages['notifications_cat_' + safeKey] || safeKey;
|
||||
|
||||
var notifsData = [];
|
||||
if (key === "all") {
|
||||
unreadData = notifsData;
|
||||
}
|
||||
var $div = $('<div>', {'class': 'cp-notifications-' + key + ' cp-sidebarlayout-element'});
|
||||
var notifsPanel, notifsList, dismissAll;
|
||||
notifsPanel = h("div.cp-app-notifications-panel", [
|
||||
h('div.cp-app-notifications-panel-titlebar', [
|
||||
h("span.cp-app-notifications-panel-title",
|
||||
(Messages.notificationsPage || "Notifications") + " - " + categoryName),
|
||||
h("div.cp-app-notifications-panel-titlebar-buttons", [
|
||||
dismissAll = h("div.cp-app-notifications-dismissall.cp-clickable", { title: Messages.notifications_dismissAll || "Dismiss All" }, h("span.fa.fa-trash")),
|
||||
]),
|
||||
]),
|
||||
notifsList = h("div.cp-app-notifications-panel-list", [
|
||||
h("div.cp-notification.no-notifications", Messages.notifications_empty),
|
||||
]),
|
||||
]);
|
||||
|
||||
// add notification
|
||||
var addNotification = function (data, el) {
|
||||
// if the type of notification correspond
|
||||
if (filterTypes.indexOf(data.content.msg.type) !== -1) {
|
||||
notifsData.push(data);
|
||||
$(notifsList).prepend(el);
|
||||
}
|
||||
};
|
||||
var addArchivedNotification = function (data) {
|
||||
// if the type is allowed
|
||||
if (data.content.archived && notifsAllowedTypes.indexOf(data.content.msg.type) !== -1) {
|
||||
var isDataUnread = unreadData.some(function (ud) {
|
||||
return ud.content.hash === data.content.hash;
|
||||
});
|
||||
notifsData.push(data);
|
||||
var el = common.mailbox.createElement(data);
|
||||
var time = new Date(data.content.time);
|
||||
$(el).find(".cp-notification-content").append(h("span.notification-time", time.toLocaleString()));
|
||||
$(el).addClass("cp-app-notification-archived");
|
||||
$(el).toggle(!isDataUnread);
|
||||
$(notifsList).append(el);
|
||||
}
|
||||
};
|
||||
|
||||
$div.append(notifsPanel);
|
||||
|
||||
if (key === "archived") {
|
||||
var loadmore;
|
||||
var lastKnownHash;
|
||||
$(dismissAll).remove();
|
||||
loadmore = h("div.cp-app-notification-loadmore.cp-clickable", Messages.history_loadMore);
|
||||
$(loadmore).click(function () {
|
||||
common.mailbox.getNotificationsHistory('notifications', 10, lastKnownHash, function (err, messages, end) {
|
||||
if (!Array.isArray(messages)) { return; }
|
||||
// display archived notifs from most recent to oldest
|
||||
for (var i = messages.length - 1 ; i >= 0 ; i--) {
|
||||
var data = messages[i];
|
||||
data.content.archived = true;
|
||||
addArchivedNotification(data);
|
||||
}
|
||||
if (end) {
|
||||
$(loadmore).hide();
|
||||
}
|
||||
else {
|
||||
lastKnownHash = messages[0].content.hash;
|
||||
}
|
||||
$('#cp-sidebarlayout-rightside').scrollTop($('#cp-sidebarlayout-rightside')[0].scrollHeight);
|
||||
});
|
||||
});
|
||||
notifsList.after(loadmore);
|
||||
$(loadmore).click();
|
||||
}
|
||||
|
||||
common.mailbox.subscribe(["notifications"], {
|
||||
onMessage: function (data, el) {
|
||||
addNotification(data, el);
|
||||
},
|
||||
onViewed: function (data) {
|
||||
$('.cp-app-notification-archived[data-hash="' + data.hash + '"]').show();
|
||||
}
|
||||
});
|
||||
|
||||
$(dismissAll).click(function () {
|
||||
notifsData.forEach(function (data) {
|
||||
if (data.content.isDismissible) {
|
||||
data.content.dismissHandler();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return $div;
|
||||
};
|
||||
create['all'] = function () {
|
||||
var key = 'all';
|
||||
return makeNotificationList(key, notifsAllowedTypes);
|
||||
};
|
||||
|
||||
create['friends'] = function () {
|
||||
var key = 'friends';
|
||||
var filter = ["FRIEND_REQUEST", "FRIEND_REQUEST_ACCEPTED", "FRIEND_REQUEST_DECLINED"];
|
||||
return makeNotificationList(key, filter);
|
||||
};
|
||||
|
||||
create['pads'] = function () {
|
||||
var key = 'pads';
|
||||
var filter = ["SHARE_PAD"];
|
||||
return makeNotificationList(key, filter);
|
||||
};
|
||||
|
||||
create['archived'] = function () {
|
||||
var key = 'archived';
|
||||
var filter = [];
|
||||
return makeNotificationList(key, filter);
|
||||
};
|
||||
|
||||
|
||||
var hideCategories = function () {
|
||||
APP.$rightside.find('> div').hide();
|
||||
};
|
||||
var showCategories = function (cat) {
|
||||
hideCategories();
|
||||
cat.forEach(function (c) {
|
||||
APP.$rightside.find('.'+c).show();
|
||||
});
|
||||
};
|
||||
var createLeftside = function () {
|
||||
var $categories = $('<div>', {'class': 'cp-sidebarlayout-categories'})
|
||||
.appendTo(APP.$leftside);
|
||||
var metadataMgr = common.getMetadataMgr();
|
||||
var privateData = metadataMgr.getPrivateData();
|
||||
var active = privateData.category || 'all';
|
||||
common.setHash(active);
|
||||
Object.keys(categories).forEach(function (key) {
|
||||
var $category = $('<div>', {'class': 'cp-sidebarlayout-category'}).appendTo($categories);
|
||||
if (key === 'all') { $category.append($('<span>', {'class': 'fa fa-bars'})); }
|
||||
if (key === 'friends') { $category.append($('<span>', {'class': 'fa fa-user'})); }
|
||||
if (key === 'pads') { $category.append($('<span>', {'class': 'cptools cptools-pad'})); }
|
||||
if (key === 'archived') { $category.append($('<span>', {'class': 'fa fa-archive'})); }
|
||||
|
||||
if (key === active) {
|
||||
$category.addClass('cp-leftside-active');
|
||||
}
|
||||
|
||||
$category.click(function () {
|
||||
if (!Array.isArray(categories[key]) && categories[key].onClick) {
|
||||
categories[key].onClick();
|
||||
return;
|
||||
}
|
||||
active = key;
|
||||
common.setHash(key);
|
||||
$categories.find('.cp-leftside-active').removeClass('cp-leftside-active');
|
||||
$category.addClass('cp-leftside-active');
|
||||
showCategories(categories[key]);
|
||||
});
|
||||
|
||||
$category.append(Messages['notifications_cat_'+key] || key);
|
||||
});
|
||||
showCategories(categories[active]);
|
||||
};
|
||||
|
||||
var createToolbar = function () {
|
||||
var displayed = ['useradmin', 'newpad', 'limit', 'pageTitle', 'notifications'];
|
||||
var configTb = {
|
||||
displayed: displayed,
|
||||
sfCommon: common,
|
||||
$container: APP.$toolbar,
|
||||
pageTitle: Messages.notificationsPage || 'Notifications',
|
||||
metadataMgr: common.getMetadataMgr(),
|
||||
};
|
||||
APP.toolbar = Toolbar.create(configTb);
|
||||
APP.toolbar.$rightside.hide();
|
||||
};
|
||||
|
||||
nThen(function (waitFor) {
|
||||
$(waitFor(UI.addLoadingScreen));
|
||||
SFCommon.create(waitFor(function (c) { APP.common = common = c; }));
|
||||
}).nThen(function (waitFor) {
|
||||
APP.$container = $('#cp-sidebarlayout-container');
|
||||
APP.$toolbar = $('#cp-toolbar');
|
||||
APP.$leftside = $('<div>', {id: 'cp-sidebarlayout-leftside'}).appendTo(APP.$container);
|
||||
APP.$rightside = $('<div>', {id: 'cp-sidebarlayout-rightside'}).appendTo(APP.$container);
|
||||
sFrameChan = common.getSframeChannel();
|
||||
sFrameChan.onReady(waitFor());
|
||||
}).nThen(function (/*waitFor*/) {
|
||||
createToolbar();
|
||||
common.setTabTitle(Messages.notificationsPage || 'Notifications');
|
||||
|
||||
|
||||
// Content
|
||||
var $rightside = APP.$rightside;
|
||||
var addItem = function (cssClass) {
|
||||
var item = cssClass.slice(17); // remove 'cp-notifications-'
|
||||
if (typeof (create[item]) === "function") {
|
||||
$rightside.append(create[item]());
|
||||
}
|
||||
};
|
||||
for (var cat in categories) {
|
||||
if (!Array.isArray(categories[cat])) { continue; }
|
||||
categories[cat].forEach(addItem);
|
||||
}
|
||||
|
||||
createLeftside();
|
||||
|
||||
UI.removeLoadingScreen();
|
||||
|
||||
});
|
||||
});
|
@ -0,0 +1,21 @@
|
||||
@import (reference) '../../customize/src/less2/include/framework.less';
|
||||
@import (reference) '../../customize/src/less2/include/sidebar-layout.less';
|
||||
@import (reference) '../../customize/src/less2/include/support.less';
|
||||
|
||||
&.cp-app-support {
|
||||
.framework_min_main(
|
||||
@bg-color: @colortheme_support-bg,
|
||||
@warn-color: @colortheme_support-warn,
|
||||
@color: @colortheme_support-color
|
||||
);
|
||||
.sidebar-layout_main();
|
||||
.support_main();
|
||||
|
||||
.cp-hidden {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
display: flex;
|
||||
flex-flow: column;
|
||||
}
|
||||
|
@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CryptPad</title>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="referrer" content="no-referrer" />
|
||||
<script async data-bootload="main.js" data-main="/common/boot.js?ver=1.0" src="/bower_components/requirejs/require.js?ver=2.3.5"></script>
|
||||
<link href="/customize/src/outer.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
<iframe id="sbox-iframe">
|
@ -0,0 +1,18 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="cp-app-noscroll">
|
||||
<head>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
||||
<script async data-bootload="/support/inner.js" data-main="/common/sframe-boot.js?ver=1.6" src="/bower_components/requirejs/require.js?ver=2.3.5"></script>
|
||||
<style>
|
||||
.loading-hidden { display: none; }
|
||||
</style>
|
||||
</head>
|
||||
<body class="cp-app-support">
|
||||
<div id="cp-toolbar" class="cp-toolbar-container"></div>
|
||||
<div id="cp-sidebarlayout-container"></div>
|
||||
<noscript>
|
||||
<p><strong>OOPS</strong> In order to do encryption in your browser, Javascript is really <strong>really</strong> required.</p>
|
||||
<p><strong>OUPS</strong> Afin de pouvoir réaliser le chiffrement dans votre navigateur, Javascript est <strong>vraiment</strong> nécessaire.</p>
|
||||
</noscript>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue