Merge branch 'staging' into communities-kanban
commit
b85d0fc9df
@ -0,0 +1,45 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**Where did it happen?**
|
||||
Did the issue occur on CryptPad.fr or an instance hosted by a third-party?
|
||||
If on another instance, please provide its full URL.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Browser (please complete the following information):**
|
||||
- OS: [e.g. iOS]
|
||||
- Browser [e.g. firefox, tor browser, chrome, safari, brave, edge, ???]
|
||||
- variations [e.g. Firefox nightly, Firefox ESR, Chromium, Ungoogled chrome]
|
||||
- Version [e.g. 22]
|
||||
- Extensions installed (UBlock Origin, Passbolt, LibreJS]
|
||||
- Browser tweaks [e.g. firefox "Enhanced Tracking Protection" strict/custom mode, tor browser "safer" security level, chrome incognito mode]
|
||||
|
||||
**Smartphone (please complete the following information):**
|
||||
- Device: [e.g. iPhone6]
|
||||
- OS: [e.g. iOS8.1]
|
||||
- Browser [e.g. stock browser, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
@ -0,0 +1,86 @@
|
||||
var Default = module.exports;
|
||||
|
||||
Default.commonCSP = function (domain) {
|
||||
domain = ' ' + domain;
|
||||
// Content-Security-Policy
|
||||
|
||||
return [
|
||||
"default-src 'none'",
|
||||
"style-src 'unsafe-inline' 'self' " + domain,
|
||||
"font-src 'self' data:" + domain,
|
||||
|
||||
/* child-src is used to restrict iframes to a set of allowed domains.
|
||||
* connect-src is used to restrict what domains can connect to the websocket.
|
||||
*
|
||||
* it is recommended that you configure these fields to match the
|
||||
* domain which will serve your CryptPad instance.
|
||||
*/
|
||||
"child-src blob: *",
|
||||
// IE/Edge
|
||||
"frame-src blob: *",
|
||||
|
||||
/* this allows connections over secure or insecure websockets
|
||||
if you are deploying to production, you'll probably want to remove
|
||||
the ws://* directive, and change '*' to your domain
|
||||
*/
|
||||
"connect-src 'self' ws: wss: blob:" + domain,
|
||||
|
||||
// data: is used by codemirror
|
||||
"img-src 'self' data: blob:" + domain,
|
||||
"media-src * blob:",
|
||||
|
||||
// for accounts.cryptpad.fr authentication and cross-domain iframe sandbox
|
||||
"frame-ancestors *",
|
||||
""
|
||||
];
|
||||
};
|
||||
|
||||
Default.contentSecurity = function (domain) {
|
||||
return (Default.commonCSP(domain).join('; ') + "script-src 'self' resource: " + domain).replace(/\s+/g, ' ');
|
||||
};
|
||||
|
||||
Default.padContentSecurity = function (domain) {
|
||||
return (Default.commonCSP(domain).join('; ') + "script-src 'self' 'unsafe-eval' 'unsafe-inline' resource: " + domain).replace(/\s+/g, ' ');
|
||||
};
|
||||
|
||||
Default.httpHeaders = function () {
|
||||
return {
|
||||
"X-XSS-Protection": "1; mode=block",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"Access-Control-Allow-Origin": "*"
|
||||
};
|
||||
};
|
||||
|
||||
Default.mainPages = function () {
|
||||
return [
|
||||
'index',
|
||||
'privacy',
|
||||
'terms',
|
||||
'about',
|
||||
'contact',
|
||||
'what-is-cryptpad',
|
||||
'features',
|
||||
'faq',
|
||||
'maintenance'
|
||||
];
|
||||
};
|
||||
|
||||
/* By default the CryptPad server will run scheduled tasks every five minutes
|
||||
* If you want to run scheduled tasks in a separate process (like a crontab)
|
||||
* you can disable this behaviour by setting the following value to true
|
||||
*/
|
||||
//disableIntegratedTasks: false,
|
||||
|
||||
/* CryptPad's file storage adaptor closes unused files after a configurable
|
||||
* number of milliseconds (default 30000 (30 seconds))
|
||||
*/
|
||||
// channelExpirationMs: 30000,
|
||||
|
||||
/* CryptPad's file storage adaptor is limited by the number of open files.
|
||||
* When the adaptor reaches openFileLimit, it will clean up older files
|
||||
*/
|
||||
//openFileLimit: 2048,
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,76 @@
|
||||
/* jshint esversion: 6 */
|
||||
/* global Buffer */
|
||||
|
||||
const ToPull = require('stream-to-pull-stream');
|
||||
const Pull = require('pull-stream');
|
||||
|
||||
const Stream = module.exports;
|
||||
|
||||
// transform a stream of arbitrarily divided data
|
||||
// into a stream of buffers divided by newlines in the source stream
|
||||
// TODO see if we could improve performance by using libnewline
|
||||
const NEWLINE_CHR = ('\n').charCodeAt(0);
|
||||
const mkBufferSplit = () => {
|
||||
let remainder = null;
|
||||
return Pull((read) => {
|
||||
return (abort, cb) => {
|
||||
read(abort, function (end, data) {
|
||||
if (end) {
|
||||
if (data) { console.log("mkBufferSplit() Data at the end"); }
|
||||
cb(end, remainder ? [remainder, data] : [data]);
|
||||
remainder = null;
|
||||
return;
|
||||
}
|
||||
const queue = [];
|
||||
for (;;) {
|
||||
const offset = data.indexOf(NEWLINE_CHR);
|
||||
if (offset < 0) {
|
||||
remainder = remainder ? Buffer.concat([remainder, data]) : data;
|
||||
break;
|
||||
}
|
||||
let subArray = data.slice(0, offset);
|
||||
if (remainder) {
|
||||
subArray = Buffer.concat([remainder, subArray]);
|
||||
remainder = null;
|
||||
}
|
||||
queue.push(subArray);
|
||||
data = data.slice(offset + 1);
|
||||
}
|
||||
cb(end, queue);
|
||||
});
|
||||
};
|
||||
}, Pull.flatten());
|
||||
};
|
||||
|
||||
// return a streaming function which transforms buffers into objects
|
||||
// containing the buffer and the offset from the start of the stream
|
||||
const mkOffsetCounter = () => {
|
||||
let offset = 0;
|
||||
return Pull.map((buff) => {
|
||||
const out = { offset: offset, buff: buff };
|
||||
// +1 for the eaten newline
|
||||
offset += buff.length + 1;
|
||||
return out;
|
||||
});
|
||||
};
|
||||
|
||||
// readMessagesBin asynchronously iterates over the messages in a channel log
|
||||
// the handler for each message must call back to read more, which should mean
|
||||
// that this function has a lower memory profile than our classic method
|
||||
// of reading logs line by line.
|
||||
// it also allows the handler to abort reading at any time
|
||||
Stream.readFileBin = (stream, msgHandler, cb) => {
|
||||
//const stream = Fs.createReadStream(path, { start: start });
|
||||
let keepReading = true;
|
||||
Pull(
|
||||
ToPull.read(stream),
|
||||
mkBufferSplit(),
|
||||
mkOffsetCounter(),
|
||||
Pull.asyncMap((data, moreCb) => {
|
||||
msgHandler(data, moreCb, () => { keepReading = false; moreCb(); });
|
||||
}),
|
||||
Pull.drain(() => (keepReading), (err) => {
|
||||
cb((keepReading) ? err : undefined);
|
||||
})
|
||||
);
|
||||
};
|
Loading…
Reference in New Issue