From 494a0d5f065f4c5ffdc8795f51cb747426df72b3 Mon Sep 17 00:00:00 2001 From: Sheogorath Date: Fri, 23 Nov 2018 17:10:31 +0100 Subject: [PATCH 01/10] Add some missing translations There are some places in our code that made it to be not translated. This patch fixes some small translation problems and adds some static strings in templates to translation. Signed-off-by: Sheogorath --- locales/en.json | 4 +++- public/views/index/body.ejs | 2 +- public/views/shared/signin-modal.ejs | 16 ++++++++-------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/locales/en.json b/locales/en.json index ead7ce2..262b5f7 100644 --- a/locales/en.json +++ b/locales/en.json @@ -113,5 +113,7 @@ "Delete user": "Delete user", "Export user data": "Export user data", "Help us translating on %s": "Help us translating on %s", - "Source Code": "Source Code" + "Source Code": "Source Code", + "Powered by": "Powered by", + "Register": "Register" } diff --git a/public/views/index/body.ejs b/public/views/index/body.ejs index a5e591e..3cab8bf 100644 --- a/public/views/index/body.ejs +++ b/public/views/index/body.ejs @@ -150,7 +150,7 @@

- Powered by CodiMD | <%= __('Releases') %>| <%= __('Source Code') %><% if(privacyStatement) { %> | <%= __('Privacy') %><% } %><% if(termsOfUse) { %> | <%= __('Terms of Use') %><% } %> + <%= __('Powered by') %> CodiMD | <%= __('Releases') %>| <%= __('Source Code') %><% if(privacyStatement) { %> | <%= __('Privacy') %><% } %><% if(termsOfUse) { %> | <%= __('Terms of Use') %><% } %>

Via <% if (authProviders.ldapProviderName) { %> <%= authProviders.ldapProviderName %> (LDAP) <% } else { %> LDAP <% } %>

+

<%= __('Sign in via %s', authProviders.ldapProviderName ? authProviders.ldapProviderName + ' (LDAP)' : 'LDAP') %>

