From 29315f44e770b4fece61022553d500277f12a617 Mon Sep 17 00:00:00 2001 From: Debanjum Date: Mon, 25 Nov 2024 23:25:05 -0800 Subject: [PATCH] Add assetlinks.json to link android app to app.khoj.dev domain Add sha cert of android upload, signing keys to open debug, prod apps as TWA in fullscreen on android phones --- src/khoj/interface/web/.well-known/assetlinks.json | 11 +++++++++++ src/khoj/routers/web_client.py | 5 +++++ src/khoj/utils/constants.py | 1 + 3 files changed, 17 insertions(+) create mode 100644 src/khoj/interface/web/.well-known/assetlinks.json diff --git a/src/khoj/interface/web/.well-known/assetlinks.json b/src/khoj/interface/web/.well-known/assetlinks.json new file mode 100644 index 000000000..dea482e0d --- /dev/null +++ b/src/khoj/interface/web/.well-known/assetlinks.json @@ -0,0 +1,11 @@ +[{ + "relation": ["delegate_permission/common.handle_all_urls"], + "target": { + "namespace": "android_app", + "package_name": "dev.khoj.app", + "sha256_cert_fingerprints": [ + "CC:98:4A:0A:F1:CC:84:26:AC:02:86:49:AA:69:64:B9:5E:63:A3:EF:18:56:EA:CA:13:C1:3A:15:CA:49:77:46", + "D4:5A:6F:6C:18:28:D2:1C:78:27:92:C6:AC:DB:4C:12:C4:52:A1:88:9B:A1:F5:67:D1:22:FE:A0:0F:B1:AE:92" + ] + } +}] diff --git a/src/khoj/routers/web_client.py b/src/khoj/routers/web_client.py index 76ce7dd43..97297baba 100644 --- a/src/khoj/routers/web_client.py +++ b/src/khoj/routers/web_client.py @@ -134,3 +134,8 @@ def automations_config_page( "request": request, }, ) + + +@web_client.get("/.well-known/assetlinks.json", response_class=FileResponse) +def assetlinks(request: Request): + return FileResponse(constants.assetlinks_file_path) diff --git a/src/khoj/utils/constants.py b/src/khoj/utils/constants.py index 403203734..f2ab40c63 100644 --- a/src/khoj/utils/constants.py +++ b/src/khoj/utils/constants.py @@ -5,6 +5,7 @@ web_directory = app_root_directory / "khoj/interface/web/" next_js_directory = app_root_directory / "khoj/interface/built/" pypi_static_directory = app_root_directory / "khoj/interface/compiled/" +assetlinks_file_path = web_directory / ".well-known/assetlinks.json" empty_escape_sequences = "\n|\r|\t| " app_env_filepath = "~/.khoj/env" telemetry_server = "https://khoj.beta.haletic.com/v1/telemetry"