diff options
-rw-r--r-- | config.json.example | 2 | ||||
-rw-r--r-- | docs/configuration-config-file.md | 32 | ||||
-rw-r--r-- | docs/configuration-env-vars.md | 22 | ||||
-rw-r--r-- | docs/guides/providing-terms.md | 9 | ||||
-rw-r--r-- | lib/config/environment.js | 3 | ||||
-rw-r--r-- | lib/response.js | 1 | ||||
-rw-r--r-- | lib/web/imageRouter/s3.js | 4 | ||||
-rw-r--r-- | locales/de.json | 1 | ||||
-rw-r--r-- | locales/en.json | 1 | ||||
-rw-r--r-- | public/docs/yaml-metadata.md | 5 | ||||
-rw-r--r-- | public/views/index/body.ejs | 2 |
11 files changed, 49 insertions, 33 deletions
diff --git a/config.json.example b/config.json.example index d1c1cc5c..f627fadb 100644 --- a/config.json.example +++ b/config.json.example @@ -91,7 +91,7 @@ "saml": { "idpSsoUrl": "change: authentication endpoint of IdP", "idpCert": "change: certificate file path of IdP in PEM format", - "issuer": "change or delete: identity of the service provider (default: serverurl)", + "issuer": "change or delete: identity of the service provider (default: config.serverURL)", "identifierFormat": "change or delete: name identifier format (default: 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress')", "disableRequestedAuthnContext": "change or delete: true to allow any authentication method, false restricts to password authentication method (default: false)", "groupAttribute": "change or delete: attribute name for group list (ex: memberOf)", diff --git a/docs/configuration-config-file.md b/docs/configuration-config-file.md index b233cebe..39c5c204 100644 --- a/docs/configuration-config-file.md +++ b/docs/configuration-config-file.md @@ -26,13 +26,13 @@ to `config.json` before filling in your own details. | --------- | ------ | ----------- | | `allowPDFExport` | `true` | Whether or not PDF export is offered. | | `db` | `{ "dialect": "sqlite", "storage": "./db.codimd.sqlite" }` | set the db configs, [see more here](http://sequelize.readthedocs.org/en/latest/api/sequelize/) | -| `dbURL` | `mysql://localhost:3306/database` | set the db URL; if set, then db config (below) won't be applied | +| `dbURL` | `mysql://localhost:3306/database` | Set the db in URL style. If set, then the relevant `db` config entries will be overridden. | | `forbiddenNoteIDs` | `['robots.txt']` | disallow creation of notes, even if `allowFreeUrl` is `true` | -| `loglevel` | `info` | Defines what kind of logs are provided to stdout. | -| `imageUploadType` | `imgur`, `s3`, `minio`, `azure`, `lutim` or `filesystem`(default) | Where to upload images. For S3, see our Image Upload Guides for [S3](guides/s3-image-upload.md) or [Minio](guides/minio-image-upload.md)| +| `loglevel` | `info` | Defines what kind of logs are provided to stdout. Available options: `debug`, `verbose`, `info`, `warn`, `error` | +| `imageUploadType` | `imgur`, `s3`, `minio`, `azure`, `lutim` or `filesystem`(default) | Where to upload images. For S3, see our Image Upload Guides for [S3](guides/s3-image-upload.md) or [MinIO](guides/minio-image-upload.md)| | `sourceURL` | `https://github.com/codimd/server/tree/<current commit>` | Provides the link to the source code of CodiMD on the entry page (Please, make sure you change this when you run a modified version) | | `staticCacheTime` | `1 * 24 * 60 * 60 * 1000` | static file cache time | -| `tooBusyLag` | `70` | CPU time for one eventloop tick until node throttles connections. (milliseconds) | +| `tooBusyLag` | `70` | CPU time for one event loop tick until node throttles connections. (milliseconds) | | `heartbeatInterval` | `5000` | socket.io heartbeat interval | | `heartbeatTimeout` | `10000` | socket.io heartbeat timeout | | `documentMaxLength` | `100000` | note max length | @@ -81,20 +81,20 @@ these are rarely used for various reasons. | variables | example values | description | | --------- | ------ | ----------- | -| `allowGravatar` | `true` or `false` | set to `false` to disable gravatar as profile picture source on your instance | +| `allowGravatar` | `true` or `false` | set to `false` to disable Gravatar as profile picture source on your instance | | `useCDN` | `true` or `false` | set to use CDN resources or not (default is `true`) | ## Users and Privileges | variables | example values | description | | --------- | ------ | ----------- | -| `allowAnonymous` | `true` or `false` | set to allow anonymous usage (default is `true`) | -| `allowAnonymousEdits` | `true` or `false` | if `allowAnonymous` is `true`: allow users to select `freely` permission, allowing guests to edit existing notes (default is `false`) | -| `allowFreeURL` | `true` or `false` | set to allow new note creation by accessing a nonexistent note URL | -| `defaultPermission` | `freely`, `editable`, `limited`, `locked`, `protected` or `private` | set notes default permission (only applied on signed users) | -| `sessionName` | `connect.sid` | cookie session name | -| `sessionLife` | `14 * 24 * 60 * 60 * 1000` | cookie session life | -| `sessionSecret` | `secret` | cookie session secret | If none is set, one will randomly generated on each startup, meaning all your users will be logged out. | +| `allowAnonymous` | `true` or `false` | Set to allow anonymous usage (default is `true`). | +| `allowAnonymousEdits` | `true` or `false` | If `allowAnonymous` is `true`: allow users to select `freely` permission, allowing guests to edit existing notes (default is `false`). | +| `allowFreeURL` | `true` or `false` | Set to allow new note creation by accessing a nonexistent note URL. This is the behavior familiar from [Etherpad](https://github.com/ether/etherpad-lite). | +| `defaultPermission` | `freely`, `editable`, `limited`, `locked`, `protected` or `private` | Set notes default permission (only applied on signed-in users). | +| `sessionName` | `connect.sid` | Cookie session name. | +| `sessionLife` | `14 * 24 * 60 * 60 * 1000` (14 days) | Cookie session life time in milliseconds. | +| `sessionSecret` | `secret` | Cookie session secret. If none is set, one will randomly generated on each startup, meaning all your users will be logged out. | ## Login methods @@ -105,8 +105,8 @@ Most of these have never been documented for the config.json, feel free to expan | variables | example values | description | | --------- | ------ | ----------- | -| `email` | `true` or `false` | set to allow email signin | -| `allowEmailRegister` | `true` or `false` | set to allow email register (only applied when email is set, default is `true`. Note `bin/manage_users` might help you if registration is `false`.) | +| `email` | `true` or `false` | Set to allow email sign-in. The default is `true`. | +| `allowEmailRegister` | `true` or `false` | Set to allow registration of new accounts using an email address. If set to `false`, you can still create accounts using the command line - see `bin/manage_users` for details. This setting has no effect if `email` is `false`. The default for `allowEmailRegister` is `true`. | ### Dropbox Login ### Facebook Login @@ -138,8 +138,8 @@ Most of these have never been documented for the config.json, feel free to expan | `s3bucket` | `YOUR_S3_BUCKET_NAME` | bucket name when `imageUploadType` is set to `s3` or `minio` | ### Azure Blob Storage -### imgur -### Minio +### Imgur +### MinIO | variables | example values | description | | --------- | ------ | ----------- | diff --git a/docs/configuration-env-vars.md b/docs/configuration-env-vars.md index bc0eac99..1f44083e 100644 --- a/docs/configuration-env-vars.md +++ b/docs/configuration-env-vars.md @@ -30,12 +30,12 @@ defaultNotePath can't be set from env-vars | -------- | ------------- | ----------- | | `CMD_ALLOW_PDF_EXPORT` | `true` or `false` | Enable or disable PDF exports | | `CMD_CONFIG_FILE` | `/path/to/config.json` | optional override for the path to CodiMD's config file | -| `CMD_DB_URL` | `mysql://localhost:3306/database` | set the database URL | +| `CMD_DB_URL` | `mysql://localhost:3306/database` | Set the db in URL style. If set, then the relevant `db` config entries will be overridden. | | `CMD_LOGLEVEL` | `info`, `debug` ... | Defines what kind of logs are provided to stdout. | | `CMD_FORBIDDEN_NOTE_IDS` | `'robots.txt'` | disallow creation of notes, even if `CMD_ALLOW_FREEURL` is `true` | | `CMD_IMAGE_UPLOAD_TYPE` | `imgur`, `s3`, `minio`, `lutim` or `filesystem` | Where to upload images. For S3, see our Image Upload Guides for [S3](guides/s3-image-upload.md) or [Minio](guides/minio-image-upload.md), also there's a whole section on their respective env vars below. | | `CMD_SOURCE_URL` | `https://github.com/codimd/server/tree/<current commit>` | Provides the link to the source code of CodiMD on the entry page (Please, make sure you change this when you run a modified version) | -| `CMD_TOOBUSY_LAG` | `70` | CPU time for one eventloop tick until node throttles connections. (milliseconds) | +| `CMD_TOOBUSY_LAG` | `70` | CPU time for one event loop tick until node throttles connections. (milliseconds) | ## CodiMD Location @@ -76,11 +76,11 @@ defaultNotePath can't be set from env-vars | variable | example value | description | | -------- | ------------- | ----------- | -| `CMD_ALLOW_ANONYMOUS` | `true` or `false` | set to allow anonymous usage (default is `true`) | -| `CMD_ALLOW_ANONYMOUS_EDITS` | `true` or `false` | if `allowAnonymous` is `true`, allow users to select `freely` permission, allowing guests to edit existing notes (default is `false`) | -| `CMD_ALLOW_FREEURL` | `true` or `false` | set to allow new note creation by accessing a nonexistent note URL | -| `CMD_DEFAULT_PERMISSION` | `freely`, `editable`, `limited`, `locked` or `private` | set notes default permission (only applied on signed users) | -| `CMD_SESSION_LIFE` | `1209600000` | Session life time. (milliseconds) | +| `CMD_ALLOW_ANONYMOUS` | `true` or `false` | Set to allow anonymous usage (default is `true`). | +| `CMD_ALLOW_ANONYMOUS_EDITS` | `true` or `false` | If `allowAnonymous` is `true`: allow users to select `freely` permission, allowing guests to edit existing notes (default is `false`). | +| `CMD_ALLOW_FREEURL` | `true` or `false` | Set to allow new note creation by accessing a nonexistent note URL. This is the behavior familiar from [Etherpad](https://github.com/ether/etherpad-lite). | +| `CMD_DEFAULT_PERMISSION` | `freely`, `editable`, `limited`, `locked`, `protected` or `private` | Set notes default permission (only applied on signed-in users). | +| `CMD_SESSION_LIFE` | `1209600000` (14 days) | Cookie session life time in milliseconds. | | `CMD_SESSION_SECRET` | no example | Secret used to sign the session cookie. If none is set, one will randomly generated on each startup, meaning all your users will be logged out. | @@ -90,8 +90,8 @@ defaultNotePath can't be set from env-vars | variable | example value | description | | -------- | ------------- | ----------- | -| `CMD_EMAIL` | `true` or `false` | set to allow email signin | -| `CMD_ALLOW_EMAIL_REGISTER` | `true` or `false` | set to allow email register (only applied when email is set, default is `true`. Note `bin/manage_users` might help you if registration is `false`.) | +| `CMD_EMAIL` | `true` or `false` | Set to allow email sign-in. The default is `true`. | +| `CMD_ALLOW_EMAIL_REGISTER` | `true` or `false` | Set to allow registration of new accounts using an email address. If set to `false`, you can still create accounts using the command line - see `bin/manage_users` for details. This setting has no effect if `CMD_EMAIL` is `false`. The default for `CMD_ALLOW_EMAIL_REGISTER` is `true`. | ### Dropbox Login @@ -166,7 +166,7 @@ defaultNotePath can't be set from env-vars | variable | example value | description | | -------- | ------------- | ----------- | -| `CMD_OAUTH2_USER_PROFILE_URL` | `https://example.com` | where retrieve information about a user after succesful login. Needs to output JSON. (no default value) Refer to the [Mattermost](guides/auth/mattermost-self-hosted.md) or [Nextcloud](guides/auth/nextcloud.md) examples for more details on all of the `CMD_OAUTH2...` options. | +| `CMD_OAUTH2_USER_PROFILE_URL` | `https://example.com` | Where to retrieve information about a user after successful login. Needs to output JSON. (no default value) Refer to the [Mattermost](guides/auth/mattermost-self-hosted.md) or [Nextcloud](guides/auth/nextcloud.md) examples for more details on all of the `CMD_OAUTH2...` options. | | `CMD_OAUTH2_USER_PROFILE_USERNAME_ATTR` | `name` | where to find the username in the JSON from the user profile URL. (no default value)| | `CMD_OAUTH2_USER_PROFILE_DISPLAY_NAME_ATTR` | `display-name` | where to find the display-name in the JSON from the user profile URL. (no default value) | | `CMD_OAUTH2_USER_PROFILE_EMAIL_ATTR` | `email` | where to find the email address in the JSON from the user profile URL. (no default value) | @@ -183,7 +183,7 @@ defaultNotePath can't be set from env-vars | -------- | ------------- | ----------- | | `CMD_SAML_IDPSSOURL` | `https://idp.example.com/sso` | authentication endpoint of IdP. for details, see [guide](guides/auth/saml-onelogin.md). | | `CMD_SAML_IDPCERT` | `/path/to/cert.pem` | certificate file path of IdP in PEM format | -| `CMD_SAML_ISSUER` | no example | identity of the service provider (optional, default: serverurl)" | +| `CMD_SAML_ISSUER` | no example | Issuer to supply to identity provider (optional, default: `serverURL` config)" | | `CMD_SAML_DISABLEREQUESTEDAUTHNCONTEXT` | `true` or `false` | true to allow any authentication method, false restricts to password authentication (PasswordProtectedTransport) method (default: false) | | `CMD_SAML_IDENTIFIERFORMAT` | no example | name identifier format (optional, default: `urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress`) | | `CMD_SAML_GROUPATTRIBUTE` | `memberOf` | attribute name for group list (optional) | diff --git a/docs/guides/providing-terms.md b/docs/guides/providing-terms.md index 1e580df9..73de2b37 100644 --- a/docs/guides/providing-terms.md +++ b/docs/guides/providing-terms.md @@ -15,3 +15,12 @@ To add a privacy policy you can use the same technique as for the terms of use. See our example file `./public/docs/privacy.md.example` container some useful hints for writing your own privacy policy. As with the terms of use, a link to the privacy notices will show up in the area where the release notes are provided on the index page. + +Setup your imprint +=== + +To add an imprint you can use the same technique as for the terms of use. The main difference is that the document is called `imprint.md`. + +It has to be provided under `./public/docs/` and will be automatically turned into a CodiMD document. It will also automatically updated as soon as you change the document on disk. + +As with the terms of use, a link to the imprint will show up in the area where the release notes are provided on the index page. diff --git a/lib/config/environment.js b/lib/config/environment.js index d2350e72..716f8b75 100644 --- a/lib/config/environment.js +++ b/lib/config/environment.js @@ -41,7 +41,8 @@ module.exports = { s3: { accessKeyId: process.env.CMD_S3_ACCESS_KEY_ID, secretAccessKey: process.env.CMD_S3_SECRET_ACCESS_KEY, - region: process.env.CMD_S3_REGION + region: process.env.CMD_S3_REGION, + endpoint: process.env.CMD_S3_ENDPOINT }, minio: { accessKey: process.env.CMD_MINIO_ACCESS_KEY, diff --git a/lib/response.js b/lib/response.js index 1313f9f4..6450bdf5 100644 --- a/lib/response.js +++ b/lib/response.js @@ -70,6 +70,7 @@ function showIndex (req, res, next) { signin: authStatus, infoMessage: req.flash('info'), errorMessage: req.flash('error'), + imprint: fs.existsSync(path.join(config.docsPath, 'imprint.md')), privacyStatement: fs.existsSync(path.join(config.docsPath, 'privacy.md')), termsOfUse: fs.existsSync(path.join(config.docsPath, 'terms-of-use.md')), deleteToken: deleteToken diff --git a/lib/web/imageRouter/s3.js b/lib/web/imageRouter/s3.js index 4effea04..2bf08cc7 100644 --- a/lib/web/imageRouter/s3.js +++ b/lib/web/imageRouter/s3.js @@ -43,7 +43,9 @@ exports.uploadImage = function (imagePath, callback) { } let s3Endpoint = 's3.amazonaws.com' - if (config.s3.region && config.s3.region !== 'us-east-1') { + if (config.s3.endpoint) { + s3Endpoint = config.s3.endpoint + } else if (config.s3.region && config.s3.region !== 'us-east-1') { s3Endpoint = `s3-${config.s3.region}.amazonaws.com` } callback(null, `https://${s3Endpoint}/${config.s3bucket}/${params.Key}`) diff --git a/locales/de.json b/locales/de.json index f99d8c1f..3f91244a 100644 --- a/locales/de.json +++ b/locales/de.json @@ -106,6 +106,7 @@ "Select Visibility Level": "Sichtbarkeit bestimmen", "Night Theme": "Nachtmodus", "Follow us on %s and %s.": "Folge uns auf %s und %s.", + "Imprint": "Impressum", "Privacy": "Datenschutz", "Terms of Use": "Nutzungsbedingungen", "Do you really want to delete your user account?": "Möchten Sie wirklich Ihr Nutzerkonto löschen?", diff --git a/locales/en.json b/locales/en.json index 9a601c04..4f661cf5 100644 --- a/locales/en.json +++ b/locales/en.json @@ -106,6 +106,7 @@ "Select Visibility Level": "Select Visibility Level", "Night Theme": "Night Theme", "Follow us on %s and %s.": "Follow us on %s, and %s.", + "Imprint": "Imprint", "Privacy": "Privacy", "Terms of Use": "Terms of Use", "Do you really want to delete your user account?": "Do you really want to delete your user account?", diff --git a/public/docs/yaml-metadata.md b/public/docs/yaml-metadata.md index 839616a8..8e59c8f2 100644 --- a/public/docs/yaml-metadata.md +++ b/public/docs/yaml-metadata.md @@ -31,7 +31,7 @@ title: meta title description --- -This option will set the note description. +This option will set the note description as a `<meta name="description">` tag. This only affects the [Publish](../features#Share-Notes) function. > default: not set @@ -68,7 +68,8 @@ robots: noindex, nofollow lang --- -This option will set the language of the note, that might alter some typography of it. +This option will set the language of the note. +Setting the language helps the browser to apply rules such as typography correctly. You can find your the language code in ISO 639-1 standard: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes diff --git a/public/views/index/body.ejs b/public/views/index/body.ejs index d588766f..9234da2f 100644 --- a/public/views/index/body.ejs +++ b/public/views/index/body.ejs @@ -153,7 +153,7 @@ <option value="ar">العربية</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(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><% } %> + <%- __('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><% } %> </p> <h6 class="social-foot"> <%- __('Follow us on %s and %s.', '<a href="https://github.com/codimd/server" target="_blank" rel="noopener"><i class="fa fa-github"></i> GitHub</a>, <a href="https://community.codimd.org" target="_blank" rel="noopener"><i class="fa fa-users" aria-hidden="true"></i> Discourse</a>, <a href="https://riot.im/app/#/room/#codimd:matrix.org" target="_blank" rel="noopener"><i class="fa fa-comments"></i> Riot</a>, <a href="https://social.codimd.org/mastodon" target="_blank" rel="noopener"><i class="fa fa-mastodon"></i> Mastodon</a>', '<a href="https://translate.codimd.org" target="_blank" rel="noopener"><i class="fa fa-globe"></i> POEditor</a>') %> |