diff --git a/.gitignore b/.gitignore
index 4041122a3..09288aa7c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -42,3 +42,13 @@ src/interface/obsidian/main.js
# obsidian
data.json
+
+# Android
+src/interface/android/.gradle
+src/interface/android/app/build
+src/interface/android/build
+src/interface/android/*.aab
+src/interface/android/*.apk
+src/interface/android/*.apk.idsig
+src/interface/android/*.keystore
+src/interface/android/local.properties
diff --git a/src/interface/android/app/build.gradle b/src/interface/android/app/build.gradle
new file mode 100644
index 000000000..bfa069117
--- /dev/null
+++ b/src/interface/android/app/build.gradle
@@ -0,0 +1,211 @@
+/*
+ * Copyright 2019 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import groovy.xml.MarkupBuilder
+
+plugins {
+ id 'com.android.application'
+}
+
+def twaManifest = [
+ applicationId: 'dev.khoj.app',
+ hostName: 'app.khoj.dev', // The domain being opened in the TWA.
+ launchUrl: '/', // The start path for the TWA. Must be relative to the domain.
+ name: 'Khoj AI', // The application name.
+ launcherName: 'Khoj', // The name shown on the Android Launcher.
+ themeColor: '#FFFFFF', // The color used for the status bar.
+ themeColorDark: '#000000', // The color used for the dark status bar.
+ navigationColor: '#000000', // The color used for the navigation bar.
+ navigationColorDark: '#000000', // The color used for the dark navbar.
+ navigationDividerColor: '#000000', // The navbar divider color.
+ navigationDividerColorDark: '#000000', // The dark navbar divider color.
+ backgroundColor: '#FFFFFF', // The color used for the splash screen background.
+ enableNotifications: true, // Set to true to enable notification delegation.
+ // Every shortcut must include the following fields:
+ // - name: String that will show up in the shortcut.
+ // - short_name: Shorter string used if |name| is too long.
+ // - url: Absolute path of the URL to launch the app with (e.g '/create').
+ // - icon: Name of the resource in the drawable folder to use as an icon.
+ shortcuts: [],
+ // The duration of fade out animation in milliseconds to be played when removing splash screen.
+ splashScreenFadeOutDuration: 300,
+ generatorApp: 'bubblewrap-cli', // Application that generated the Android Project
+ // The fallback strategy for when Trusted Web Activity is not available. Possible values are
+ // 'customtabs' and 'webview'.
+ fallbackType: 'customtabs',
+ enableSiteSettingsShortcut: 'true',
+ orientation: 'natural',
+]
+
+android {
+ compileSdkVersion 35
+ namespace "dev.khoj.app"
+ defaultConfig {
+ applicationId "dev.khoj.app"
+ minSdkVersion 19
+ targetSdkVersion 35
+ versionCode 4
+ versionName "4"
+
+ // The name for the application
+ resValue "string", "appName", twaManifest.name
+
+ // The name for the application on the Android Launcher
+ resValue "string", "launcherName", twaManifest.launcherName
+
+ // The URL that will be used when launching the TWA from the Android Launcher
+ def launchUrl = "https://" + twaManifest.hostName + twaManifest.launchUrl
+ resValue "string", "launchUrl", launchUrl
+
+
+ // The URL the Web Manifest for the Progressive Web App that the TWA points to. This
+ // is used by Chrome OS and Meta Quest to open the Web version of the PWA instead of
+ // the TWA, as it will probably give a better user experience for non-mobile devices.
+ resValue "string", "webManifestUrl", 'https://app.khoj.dev/static/khoj.webmanifest'
+
+
+
+ // This is used by Meta Quest.
+ resValue "string", "fullScopeUrl", 'https://app.khoj.dev/'
+
+
+
+
+ // The hostname is used when building the intent-filter, so the TWA is able to
+ // handle Intents to open host url of the application.
+ resValue "string", "hostName", twaManifest.hostName
+
+ // This attribute sets the status bar color for the TWA. It can be either set here or in
+ // `res/values/colors.xml`. Setting in both places is an error and the app will not
+ // compile. If not set, the status bar color defaults to #FFFFFF - white.
+ resValue "color", "colorPrimary", twaManifest.themeColor
+
+ // This attribute sets the dark status bar color for the TWA. It can be either set here or in
+ // `res/values/colors.xml`. Setting in both places is an error and the app will not
+ // compile. If not set, the status bar color defaults to #000000 - white.
+ resValue "color", "colorPrimaryDark", twaManifest.themeColorDark
+
+ // This attribute sets the navigation bar color for the TWA. It can be either set here or
+ // in `res/values/colors.xml`. Setting in both places is an error and the app will not
+ // compile. If not set, the navigation bar color defaults to #FFFFFF - white.
+ resValue "color", "navigationColor", twaManifest.navigationColor
+
+ // This attribute sets the dark navigation bar color for the TWA. It can be either set here
+ // or in `res/values/colors.xml`. Setting in both places is an error and the app will not
+ // compile. If not set, the navigation bar color defaults to #000000 - black.
+ resValue "color", "navigationColorDark", twaManifest.navigationColorDark
+
+ // This attribute sets the navbar divider color for the TWA. It can be either
+ // set here or in `res/values/colors.xml`. Setting in both places is an error and the app
+ // will not compile. If not set, the divider color defaults to #00000000 - transparent.
+ resValue "color", "navigationDividerColor", twaManifest.navigationDividerColor
+
+ // This attribute sets the dark navbar divider color for the TWA. It can be either
+ // set here or in `res/values/colors.xml`. Setting in both places is an error and the
+ //app will not compile. If not set, the divider color defaults to #000000 - black.
+ resValue "color", "navigationDividerColorDark", twaManifest.navigationDividerColorDark
+
+ // Sets the color for the background used for the splash screen when launching the
+ // Trusted Web Activity.
+ resValue "color", "backgroundColor", twaManifest.backgroundColor
+
+ // Defines a provider authority for the Splash Screen
+ resValue "string", "providerAuthority", twaManifest.applicationId + '.fileprovider'
+
+ // The enableNotification resource is used to enable or disable the
+ // TrustedWebActivityService, by changing the android:enabled and android:exported
+ // attributes
+ resValue "bool", "enableNotification", twaManifest.enableNotifications.toString()
+
+ twaManifest.shortcuts.eachWithIndex { shortcut, index ->
+ resValue "string", "shortcut_name_$index", "$shortcut.name"
+ resValue "string", "shortcut_short_name_$index", "$shortcut.short_name"
+ }
+
+ // The splashScreenFadeOutDuration resource is used to set the duration of fade out animation in milliseconds
+ // to be played when removing splash screen. The default is 0 (no animation).
+ resValue "integer", "splashScreenFadeOutDuration", twaManifest.splashScreenFadeOutDuration.toString()
+
+ resValue "string", "generatorApp", twaManifest.generatorApp
+
+ resValue "string", "fallbackType", twaManifest.fallbackType
+
+ resValue "bool", "enableSiteSettingsShortcut", twaManifest.enableSiteSettingsShortcut
+ resValue "string", "orientation", twaManifest.orientation
+ }
+ buildTypes {
+ release {
+ minifyEnabled true
+ }
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+ lintOptions {
+ checkReleaseBuilds false
+ }
+}
+
+task generateShorcutsFile {
+ assert twaManifest.shortcuts.size() < 5, "You can have at most 4 shortcuts."
+ twaManifest.shortcuts.eachWithIndex { s, i ->
+ assert s.name != null, 'Missing `name` in shortcut #' + i
+ assert s.short_name != null, 'Missing `short_name` in shortcut #' + i
+ assert s.url != null, 'Missing `icon` in shortcut #' + i
+ assert s.icon != null, 'Missing `url` in shortcut #' + i
+ }
+
+ def shortcutsFile = new File("$projectDir/src/main/res/xml", "shortcuts.xml")
+
+ def xmlWriter = new StringWriter()
+ def xmlMarkup = new MarkupBuilder(new IndentPrinter(xmlWriter, " ", true))
+
+ xmlMarkup
+ .'shortcuts'('xmlns:android': 'http://schemas.android.com/apk/res/android') {
+ twaManifest.shortcuts.eachWithIndex { s, i ->
+ 'shortcut'(
+ 'android:shortcutId': 'shortcut' + i,
+ 'android:enabled': 'true',
+ 'android:icon': '@drawable/' + s.icon,
+ 'android:shortcutShortLabel': '@string/shortcut_short_name_' + i,
+ 'android:shortcutLongLabel': '@string/shortcut_name_' + i) {
+ 'intent'(
+ 'android:action': 'android.intent.action.MAIN',
+ 'android:targetPackage': twaManifest.applicationId,
+ 'android:targetClass': twaManifest.applicationId + '.LauncherActivity',
+ 'android:data': s.url)
+ 'categories'('android:name': 'android.intent.category.LAUNCHER')
+ }
+ }
+ }
+ shortcutsFile.text = xmlWriter.toString() + '\n'
+}
+
+preBuild.dependsOn(generateShorcutsFile)
+
+repositories {
+
+}
+
+dependencies {
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+
+ implementation 'com.google.androidbrowserhelper:locationdelegation:1.1.1'
+
+ implementation 'com.google.androidbrowserhelper:androidbrowserhelper:2.5.0'
+
+}
diff --git a/src/interface/android/app/src/main/AndroidManifest.xml b/src/interface/android/app/src/main/AndroidManifest.xml
new file mode 100644
index 000000000..39fee27d9
--- /dev/null
+++ b/src/interface/android/app/src/main/AndroidManifest.xml
@@ -0,0 +1,188 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/interface/android/app/src/main/java/dev/khoj/app/Application.java b/src/interface/android/app/src/main/java/dev/khoj/app/Application.java
new file mode 100644
index 000000000..a1d3040f3
--- /dev/null
+++ b/src/interface/android/app/src/main/java/dev/khoj/app/Application.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2020 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package dev.khoj.app;
+
+
+
+public class Application extends android.app.Application {
+
+
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+
+ }
+}
diff --git a/src/interface/android/app/src/main/java/dev/khoj/app/DelegationService.java b/src/interface/android/app/src/main/java/dev/khoj/app/DelegationService.java
new file mode 100644
index 000000000..d8d6bd103
--- /dev/null
+++ b/src/interface/android/app/src/main/java/dev/khoj/app/DelegationService.java
@@ -0,0 +1,17 @@
+package dev.khoj.app;
+
+
+import com.google.androidbrowserhelper.locationdelegation.LocationDelegationExtraCommandHandler;
+
+
+public class DelegationService extends
+ com.google.androidbrowserhelper.trusted.DelegationService {
+ @Override
+ public void onCreate() {
+ super.onCreate();
+
+
+ registerExtraCommandHandler(new LocationDelegationExtraCommandHandler());
+
+ }
+}
diff --git a/src/interface/android/app/src/main/java/dev/khoj/app/LauncherActivity.java b/src/interface/android/app/src/main/java/dev/khoj/app/LauncherActivity.java
new file mode 100644
index 000000000..a56c42320
--- /dev/null
+++ b/src/interface/android/app/src/main/java/dev/khoj/app/LauncherActivity.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2020 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package dev.khoj.app;
+
+import android.content.pm.ActivityInfo;
+import android.net.Uri;
+import android.os.Build;
+import android.os.Bundle;
+
+
+
+public class LauncherActivity
+ extends com.google.androidbrowserhelper.trusted.LauncherActivity {
+
+
+
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ // Setting an orientation crashes the app due to the transparent background on Android 8.0
+ // Oreo and below. We only set the orientation on Oreo and above. This only affects the
+ // splash screen and Chrome will still respect the orientation.
+ // See https://github.com/GoogleChromeLabs/bubblewrap/issues/496 for details.
+ if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O) {
+ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
+ } else {
+ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
+ }
+ }
+
+ @Override
+ protected Uri getLaunchingUrl() {
+ // Get the original launch Url.
+ Uri uri = super.getLaunchingUrl();
+
+
+
+ return uri;
+ }
+}
diff --git a/src/interface/android/app/src/main/res/drawable-anydpi/shortcut_legacy_background.xml b/src/interface/android/app/src/main/res/drawable-anydpi/shortcut_legacy_background.xml
new file mode 100644
index 000000000..d53c148ac
--- /dev/null
+++ b/src/interface/android/app/src/main/res/drawable-anydpi/shortcut_legacy_background.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/interface/android/app/src/main/res/drawable-hdpi/ic_notification_icon.png b/src/interface/android/app/src/main/res/drawable-hdpi/ic_notification_icon.png
new file mode 100644
index 000000000..db196a126
Binary files /dev/null and b/src/interface/android/app/src/main/res/drawable-hdpi/ic_notification_icon.png differ
diff --git a/src/interface/android/app/src/main/res/drawable-hdpi/splash.png b/src/interface/android/app/src/main/res/drawable-hdpi/splash.png
new file mode 100644
index 000000000..9d2384e20
Binary files /dev/null and b/src/interface/android/app/src/main/res/drawable-hdpi/splash.png differ
diff --git a/src/interface/android/app/src/main/res/drawable-mdpi/ic_notification_icon.png b/src/interface/android/app/src/main/res/drawable-mdpi/ic_notification_icon.png
new file mode 100644
index 000000000..1d97f7c18
Binary files /dev/null and b/src/interface/android/app/src/main/res/drawable-mdpi/ic_notification_icon.png differ
diff --git a/src/interface/android/app/src/main/res/drawable-mdpi/splash.png b/src/interface/android/app/src/main/res/drawable-mdpi/splash.png
new file mode 100644
index 000000000..770884255
Binary files /dev/null and b/src/interface/android/app/src/main/res/drawable-mdpi/splash.png differ
diff --git a/src/interface/android/app/src/main/res/drawable-xhdpi/ic_notification_icon.png b/src/interface/android/app/src/main/res/drawable-xhdpi/ic_notification_icon.png
new file mode 100644
index 000000000..9625ad912
Binary files /dev/null and b/src/interface/android/app/src/main/res/drawable-xhdpi/ic_notification_icon.png differ
diff --git a/src/interface/android/app/src/main/res/drawable-xhdpi/splash.png b/src/interface/android/app/src/main/res/drawable-xhdpi/splash.png
new file mode 100644
index 000000000..1d4f64fe1
Binary files /dev/null and b/src/interface/android/app/src/main/res/drawable-xhdpi/splash.png differ
diff --git a/src/interface/android/app/src/main/res/drawable-xxhdpi/ic_notification_icon.png b/src/interface/android/app/src/main/res/drawable-xxhdpi/ic_notification_icon.png
new file mode 100644
index 000000000..355b75861
Binary files /dev/null and b/src/interface/android/app/src/main/res/drawable-xxhdpi/ic_notification_icon.png differ
diff --git a/src/interface/android/app/src/main/res/drawable-xxhdpi/splash.png b/src/interface/android/app/src/main/res/drawable-xxhdpi/splash.png
new file mode 100644
index 000000000..43423514a
Binary files /dev/null and b/src/interface/android/app/src/main/res/drawable-xxhdpi/splash.png differ
diff --git a/src/interface/android/app/src/main/res/drawable-xxxhdpi/ic_notification_icon.png b/src/interface/android/app/src/main/res/drawable-xxxhdpi/ic_notification_icon.png
new file mode 100644
index 000000000..9ed4d5e61
Binary files /dev/null and b/src/interface/android/app/src/main/res/drawable-xxxhdpi/ic_notification_icon.png differ
diff --git a/src/interface/android/app/src/main/res/drawable-xxxhdpi/splash.png b/src/interface/android/app/src/main/res/drawable-xxxhdpi/splash.png
new file mode 100644
index 000000000..cec7e27de
Binary files /dev/null and b/src/interface/android/app/src/main/res/drawable-xxxhdpi/splash.png differ
diff --git a/src/interface/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/src/interface/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 000000000..b97b2df5d
Binary files /dev/null and b/src/interface/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/src/interface/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/src/interface/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 000000000..0a454eb19
Binary files /dev/null and b/src/interface/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/src/interface/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/src/interface/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 000000000..47c45373e
Binary files /dev/null and b/src/interface/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/src/interface/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/src/interface/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 000000000..643b56f7a
Binary files /dev/null and b/src/interface/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/src/interface/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/src/interface/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 000000000..3a456d9fd
Binary files /dev/null and b/src/interface/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/src/interface/android/app/src/main/res/raw/web_app_manifest.json b/src/interface/android/app/src/main/res/raw/web_app_manifest.json
new file mode 100644
index 000000000..cff9d4ef8
--- /dev/null
+++ b/src/interface/android/app/src/main/res/raw/web_app_manifest.json
@@ -0,0 +1 @@
+{"name":"Khoj","short_name":"Khoj","display":"standalone","start_url":"/","description":"The open, personal AI for your digital brain. You can ask Khoj to draft a message, paint your imagination, find information on the internet and even answer questions from your documents.","theme_color":"#ffffff","background_color":"#ffffff","icons":[{"src":"/static/assets/icons/khoj_lantern_128x128.png","sizes":"128x128","type":"image/png"},{"src":"/static/assets/icons/khoj_lantern_256x256.png","sizes":"256x256","type":"image/png"}],"screenshots":[{"src":"/static/assets/samples/phone-remember-plan-sample.png","sizes":"419x900","type":"image/png","form_factor":"narrow","label":"Remember and Plan"},{"src":"/static/assets/samples/phone-browse-draw-sample.png","sizes":"419x900","type":"image/png","form_factor":"narrow","label":"Browse and Draw"},{"src":"/static/assets/samples/desktop-remember-plan-sample.png","sizes":"1260x742","type":"image/png","form_factor":"wide","label":"Remember and Plan"},{"src":"/static/assets/samples/desktop-browse-draw-sample.png","sizes":"1260x742","type":"image/png","form_factor":"wide","label":"Browse and Draw"}]}
diff --git a/src/interface/android/app/src/main/res/values/colors.xml b/src/interface/android/app/src/main/res/values/colors.xml
new file mode 100644
index 000000000..e66222d00
--- /dev/null
+++ b/src/interface/android/app/src/main/res/values/colors.xml
@@ -0,0 +1,18 @@
+
+
+ #F5F5F5
+
diff --git a/src/interface/android/app/src/main/res/values/strings.xml b/src/interface/android/app/src/main/res/values/strings.xml
new file mode 100644
index 000000000..d5d34f8b6
--- /dev/null
+++ b/src/interface/android/app/src/main/res/values/strings.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+ [{
+ \"relation\": [\"delegate_permission/common.handle_all_urls\"],
+ \"target\": {
+ \"namespace\": \"web\",
+ \"site\": \"https://app.khoj.dev\"
+ }
+ }]
+
+
+
diff --git a/src/interface/android/app/src/main/res/xml/filepaths.xml b/src/interface/android/app/src/main/res/xml/filepaths.xml
new file mode 100644
index 000000000..a54348527
--- /dev/null
+++ b/src/interface/android/app/src/main/res/xml/filepaths.xml
@@ -0,0 +1,18 @@
+
+
+
+
diff --git a/src/interface/android/app/src/main/res/xml/shortcuts.xml b/src/interface/android/app/src/main/res/xml/shortcuts.xml
new file mode 100644
index 000000000..5effdb1d1
--- /dev/null
+++ b/src/interface/android/app/src/main/res/xml/shortcuts.xml
@@ -0,0 +1 @@
+
diff --git a/src/interface/android/build.gradle b/src/interface/android/build.gradle
new file mode 100644
index 000000000..fe8944ba2
--- /dev/null
+++ b/src/interface/android/build.gradle
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2019 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+
+ repositories {
+ google()
+ mavenCentral()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:8.7.2'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ google()
+ mavenCentral()
+ }
+}
+
+tasks.register('clean', Delete) {
+ delete rootProject.buildDir
+}
diff --git a/src/interface/android/gradle.properties b/src/interface/android/gradle.properties
new file mode 100644
index 000000000..784a1d43f
--- /dev/null
+++ b/src/interface/android/gradle.properties
@@ -0,0 +1,14 @@
+# Project-wide Gradle settings.
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx1536m
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
+android.useAndroidX=true
diff --git a/src/interface/android/gradle/wrapper/gradle-wrapper.jar b/src/interface/android/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 000000000..5c2d1cf01
Binary files /dev/null and b/src/interface/android/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/src/interface/android/gradle/wrapper/gradle-wrapper.properties b/src/interface/android/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 000000000..b30c99143
--- /dev/null
+++ b/src/interface/android/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,7 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
+networkTimeout=10000
+validateDistributionUrl=true
diff --git a/src/interface/android/gradlew b/src/interface/android/gradlew
new file mode 100755
index 000000000..b740cf133
--- /dev/null
+++ b/src/interface/android/gradlew
@@ -0,0 +1,249 @@
+#!/bin/sh
+
+#
+# Copyright © 2015-2021 the original authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
+##############################################################################
+
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
+done
+
+# This is normally unused
+# shellcheck disable=SC2034
+APP_BASE_NAME=${0##*/}
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD=maximum
+
+warn () {
+ echo "$*"
+} >&2
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+} >&2
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD=$JAVA_HOME/jre/sh/java
+ else
+ JAVACMD=$JAVA_HOME/bin/java
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD=java
+ if ! command -v java >/dev/null 2>&1
+ then
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+fi
+
+# Increase the maximum file descriptors if we can.
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
+fi
+
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
+ fi
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
+ done
+fi
+
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Collect all arguments for the java command:
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+# and any embedded shellness will be escaped.
+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+# treated as '${Hostname}' itself on the command line.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ org.gradle.wrapper.GradleWrapperMain \
+ "$@"
+
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+ die "xargs is not available"
+fi
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
+exec "$JAVACMD" "$@"
diff --git a/src/interface/android/gradlew.bat b/src/interface/android/gradlew.bat
new file mode 100644
index 000000000..7101f8e46
--- /dev/null
+++ b/src/interface/android/gradlew.bat
@@ -0,0 +1,92 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%"=="" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if %ERRORLEVEL% equ 0 goto execute
+
+echo. 1>&2
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo. 1>&2
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if %ERRORLEVEL% equ 0 goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+set EXIT_CODE=%ERRORLEVEL%
+if %EXIT_CODE% equ 0 set EXIT_CODE=1
+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
+exit /b %EXIT_CODE%
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/src/interface/android/manifest-checksum.txt b/src/interface/android/manifest-checksum.txt
new file mode 100644
index 000000000..d3280ee8f
--- /dev/null
+++ b/src/interface/android/manifest-checksum.txt
@@ -0,0 +1 @@
+6ee1711cf4f745dafc80c1cc13c3025342a0f5da
diff --git a/src/interface/android/settings.gradle b/src/interface/android/settings.gradle
new file mode 100644
index 000000000..e7b4def49
--- /dev/null
+++ b/src/interface/android/settings.gradle
@@ -0,0 +1 @@
+include ':app'
diff --git a/src/interface/android/store_icon.png b/src/interface/android/store_icon.png
new file mode 100644
index 000000000..93b5729d7
Binary files /dev/null and b/src/interface/android/store_icon.png differ
diff --git a/src/interface/android/twa-manifest.json b/src/interface/android/twa-manifest.json
new file mode 100644
index 000000000..9b4628343
--- /dev/null
+++ b/src/interface/android/twa-manifest.json
@@ -0,0 +1,55 @@
+{
+ "packageId": "dev.khoj.app",
+ "host": "app.khoj.dev",
+ "name": "Khoj AI",
+ "launcherName": "Khoj",
+ "display": "standalone",
+ "themeColor": "#FFFFFF",
+ "themeColorDark": "#000000",
+ "navigationColor": "#000000",
+ "navigationColorDark": "#000000",
+ "navigationDividerColor": "#000000",
+ "navigationDividerColorDark": "#000000",
+ "backgroundColor": "#FFFFFF",
+ "enableNotifications": true,
+ "startUrl": "/",
+ "iconUrl": "https://assets.khoj.dev/khoj_lantern_1200x1200.png",
+ "splashScreenFadeOutDuration": 300,
+ "signingKey": {
+ "path": "android.keystore",
+ "alias": "android"
+ },
+ "appVersionName": "4",
+ "appVersionCode": 4,
+ "shortcuts": [],
+ "generatorApp": "bubblewrap-cli",
+ "webManifestUrl": "https://app.khoj.dev/static/khoj.webmanifest",
+ "fallbackType": "customtabs",
+ "features": {
+ "locationDelegation": {
+ "enabled": true
+ }
+ },
+ "alphaDependencies": {
+ "enabled": false
+ },
+ "enableSiteSettingsShortcut": true,
+ "isChromeOSOnly": false,
+ "isMetaQuest": false,
+ "fullScopeUrl": "https://app.khoj.dev/",
+ "minSdkVersion": 19,
+ "orientation": "natural",
+ "fingerprints": [
+ {
+ "name": "signing",
+ "value": "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"
+ },
+ {
+ "name": "upload",
+ "value": "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"
+ }
+ ],
+ "additionalTrustedOrigins": [],
+ "retainedBundles": [],
+ "appVersion": "4"
+}
diff --git a/src/interface/web/public/assets/icons/khoj_lantern_1200x1200.png b/src/interface/web/public/assets/icons/khoj_lantern_1200x1200.png
new file mode 100644
index 000000000..14a8b28b1
Binary files /dev/null and b/src/interface/web/public/assets/icons/khoj_lantern_1200x1200.png differ
diff --git a/src/interface/web/public/assets/icons/khoj_lantern_512x512.png b/src/interface/web/public/assets/icons/khoj_lantern_512x512.png
new file mode 100644
index 000000000..046db1702
Binary files /dev/null and b/src/interface/web/public/assets/icons/khoj_lantern_512x512.png differ
diff --git a/src/interface/web/public/khoj.webmanifest b/src/interface/web/public/khoj.webmanifest
index e0ed3744b..295223896 100644
--- a/src/interface/web/public/khoj.webmanifest
+++ b/src/interface/web/public/khoj.webmanifest
@@ -1,11 +1,18 @@
{
- "name": "Khoj",
+ "id": "https://app.khoj.dev",
+ "name": "Khoj AI - Get Answers, Create Anything",
"short_name": "Khoj",
"display": "standalone",
"start_url": "/",
- "description": "The open, personal AI for your digital brain. You can ask Khoj to draft a message, paint your imagination, find information on the internet and even answer questions from your documents.",
+ "scope": "/",
+ "description": "Khoj is your open, personal AI. Gets answers from the internet and your documents. Quickly draft messages, summarize any information, generate beautiful paintings, create personal agents and do deep research.",
+ "categories": ["productivity", "utilities", "personalization", "education"],
"theme_color": "#ffffff",
"background_color": "#ffffff",
+ "orientation": "natural",
+ "launch_handler": {
+ "client_mode": ["navigate-existing", "auto"]
+ },
"icons": [
{
"src": "/static/assets/icons/khoj_lantern_128x128.png",
@@ -16,6 +23,24 @@
"src": "/static/assets/icons/khoj_lantern_256x256.png",
"sizes": "256x256",
"type": "image/png"
+ },
+ {
+ "src": "/static/assets/icons/khoj_lantern_512x512.png",
+ "sizes": "512x512",
+ "type": "image/png",
+ "purpose": "any"
+ },
+ {
+ "src": "/static/assets/icons/khoj_lantern_512x512.png",
+ "sizes": "512x512",
+ "type": "image/png",
+ "purpose": "maskable"
+ },
+ {
+ "src": "/static/assets/icons/khoj_lantern_1200x1200.png",
+ "sizes": "1200x1200",
+ "type": "image/png",
+ "purpose": "any"
}
],
"screenshots": [