Merge branch 'staging' into code2

pull/1/head
yflory 7 years ago
commit 0893bcc0e5

@ -9,15 +9,20 @@ mkdir -p customize
# Linking config.js
[ ! -h config.js ] && echo "Linking config.js" && ln -s customize/config.js config.js
# Thanks to http://stackoverflow.com/a/10467453
sedeasy() {
sed -i "s/$1/$(echo $2 | sed -e 's/[\/&]/\\&/g')/g" $3
}
# Configure
[ -n "$USE_SSL" ] && echo "Using secure websockets: $USE_SSL" \
&& sed -i "s/useSecureWebsockets: .*/useSecureWebsockets: ${USE_SSL},/g" customize/config.js
&& sedeasy "useSecureWebsockets: [^,]*," "useSecureWebsockets: ${USE_SSL}," customize/config.js
[ -n "$STORAGE" ] && echo "Using storage adapter: $STORAGE" \
&& sed -i "s/storage: .*/storage: ${STORAGE},/g" customize/config.js
&& sedeasy "storage: [^,]*," "storage: ${STORAGE}," customize/config.js
[ -n "$LOG_TO_STDOUT" ] && echo "Logging to stdout: $LOG_TO_STDOUT" \
&& sed -i "s/logToStdout: .*/logToStdout: ${LOG_TO_STDOUT},/g" customize/config.js
&& sedeasy "logToStdout: [^,]*," "logToStdout: ${LOG_TO_STDOUT}," customize/config.js
exec node ./server.js

@ -410,7 +410,7 @@ define([
}),
h('div.spinnerContainer',
h('span.fa.fa-circle-o-notch.fa-spin.fa-4x.fa-fw')),
h('p', Msg.loading)
h('p'),
])
);
};

@ -43,8 +43,6 @@
right: 0;
display: flex;
flex-flow: column;
height: 100vh;
width: 100vw;
}
.cke_toolbox_main {
display: inline-block;
@ -56,7 +54,7 @@
display: flex;
overflow: visible;
iframe {
height: 100%;
min-height: 100%;
width: 100%;
}
}

