diff options
-rw-r--r-- | app.js | 4 | ||||
-rw-r--r-- | app.json | 4 | ||||
-rw-r--r-- | config.json.example | 1 | ||||
-rw-r--r-- | docs/configuration.md | 25 | ||||
-rw-r--r-- | lib/config/default.js | 1 | ||||
-rw-r--r-- | lib/config/environment.js | 1 | ||||
-rw-r--r-- | lib/config/index.js | 5 | ||||
-rw-r--r-- | lib/web/statusRouter.js | 3 | ||||
-rw-r--r-- | locales/ml.json | 130 | ||||
-rw-r--r-- | public/js/index.js | 2 | ||||
-rw-r--r-- | public/js/lib/common/constant.ejs | 2 | ||||
-rw-r--r-- | public/js/lib/common/login.js | 4 | ||||
-rw-r--r-- | public/js/lib/editor/index.js | 16 | ||||
-rw-r--r-- | public/js/locale.js | 2 | ||||
-rw-r--r-- | public/views/index/body.ejs | 1 |
15 files changed, 174 insertions, 27 deletions
@@ -120,7 +120,7 @@ if (config.csp.enable) { } i18n.configure({ - locales: ['en', 'zh-CN', 'zh-TW', 'fr', 'de', 'ja', 'es', 'ca', 'el', 'pt', 'it', 'tr', 'ru', 'nl', 'hr', 'pl', 'uk', 'hi', 'sv', 'eo', 'da', 'ko', 'id', 'sr', 'vi', 'ar', 'cs', 'sk'], + locales: ['en', 'zh-CN', 'zh-TW', 'fr', 'de', 'ja', 'es', 'ca', 'el', 'pt', 'it', 'tr', 'ru', 'nl', 'hr', 'pl', 'uk', 'hi', 'sv', 'eo', 'da', 'ko', 'id', 'sr', 'vi', 'ar', 'cs', 'sk', 'ml'], cookie: 'locale', indent: ' ', // this is the style poeditor.com exports it, this creates less churn directory: path.join(__dirname, '/locales'), @@ -147,7 +147,7 @@ app.use(session({ rolling: true, // reset maxAge on every response cookie: { maxAge: config.sessionLife, - sameSite: 'lax', + sameSite: config.cookiePolicy, // be careful: setting a SameSite value of none without https breaks the editor secure: config.useSSL || config.protocolUseSSL || false }, store: sessionStore @@ -56,6 +56,10 @@ "description": "set to use ssl protocol for resources path (only applied when domain is set)", "required": false }, + "CMD_COOKIE_POLICY": { + "description": "Set whether cookies should be sent cross-origin (SameSite value)", + "required": false + }, "CMD_URL_ADDPORT": { "description": "set to add port on callback url (port 80 or 443 won't applied) (only applied when domain is set)", "required": false diff --git a/config.json.example b/config.json.example index 0366c3b2..84ae53bd 100644 --- a/config.json.example +++ b/config.json.example @@ -35,6 +35,7 @@ "addDisqus": true, "addGoogleAnalytics": true }, + "cookiePolicy": "strict", "db": { "username": "", "password": "", diff --git a/docs/configuration.md b/docs/configuration.md index a6f63168..af4f26ce 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -69,18 +69,19 @@ these are rarely used for various reasons. | `urlAddPort` | `CMD_URL_ADDPORT` | **`false`** or `true` | set to add port on callback URL (ports `80` or `443` won't be applied) (only applied when domain is set) | | `allowOrigin` | `CMD_ALLOW_ORIGIN` | **`['localhost']`**, `['codimd.org']`, `[localhost, codimd.org]` | domain name whitelist (use comma to separate) | -## CSP and HSTS - -| config file | environment | **default** and example value | description | -| ----------- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `hsts` | | `{"enable": true, "maxAgeSeconds": 31536000, "includeSubdomains": true, "preload": true}` | [HSTS](https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security) options to use with HTTPS (default is the example value, max age is a year) | -| | `CMD_HSTS_ENABLE` | **`true`** or `false` | set to enable [HSTS](https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security) if HTTPS is also enabled (default is ` true`) | -| | `CMD_HSTS_INCLUDE_SUBDOMAINS` | **`true`** or `false` | set to include subdomains in HSTS (default is `true`) | -| | `CMD_HSTS_MAX_AGE` | **`31536000`**, `60 * 60 * 24 * 365` | max duration in seconds to tell clients to keep HSTS status (default is a year) | -| | `CMD_HSTS_PRELOAD` | **`true`** or `false` | whether to allow preloading of the site's HSTS status (e.g. into browsers) | -| `csp` | | `{"enable": true, "directives": {"scriptSrc": "trustworthy-scripts.example.com"}, "upgradeInsecureRequests": "auto", "addDefaults": true}` | Configures [Content Security Policy](https://helmetjs.github.io/docs/csp/). Directives are passed to Helmet - see [their documentation](https://helmetjs.github.io/docs/csp/) for more information on the format. Some defaults are added to the configured values so that the application doesn't break. To disable this behaviour, set `addDefaults` to `false`. Further, if `usecdn` is on, some CDN locations are allowed too. By default (`auto`), insecure (HTTP) requests are upgraded to HTTPS via CSP if `useSSL` is on. To change this behaviour, set `upgradeInsecureRequests` to either `true` or `false`. | -| | `CMD_CSP_ENABLE` | **`true`** or `false` | whether to enable Content Security Policy (directives cannot be configured with environment variables) | -| | `CMD_CSP_REPORTURI` | **`undefined`**, `https://<someid>.report-uri.com/r/d/csp/enforce` | Allows to add a URL for CSP reports in case of violations | +## Web security aspects + +| config file | environment | **default** and example value | description | +| -------------- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `hsts` | | `{"enable": true, "maxAgeSeconds": 31536000, "includeSubdomains": true, "preload": true}` | [HSTS](https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security) options to use with HTTPS (default is the example value, max age is a year) | +| | `CMD_HSTS_ENABLE` | **`true`** or `false` | set to enable [HSTS](https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security) if HTTPS is also enabled (default is ` true`) | +| | `CMD_HSTS_INCLUDE_SUBDOMAINS` | **`true`** or `false` | set to include subdomains in HSTS (default is `true`) | +| | `CMD_HSTS_MAX_AGE` | **`31536000`**, `60 * 60 * 24 * 365` | max duration in seconds to tell clients to keep HSTS status (default is a year) | +| | `CMD_HSTS_PRELOAD` | **`true`** or `false` | whether to allow preloading of the site's HSTS status (e.g. into browsers) | +| `csp` | | `{"enable": true, "directives": {"scriptSrc": "trustworthy-scripts.example.com"}, "upgradeInsecureRequests": "auto", "addDefaults": true}` | Configures [Content Security Policy](https://helmetjs.github.io/docs/csp/). Directives are passed to Helmet - see [their documentation](https://helmetjs.github.io/docs/csp/) for more information on the format. Some defaults are added to the configured values so that the application doesn't break. To disable this behaviour, set `addDefaults` to `false`. Further, if `usecdn` is on, some CDN locations are allowed too. By default (`auto`), insecure (HTTP) requests are upgraded to HTTPS via CSP if `useSSL` is on. To change this behaviour, set `upgradeInsecureRequests` to either `true` or `false`. | +| | `CMD_CSP_ENABLE` | **`true`** or `false` | whether to enable Content Security Policy (directives cannot be configured with environment variables) | +| | `CMD_CSP_REPORTURI` | **`undefined`**, `https://<someid>.report-uri.com/r/d/csp/enforce` | Allows to add a URL for CSP reports in case of violations | +| `cookiePolicy` | `CMD_COOKIE_POLICY` | **`lax`**, `strict` or `none` | Set a SameSite policy whether cookies are send from cross-origin. Be careful: setting a SameSite value of none without https breaks the editor | ## Privacy and External Requests diff --git a/lib/config/default.js b/lib/config/default.js index 9284882a..38bb164b 100644 --- a/lib/config/default.js +++ b/lib/config/default.js @@ -27,6 +27,7 @@ module.exports = { upgradeInsecureRequests: 'auto', reportURI: undefined }, + cookiePolicy: 'lax', protocolUseSSL: false, useCDN: false, allowAnonymous: true, diff --git a/lib/config/environment.js b/lib/config/environment.js index 2d76286f..cf9fb5a1 100644 --- a/lib/config/environment.js +++ b/lib/config/environment.js @@ -22,6 +22,7 @@ module.exports = { enable: toBooleanConfig(process.env.CMD_CSP_ENABLE), reportURI: process.env.CMD_CSP_REPORTURI }, + cookiePolicy: process.env.CMD_COOKIE_POLICY, protocolUseSSL: toBooleanConfig(process.env.CMD_PROTOCOL_USESSL), allowOrigin: toArrayConfig(process.env.CMD_ALLOW_ORIGIN), useCDN: toBooleanConfig(process.env.CMD_USECDN), diff --git a/lib/config/index.js b/lib/config/index.js index ee4817b3..b5461a8d 100644 --- a/lib/config/index.js +++ b/lib/config/index.js @@ -51,6 +51,11 @@ if (['debug', 'verbose', 'info', 'warn', 'error'].includes(config.loglevel)) { logger.error('Selected loglevel %s doesn\'t exist, using default level \'debug\'. Available options: debug, verbose, info, warn, error', config.loglevel) } +if (!['strict', 'lax', 'none'].includes(config.cookiePolicy)) { + logger.error('Cookie SameSite policy %s does not exist. Falling back to lax. Available values are: strict, lax, none.', config.cookiePolicy) + config.cookiePolicy = 'lax' +} + // load LDAP CA if (config.ldap.tlsca) { let ca = config.ldap.tlsca.split(',') diff --git a/lib/web/statusRouter.js b/lib/web/statusRouter.js index 025aafd4..febe2df3 100644 --- a/lib/web/statusRouter.js +++ b/lib/web/statusRouter.js @@ -97,7 +97,8 @@ statusRouter.get('/config', function (req, res) { version: config.fullversion, DROPBOX_APP_KEY: config.dropbox.appKey, allowedUploadMimeTypes: config.allowedUploadMimeTypes, - linkifyHeaderStyle: config.linkifyHeaderStyle + linkifyHeaderStyle: config.linkifyHeaderStyle, + cookiePolicy: config.cookiePolicy } res.set({ 'Cache-Control': 'private', // only cache by client diff --git a/locales/ml.json b/locales/ml.json new file mode 100644 index 00000000..cc91d4e6 --- /dev/null +++ b/locales/ml.json @@ -0,0 +1,130 @@ +{ + "Collaborative markdown notes": "സംയോജിത മാർക് ഡൗൺ കുറിപ്പുകൾ", + "Realtime collaborative markdown notes on all platforms.": "മാർക്ക് ഡൗൺ കുറിപ്പുകളിൽ ഏത് പ്ലാറ്റ് ഫോമിൽ നിന്നും തത്സമയം സഹകരിക്കാൻ", + "Best way to write and share your knowledge in markdown.": "മാർക് ഡൗൺ കുറിപ്പുകൾ എഴുതാനും പങ്കുവെക്കാനുമുള്ള ഏറ്റവും മികച്ച പ്ലാറ്റ്ഫോം ", + "Intro": "ആമുഖം ", + "History": "ചരിത്രം", + "New guest note": "പുതിയ അതിഥി കുറിപ്പ് ", + "Collaborate with URL": "തത്സമയ സഹകരണം", + "Support charts and MathJax": "ചാർട്ടുകളും മാത്ത്ജാക്സും കൈകാര്യം ചെയ്യുന്നു", + "Support slide mode": "സ്ലൈഡ് മോഡ് പിന്തുണക്കുന്നു", + "Sign In": "സൈൻ ഇൻ ", + "Below is the history from browser": "ഈ ബ്രൗസറിലെ ചരിത്രം ചുവടെ", + "Welcome!": "സ്വാഗതം!", + "New note": "പുതിയ കുറിപ്പ്", + "or": "അല്ലെങ്കിൽ", + "Sign Out": "സൈൻ ഔട്ട്", + "Explore all features": "എല്ലാ സൗകര്യങ്ങളും പരിശോധിക്കുക", + "Select tags...": "ടാഗുകൾ തിരഞ്ഞെടുക്കുക", + "Search keyword...": "സൂചകപദം തിരയുക ", + "Sort by title": "ശീർഷകക്രമത്തിൽ ", + "Title": "ശീർഷകം", + "Sort by time": "സമയക്രമത്തിൽ ", + "Time": "സമയം ", + "Export history": "ചരിത്രം പുറത്തെത്തിക്കുക", + "Import history": "ചരിത്രം അകത്തെത്തിക്കുക", + "Clear history": "ചരിത്രം കളയുക", + "Refresh history": "ചരിത്രം പുതുക്കുക", + "No history": "ചരിത്രമില്ല", + "Import from browser": "ബ്രൗസറിൽ നിന്നും കൊണ്ടുവരിക ", + "Releases": "പ്രസിദ്ധീകരണം ", + "Are you sure?": "തീർച്ചയാണോ?", + "Do you really want to delete this note?": "ഈ കുറിപ്പ് നശിപ്പിക്കാൻ ആഗ്രഹിക്കുന്നുവോ?", + "All users will lose their connection.": "എല്ലാവർക്കും ബന്ധം നഷ്ടപ്പെടും", + "Cancel": "ഉപേക്ഷിക്കുക ", + "Yes, do it!": "അതെ, ചെയ്യൂ", + "Choose method": "രീതി തിരഞ്ഞെടുക്കുക ", + "Sign in via %s": "%s വഴി സൈൻ ഇൻചെയ്യുക", + "New": "പുതിയത് ", + "Publish": "പ്രസിദ്ധീകരിക്കുക", + "Extra": "മറ്റുള്ള ", + "Revision": "തിരുത്തലുകൾ", + "Slide Mode": "സ്ലൈഡ് ബോർഡ് ", + "Export": "പുറത്തേക്ക്", + "Import": "അകത്തേക്ക്", + "Clipboard": "ക്ലിപ്ബോർഡ് ", + "Download": "ഡൌൺലോഡ് ", + "Raw HTML": "തനി HTML", + "Edit": "തിരുത്തുക ", + "View": "കാണുക", + "Both": "രണ്ടും ", + "Help": "സഹായം ", + "Upload Image": "ചിത്രം അപ്ലോഡ് ചെയ്യുക", + "Menu": "മെനു ", + "This page need refresh": "ഈ പേജ് പുതുക്കണം ", + "You have an incompatible client version.": "നിങ്ങളുടെ സംവിധാനത്തിന്റെ നിലവിലെ പതിപ്പ് പൊരുത്തപ്പെടുന്നില്ല ", + "Refresh to update.": "പുതുക്കാനായി വീണ്ടും തുറക്കൂ", + "New version available!": "പുതിയ പതിപ്പ് ലഭ്യമാണ്", + "See releases notes here": "പ്രസിദ്ധീകരണക്കുറിപ്പുകൾ ഇവിടെ ", + "Refresh to enjoy new features.": "പുതിയ സൗകര്യങ്ങൾക്കായി വീണ്ടും തുറക്കൂ ", + "Your user state has changed.": "നിങ്ങളുടെ സ്ഥിതി മാറി", + "Refresh to load new user state.": "പുതിയ സ്ഥിതിയ്ക്കായി വീണ്ടും തുറക്കൂ ", + "Refresh": "വീണ്ടും തുറക്കൂ ", + "Contacts": "ബന്ധങ്ങൾ ", + "Report an issue": "പ്രശ്നം പറയൂ ", + "Meet us on %s": "ഞങ്ങളെ %s-ൽ കാണാം", + "Send us email": "ഞങ്ങൾക്കൊരു ഇമെയിൽ അയക്കുക ", + "Documents": "രേഖകൾ", + "Features": "സൗകര്യങ്ങൾ", + "YAML Metadata": "YAML മെറ്റാഡാറ്റ", + "Slide Example": "സ്ലൈഡിന് ഉദാഹരണം ", + "Cheatsheet": "ചീറ്റ്ഷീറ്റ്", + "Example": "ഉദാഹരണം", + "Syntax": "സിന്റാക്സ്", + "Header": "തലക്കെട്ട് ", + "Unordered List": "ക്രമമില്ലാത്ത പട്ടിക ", + "Ordered List": "ക്രമത്തിലുള്ള പട്ടിക ", + "Todo List": "ഒത്തുനോക്കുക ", + "Blockquote": "ഉദ്ധരണികൂട്ടം ", + "Bold font": "കട്ടിയാക്കുക", + "Italics font": "ചെരിക്കുക", + "Strikethrough": "കുറുകെ വരക്കുക", + "Inserted text": "അടിവരയിട്ട വാചകം", + "Marked text": "എടുത്തുകാണിച്ച വാചകം", + "Link": "ലിങ്ക്", + "Image": "ചിത്രം", + "Code": "കോഡ്", + "Externals": "പുറത്തുള്ളത് ", + "This is a alert area.": "ഇതൊരു സൂചനാ സ്ഥലം ആണ് ", + "Revert": "തിരിച്ചാക്കുക", + "Import from clipboard": "ക്ലിപ് ബോർഡിൽ നിന്നും അകത്തെത്തിക്കുക", + "Paste your markdown or webpage here...": "നിങ്ങളുടെ മാർക്ക്ഡൗണോ വെബ്പേജോ ഇവിടെ പതിക്കുക ", + "Clear": "നീക്കം ചെയ്യുക", + "This note is locked": "ഈ കുറിപ്പ് പൂട്ടിയിരിക്കുന്നു ", + "Sorry, only owner can edit this note.": "ക്ഷമിക്കണം, ഉടമയ്ക്ക് മാത്രമേ ഇത് തിരുത്താനാകൂ", + "OK": "ശരി", + "Reach the limit": "പരിധി എത്തുക", + "Sorry, you've reached the max length this note can be.": "ക്ഷമിക്കണം, നിങ്ങൾ ഈ കുറിപ്പിനെത്താവുന്ന പരമാവധി വലിപ്പത്തിൽ എത്തിയിരിക്കുന്നു ", + "Please reduce the content or divide it to more notes, thank you!": "കുറിപ്പ് ചെറുതാക്കുക", + "Import from Gist": "സാരാംശം എടുക്കുക ", + "Paste your gist url here...": "സാരാംശത്തിലേക്കുള്ള വഴി ഇവിടെ പതിക്കുക ", + "Import from Snippet": "ശകലത്തിൽ നിന്നും കൊണ്ടുവരിക", + "Select From Available Projects": "ലഭ്യമായ പദ്ധതികളിൽ നിന്നും തിരഞ്ഞെടുക്കുക", + "Select From Available Snippets": "ലഭ്യമായ ശകലത്തിൽ നിന്നും തിരഞ്ഞെടുക്കുക", + "OR": "അല്ലെങ്കിൽ", + "Export to Snippet": "ശകലത്തിലേക്ക് മാറ്റുക ", + "Select Visibility Level": "കാഴ്ചയുടെ പരിധി തിരഞ്ഞെടുക്കുക", + "Night Theme": "ഇരുണ്ട ദൃശ്യം ", + "Follow us on %s and %s.": "ഞങ്ങളെ %s-ലും %s-ലും പിന്തുടരൂ", + "Privacy": "സ്വകാര്യത", + "Terms of Use": "ഉപയോഗനിർദേശങ്ങൾ", + "Do you really want to delete your user account?": "ഈ ഇടപാടുകൾ ശരിക്കും ഉപേക്ഷിക്കുകയാണോ ", + "This will delete your account, all notes that are owned by you and remove all references to your account from other notes.": "നിങ്ങളുടെ കുറിപ്പുകളും പരാമർശങ്ങളും ഉൾപ്പടെ നിങ്ങളുടെ എല്ലാ ഇടപാടുകളും ഇത് ഇല്ലാതാക്കും", + "Delete user": "ഉപയോക്താവിനെ കളയുക", + "Export user data": "ഉപയോക്താവിന്റെ വിവരങ്ങൾ പുറത്തെത്തിക്കുക ", + "Help us translating on %s": "%s ലേക്ക് പരിഭാഷപ്പെടുത്താൻ ഞങ്ങളെ സഹായിക്കൂ ", + "Source Code": "സോഴ്സ് കോഡ്", + "Register": "രജിസ്റ്റർ ", + "Powered by %s": "%s ന്റെ പിന്തുണയാൽ ", + "Help us translating": "പരിഭാഷപ്പെടുത്താൻ ഞങ്ങളെ സഹായിക്കുക", + "Join the community": "കൂട്ടായ്മയുടെ ഭാഗമാവൂ", + "Imprint": "അടയാളപ്പെടുത്തൂ ", + "Freely - Anyone can edit": "സ്വന്തന്ത്രം- ആർക്കും തിരുത്താം ", + "Editable - Signed-in people can edit": "തിരുത്താവുന്നതു - ഇടപാടുകാർക്കു മാത്രം ", + "Limited - Signed-in people can edit (forbid guests)": "പരിമിതം- ഇടപാടുകാർക്കു മാത്രം കാണാനും തിരുത്താനും (ഇടപാടുകാർക്കു കാണാം)", + "Locked - Only owner can edit": "പൂട്ടിയിരിക്കുന്നു- ഉപഭോക്താവിന് മാത്രം തിരുത്താം ", + "Protected - Only owner can edit (forbid guests)": "സംരക്ഷിച്ചിരിക്കുന്നു -ഉടമക്ക് മാത്രം തിരുത്താം (ഇടപാടുകാർക്കു കാണാം )", + "Private - Only owner can view & edit": "സ്വകാര്യം -ഉടമക്ക് മാത്രം കാണാനും തിരുത്താനും ", + "changed": "changed", + "created": "created" +}
\ No newline at end of file diff --git a/public/js/index.js b/public/js/index.js index 3eaba0ee..9946e6fd 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -1599,7 +1599,7 @@ function toggleNightMode () { } else { Cookies.set('nightMode', !isActive, { expires: 365, - sameSite: 'strict' + sameSite: window.cookiePolicy }) } } diff --git a/public/js/lib/common/constant.ejs b/public/js/lib/common/constant.ejs index 114a9077..2a32c333 100644 --- a/public/js/lib/common/constant.ejs +++ b/public/js/lib/common/constant.ejs @@ -8,3 +8,5 @@ window.allowedUploadMimeTypes = <%- JSON.stringify(allowedUploadMimeTypes) %> window.linkifyHeaderStyle = '<%- linkifyHeaderStyle %>' window.DROPBOX_APP_KEY = '<%- DROPBOX_APP_KEY %>' + +window.cookiePolicy = '<%- cookiePolicy %>' diff --git a/public/js/lib/common/login.js b/public/js/lib/common/login.js index 931c115f..3f7a3e4d 100644 --- a/public/js/lib/common/login.js +++ b/public/js/lib/common/login.js @@ -20,12 +20,12 @@ export function resetCheckAuth () { export function setLoginState (bool, id) { Cookies.set('loginstate', bool, { expires: 365, - sameSite: 'strict' + sameSite: window.cookiePolicy }) if (id) { Cookies.set('userid', id, { expires: 365, - sameSite: 'strict' + sameSite: window.cookiePolicy }) } else { Cookies.remove('userid') diff --git a/public/js/lib/editor/index.js b/public/js/lib/editor/index.js index 07ef58a1..d86ebf3c 100644 --- a/public/js/lib/editor/index.js +++ b/public/js/lib/editor/index.js @@ -304,13 +304,13 @@ export default class Editor { if (this.editor.getOption('indentWithTabs')) { Cookies.set('indent_type', 'tab', { expires: 365, - sameSite: 'strict' + sameSite: window.cookiePolicy }) type.text('Tab Size:') } else { Cookies.set('indent_type', 'space', { expires: 365, - sameSite: 'strict' + sameSite: window.cookiePolicy }) type.text('Spaces:') } @@ -322,12 +322,12 @@ export default class Editor { if (this.editor.getOption('indentWithTabs')) { Cookies.set('tab_size', unit, { expires: 365, - sameSite: 'strict' + sameSite: window.cookiePolicy }) } else { Cookies.set('space_units', unit, { expires: 365, - sameSite: 'strict' + sameSite: window.cookiePolicy }) } widthLabel.text(unit) @@ -396,7 +396,7 @@ export default class Editor { var keymap = this.editor.getOption('keyMap') Cookies.set('keymap', keymap, { expires: 365, - sameSite: 'strict' + sameSite: window.cookiePolicy }) label.text(keymap) this.restoreOverrideEditorKeymap() @@ -445,7 +445,7 @@ export default class Editor { this.editor.setOption('theme', theme) Cookies.set('theme', theme, { expires: 365, - sameSite: 'strict' + sameSite: window.cookiePolicy }) checkTheme() @@ -491,7 +491,7 @@ export default class Editor { } Cookies.set('spellcheck', mode === 'spell-checker', { expires: 365, - sameSite: 'strict' + sameSite: window.cookiePolicy }) checkSpellcheck() @@ -537,7 +537,7 @@ export default class Editor { if (overrideBrowserKeymap.is(':checked')) { Cookies.set('preferences-override-browser-keymap', true, { expires: 365, - sameSite: 'strict' + sameSite: window.cookiePolicy }) this.restoreOverrideEditorKeymap() } else { diff --git a/public/js/locale.js b/public/js/locale.js index aca35b98..8baa77fc 100644 --- a/public/js/locale.js +++ b/public/js/locale.js @@ -31,7 +31,7 @@ if (localeSelector.length > 0) { localeSelector.change(function () { Cookies.set('locale', $(this).val(), { expires: 365, - sameSite: 'strict' + sameSite: window.cookiePolicy }) window.location.reload() }) diff --git a/public/views/index/body.ejs b/public/views/index/body.ejs index 1f941f14..0f2b8f33 100644 --- a/public/views/index/body.ejs +++ b/public/views/index/body.ejs @@ -153,6 +153,7 @@ <option value="ar">العربية</option> <option value="cs">Česky</option> <option value="sk">Slovensky</option> + <option value="ml">മലയാളം</option> </select> <p> <%- __('Powered by %s', '<a href="https://codimd.org">CodiMD</a>') %> | <a href="<%- serverURL %>/s/release-notes" target="_blank" rel="noopener"><%= __('Releases') %></a> | <a href="<%- sourceURL %>" target="_blank" rel="noopener"><%= __('Source Code') %></a><% if(imprint) { %> | <a href="<%- serverURL %>/s/imprint" target="_blank" rel="noopener"><%= __('Imprint') %></a><% } %><% if(privacyStatement) { %> | <a href="<%- serverURL %>/s/privacy" target="_blank" rel="noopener"><%= __('Privacy') %></a><% } %><% if(termsOfUse) { %> | <a href="<%- serverURL %>/s/terms-of-use" target="_blank" rel="noopener"><%= __('Terms of Use') %></a><% } %> |