diff --git a/bower.json b/bower.json index e2763ccfd..809fd5323 100644 --- a/bower.json +++ b/bower.json @@ -31,7 +31,7 @@ "hyperjson": "~1.4.0", "chainpad-crypto": "^0.1.8", "chainpad-listmap": "^0.5.0", - "chainpad": "^5.0.0", + "chainpad": "^5.1.0", "chainpad-netflux": "^0.7.0", "file-saver": "1.3.1", "alertifyjs": "1.0.11", diff --git a/customize.dist/login.js b/customize.dist/login.js index 1f8cebab5..dd40ad831 100644 --- a/customize.dist/login.js +++ b/customize.dist/login.js @@ -154,6 +154,7 @@ define([ proxy.login_name = uname; proxy[Constants.displayNameKey] = uname; sessionStorage.createReadme = 1; + if (!shouldImport) { proxy.version = 5; } Feedback.send('REGISTRATION', true); } else { Feedback.send('LOGIN', true); diff --git a/customize.dist/src/less2/include/infopages.less b/customize.dist/src/less2/include/infopages.less index b07b90aa8..4282b3499 100644 --- a/customize.dist/src/less2/include/infopages.less +++ b/customize.dist/src/less2/include/infopages.less @@ -161,6 +161,7 @@ background-size: contain; height: 50px; width: 250px; + margin-right: 0; } a { border: 2px solid transparent; @@ -169,7 +170,8 @@ .nav-link { padding: 0.5em 0.7em; &:hover { - transform: scale(1.05); + font-size: 1.05em; + //transform: scale(1.05); }; } .cp-register-btn { @@ -184,9 +186,18 @@ color: #4591C4; } } -@media (max-width: 991px) { +@media (max-width: 1000px) { #menuCollapse { text-align: right; +/* @media (min-width: 576px) { + top: 100%; + background: rgba(255,255,255,0.8); + position: absolute; + right: 0px; + padding: 0 20px; + z-index: 1; + } +*/ } .navbar-nav a { text-align: right !important; @@ -194,7 +205,7 @@ .cp-register-btn { margin-right: 13px; text-align: center; - } + } } //footer general styles diff --git a/customize.dist/src/less2/pages/page-register.less b/customize.dist/src/less2/pages/page-register.less index 6336c6aa3..e8f49a850 100644 --- a/customize.dist/src/less2/pages/page-register.less +++ b/customize.dist/src/less2/pages/page-register.less @@ -23,11 +23,7 @@ } margin-top: 16px; font-size: 1.25em; - min-width: 30%; // conflict? - width: 30%; - @media (max-width: 500px) { - width: 45%; - } + min-width: 30%; } } padding-bottom: 3em; diff --git a/customize.dist/translations/messages.fr.js b/customize.dist/translations/messages.fr.js index 05845a83c..86f960bcb 100644 --- a/customize.dist/translations/messages.fr.js +++ b/customize.dist/translations/messages.fr.js @@ -37,6 +37,7 @@ define(function () { out.chainpadError = 'Une erreur critique est survenue lors de la mise à jour du contenu. Le pad est désormais en mode lecture seule afin de s\'assurer que vous ne perdiez pas davantage de données.
' + 'Appuyez sur Échap pour voir le pad ou rechargez la page pour pouvoir le modifier à nouveau.'; out.errorCopy = ' Vous pouvez toujours copier son contenu ailleurs en appuyant sur Échap.
Dés que vous aurez quitté la page, il sera impossible de le récupérer.'; + out.errorRedirectToHome = 'Appuyez sur Échap pour retourner vers votre CryptDrive.'; out.loading = "Chargement..."; out.error = "Erreur"; diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js index ce2868783..ddaa1158f 100644 --- a/customize.dist/translations/messages.js +++ b/customize.dist/translations/messages.js @@ -38,6 +38,7 @@ define(function () { out.chainpadError = 'A critical error occurred when updating your content. This page is in read-only mode to make sure you won\'t lose your work.
' + 'Hit Esc to continue to view this pad, or reload to try editing again.'; out.errorCopy = ' You can still copy the content to another location by pressing Esc.
Once you leave this page, it will disappear forever!'; + out.errorRedirectToHome = 'Press Esc to be redirected to your CryptDrive.'; out.loading = "Loading..."; out.error = "Error"; diff --git a/docs/example.nginx.conf b/docs/example.nginx.conf index d56920bf5..44b12ade8 100644 --- a/docs/example.nginx.conf +++ b/docs/example.nginx.conf @@ -75,6 +75,12 @@ server { } location ^~ /blob/ { + add_header Cache-Control max-age=31536000; + try_files $uri =404; + } + + location ^~ /datastore/ { + add_header Cache-Control max-age=0; try_files $uri =404; } diff --git a/server.js b/server.js index 1ff289f64..aac8d7513 100644 --- a/server.js +++ b/server.js @@ -123,6 +123,9 @@ app.get(mainPagePattern, Express.static(__dirname + '/customize.dist')); app.use("/blob", Express.static(Path.join(__dirname, (config.blobPath || './blob')), { maxAge: DEV_MODE? "0d": "365d" })); +app.use("/datastore", Express.static(Path.join(__dirname, (config.filePath || './datastore')), { + maxAge: "0d" +})); app.use("/customize", Express.static(__dirname + '/customize')); app.use("/customize", Express.static(__dirname + '/customize.dist')); diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index fab9dfcfd..11d20ce56 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -650,6 +650,12 @@ define([ Cryptpad.getMetadata(waitFor(function (err, m) { cpNfCfg.owners = [m.priv.edPublic]; })); + } else if (isNewFile && !cfg.useCreationScreen && window.location.hash) { + console.log("new file with hash in the address bar in an app without pcs and which requires owners"); + sframeChan.onReady(function () { + sframeChan.query("EV_LOADING_ERROR", "DELETED"); + }); + waitFor.abort(); } }).nThen(function () { Object.keys(rtConfig).forEach(function (k) { diff --git a/www/common/sframe-common.js b/www/common/sframe-common.js index c909c01f2..ab3c2389d 100644 --- a/www/common/sframe-common.js +++ b/www/common/sframe-common.js @@ -435,6 +435,15 @@ define([ Feedback.init(feedback); } catch (e) { Feedback.init(false); } + ctx.sframeChan.on('EV_LOADING_ERROR', function (err) { + if (err === 'DELETED') { + var msg = Messages.deletedError + '
' + Messages.errorRedirectToHome; + UI.errorLoadingScreen(msg, false, function () { + funcs.gotoURL('/drive/'); + }); + } + }); + ctx.sframeChan.on('EV_LOGOUT', function () { $(window).on('keyup', function (e) { if (e.keyCode === 27) { diff --git a/www/common/sframe-protocol.js b/www/common/sframe-protocol.js index 4c3046ad9..8142694ce 100644 --- a/www/common/sframe-protocol.js +++ b/www/common/sframe-protocol.js @@ -227,4 +227,7 @@ define({ // This is for sending data out of the iframe when we are in testing mode // The exact protocol is defined in common/test.js 'EV_TESTDATA': true, + + // Critical error outside the iframe during loading screen + 'EV_LOADING_ERROR': true, }); diff --git a/www/drive/inner.js b/www/drive/inner.js index ae0328491..df9708d97 100644 --- a/www/drive/inner.js +++ b/www/drive/inner.js @@ -2096,7 +2096,7 @@ define([ var parsed = Hash.parsePadUrl(href); var $table = $(''); var $icon = $('
', {'rowspan': '3', 'class': 'cp-app-drive-search-icon'}) - .append(getFileIcon(href)); + .append(getFileIcon(r.id)); var $title = $('', { 'class': 'cp-app-drive-search-col1 cp-app-drive-search-title' }).text(r.data.title) diff --git a/www/profile/main.js b/www/profile/main.js index 2449ea96b..c4b3847a4 100644 --- a/www/profile/main.js +++ b/www/profile/main.js @@ -53,7 +53,11 @@ define([ return void cb(null, Hash.getSecrets('profile', editHash)); } // 3rd case: profile creation (create a new random hash, store it later if needed) - if (!Utils.LocalStore.isLoggedIn()) { return void cb(); } + if (!Utils.LocalStore.isLoggedIn()) { + // Unregistered users can't create a profile + window.location.href = '/drive'; + return void cb(); + } var hash = Hash.createRandomHash(); var secret = Hash.getSecrets('profile', hash); Cryptpad.pinPads([secret.channel], function (e) {