Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging
This commit is contained in:
commit
5194677443
File diff suppressed because one or more lines are too long
@ -503,10 +503,13 @@ define([
|
|||||||
|
|
||||||
// User dropdown
|
// User dropdown
|
||||||
if (config.displayed.indexOf('useradmin') !== -1) {
|
if (config.displayed.indexOf('useradmin') !== -1) {
|
||||||
var userMenuCfg = {
|
var userMenuCfg = {};
|
||||||
displayNameCls: USERNAME_CLS,
|
if (config.userData) {
|
||||||
changeNameButtonCls: USERBUTTON_CLS,
|
userMenuCfg = {
|
||||||
};
|
displayNameCls: USERNAME_CLS,
|
||||||
|
changeNameButtonCls: USERBUTTON_CLS,
|
||||||
|
};
|
||||||
|
}
|
||||||
if (readOnly !== 1) {
|
if (readOnly !== 1) {
|
||||||
userMenuCfg.displayName = 1;
|
userMenuCfg.displayName = 1;
|
||||||
userMenuCfg.displayChangeName = 1;
|
userMenuCfg.displayChangeName = 1;
|
||||||
@ -674,25 +677,27 @@ define([
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update user list
|
// Update user list
|
||||||
if (userData) {
|
if (userList) {
|
||||||
userList.change.push(function (newUserData) {
|
if (userData) {
|
||||||
var users = userList.users;
|
userList.change.push(function (newUserData) {
|
||||||
if (users.indexOf(myUserName) !== -1) { connected = true; }
|
var users = userList.users;
|
||||||
if (!connected) { return; }
|
if (users.indexOf(myUserName) !== -1) { connected = true; }
|
||||||
checkSynchronizing(users, myUserName, $stateElement);
|
if (!connected) { return; }
|
||||||
updateUserList(config, myUserName, userListElement, users, userData, readOnly, $userAdminElement);
|
checkSynchronizing(users, myUserName, $stateElement);
|
||||||
});
|
updateUserList(config, myUserName, userListElement, users, userData, readOnly, $userAdminElement);
|
||||||
} else {
|
});
|
||||||
userList.change.push(function () {
|
} else {
|
||||||
var users = userList.users;
|
userList.change.push(function () {
|
||||||
if (users.indexOf(myUserName) !== -1) { connected = true; }
|
var users = userList.users;
|
||||||
if (!connected) { return; }
|
if (users.indexOf(myUserName) !== -1) { connected = true; }
|
||||||
checkSynchronizing(users, myUserName, $stateElement);
|
if (!connected) { return; }
|
||||||
});
|
checkSynchronizing(users, myUserName, $stateElement);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Display notifications when users are joining/leaving the session
|
// Display notifications when users are joining/leaving the session
|
||||||
var oldUserData;
|
var oldUserData;
|
||||||
if (typeof Cryptpad !== "undefined") {
|
if (typeof Cryptpad !== "undefined" && userList) {
|
||||||
var notify = function(type, name, oldname) {
|
var notify = function(type, name, oldname) {
|
||||||
// type : 1 (+1 user), 0 (rename existing user), -1 (-1 user)
|
// type : 1 (+1 user), 0 (rename existing user), -1 (-1 user)
|
||||||
if (typeof name === "undefined") { return; }
|
if (typeof name === "undefined") { return; }
|
||||||
@ -758,7 +763,7 @@ define([
|
|||||||
for (var k in newdata) {
|
for (var k in newdata) {
|
||||||
if (k !== myUserName && userList.users.indexOf(k) !== -1) {
|
if (k !== myUserName && userList.users.indexOf(k) !== -1) {
|
||||||
if (typeof oldUserData[k] === "undefined") {
|
if (typeof oldUserData[k] === "undefined") {
|
||||||
// if the same uid is already present in the userdata, don't notify
|
// if the same uid is already present in the userdata, don't notify
|
||||||
if (!userPresent(k, newdata[k], oldUserData)) {
|
if (!userPresent(k, newdata[k], oldUserData)) {
|
||||||
notify(1, newdata[k].name);
|
notify(1, newdata[k].name);
|
||||||
}
|
}
|
||||||
@ -777,14 +782,16 @@ define([
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
realtime.onPatch(ks());
|
if (realtime) {
|
||||||
realtime.onMessage(ks(true));
|
realtime.onPatch(ks());
|
||||||
|
realtime.onMessage(ks(true));
|
||||||
|
|
||||||
checkLag(getLag, lagElement);
|
|
||||||
setInterval(function () {
|
|
||||||
if (!connected) { return; }
|
|
||||||
checkLag(getLag, lagElement);
|
checkLag(getLag, lagElement);
|
||||||
}, 3000);
|
setInterval(function () {
|
||||||
|
if (!connected) { return; }
|
||||||
|
checkLag(getLag, lagElement);
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
|
||||||
var failed = function () {
|
var failed = function () {
|
||||||
connected = false;
|
connected = false;
|
||||||
|
|||||||
BIN
www/examples/file/assets/image.png-encrypted
Normal file
BIN
www/examples/file/assets/image.png-encrypted
Normal file
Binary file not shown.
47
www/examples/file/index.html
Normal file
47
www/examples/file/index.html
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html class="cp pad">
|
||||||
|
<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">
|
||||||
|
<link rel="stylesheet" href="/bower_components/components-font-awesome/css/font-awesome.min.css">
|
||||||
|
<script data-bootload="main.js" data-main="/common/boot.js" src="/bower_components/requirejs/require.js"></script>
|
||||||
|
<link rel="icon" type="image/png"
|
||||||
|
href="/customize/main-favicon.png"
|
||||||
|
data-main-favicon="/customize/main-favicon.png"
|
||||||
|
data-alt-favicon="/customize/alt-favicon.png"
|
||||||
|
id="favicon" />
|
||||||
|
<link rel="stylesheet" href="/customize/main.css" />
|
||||||
|
<style>
|
||||||
|
html, body {
|
||||||
|
margin: 0px;
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
#pad-iframe {
|
||||||
|
position:fixed;
|
||||||
|
top:0px;
|
||||||
|
left:0px;
|
||||||
|
bottom:0px;
|
||||||
|
right:0px;
|
||||||
|
width:100%;
|
||||||
|
height:100%;
|
||||||
|
border:none;
|
||||||
|
margin:0;
|
||||||
|
padding:0;
|
||||||
|
overflow:hidden;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<iframe id="pad-iframe"></iframe><script src="/common/noscriptfix.js"></script>
|
||||||
|
<div id="loading">
|
||||||
|
<div class="loadingContainer">
|
||||||
|
<img class="cryptofist" src="/customize/cryptofist_small.png" />
|
||||||
|
<div class="spinnerContainer">
|
||||||
|
<span class="fa fa-spinner fa-pulse fa-4x fa-fw"></span>
|
||||||
|
</div>
|
||||||
|
<p data-localization="loading"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
25
www/examples/file/inner.html
Normal file
25
www/examples/file/inner.html
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
||||||
|
<link rel="stylesheet" href="/bower_components/components-font-awesome/css/font-awesome.min.css">
|
||||||
|
<script src="/bower_components/jquery/dist/jquery.min.js"></script>
|
||||||
|
<link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap.min.css">
|
||||||
|
<script src="/bower_components/ckeditor/ckeditor.js"></script>
|
||||||
|
<style>
|
||||||
|
html, body {
|
||||||
|
margin: 0px;
|
||||||
|
}
|
||||||
|
.cryptpad-toolbar {
|
||||||
|
margin-bottom: 1px;
|
||||||
|
padding: 0px;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="toolbar" class="toolbar-container"></div>
|
||||||
|
<media-tag id="encryptedFile"></media-tag>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
52
www/examples/file/main.js
Normal file
52
www/examples/file/main.js
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
define([
|
||||||
|
'jquery',
|
||||||
|
'/bower_components/chainpad-crypto/crypto.js',
|
||||||
|
'/bower_components/chainpad-netflux/chainpad-netflux.js',
|
||||||
|
'/common/toolbar.js',
|
||||||
|
'/common/cryptpad-common.js',
|
||||||
|
'/common/visible.js',
|
||||||
|
'/common/notify.js',
|
||||||
|
'/bower_components/tweetnacl/nacl-fast.min.js',
|
||||||
|
], function ($, Crypto, realtimeInput, Toolbar, Cryptpad, Visible, Notify) {
|
||||||
|
var Messages = Cryptpad.Messages;
|
||||||
|
window.Nacl = window.nacl;
|
||||||
|
$(function () {
|
||||||
|
|
||||||
|
var ifrw = $('#pad-iframe')[0].contentWindow;
|
||||||
|
var $iframe = $('#pad-iframe').contents();
|
||||||
|
|
||||||
|
Cryptpad.addLoadingScreen();
|
||||||
|
|
||||||
|
var andThen = function () {
|
||||||
|
var $bar = $iframe.find('.toolbar-container');
|
||||||
|
var secret = Cryptpad.getSecrets();
|
||||||
|
var readOnly = secret.keys && !secret.keys.editKeyStr;
|
||||||
|
if (!secret.keys) {
|
||||||
|
secret.keys = secret.key;
|
||||||
|
}
|
||||||
|
|
||||||
|
var $mt = $iframe.find('#encryptedFile');
|
||||||
|
$mt.attr('src', './assets/image.png-encrypted');
|
||||||
|
$mt.attr('data-crypto-key', 'TBo77200c0e/FdldQFcnQx4Y');
|
||||||
|
$mt.attr('data-type', 'image/png');
|
||||||
|
require(['/common/media-tag.js'], function (MediaTag) {
|
||||||
|
MediaTag($mt[0]);
|
||||||
|
Cryptpad.removeLoadingScreen();
|
||||||
|
var configTb = {
|
||||||
|
displayed: ['useradmin', 'newpad'],
|
||||||
|
ifrw: ifrw,
|
||||||
|
common: Cryptpad
|
||||||
|
};
|
||||||
|
toolbar = Toolbar.create($bar, null, null, null, null, configTb);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
Cryptpad.ready(function (err, anv) {
|
||||||
|
andThen();
|
||||||
|
Cryptpad.reportAppUsage();
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
Loading…
x
Reference in New Issue
Block a user