diff --git a/.gitignore b/.gitignore index 139fab33c..fc1136152 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,5 @@ data npm-debug.log pins/ blob/ +blobstage/ privileged.conf diff --git a/.travis.yml b/.travis.yml index 4160b8719..09967f1f1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,12 @@ language: node_js env: matrix: - - "BROWSER='firefox:19:Windows 2012'" - - "BROWSER='chrome::Windows 2008'" + - "BROWSER='firefox::Windows 10'" + - "BROWSER='chrome::Windows 10'" + #- "BROWSER='MicrosoftEdge:14.14393:Windows 10'" + #- "BROWSER='internet explorer:11.103:Windows 10'" + #- "BROWSER='safari:10.0:macOS 10.12'" + #- "BROWSER='safari:9.0:OS X 10.11'" branches: only: - master diff --git a/TestSelenium.js b/TestSelenium.js index 9623577b5..fccd4e067 100644 --- a/TestSelenium.js +++ b/TestSelenium.js @@ -1,11 +1,13 @@ /* global process */ var WebDriver = require("selenium-webdriver"); +var nThen = require('nthen'); if (process.env.TRAVIS_PULL_REQUEST && process.env.TRAVIS_PULL_REQUEST !== 'false') { // We can't do saucelabs on pull requests so don't fail. return; } +// https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/ var driver; if (process.env.SAUCE_USERNAME !== undefined) { var browserArray = process.env.BROWSER.split(':'); @@ -21,18 +23,59 @@ if (process.env.SAUCE_USERNAME !== undefined) { driver = new WebDriver.Builder().withCapabilities({ browserName: "chrome" }).build(); } -driver.get('http://localhost:3000/assert/'); -var report = driver.wait(WebDriver.until.elementLocated(WebDriver.By.className("report")), 5000); -report.getAttribute("class").then(function (cls) { - report.getText().then(function (text) { - console.log("\n-----\n" + text + "\n-----"); - driver.quit(); - if (!cls) { - throw new Error("cls is null"); - } else if (cls.indexOf("failure") !== -1) { - throw new Error("cls contains the word failure"); - } else if (cls.indexOf("success") === -1) { - throw new Error("cls does not contain the word success"); - } - }); +var SC_GET_DATA = "return (window.__CRYPTPAD_TEST__) ? window.__CRYPTPAD_TEST__.getData() : '[]'"; + +var failed = false; +var nt = nThen; +[ + //'/register/#?test=test', + '/assert/#?test=test', + // '/auth/#?test=test' // TODO(cjd): Not working on automatic tests, understand why. +].forEach(function (path) { + if (failed) { return; } + var url = 'http://localhost:3000' + path; + nt = nt(function (waitFor) { + var done = waitFor(); + console.log('\n\n-----TEST ' + url + ' -----'); + var waitTo = setTimeout(function () { + console.log("no report in 20 seconds, timing out"); + failed = true; + done(); + done = undefined; + }, 20000); + var logMore = function () { + if (!done) { return; } + driver.executeScript(SC_GET_DATA).then(waitFor(function (dataS) { + if (!done) { return; } + var data = JSON.parse(dataS); + data.forEach(function (d) { + if (d.type !== 'log') { return; } + console.log('>' + d.val); + }); + data.forEach(function (d) { + if (d.type !== 'report') { return; } + console.log('RESULT: ' + d.val); + if (d.val !== 'passed') { + if (d.error) { + console.log(d.error.message); + console.log(d.error.stack); + } + failed = true; + } + clearTimeout(waitTo); + console.log('-----END TEST ' + url + ' -----'); + done(); + done = undefined; + }); + if (done) { setTimeout(logMore, 50); } + })); + }; + driver.get(url).then(waitFor(logMore)); + }).nThen; +}); + +nt(function (waitFor) { + driver.quit().then(waitFor(function () { + if (failed) { process.exit(100); } + })); }); diff --git a/bower.json b/bower.json index 5734be6ec..0c80203da 100644 --- a/bower.json +++ b/bower.json @@ -37,6 +37,7 @@ "diff-dom": "^2.1.1", "alertifyjs": "^1.0.11", "scrypt-async": "^1.2.0", - "bootstrap": "#v4.0.0-alpha.6" + "bootstrap": "#v4.0.0-alpha.6", + "pdfjs-dist": "^1.8.398" } } diff --git a/config.example.js b/config.example.js index 76bba6eae..d5b0c5dbf 100644 --- a/config.example.js +++ b/config.example.js @@ -10,7 +10,7 @@ module.exports = { // the port on which your httpd will listen - /* Cryptpad can be configured to send customized HTTP Headers + /* CryptPad can be configured to send customized HTTP Headers * These settings may vary widely depending on your needs * Examples are provided below */ @@ -31,15 +31,17 @@ module.exports = { * 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. + * domain which will serve your CryptPad instance. */ "child-src 'self' *", + "media-src *", + /* 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:", + "connect-src 'self' ws: wss: blob:", // data: is used by codemirror "img-src 'self' data: blob:", @@ -82,24 +84,24 @@ module.exports = { */ //websocketPort: 3000, - /* if you want to run a different version of cryptpad but using the same websocket + /* if you want to run a different version of CryptPad but using the same websocket * server, you should use the other server port as websocketPort and disable * the websockets on that server */ //useExternalWebsocket: false, - /* If Cryptpad is proxied without using https, the server needs to know. + /* If CryptPad is proxied without using https, the server needs to know. * Specify 'useSecureWebsockets: true' so that it can send * Content Security Policy Headers that prevent http and https from mixing */ useSecureWebsockets: false, - /* Cryptpad can log activity to stdout + /* CryptPad can log activity to stdout * This may be useful for debugging */ logToStdout: false, - /* Cryptpad supports verbose logging + /* CryptPad supports verbose logging * (false by default) */ verbose: false, @@ -116,6 +118,58 @@ module.exports = { 'contact', ], + /* Limits, Donations, Subscriptions and Contact + * + * By default, CryptPad limits every registered user to 50MB of storage. It also shows a + * donate button which allows for making a donation to support CryptPad development. + * + * You can either: + * A: Leave it exactly as it is. + * B: Hide the donate button. + * C: Change the donate button to a subscribe button, people who subscribe will get more + * storage on your instance and you get 50% of the revenue earned. + * + * CryptPad is developed by people who need to live and who deserve an equivilent life to + * what they would get at a company which monitizes user data. However, we intend to have + * a mutually positive relationship with every one of our users, including you. If you are + * getting value from CryptPad, you should be giving equal value back. + * + * If you are using CryptPad in a business context, please consider taking a support contract + * by contacting sales@cryptpad.fr + * + * If you choose A then there's nothing to do. + * + * If you choose B, set this variable to true and it will remove the donate button. + */ + removeDonateButton: false, + /* + * If you choose C, set allowSubscriptions to true, then set myDomain to the domain which people + * use to reach your CryptPad instance. Then contact sales@cryptpad.fr and tell us your domain. + * We will tell you what is needed to get paid. + */ + allowSubscriptions: false, + myDomain: 'i.did.not.read.my.config.myserver.tld', + + /* + * If you are using CryptPad internally and you want to increase the per-user storage limit, + * change the following value. + * + * Please note: This limit is what makes people subscribe and what pays for CryptPad + * development. Running a public instance that provides a "better deal" than cryptpad.fr + * is effectively using the project against itself. + */ + defaultStorageLimit: 50 * 1024 * 1024, + + /* + * By default, CryptPad also contacts our accounts server once a day to check for changes in + * the people who have accounts. This check-in will also send the version of your CryptPad + * instance and your email so we can reach you if we are aware of a serious problem. We will + * never sell it or send you marketing mail. If you want to block this check-in and remain + * completely invisible, set this and allowSubscriptions both to false. + */ + adminEmail: 'i.did.not.read.my.config@cryptpad.fr', + + /* You have the option of specifying an alternative storage adaptor. These status of these alternatives are specified in their READMEs, @@ -135,7 +189,7 @@ module.exports = { storage: './storage/file', /* - Cryptpad stores each document in an individual file on your hard drive. + CryptPad stores each document in an individual file on your hard drive. Specify a directory where files should be stored. It will be created automatically if it does not already exist. */ @@ -158,17 +212,17 @@ module.exports = { */ blobStagingPath: './blobstage', - /* Cryptpad's file storage adaptor closes unused files after a configurale + /* CryptPad's file storage adaptor closes unused files after a configurale * number of milliseconds (default 30000 (30 seconds)) */ channelExpirationMs: 30000, - /* Cryptpad's file storage adaptor is limited by the number of open files. + /* 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, - /* Cryptpad's socket server can be extended to respond to RPC calls + /* CryptPad's socket server can be extended to respond to RPC calls * you can configure it to respond to custom RPC calls if you like. * provide the path to your RPC module here, or `false` if you would * like to disable the RPC interface completely @@ -191,7 +245,7 @@ module.exports = { /* Setting this value to anything other than true will cause file upload * attempts to be rejected outright. */ - enableUploads: true, + enableUploads: false, /* If you have enabled file upload, you have the option of restricting it * to a list of users identified by their public keys. If this value is set @@ -203,9 +257,24 @@ module.exports = { * This is a temporary measure until a better quota system is in place. * registered users' public keys can be found on the settings page. */ - restrictUploads: true, + //restrictUploads: false, - /* it is recommended that you serve cryptpad over https + /* Max Upload Size (bytes) + * this sets the maximum size of any one file uploaded to the server. + * anything larger than this size will be rejected + */ + maxUploadSize: 20 * 1024 * 1024, + + /* clients can use the /settings/ app to opt out of usage feedback + * which informs the server of things like how much each app is being + * used, and whether certain clientside features are supported by + * the client's browser. The intent is to provide feedback to the admin + * such that the service can be improved. Enable this with `true` + * and ignore feedback with `false` or by commenting the attribute + */ + //logFeedback: true, + + /* it is recommended that you serve CryptPad over https * the filepaths below are used to configure your certificates */ //privKeyAndCertFiles: [ diff --git a/customize.dist/BottomBar.html b/customize.dist/BottomBar.html deleted file mode 100644 index c8d43dfce..000000000 --- a/customize.dist/BottomBar.html +++ /dev/null @@ -1,16 +0,0 @@ - -