From 5e65754a8bfb3b8d5929c3cf4490d872b2c1fc39 Mon Sep 17 00:00:00 2001 From: Debanjum Date: Sun, 28 Dec 2025 17:11:52 -0800 Subject: [PATCH] Unify login via popup on home. No need for separate login html page. Delete old login html page. Login via popup on home is the single, unified login experience. Have docs mention khoj home url, no need to mention /login as login popup shows on home page too --- .../docs/advanced/authentication.mdx | 2 +- documentation/docs/features/all-features.md | 2 +- documentation/docs/get-started/overview.md | 2 +- .../docs/get-started/privacy-security.md | 2 +- documentation/docusaurus.config.js | 6 +- src/khoj/interface/web/login.html | 310 ------------------ src/khoj/routers/web_client.py | 15 +- 7 files changed, 11 insertions(+), 328 deletions(-) delete mode 100644 src/khoj/interface/web/login.html diff --git a/documentation/docs/advanced/authentication.mdx b/documentation/docs/advanced/authentication.mdx index 34523d14..0df022e8 100644 --- a/documentation/docs/advanced/authentication.mdx +++ b/documentation/docs/advanced/authentication.mdx @@ -24,7 +24,7 @@ It's still possible to use the magic links feature without Resend, but you'll ne ## Manually sending magic links -1. The user will have to enter their email address in the login page at http://localhost:42110/login. +1. The user will have to enter their email address in the login popup shown at http://localhost:42110/?v=app. They'll click `Get Login Link`. Without the Resend API key, this will just create an unverified account for them in the backend Magic link login form diff --git a/documentation/docs/features/all-features.md b/documentation/docs/features/all-features.md index 3c86ed08..dd798ed8 100644 --- a/documentation/docs/features/all-features.md +++ b/documentation/docs/features/all-features.md @@ -17,7 +17,7 @@ Khoj supports a variety of features, including search and chat with a wide range - **Works online or offline**: Chat using online or offline AI chat models #### General - - **Cloud or Self-Host**: Use [cloud](https://app.khoj.dev/login) to use Khoj anytime from anywhere or [self-host](/get-started/setup) for privacy + - **Cloud or Self-Host**: Use [cloud](https://app.khoj.dev) to use Khoj anytime from anywhere or [self-host](/get-started/setup) for privacy - **Natural**: Advanced natural language understanding using Transformer based ML Models - **Pluggable**: Modular architecture makes it easy to plug in new data sources, frontends and ML models - **Multiple Sources**: Index your Org-mode, Markdown, PDF, plaintext files, Github repos and Notion pages diff --git a/documentation/docs/get-started/overview.md b/documentation/docs/get-started/overview.md index 197fbf36..614d13ec 100644 --- a/documentation/docs/get-started/overview.md +++ b/documentation/docs/get-started/overview.md @@ -28,7 +28,7 @@ Welcome to the Khoj Docs! This is the best place to get setup and explore Khoj's - Quickly [find](/features/search) relevant notes and documents using natural language - It understands pdf, plaintext, markdown, org-mode files, and [notion pages](/data-sources/notion_integration). - Access it from your [Emacs](/clients/emacs), [Obsidian](/clients/obsidian), the [Khoj desktop app](/clients/desktop), or [any web browser](/clients/web) -- Use our [cloud](https://app.khoj.dev/login) instance to access your Khoj anytime from anywhere, [self-host](/get-started/setup) on consumer hardware for privacy +- Use our [cloud](https://app.khoj.dev) instance to access your Khoj anytime from anywhere, [self-host](/get-started/setup) on consumer hardware for privacy ![demo_chat](https://assets.khoj.dev/quadratic_equation_khoj_web.gif) diff --git a/documentation/docs/get-started/privacy-security.md b/documentation/docs/get-started/privacy-security.md index 3ff08a8d..1070b975 100644 --- a/documentation/docs/get-started/privacy-security.md +++ b/documentation/docs/get-started/privacy-security.md @@ -17,7 +17,7 @@ Here's what to consider if you're using Khoj, whether self-hosted or on our clou - If you're self-hosting, you can opt out of telemetry by following [these instructions](/miscellaneous/telemetry). -Self-hosting isn't for everyone, so we've still taken steps to make Khoj privacy-friendly, even if you choose to use our [cloud offering](https://app.khoj.dev/login). Here's what to consider when using Khoj Cloud: +Self-hosting isn't for everyone, so we've still taken steps to make Khoj privacy-friendly, even if you choose to use our [cloud offering](https://app.khoj.dev). Here's what to consider when using Khoj Cloud: 1. Your embeddings are generated by an open source model within our own dedicated endpoint [hosted on AWS with Huggingface](https://huggingface.co/inference-endpoints/dedicated). There's zero persistent memory to the Huggingface Inference endpoints (it's stateless). 1. Your embeddings and the associated raw text are stored in a secure Postgres DB in our private AWS cloud. Your data is sharded on a unique user ID. We store the raw text in your files to improve file syncing and provide context when you chat with Khoj. 1. When you use the single-sign-on option with Google, we only receive your name, a link to your profile photo, and your email address. diff --git a/documentation/docusaurus.config.js b/documentation/docusaurus.config.js index a3a5b102..f5acc371 100644 --- a/documentation/docusaurus.config.js +++ b/documentation/docusaurus.config.js @@ -103,7 +103,7 @@ const config = { 'aria-label': 'GitHub repository', }, { - href: 'https://app.khoj.dev/login', + href: 'https://app.khoj.dev', position: 'right', className: 'header-cloud-link', title: 'Khoj Cloud', @@ -191,14 +191,14 @@ const config = { }, { label: 'Khoj Cloud', - href: 'https://app.khoj.dev/login', + href: 'https://app.khoj.dev', }, { label: 'GitHub', href: 'https://github.com/khoj-ai/khoj', }, { - label: 'Website', + label: 'Khoj Inc.', href: 'https://khoj.dev', }, ], diff --git a/src/khoj/interface/web/login.html b/src/khoj/interface/web/login.html deleted file mode 100644 index b7db3a1a..00000000 --- a/src/khoj/interface/web/login.html +++ /dev/null @@ -1,310 +0,0 @@ - - - - - - Khoj - Login - - - - - - - -
- -
-
- - - - -
- - -
OR
- - - -
- - -
- -
-
-

