From 30f1eaef1cf8583caee6b36aaee4e9435e55425a Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Sun, 12 Jan 2025 20:28:27 -0500 Subject: [PATCH] feat: enhance download command with success and warning messages; update Authentik documentation for clarity --- .../worldtravel/management/commands/download-countries.py | 3 +++ documentation/docs/configuration/social_auth/authentik.md | 6 +++++- frontend/src/lib/components/AdventureModal.svelte | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/backend/server/worldtravel/management/commands/download-countries.py b/backend/server/worldtravel/management/commands/download-countries.py index a11cd9c..d4f5492 100644 --- a/backend/server/worldtravel/management/commands/download-countries.py +++ b/backend/server/worldtravel/management/commands/download-countries.py @@ -48,6 +48,7 @@ class Command(BaseCommand): if res.status_code == 200: with open(countries_json_path, 'w') as f: f.write(res.text) + self.stdout.write(self.style.SUCCESS('countries+regions+states.json downloaded successfully')) else: self.stdout.write(self.style.ERROR('Error downloading countries+regions+states.json')) return @@ -56,6 +57,8 @@ class Command(BaseCommand): return elif os.path.getsize(countries_json_path) == 0: self.stdout.write(self.style.ERROR('countries+regions+states.json is empty')) + elif Country.objects.count() == 0 or Region.objects.count() == 0 or City.objects.count() == 0: + self.stdout.write(self.style.WARNING('Some region data is missing. Re-importing all data.')) else: self.stdout.write(self.style.SUCCESS('Latest country, region, and state data already downloaded.')) return diff --git a/documentation/docs/configuration/social_auth/authentik.md b/documentation/docs/configuration/social_auth/authentik.md index a633e0c..6bc62d9 100644 --- a/documentation/docs/configuration/social_auth/authentik.md +++ b/documentation/docs/configuration/social_auth/authentik.md @@ -18,6 +18,7 @@ To enable Authentik as an identity provider, the administrator must first config 4. Set the `Redirect URI` of type `Regex` to `^http:///accounts/oidc/.*$` where `` is the URL of your AdventureLog Server service. 5. Copy the `Client ID` and `Client Secret` generated by Authentik, you will need these to configure AdventureLog. 6. Create an application in Authentik and assign the provider to it, name the `slug` `adventurelog` or any other name you prefer. +7. If you want the logo, you can find it [here](https://adventurelog.app/adventurelog.png). ### AdventureLog Configuration @@ -41,7 +42,10 @@ This configuration is done in the [Admin Panel](../../guides/admin_panel.md). Yo } ``` - - Sites: move over the sites you want to enable Authentik on, usually `example.com` and `www.example.com` unless you renamed your sites. + ::: warning + `localhost` is most likely not a valid `server_url` for Authentik in this instance because `localhost` is the server running AdventureLog, not Authentik. You should use the IP address of the server running Authentik or the domain name if you have one. + +- Sites: move over the sites you want to enable Authentik on, usually `example.com` and `www.example.com` unless you renamed your sites. #### What it Should Look Like diff --git a/frontend/src/lib/components/AdventureModal.svelte b/frontend/src/lib/components/AdventureModal.svelte index 824e04e..2fd2470 100644 --- a/frontend/src/lib/components/AdventureModal.svelte +++ b/frontend/src/lib/components/AdventureModal.svelte @@ -561,8 +561,8 @@ } } if ( - (adventure.is_visited && !reverseGeocodePlace?.region_visited) || - !reverseGeocodePlace?.city_visited + adventure.is_visited && + (!reverseGeocodePlace?.region_visited || !reverseGeocodePlace?.city_visited) ) { markVisited(); }