@ -695,6 +695,8 @@ define(function () {
out.tips.driveUpload = "Registered users can upload encrypted files by dragging and dropping them into their CryptDrive.";
out.tips.filenames = "You can rename files in your CryptDrive, this name is just for you.";
out.tips.drive = "Logged in users can organize their files in their CryptDrive, accessible from the CryptPad icon at the top left of all pads.";
out.tips.profile = "Registered users can create a profile from the user menu in the top right.";
out.tips.avatars = "You can upload an avatar in your profile. People will see it when you collaborate in a pad.";
out.feedback_about = "If you're reading this, you were probably curious why CryptPad is requesting web pages when you perform certain actions";
out.feedback_privacy = "We care about your privacy, and at the same time we want CryptPad to be very easy to use. We use this file to figure out which UI features matter to our users, by requesting it along with a parameter specifying which action was taken.";

@ -22,15 +22,6 @@ Or, using docker-compose
docker-compose up -d
```
## TODO
```
cryptpad_1 | Linking config.js
cryptpad_1 | Using secure websockets: true
cryptpad_1 | Using storage adapter: './storage/file'
cryptpad_1 | sed: -e expression #1, char 27: unknown option to `s'
```
## Configuration
Set configurations Dockerfile or in .env (using docker-compose) file.

@ -73,7 +73,7 @@ define([
var proxy = Cryptpad.getProxy();
var updateIndentSettings = function () {
var updateIndentSettings = APP.updateIndentSettings = function () {
var indentUnit = proxy[indentKey];
var useTabs = proxy[useTabsKey];
setIndentation(
@ -208,6 +208,9 @@ define([
$previewContainer.hide();
APP.$previewButton.removeClass('active');
$codeMirror.addClass('fullPage');
if (typeof(APP.updateIndentSettings) === 'function') {
APP.updateIndentSettings();
}
};
config.onInit = function (info) {

@ -10,7 +10,13 @@ define([
var module = { exports: {} };
var key = Config.requireConf.urlArgs;
var localStorage = window.localStorage || {};
var localStorage;
try {
localStorage = window.localStorage || {};
} catch (e) {
console.error(e);
localStorage = {};
}
var fixURL = function (url) {
var mark = (url.indexOf('?') !== -1) ? '&' : '?';

@ -1,4 +1,4 @@
define(function () {
define(['json.sortify'], function (Sortify) {
var module = {};
module.create = function (info, onLocal, Cryptget, Cryptpad) {
@ -15,6 +15,7 @@ define(function () {
var parsed = Cryptpad.parsePadUrl(window.location.href);
var appType = parsed ? parsed.type : undefined;
var oldUserData = {};
var addToUserData = exp.addToUserData = function(data) {
var users = userList.users;
for (var attrname in data) { userData[attrname] = data[attrname]; }
@ -28,6 +29,10 @@ define(function () {
}
if(userList && typeof userList.onChange === "function") {
// Make sure we don't update the userlist everytime someone makes a change to the pad
if (Sortify(oldUserData) === Sortify(userData)) { return; }
oldUserData = JSON.parse(JSON.stringify(userData));
userList.onChange(userData);
}
};

@ -1794,12 +1794,15 @@ define([
};
var $userAdmin = createDropdown(dropdownConfigUser);
var oldUrl;
if (account && !config.static && store) {
var $avatar = $userAdmin.find('.buttonTitle');
var updateButton = function (newName) {
var profile = store.getProfile();
var url = profile && profile.avatar;
if (oldUrl === url) { return; }
oldUrl = url;
$avatar.html('');
common.displayAvatar($avatar, url, newName, function ($img) {
if ($img) {

@ -18,14 +18,7 @@ define([
if (!document.body) { return; }
clearInterval(intr);
document.body.appendChild(elem);
require([
'/customize/messages.js',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
], function (Messages) {
document.getElementById('cp-loading-message').innerText = Messages.loading;
});
};
intr = setInterval(append, 100);
append();
});
});

@ -1,4 +1,4 @@
define([], function () {
define(['json.sortify'], function (Sortify) {
var UNINIT = 'uninitialized';
var create = function (sframeChan) {
var meta = UNINIT;
@ -102,7 +102,9 @@ define([], function () {
return Object.freeze({
updateMetadata: function (m) {
if (JSON.stringify(metadataObj) === JSON.stringify(m)) { return; }
// JSON.parse(JSON.stringify()) reorders the json, so we have to use sortify even
// if it's on our own computer
if (Sortify(metadataLazyObj) === Sortify(m)) { return; }
metadataObj = JSON.parse(JSON.stringify(m));
metadataLazyObj = JSON.parse(JSON.stringify(m));
change(false);

@ -1,30 +1,40 @@
// Stage 0, this gets cached which means we can't change it. boot2-sframe.js is changable.
// Note that this file is meant to be executed only inside of a sandbox iframe.
;(function () {
var req = JSON.parse(decodeURIComponent(window.location.hash.substring(1)));
req.cfg = req.cfg || {};
if (req.pfx) {
req.cfg.onNodeCreated = function (node /*, config, module, path*/) {
node.setAttribute('src', req.pfx + node.getAttribute('src'));
var afterLoaded = function (req) {
req.cfg = req.cfg || {};
if (req.pfx) {
req.cfg.onNodeCreated = function (node /*, config, module, path*/) {
node.setAttribute('src', req.pfx + node.getAttribute('src'));
};
}
require.config(req.cfg);
var txid = Math.random().toString(16).replace('0.', '');
var intr;
var ready = function () {
intr = setInterval(function () {
if (typeof(txid) !== 'string') { return; }
window.parent.postMessage(JSON.stringify({ q: 'READY', txid: txid }), '*');
}, 1);
};
}
require.config(req.cfg);
var txid = Math.random().toString(16).replace('0.', '');
var intr;
var ready = function () {
intr = setInterval(function () {
if (typeof(txid) !== 'string') { return; }
window.parent.postMessage(JSON.stringify({ q: 'READY', txid: txid }), '*');
}, 1);
};
if (req.req) { require(req.req, ready); } else { ready(); }
var onReply = function (msg) {
var data = JSON.parse(msg.data);
if (data.txid !== txid) { return; }
clearInterval(intr);
txid = {};
window.removeEventListener('message', onReply);
require(['/common/sframe-boot2.js'], function () { });
if (req.req) { require(req.req, ready); } else { ready(); }
var onReply = function (msg) {
var data = JSON.parse(msg.data);
if (data.txid !== txid) { return; }
clearInterval(intr);
txid = {};
window.removeEventListener('message', onReply);
require(['/common/sframe-boot2.js'], function () { });
};
window.addEventListener('message', onReply);
};
window.addEventListener('message', onReply);
var intr = setInterval(function () {
try {
var req = JSON.parse(decodeURIComponent(window.location.hash.substring(1)));
clearInterval(intr);
afterLoaded(req);
} catch (e) { console.error(e); }
}, 100);
}());

@ -208,15 +208,17 @@ define([
var $displayName = $userAdmin.find('.'+displayNameCls);
var $avatar = $userAdmin.find('.buttonTitle');
var oldUrl;
var updateButton = function () {
var myData = metadataMgr.getUserData();
if (!myData) { return; }
var newName = myData.name;
var url = myData.avatar;
$displayName.text(newName || Messages.anonymous);
if (accountName) {
if (accountName && oldUrl !== url) {
$avatar.html('');
UI.displayAvatar(Common, $avatar, url, newName, function ($img) {
oldUrl = url;
if ($img) {
$userAdmin.find('button').addClass('avatar');
}

@ -188,7 +188,6 @@ define([
var $editUsersList = $('<div>', {'class': 'userlist-others'});
// Editors
// TODO iframe enable friends
var pendingFriends = Common.getPendingFriends();
editUsersNames.forEach(function (data) {
var name = data.name || Messages.anonymous;

@ -2,7 +2,7 @@
<html class="cp pad">
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<script async data-bootload="/pad/inner.js" data-main="/common/sframe-boot.js?ver=1.1" src="/bower_components/requirejs/require.js?ver=2.3.5"></script>
<script async data-bootload="/pad/inner.js" data-main="/common/sframe-boot.js?ver=1.2" src="/bower_components/requirejs/require.js?ver=2.3.5"></script>
<style>
html, body {
margin: 0px;

@ -773,11 +773,18 @@ define([
}
// Used in ckeditor-config.js
Ckeditor.CRYPTPAD_URLARGS = ApiConfig.requireConf.urlArgs;
editor = Ckeditor.replace('editor1', {
module.ckeditor = editor = Ckeditor.replace('editor1', {
customConfig: '/customize/ckeditor-config.js',
});
editor.on('instanceReady', waitFor());
}).nThen(function (/*waitFor*/) {
/*if (Ckeditor.env.safari) {
var fixIframe = function () {
$('iframe.cke_wysiwyg_frame').height($('#cke_1_contents').height());
};
$(window).resize(fixIframe);
fixIframe();
}*/
Links.addSupportForOpeningLinksInNewTab(Ckeditor)({editor: editor});
Cryptpad.onError(function (info) {
if (info && info.type === "store") {

@ -176,7 +176,8 @@ define([
var $inputBlock = $('<div>', {
'class': 'inputBlock',
}).appendTo($div);
}).css('flex-flow', 'column')
.appendTo($div);
var $input = $('<input>', {
type: 'checkbox',
@ -186,16 +187,9 @@ define([
proxy[key] = val;
}).appendTo($inputBlock);
proxy.on('change', [key], function (o, n) { $input.val(n); });
$input[0].checked = !!proxy[key];
proxy.on('change', [key], function (o, n) { $input[0].checked = !!n; });
Cryptpad.getAttribute('indentUnit', function (e, val) {
if (e) { return void console.error(e); }
if (typeof(val) !== 'number') {
$input.val(2);
} else {
$input.val(val);
}
});
return $div;
};

Loading…
Cancel
Save