Skip to content

Commit

Permalink
Enhancement: support photoprism app passwords (gethomepage#4028)
Browse files Browse the repository at this point in the history
  • Loading branch information
shamoon authored Sep 23, 2024
1 parent 20f5134 commit 8c1e50d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
9 changes: 6 additions & 3 deletions docs/widgets/services/photoprism.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ title: PhotoPrism
description: PhotoPrism Widget Configuration
---

Learn more about [PhotoPrism](https://github.com/photoprism/photoprism)..
Learn more about [PhotoPrism](https://github.com/photoprism/photoprism).

Authentication is possible via [app passwords](https://docs.photoprism.app/user-guide/settings/account/#apps-and-devices) or username/password.

Allowed fields: `["albums", "photos", "videos", "people"]`.

```yaml
widget:
type: photoprism
url: http://photoprism.host.or.ip:port
username: admin
password: password
username: admin # required only if using username/password
password: password # required only if using username/password
key: # required only if using app passwords
```
5 changes: 5 additions & 0 deletions src/widgets/photoprism/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ export default async function photoprismProxyHandler(req, res) {
username: widget.username,
password: widget.password,
});
} else if (widget.key) {
params.headers.Authorization = `Bearer ${widget.key}`;
params.body = JSON.stringify({
authToken: widget.key,
});
}

const [status, contentType, data] = await httpProxy(url, params);
Expand Down

0 comments on commit 8c1e50d

Please sign in to comment.