Add reddit app auth #529

Co-authored-by: s0ders <39492740+s0ders@users.noreply.github.com>
This commit is contained in:
Svilen Markov
2025-04-28 18:37:14 +01:00
parent 65adf9b9c3
commit d7a17aab01
3 changed files with 128 additions and 80 deletions

View File

@@ -843,7 +843,10 @@ Display a list of posts from a specific subreddit.
> [!WARNING]
>
> Reddit does not allow unauthorized API access from VPS IPs, if you're hosting Glance on a VPS you will get a 403 response. As a workaround you can route the traffic from Glance through a VPN or your own HTTP proxy using the `request-url-template` property.
> Reddit does not allow unauthorized API access from VPS IPs, if you're hosting Glance on a VPS you will get a 403
> response. As a workaround you can either [register an app on Reddit](https://ssl.reddit.com/prefs/apps/) and use the
> generated ID and secret in the widget configuration to authenticate your requests (see `app-auth` property), use a proxy
> (see `proxy` property) or route the traffic from Glance through a VPN.
Example:
@@ -868,6 +871,7 @@ Example:
| top-period | string | no | day |
| search | string | no | |
| extra-sort-by | string | no | |
| app-auth | object | no | |
##### `subreddit`
The subreddit for which to fetch the posts from.
@@ -975,6 +979,17 @@ Can be used to specify an additional sort which will be applied on top of the al
The `engagement` sort tries to place the posts with the most points and comments on top, also prioritizing recent over old posts.
##### `app-auth`
```yaml
widgets:
- type: reddit
subreddit: technology
app-auth:
name: ${REDDIT_APP_NAME}
id: ${REDDIT_APP_CLIENT_ID}
secret: ${REDDIT_APP_SECRET}
```
### Search Widget
Display a search bar that can be used to search for specific terms on various search engines.