Unlock Your Second Brain

-

Transform the way you think, create, and remember

-
-
- Chat - Get answers across your documents and the internet -
-
- Agents - Create agents with the knowledge and tools to take on any role -
-
- Automations - Automate away repetitive research -
-
-
-
-
- - - - - - - - - diff --git a/src/khoj/routers/web_client.py b/src/khoj/routers/web_client.py index 18d0462c..2dbadbe1 100644 --- a/src/khoj/routers/web_client.py +++ b/src/khoj/routers/web_client.py @@ -1,6 +1,5 @@ # System Packages import json -import os from fastapi import APIRouter, Request from fastapi.responses import FileResponse, HTMLResponse, RedirectResponse @@ -56,16 +55,10 @@ def login_page(request: Request): next_url = get_next_url(request) if request.user.is_authenticated: return RedirectResponse(url=next_url) - google_client_id = os.environ.get("GOOGLE_CLIENT_ID") - redirect_uri = str(request.app.url_path_for("auth_post")) - return templates.TemplateResponse( - "login.html", - context={ - "request": request, - "google_client_id": google_client_id, - "redirect_uri": f"{redirect_uri}?next={next_url}", - }, - ) + # Redirect to main app which shows the login popup for unauthenticated users + # Append v=app to prevent redirect loop back to /home + redirect_url = f"/?v=app&next={next_url}" if next_url != "/" else "/?v=app" + return RedirectResponse(url=redirect_url) @web_client.get("/agents", response_class=HTMLResponse)