Skip to content

Commit

Permalink
Merge pull request #478 from Thiesjoo/immich-improvements
Browse files Browse the repository at this point in the history
Immich image selection improvements
  • Loading branch information
seanmorley15 authored Feb 1, 2025
2 parents 7d71c84 + cc6a98d commit bdb17a3
Show file tree
Hide file tree
Showing 15 changed files with 219 additions and 130 deletions.
30 changes: 20 additions & 10 deletions backend/server/integrations/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,25 +63,31 @@ def search(self, request):
return integration

query = request.query_params.get('query', '')
date = request.query_params.get('date', '')

if not query:
if not query and not date:
return Response(
{
'message': 'Query is required.',
'message': 'Query or date is required.',
'error': True,
'code': 'immich.query_required'
},
status=status.HTTP_400_BAD_REQUEST
)

arguments = {}
if query:
arguments['query'] = query
if date:
arguments['takenBefore'] = date

# check so if the server is down, it does not tweak out like a madman and crash the server with a 500 error code
try:
immich_fetch = requests.post(f'{integration.server_url}/search/smart', headers={
url = f'{integration.server_url}/search/{"smart" if query else "metadata"}'
immich_fetch = requests.post(url, headers={
'x-api-key': integration.api_key
},
json = {
'query': query
}
json = arguments
)
res = immich_fetch.json()
except requests.exceptions.ConnectionError:
Expand Down Expand Up @@ -219,10 +225,14 @@ def album(self, request, albumid=None):
)

if 'assets' in res:
return Response(
res['assets'],
status=status.HTTP_200_OK
)
paginator = self.pagination_class()
# for each item in the items, we need to add the image url to the item so we can display it in the frontend
public_url = os.environ.get('PUBLIC_URL', 'http://127.0.0.1:8000').rstrip('/')
public_url = public_url.replace("'", "")
for item in res['assets']:
item['image_url'] = f'{public_url}/api/integrations/immich/get/{item["id"]}'
result_page = paginator.paginate_queryset(res['assets'], request)
return paginator.get_paginated_response(result_page)
else:
return Response(
{
Expand Down
6 changes: 3 additions & 3 deletions documentation/docs/changelogs/v0-8-0.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ I’m thrilled to announce the release of **AdventureLog v0.8.0**, a huge update
### 🚗 Transportation

- **New Transportation Edit Modal**: Includes detailed origin and destination location information for better trip planning.
- **Autocomplete for Airport Codes**: Quickly find and add airport codes while planning transportations.
- **Autocomplete for Airport Codes**: Quickly find and add airport codes while planning transportation.
- **New Transportation Card Design**: Redesigned for better clarity and aesthetics.

---

### 📝 Notes and Checklists

- **New Modals for Notes and Checklists**: Simplified creation and editing of your notes and checklists.
- **Delete Confirmation**: Added a confirmation step when deleting notes, checklists, or transportations to prevent accidental deletions.
- **Delete Confirmation**: Added a confirmation step when deleting notes, checklists, or transportation to prevent accidental deletions.

---

Expand All @@ -41,7 +41,7 @@ I’m thrilled to announce the release of **AdventureLog v0.8.0**, a huge update

### 🗓️ Calendar

- **Calendar View**: View your adventures and transportations in a calendar layout.
- **Calendar View**: View your adventures and transportation in a calendar layout.
- **ICS File Export**: Export your calendar as an ICS file for use with external apps like Google Calendar or Outlook.

---
Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/configuration/social_auth.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Social Authentication

AdventureLog support autentication via 3rd party services and self-hosted identity providers. Once these services are enabled, users can log in to AdventureLog using their accounts from these services and link exising AdventureLog accounts to these services for easier access.
AdventureLog support authentication via 3rd party services and self-hosted identity providers. Once these services are enabled, users can log in to AdventureLog using their accounts from these services and link existing AdventureLog accounts to these services for easier access.

The steps for each service varies so please refer to the specific service's documentation for more information.

Expand Down
4 changes: 2 additions & 2 deletions documentation/docs/configuration/social_auth/authentik.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ To enable Authentik as an identity provider, the administrator must first config

### AdventureLog Configuration

This configuration is done in the [Admin Panel](../../guides/admin_panel.md). You can either launch the pannel directly from the `Settings` page or navigate to `/admin` on your AdventureLog server.
This configuration is done in the [Admin Panel](../../guides/admin_panel.md). You can either launch the panel directly from the `Settings` page or navigate to `/admin` on your AdventureLog server.

1. Login to AdventureLog as an administrator and navigate to the `Settings` page.
2. Scroll down to the `Administration Settings` and launch the admin panel.
3. In the admin panel, navigate to the `Social Accounts` section and click the add button next to `Social applications`. Fill in the following fields:

- Provider: `OpenID Connect`
- Provider ID: Autnentik Client ID
- Provider ID: Authentik Client ID
- Name: `Authentik`
- Client ID: Authentik Client ID
- Secret Key: Authentik Client Secret
Expand Down
4 changes: 2 additions & 2 deletions documentation/docs/configuration/social_auth/github.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ To enable GitHub as an identity provider, the administrator must first configure

### AdventureLog Configuration

This configuration is done in the [Admin Panel](../../guides/admin_panel.md). You can either launch the pannel directly from the `Settings` page or navigate to `/admin` on your AdventureLog server.
This configuration is done in the [Admin Panel](../../guides/admin_panel.md). You can either launch the panel directly from the `Settings` page or navigate to `/admin` on your AdventureLog server.

1. Login to AdventureLog as an administrator and navigate to the `Settings` page.
2. Scroll down to the `Administration Settings` and launch the admin panel.
Expand All @@ -41,4 +41,4 @@ This configuration is done in the [Admin Panel](../../guides/admin_panel.md). Yo

4. Save the configuration.

Users should now be able to log in to AdventureLog using their GitHub account, and link it to exisiting accounts.
Users should now be able to log in to AdventureLog using their GitHub account, and link it to existing accounts.
2 changes: 1 addition & 1 deletion documentation/docs/configuration/updating.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Updating

Updating AdventureLog when using docker can be quite easy. Run the folowing commands to pull the latest version and restart the containers. Make sure you backup your instance before updating just in case!
Updating AdventureLog when using docker can be quite easy. Run the following commands to pull the latest version and restart the containers. Make sure you backup your instance before updating just in case!

Note: Make sure you are in the same directory as your `docker-compose.yml` file.

Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/guides/v0-7-1_migration.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AdventureLog v0.7.1 Migration

In order to make installation easier, the AdventureLog v0.7.1 release has **removed the need for a seperate nginx container** and cofig to serve the media files. Instead, the media files are now served by an instance of nginx running in the same container as the Django application.
In order to make installation easier, the AdventureLog v0.7.1 release has **removed the need for a separate nginx container** and config to serve the media files. Instead, the media files are now served by an instance of nginx running in the same container as the Django application.

## Docker Compose Changes

Expand Down
38 changes: 19 additions & 19 deletions documentation/docs/install/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,31 @@ wget https://raw.githubusercontent.com/seanmorley15/AdventureLog/main/docker-com

Here is a summary of the configuration options available in the `docker-compose.yml` file:

<!-- make a table with colum name, is required, other -->
<!-- make a table with column name, is required, other -->

### Frontend Container (web)

| Name | Required | Description | Default Value |
| ------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
| `PUBLIC_SERVER_URL` | Yes | What the frontend SSR server uses to connect to the backend. | http://server:8000 |
| `ORIGIN` | Sometimes | Not needed if using HTTPS. If not, set it to the domain of what you will acess the app from. | http://localhost:8015 |
| `BODY_SIZE_LIMIT` | Yes | Used to set the maximum upload size to the server. Should be changed to prevent someone from uploading too much! Custom values must be set in **kiliobytes**. | Infinity |
| Name | Required | Description | Default Value |
| ------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------- |
| `PUBLIC_SERVER_URL` | Yes | What the frontend SSR server uses to connect to the backend. | ```http://server:8000``` |
| `ORIGIN` | Sometimes | Not needed if using HTTPS. If not, set it to the domain of what you will access the app from. | ```http://localhost:8015``` |
| `BODY_SIZE_LIMIT` | Yes | Used to set the maximum upload size to the server. Should be changed to prevent someone from uploading too much! Custom values must be set in **kilobytes**. | ```Infinity``` |

### Backend Container (server)

| Name | Required | Description | Default Value |
| ----------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
| `PGHOST` | Yes | Databse host. | db |
| `PGDATABASE` | Yes | Database. | database |
| `PGUSER` | Yes | Database user. | adventure |
| `PGPASSWORD` | Yes | Database password. | changeme123 |
| `PGPORT` | No | Database port. | 5432 |
| `DJANGO_ADMIN_USERNAME` | Yes | Default username. | admin |
| `DJANGO_ADMIN_PASSWORD` | Yes | Default password, change after inital login. | admin |
| `DJANGO_ADMIN_EMAIL` | Yes | Default user's email. | [email protected] |
| `PUBLIC_URL` | Yes | This needs to match the outward port of the server and be accessible from where the app is used. It is used for the creation of image urls. | http://localhost:8016 |
| `CSRF_TRUSTED_ORIGINS` | Yes | Need to be changed to the orgins where you use your backend server and frontend. These values are comma seperated. | http://localhost:8016 |
| `FRONTEND_URL` | Yes | This is the publically accessible url to the **frontend** container. This link should be accessable for all users. Used for email generation. | http://localhost:8015 |
| Name | Required | Description | Default Value |
| ----------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------- |
| `PGHOST` | Yes | Database host. | ```db``` |
| `PGDATABASE` | Yes | Database. | ```database``` |
| `PGUSER` | Yes | Database user. | ```adventure``` |
| `PGPASSWORD` | Yes | Database password. | ```changeme123``` |
| `PGPORT` | No | Database port. | ```5432``` |
| `DJANGO_ADMIN_USERNAME` | Yes | Default username. | ```admin``` |
| `DJANGO_ADMIN_PASSWORD` | Yes | Default password, change after initial login. | ```admin``` |
| `DJANGO_ADMIN_EMAIL` | Yes | Default user's email. | ```[email protected]``` |
| `PUBLIC_URL` | Yes | This needs to match the outward port of the server and be accessible from where the app is used. It is used for the creation of image urls. | ```http://localhost:8016``` |
| `CSRF_TRUSTED_ORIGINS` | Yes | Need to be changed to the origins where you use your backend server and frontend. These values are comma separated. | ```http://localhost:8016``` |
| `FRONTEND_URL` | Yes | This is the publicly accessible url to the **frontend** container. This link should be accessible for all users. Used for email generation. | ```http://localhost:8015``` |

## Running the Containers

Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/install/kustomize.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ You must [expose tailnet IPs to your cluster](https://tailscale.com/kb/1438/kube

## Getting Started

Take a look at the [example config](https://github.com/seanmorley15/AdventureLog/blob/main/kustomization.yml) and modify it for your usecase.
Take a look at the [example config](https://github.com/seanmorley15/AdventureLog/blob/main/kustomization.yml) and modify it for your use case.

## Environment Variables

Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/install/nginx_proxy_manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Ensure that the Nginx Proxy Manager and AdventureLog containers are on the same
docker network create nginx-proxy-manager
```

Add the folowing to the bottom of the `docker-compose.yml` file for the Nginx Proxy Manager service and the AdventureLog service.
Add the following to the bottom of the `docker-compose.yml` file for the Nginx Proxy Manager service and the AdventureLog service.

```yaml
networks:
Expand Down
Loading

0 comments on commit bdb17a3

Please sign in to comment.