sync: Merge branch 'master' of https://github.com/mgkbadola/remark42 into discord-oauth

This commit is contained in:
Mrigank Badola
2024-11-10 10:43:10 +05:30
199 changed files with 3654 additions and 2087 deletions
@@ -83,15 +83,6 @@ _instructions for Google OAuth2 setup borrowed from [oauth2_proxy](https://githu
4. Choose the new project from the top right project dropdown (only if another project is selected)
5. Select **"Certificates & secrets"** and click on **"+ New Client Secret"** (`AUTH_MICROSOFT_CSEC`)
### Twitter
> **Important**: Twitter developer accounts created after _November 15th 2021_ need "Elevated access" to use the Standard v1.1 API routes required to work properly. Apply for this access from within the Twitter developer portal.
1. Create a new Twitter application https://developer.twitter.com/en/apps
2. Fill **App name**, **Description** and **URL** of your site
3. In the field **Callback URLs** enter the correct URL of your callback handler, e.g. domain + `/auth/twitter/callback`
4. Under **Key and tokens** take note of the **Consumer API Key** and **Consumer API Secret key**. Those will be used as `AUTH_TWITTER_CID` and `AUTH_TWITTER_CSEC`
### Yandex
1. Create a new **"OAuth App"**: https://oauth.yandex.com/client/new
+2 -2
View File
@@ -14,7 +14,7 @@ This documentation describes how to enable the email-related capabilities of Rem
- email notifications for any users except anonymous:
GitHub or Google or Twitter or any other kind of user gets the ability to get email notifications about new replies to their comments (and any of the responses down the tree):
GitHub or Google or any other kind of user gets the ability to get email notifications about new replies to their comments (and any of the responses down the tree):
![Email notifications subscription](images/email_notifications.png)
@@ -201,7 +201,7 @@ Now we have the following templates:
- `email_unsubscribe.html.tmpl` used for notification about successful unsubscribing from replies
- `error_response.html.tmpl` used for HTML errors
To replace any template, add the file with the same name to the directory with the remark42 executable file. In case you run Remark42 inside docker-compose, you can put customised templates into a directory like `customised_templates` and then mount it like that:
To replace any template, add the file with the same name to the directory with the remark42 executable file. In case you run Remark42 inside Docker Compose, you can put customised templates into a directory like `customised_templates` and then mount it like that:
```yaml
volumes:
@@ -30,7 +30,7 @@ Example with all of the params:
var remark_config = {
host: 'https://remark42.example.com',
site_id: 'my_site',
components: ['embed', 'last-comments']
components: ['embed', 'last-comments'],
max_shown_comments: 100,
theme: 'dark',
page_title: 'My custom title for a page',
@@ -93,8 +93,6 @@ services:
| auth.microsoft.csec | AUTH_MICROSOFT_CSEC | | Microsoft OAuth client secret |
| auth.github.cid | AUTH_GITHUB_CID | | GitHub OAuth client ID |
| auth.github.csec | AUTH_GITHUB_CSEC | | GitHub OAuth client secret |
| auth.twitter.cid | AUTH_TWITTER_CID | | Twitter Consumer API Key |
| auth.twitter.csec | AUTH_TWITTER_CSEC | | Twitter Consumer API Secret key |
| auth.patreon.cid | AUTH_PATREON_CID | | Patreon OAuth Client ID |
| auth.patreon.csec | AUTH_PATREON_CSEC | | Patreon OAuth Client Secret |
| auth.discord.cid | AUTH_DISCORD_CID | | Discord OAuth Client ID |
@@ -156,7 +154,7 @@ services:
| emoji | EMOJI | `false` | enable emoji support |
| simple-view | SIMPLE_VIEW | `false` | minimized UI with basic info only |
| proxy-cors | PROXY_CORS | `false` | disable internal CORS and delegate it to proxy |
| allowed-hosts | ALLOWED_HOSTS | enable all | limit hosts/sources allowed to embed comments |
| allowed-hosts | ALLOWED_HOSTS | enable all | limit hosts/sources allowed to embed comments via CSP 'frame-ancestors' |
| address | REMARK_ADDRESS | all interfaces | web server listening address |
| port | REMARK_PORT | `8080` | web server port |
| web-root | REMARK_WEB_ROOT | `./web` | web server root directory |
@@ -192,6 +190,8 @@ The following list of command-line options is deprecated and might be removed in
| notify.email.notify_admin | notify.admins=email | NOTIFY_EMAIL_ADMIN | NOTIFY_ADMINS=email | | | 1.9.0 |
| notify.telegram.token | telegram.token | NOTIFY_TELEGRAM_TOKEN | TELEGRAM_TOKEN | | Telegram token | 1.9.0 |
| notify.telegram.timeout | telegram.timeout | NOTIFY_TELEGRAM_TIMEOUT | TELEGRAM_TIMEOUT | | Telegram timeout | 1.9.0 |
| auth.twitter.cid | none | AUTH_TWITTER_CID | none | | Twitter Consumer API Key | 1.14.0 | |
| auth.twitter.csec | none | AUTH_TWITTER_CSEC | none | | Twitter Consumer API Secret key | 1.14.0 | |
</details>
+1 -1
View File
@@ -11,7 +11,7 @@ cp compose-dev-backend.yml compose-private.yml
# now, edit / debug `compose-private.yml` to your heart's content
# build and run
docker-compose -f compose-private.yml up --build
docker compose -f compose-private.yml up --build
```
It starts Remark42 on `127.0.0.1:8080` and adds local OAuth2 provider "Dev". To access the UI demo page go to <http://127.0.0.1:8080/web/>. By default, you would be logged in as `dev_user`, defined as admin. You can tweak any of the [supported parameters](https://remark42.com/docs/configuration/parameters/) in corresponded yml file.
+2 -2
View File
@@ -59,7 +59,7 @@ cp compose-dev-frontend.yml compose-private.yml
# now, edit / debug `compose-private.yml` to your heart's content
# build and run
docker-compose -f compose-private.yml up --build
docker compose -f compose-private.yml up --build
```
Then in the new terminal tab or window, run the following to start the frontend with Hot Reloading:
@@ -78,7 +78,7 @@ It starts Remark42 backend on `127.0.0.1:8080` and adds local OAuth2 provider "D
Frontend Docker Compose config (`compose-dev-frontend.yml`) by default skips running backend related tests.
::: note 🚨
Before submitting your changes as a Pull Request, run the backend using the `docker-compose -f compose-dev-frontend.yml build --build-arg SKIP_FRONTEND_BUILD=""; docker-compose -f compose-private.yml up` command and test your changes against <http://127.0.0.1:8080/web/>, frontend, built statically (unlike frontend on port 9000, which runs dynamically). That is how Remark42 authors will test your changes once you submit them.
Before submitting your changes as a Pull Request, run the backend using the `docker compose -f compose-dev-frontend.yml build --build-arg SKIP_FRONTEND_BUILD=""; docker compose -f compose-private.yml up` command and test your changes against <http://127.0.0.1:8080/web/>, frontend, built statically (unlike frontend on port 9000, which runs dynamically). That is how Remark42 authors will test your changes once you submit them.
:::
## Static build
@@ -41,7 +41,7 @@ below to have your translation available to all remark42 users and included in t
1. Uncomment `locale: "ru"` line in [frontend/apps/remark42/templates/demo.ejs](https://github.com/umputun/remark42/blob/master/frontend/apps/remark42/templates/demo.ejs) and replace `ru` with your translation language code
2. [Run remark42 in Docker](https://github.com/umputun/remark42#development) by issuing the following commands from the root directory of your remark42 fork:
`shell docker-compose -f compose-dev-frontend.yml build docker-compose -f compose-dev-frontend.yml up `
`shell docker compose -f compose-dev-frontend.yml build docker compose -f compose-dev-frontend.yml up `
3. open <http://127.0.0.1:8080/web/>, log in, make a comment, make a reply to a comment, and make sure your translation looks as you expect it to look
4. make a screenshot from <http://127.0.0.1:8080> with your translation in place
@@ -10,8 +10,8 @@ _This is the recommended way to run Remark42_
- copy provided [`docker-compose.yml`](https://github.com/umputun/remark42/blob/master/docker-compose.yml) and customize for your needs
- make sure you **don't keep** `ADMIN_PASSWD=something...` for any non-development deployments
- pull prepared images from the Docker Hub and start - `docker-compose pull && docker-compose up -d`
- alternatively, compile from the sources - `docker-compose build && docker-compose up -d`
- pull prepared images from the Docker Hub and start - `docker compose pull && docker compose up -d`
- alternatively, compile from the sources - `docker compose build && docker compose up -d`
### Installation with Binary
+1 -1
View File
@@ -4,7 +4,7 @@ title: Configure with Reproxy
## How to configure remark42 with [Reproxy](https://reproxy.io)
Example of Reproxy configuration (reverse proxy) running remark42 service on remark42.example.com with docker compose. Reproxy handles SSL termination with LE and gzip all the responses.
Example of Reproxy configuration (reverse proxy) running remark42 service on remark42.example.com with Docker Compose. Reproxy handles SSL termination with LE and gzip all the responses.
```yaml
version: "3.4"
@@ -10,17 +10,19 @@ Unless discussion [#1139](https://github.com/umputun/remark42/discussions/1139)
### Setup
Set `ALLOWED_HOSTS='self',example1.org,example2.org` with your domain names and `AUTH_SAME_SITE=none`. The `'self'` value means "domain which Remark42 is installed on" so you don't need to write it twice.
Set `ALLOWED_HOSTS="'self',example1.org,example2.org"` with your domain names and `AUTH_SAME_SITE=none`.
The `'self'` in `ALLOWED_HOSTS` value means "domain where Remark42 is installed on" and needed if you want `remark42.example.com/web/` to work in case you want to test something with it.
### Technical details
`ALLOWED_HOSTS` sets CSP [frame-ancestors](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors), which, once enabled, limits the domains where Remark42 would work. The default value is not set so that it would work on any domain.
`ALLOWED_HOSTS` sets CSP [frame-ancestors](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors), which, once enabled, limits the domains where Remark42 would work. The default value is `*` so that it would work on any domain`.
`AUTH_SAME_SITE` sets the [SAME_SITE](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite) attribute for authorisation cookies, allowing Remark42 either on the original domain and subdomains there (default value, not set which equals to `Lax`) or allows setting authorisation cookies on any domain where remark42 is shown (`None` setting).
`AUTH_SAME_SITE` sets the [SAME_SITE](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite) attribute for authorisation cookies, allowing Remark42 either on the original domain and subdomains there (default value, which equals to `Lax`) or allows setting authorisation cookies on any domain where remark42 is shown (`None` setting).
Here are all possible combinations of these two:
- Default setup with unaltered variables: comments are shown on any domain, but the authorisation wouldn't work anywhere, but on the same domain Remark42 is installed on and subdomains of it.
- `ALLOWED_HOSTS` set to a set of domains: comments are shown only on listed domains, authorisation wouldn't work anywhere, but on the same domain Remark42 is installed on and subdomains of it.
- Default setup with unaltered variables: comments are shown on any domain, but the authorisation wouldn't work anywhere, except on the same domain Remark42 is installed on and subdomains of it.
- `ALLOWED_HOSTS` set to a set of domains: comments are shown only on listed domains, and authorisation wouldn't work anywhere, expect on the same domain Remark42 is installed on and subdomains of it.
- `AUTH_SAME_SITE` set to `None`: comments are shown on any domain. The authorisation would work anywhere.
- `ALLOWED_HOSTS` set to a set of domains and `AUTH_SAME_SITE` set to `None`: comments are shown on listed domains. The authorisation would work on all of them.
+4 -4
View File
@@ -8,16 +8,16 @@ All documentation examples show configurations with remark42 on its own subdomai
- The frontend URL looks like this: `s.src = 'https://example.com/remark42/web/embed.js;`
- The backend `REMARK_URL` parameter will be `https://example.com/remark42`
- The backend `REMARK_URL` parameter will be `https://example.com/remark42`. `ALLOWED_HOSTS="'self'"` and `AUTH_SAME_SITE=strict` to make comments work only from the same domain.
- And you also need to slightly modify the callback URL for the social media login API's:
- And you also need to slightly modify the callback URL for the social media login APIs:
- Facebook Valid OAuth Redirect URIs: `https://example.com/remark42/auth/facebook/callback`
- Google Authorized redirect URIs: `https://example.com/remark42/auth/google/callback`
- GitHub Authorised callback URL: `https://example.com/remark42/auth/github/callback`
### docker-compose configuration
### Docker Compose configuration
Both Nginx and Caddy configuration below rely on remark42 available on hostname `remark42`, which is achieved by having `container_name: remark42` in docker-compose.
Both Nginx and Caddy configuration below rely on remark42 available on hostname `remark42`, which is achieved by having `container_name: remark42` in Docker Compose configuration file.
Example `docker-compose.yml`:
+1 -1
View File
@@ -8,7 +8,7 @@ title: Remark42 Privacy-focused lightweight commenting engine
Remark42 allows you to have a self-hosted, lightweight, and simple (yet functional) comment engine, which doesn't spy on users. It can be embedded into blogs, articles or any other place where readers add comments.
- Social login via Google, Twitter, Facebook, Microsoft, GitHub, Apple, Yandex, Patreon and Telegram
- Social login via Google, Facebook, Microsoft, GitHub, Apple, Yandex, Patreon and Telegram
- Login via email
- Optional anonymous access
- Multi-level nested comments with both tree and plain presentations