diff --git a/src/app/settings.py b/src/app/settings.py index 1cef3c88..0803081d 100644 --- a/src/app/settings.py +++ b/src/app/settings.py @@ -24,7 +24,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent.parent SECRET_KEY = os.getenv("KHOJ_DJANGO_SECRET_KEY") # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = os.getenv("DJANGO_DEBUG", "False") == "True" +DEBUG = os.getenv("KHOJ_DEBUG", "False") == "True" ALLOWED_HOSTS = [".khoj.dev", "localhost", "127.0.0.1", "[::1]", "beta.khoj.dev"] diff --git a/src/database/adapters/__init__.py b/src/database/adapters/__init__.py index 4f71c7aa..70d94df3 100644 --- a/src/database/adapters/__init__.py +++ b/src/database/adapters/__init__.py @@ -134,10 +134,11 @@ async def set_user_subscription( return None -def get_user_subscription_state(user_subscription: Subscription) -> str: +def get_user_subscription_state(email: str) -> str: """Get subscription state of user Valid state transitions: trial -> subscribed <-> unsubscribed OR expired """ + user_subscription = Subscription.objects.filter(user__email=email).first() if not user_subscription: return "trial" elif user_subscription.type == Subscription.Type.TRIAL: @@ -370,8 +371,8 @@ class EntryAdapters: ) @staticmethod - async def user_has_entries(user: KhojUser): - return await Entry.objects.filter(user=user).aexists() + def user_has_entries(user: KhojUser): + return Entry.objects.filter(user=user).exists() @staticmethod async def adelete_entry_by_file(user: KhojUser, file_path: str): @@ -450,5 +451,5 @@ class EntryAdapters: return Entry.objects.filter(user=user).values_list("file_type", flat=True).distinct() @staticmethod - def get_unique_file_source(user: KhojUser): - return Entry.objects.filter(user=user).values_list("file_source", flat=True).distinct() + def get_unique_file_sources(user: KhojUser): + return Entry.objects.filter(user=user).values_list("file_source", flat=True).distinct().all() diff --git a/src/interface/desktop/config.html b/src/interface/desktop/config.html index c63a2a5c..fb39fbb8 100644 --- a/src/interface/desktop/config.html +++ b/src/interface/desktop/config.html @@ -91,10 +91,7 @@
- -
-
- +
diff --git a/src/interface/desktop/main.js b/src/interface/desktop/main.js index ef46ce00..9a42bc5f 100644 --- a/src/interface/desktop/main.js +++ b/src/interface/desktop/main.js @@ -10,7 +10,7 @@ const {dialog} = require('electron'); const cron = require('cron').CronJob; const axios = require('axios'); -const KHOJ_URL = 'http://127.0.0.1:42110' +const KHOJ_URL = 'https://app.khoj.dev'; const Store = require('electron-store'); @@ -67,7 +67,7 @@ const schema = { } }; -const syncing = false; +let syncing = false; var state = {} const store = new Store({ schema }); diff --git a/src/interface/desktop/renderer.js b/src/interface/desktop/renderer.js index 849a8293..7e3dba4c 100644 --- a/src/interface/desktop/renderer.js +++ b/src/interface/desktop/renderer.js @@ -155,11 +155,14 @@ window.updateStateAPI.onUpdateState((event, state) => { loadingBar.style.display = 'none'; let syncStatusElement = document.getElementById("sync-status"); const currentTime = new Date(); + nextSyncTime = new Date(); + nextSyncTime.setMinutes(Math.ceil((nextSyncTime.getMinutes() + 1) / 10) * 10); if (state.completed == false) { syncStatusElement.innerHTML = `Sync was unsuccessful at ${currentTime.toLocaleTimeString()}. Contact team@khoj.dev to report this issue.`; return; } - syncStatusElement.innerHTML = `Last synced at ${currentTime.toLocaleTimeString()}`; + const options = { hour: '2-digit', minute: '2-digit' }; + syncStatusElement.innerHTML = `⏱️ Synced at ${currentTime.toLocaleTimeString(undefined, options)}. Next sync at ${nextSyncTime.toLocaleTimeString(undefined, options)}.`; }); const urlInput = document.getElementById('khoj-host-url'); diff --git a/src/khoj/interface/web/base_config.html b/src/khoj/interface/web/base_config.html index bf64164c..309fdba6 100644 --- a/src/khoj/interface/web/base_config.html +++ b/src/khoj/interface/web/base_config.html @@ -15,7 +15,7 @@ {% import 'utils.html' as utils %} - {{ utils.heading_pane(user_photo, username) }} + {{ utils.heading_pane(user_photo, username, is_active, has_documents) }}
@@ -26,9 +26,6 @@