@@ -73,7 +73,7 @@
- +
@@ -82,7 +82,7 @@
<% }%> <% if (authProviders.openID) { %> -

OpenID

+

<%= __('Sign in via %s', 'OpenID') %>

@@ -92,7 +92,7 @@
- +
@@ -101,11 +101,11 @@
<% }%> <% if (authProviders.email) { %> -

Via Email

+

<%= __('Sign in via %s', 'E-Mail') %>

- +
@@ -117,8 +117,8 @@
- - <% if (authProviders.allowEmailRegister) { %><% }%> + + <% if (authProviders.allowEmailRegister) { %><% }%>
From d982d8aaf267d9c453d042757ca0bd11869058e0 Mon Sep 17 00:00:00 2001 From: Luclu7 Date: Thu, 7 Feb 2019 20:47:43 +0100 Subject: [PATCH 02/10] Corrected a typo Signed-off-by: Luclu7 --- locales/fr.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locales/fr.json b/locales/fr.json index e455502..cf8787e 100644 --- a/locales/fr.json +++ b/locales/fr.json @@ -110,8 +110,8 @@ "Terms of Use": "Conditions d'utilisation", "Do you really want to delete your user account?": "Voulez-vous vraiment supprimer votre compte utilisateur", "This will delete your account, all notes that are owned by you and remove all references to your account from other notes.": "Cela supprimera votre compte, toutes les notes dont vous êtes propriétaire et supprimera toute référence à votre compte dans les autres notes.", - "Delete user": "Suprrimez l'utilisteur", + "Delete user": "Supprimer l'utilisteur", "Export user data": "Exportez les données utilisateur", "Help us translating on %s": "Aidez nous à traduire sur %s", "Source Code": "Code source" -} \ No newline at end of file +} From 6aab032709f29fcc3636b8ee04ff617175b3c7bf Mon Sep 17 00:00:00 2001 From: toshi0123 <7948737+toshi0123@users.noreply.github.com> Date: Wed, 27 Feb 2019 17:23:58 +0900 Subject: [PATCH 03/10] Fix empty serverURL did not redirect properly Signed-off-by: toshi0123 <7948737+toshi0123@users.noreply.github.com> --- lib/response.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/response.js b/lib/response.js index 8191e74..76793a4 100644 --- a/lib/response.js +++ b/lib/response.js @@ -23,7 +23,7 @@ var response = { responseError(res, '403', 'Forbidden', 'oh no.') } else { req.flash('error', 'You are not allowed to access this page. Maybe try logging in?') - res.redirect(config.serverURL) + res.redirect(config.serverURL + '/') } }, errorNotFound: function (res) { From 32a1afbe86a8c94fd3bcf8374f77aac3bf80d69e Mon Sep 17 00:00:00 2001 From: Sheogorath Date: Mon, 4 Mar 2019 16:59:32 +0100 Subject: [PATCH 04/10] Fix wrong value type in example config HSTS maxAge has to be an integer, not a string. Fixes https://github.com/hackmdio/codimd/issues/1159 Signed-off-by: Sheogorath --- config.json.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.json.example b/config.json.example index fe8c810..cb2bf3a 100644 --- a/config.json.example +++ b/config.json.example @@ -20,7 +20,7 @@ "loglevel": "info", "hsts": { "enable": true, - "maxAgeSeconds": "31536000", + "maxAgeSeconds": 31536000, "includeSubdomains": true, "preload": true }, From b51a048777ee36bc47d2a23599ad72091197b075 Mon Sep 17 00:00:00 2001 From: Sheogorath Date: Mon, 4 Mar 2019 17:13:33 +0100 Subject: [PATCH 05/10] Fix wrong value type for HSTS environment variable Seem like also environment variables are affected. This patch fixes that as well. Signed-off-by: Sheogorath --- lib/config/environment.js | 2 +- lib/config/hackmdEnvironment.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/config/environment.js b/lib/config/environment.js index a57fe0d..fc757cf 100644 --- a/lib/config/environment.js +++ b/lib/config/environment.js @@ -14,7 +14,7 @@ module.exports = { useSSL: toBooleanConfig(process.env.CMD_USESSL), hsts: { enable: toBooleanConfig(process.env.CMD_HSTS_ENABLE), - maxAgeSeconds: process.env.CMD_HSTS_MAX_AGE, + maxAgeSeconds: toIntegerConfig(process.env.CMD_HSTS_MAX_AGE), includeSubdomains: toBooleanConfig(process.env.CMD_HSTS_INCLUDE_SUBDOMAINS), preload: toBooleanConfig(process.env.CMD_HSTS_PRELOAD) }, diff --git a/lib/config/hackmdEnvironment.js b/lib/config/hackmdEnvironment.js index e1c1156..bc20e58 100644 --- a/lib/config/hackmdEnvironment.js +++ b/lib/config/hackmdEnvironment.js @@ -10,7 +10,7 @@ module.exports = { useSSL: toBooleanConfig(process.env.HMD_USESSL), hsts: { enable: toBooleanConfig(process.env.HMD_HSTS_ENABLE), - maxAgeSeconds: process.env.HMD_HSTS_MAX_AGE, + maxAgeSeconds: toIntegerConfig(process.env.HMD_HSTS_MAX_AGE), includeSubdomains: toBooleanConfig(process.env.HMD_HSTS_INCLUDE_SUBDOMAINS), preload: toBooleanConfig(process.env.HMD_HSTS_PRELOAD) }, From 13ee05ba0d8907156f465f2b494e663b416b641d Mon Sep 17 00:00:00 2001 From: Turakar Date: Fri, 1 Mar 2019 12:27:13 +0100 Subject: [PATCH 06/10] Mention dependency on libssl-dev in README.md This dependency was introduced by upgrading to the new scrypt version in commit cee2aa92f9244d1dcfc65c5553f5d7f0bbfb3871. Signed-off-by: Tilman Hoffbauer --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6abe930..fc428fa 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,7 @@ Just to more confusion: We are still friends with HackMD :heart: - Node.js 6.x or up (test up to 7.5.0) and <10.x - Database (PostgreSQL, MySQL, MariaDB, SQLite, MSSQL) use charset `utf8` - npm (and its dependencies, especially [uWebSockets](https://github.com/uWebSockets/uWebSockets#nodejs-developers), [node-gyp](https://github.com/nodejs/node-gyp#installation)) +- `libssl-dev` for building scrypt (see [here](https://github.com/ml1nk/node-scrypt/blob/master/README.md#installation-instructions) for further information) - For **building** CodiMD we recommend to use a machine with at least **2GB** RAM ### Instructions From bcb7972607a1b377e5f0d15817798327d1c4fb8b Mon Sep 17 00:00:00 2001 From: Sheogorath Date: Fri, 25 Jan 2019 19:48:31 +0100 Subject: [PATCH 07/10] Fix shown but broken GitLab snippets To provide a GitLab integration we need the GitLab integration to be configured. Otherwise we shouldn't show the Snippet button. This patch adds the requirement to the variable that decides if the import from snippets button shows up or not. Signed-off-by: Sheogorath --- lib/config/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/config/index.js b/lib/config/index.js index cbe6c39..e5d02dc 100644 --- a/lib/config/index.js +++ b/lib/config/index.js @@ -128,7 +128,7 @@ if (config.gitlab && config.gitlab.version !== 'v4' && config.gitlab.version !== config.gitlab.version = 'v4' } // If gitlab scope is api, enable snippets Export/import -config.isGitlabSnippetsEnable = (!config.gitlab.scope || config.gitlab.scope === 'api') +config.isGitlabSnippetsEnable = (!config.gitlab.scope || config.gitlab.scope === 'api') && config.isGitLabEnable // Only update i18n files in development setups config.updateI18nFiles = (env === Environment.development) From cda878d3777b7cd57b70b48f9418ec5dd9c2d702 Mon Sep 17 00:00:00 2001 From: Sheogorath Date: Sat, 9 Mar 2019 14:42:06 +0100 Subject: [PATCH 08/10] Add required change for Google+ API deprecation Since Google+ is shutting down soon, we need to get the profile data from another URL. Since the library already supports it, all we need to do is adding a single line of code. Details: https://github.com/hackmdio/codimd/issues/1160 Signed-off-by: Sheogorath --- lib/web/auth/google/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/web/auth/google/index.js b/lib/web/auth/google/index.js index 60282cf..0a4fd55 100644 --- a/lib/web/auth/google/index.js +++ b/lib/web/auth/google/index.js @@ -11,7 +11,8 @@ let googleAuth = module.exports = Router() passport.use(new GoogleStrategy({ clientID: config.google.clientID, clientSecret: config.google.clientSecret, - callbackURL: config.serverURL + '/auth/google/callback' + callbackURL: config.serverURL + '/auth/google/callback', + userProfileURL: "https://www.googleapis.com/oauth2/v3/userinfo" }, passportGeneralCallback)) googleAuth.get('/auth/google', function (req, res, next) { From 982775f6dc12f36bc3857e6d1f9816483f0c71b1 Mon Sep 17 00:00:00 2001 From: Sheogorath Date: Sat, 9 Mar 2019 15:03:53 +0100 Subject: [PATCH 09/10] Fix broken HTML export with emojis HTML export was broken due to missing alt-attribute for emojis. This patch adds the old alt-element style and restores the exportability this way. Signed-off-by: Sheogorath --- public/js/extra.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/extra.js b/public/js/extra.js index f8e0eb2..b80290d 100644 --- a/public/js/extra.js +++ b/public/js/extra.js @@ -1134,7 +1134,7 @@ const emojijsPlugin = new Plugin( (match, utils) => { const emoji = match[1].toLowerCase() - const div = $(``) + const div = $(`:${emoji}:`) return div[0].outerHTML } ) From 5e634aef87861a396ec6c79e6e2b126ac44af5d3 Mon Sep 17 00:00:00 2001 From: Sheogorath Date: Sun, 10 Mar 2019 01:43:02 +0100 Subject: [PATCH 10/10] Fix possible order changes for 'Powered by' in other languages Since not all languages use the same word oder and we run into potential issues, where the translation of powered by need to add something after the CodiMD link, this should give us the needed flexiblity. Signed-off-by: Sheogorath --- locales/en.json | 2 +- public/views/index/body.ejs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/locales/en.json b/locales/en.json index 262b5f7..15ed6e4 100644 --- a/locales/en.json +++ b/locales/en.json @@ -114,6 +114,6 @@ "Export user data": "Export user data", "Help us translating on %s": "Help us translating on %s", "Source Code": "Source Code", - "Powered by": "Powered by", + "Powered by %s": "Powered by %s", "Register": "Register" } diff --git a/public/views/index/body.ejs b/public/views/index/body.ejs index 3cab8bf..40ff9db 100644 --- a/public/views/index/body.ejs +++ b/public/views/index/body.ejs @@ -150,7 +150,7 @@

- <%= __('Powered by') %> CodiMD | <%= __('Releases') %>| <%= __('Source Code') %><% if(privacyStatement) { %> | <%= __('Privacy') %><% } %><% if(termsOfUse) { %> | <%= __('Terms of Use') %><% } %> + <%- __('Powered by %s', 'CodiMD') %> | <%= __('Releases') %>| <%= __('Source Code') %><% if(privacyStatement) { %> | <%= __('Privacy') %><% } %><% if(termsOfUse) { %> | <%= __('Terms of Use') %><% } %>