Epoch01 commited on
Commit
9caffaa
·
verified ·
1 Parent(s): 1110d38

Upload folder using huggingface_hub

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +9 -0
  2. src/interface/android/app/build.gradle +211 -0
  3. src/interface/android/app/src/main/AndroidManifest.xml +188 -0
  4. src/interface/android/app/src/main/java/dev/khoj/app/Application.java +29 -0
  5. src/interface/android/app/src/main/java/dev/khoj/app/DelegationService.java +17 -0
  6. src/interface/android/app/src/main/java/dev/khoj/app/LauncherActivity.java +49 -0
  7. src/interface/android/app/src/main/res/drawable-anydpi/shortcut_legacy_background.xml +25 -0
  8. src/interface/android/app/src/main/res/drawable-hdpi/ic_notification_icon.png +0 -0
  9. src/interface/android/app/src/main/res/drawable-hdpi/splash.png +0 -0
  10. src/interface/android/app/src/main/res/drawable-mdpi/ic_notification_icon.png +0 -0
  11. src/interface/android/app/src/main/res/drawable-mdpi/splash.png +0 -0
  12. src/interface/android/app/src/main/res/drawable-xhdpi/ic_notification_icon.png +0 -0
  13. src/interface/android/app/src/main/res/drawable-xhdpi/splash.png +0 -0
  14. src/interface/android/app/src/main/res/drawable-xxhdpi/ic_notification_icon.png +0 -0
  15. src/interface/android/app/src/main/res/drawable-xxhdpi/splash.png +0 -0
  16. src/interface/android/app/src/main/res/drawable-xxxhdpi/ic_notification_icon.png +0 -0
  17. src/interface/android/app/src/main/res/drawable-xxxhdpi/splash.png +0 -0
  18. src/interface/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  19. src/interface/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  20. src/interface/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  21. src/interface/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  22. src/interface/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  23. src/interface/android/app/src/main/res/raw/web_app_manifest.json +1 -0
  24. src/interface/android/app/src/main/res/values/colors.xml +18 -0
  25. src/interface/android/app/src/main/res/values/strings.xml +36 -0
  26. src/interface/android/app/src/main/res/xml/filepaths.xml +18 -0
  27. src/interface/android/app/src/main/res/xml/shortcuts.xml +1 -0
  28. src/interface/android/build.gradle +42 -0
  29. src/interface/android/gradle.properties +14 -0
  30. src/interface/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  31. src/interface/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  32. src/interface/android/gradlew +249 -0
  33. src/interface/android/gradlew.bat +92 -0
  34. src/interface/android/manifest-checksum.txt +1 -0
  35. src/interface/android/settings.gradle +1 -0
  36. src/interface/android/store_icon.png +0 -0
  37. src/interface/android/twa-manifest.json +55 -0
  38. src/interface/desktop/README.md +37 -0
  39. src/interface/desktop/about.html +89 -0
  40. src/interface/desktop/assets/icons/clock.svg +1 -0
  41. src/interface/desktop/assets/icons/copy-button-success.svg +6 -0
  42. src/interface/desktop/assets/icons/copy-button.svg +5 -0
  43. src/interface/desktop/assets/icons/favicon-128x128.ico +3 -0
  44. src/interface/desktop/assets/icons/favicon-128x128.png +0 -0
  45. src/interface/desktop/assets/icons/favicon-20x20.png +0 -0
  46. src/interface/desktop/assets/icons/favicon-256x256.png +0 -0
  47. src/interface/desktop/assets/icons/favicon.icns +0 -0
  48. src/interface/desktop/assets/icons/favicon.ico +3 -0
  49. src/interface/desktop/assets/icons/file-not-synced.svg +1 -0
  50. src/interface/desktop/assets/icons/file-synced.svg +1 -0
.gitattributes CHANGED
@@ -1,2 +1,11 @@
1
  # Exclude tests data file from programming stats on Github
2
  tests/data/** linguist-vendored
 
 
 
 
 
 
 
 
 
 
1
  # Exclude tests data file from programming stats on Github
2
  tests/data/** linguist-vendored
3
+ src/interface/desktop/assets/icons/favicon-128x128.ico filter=lfs diff=lfs merge=lfs -text
4
+ src/interface/desktop/assets/icons/favicon.ico filter=lfs diff=lfs merge=lfs -text
5
+ src/interface/web/public/assets/icons/khoj_lantern.ico filter=lfs diff=lfs merge=lfs -text
6
+ src/interface/web/public/assets/samples/desktop-browse-draw-sample.png filter=lfs diff=lfs merge=lfs -text
7
+ src/interface/web/public/assets/samples/desktop-plain-chat-sample.png filter=lfs diff=lfs merge=lfs -text
8
+ src/interface/web/public/assets/samples/desktop-remember-plan-sample.png filter=lfs diff=lfs merge=lfs -text
9
+ src/interface/web/public/assets/samples/phone-browse-draw-sample.png filter=lfs diff=lfs merge=lfs -text
10
+ src/interface/web/public/assets/samples/phone-remember-plan-sample.png filter=lfs diff=lfs merge=lfs -text
11
+ src/khoj/interface/web/home/khoj_app_hero_image.avif filter=lfs diff=lfs merge=lfs -text
src/interface/android/app/build.gradle ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright 2019 Google Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import groovy.xml.MarkupBuilder
18
+
19
+ plugins {
20
+ id 'com.android.application'
21
+ }
22
+
23
+ def twaManifest = [
24
+ applicationId: 'dev.khoj.app',
25
+ hostName: 'app.khoj.dev', // The domain being opened in the TWA.
26
+ launchUrl: '/', // The start path for the TWA. Must be relative to the domain.
27
+ name: 'Khoj AI', // The application name.
28
+ launcherName: 'Khoj', // The name shown on the Android Launcher.
29
+ themeColor: '#FFFFFF', // The color used for the status bar.
30
+ themeColorDark: '#000000', // The color used for the dark status bar.
31
+ navigationColor: '#000000', // The color used for the navigation bar.
32
+ navigationColorDark: '#000000', // The color used for the dark navbar.
33
+ navigationDividerColor: '#000000', // The navbar divider color.
34
+ navigationDividerColorDark: '#000000', // The dark navbar divider color.
35
+ backgroundColor: '#FFFFFF', // The color used for the splash screen background.
36
+ enableNotifications: true, // Set to true to enable notification delegation.
37
+ // Every shortcut must include the following fields:
38
+ // - name: String that will show up in the shortcut.
39
+ // - short_name: Shorter string used if |name| is too long.
40
+ // - url: Absolute path of the URL to launch the app with (e.g '/create').
41
+ // - icon: Name of the resource in the drawable folder to use as an icon.
42
+ shortcuts: [],
43
+ // The duration of fade out animation in milliseconds to be played when removing splash screen.
44
+ splashScreenFadeOutDuration: 300,
45
+ generatorApp: 'bubblewrap-cli', // Application that generated the Android Project
46
+ // The fallback strategy for when Trusted Web Activity is not available. Possible values are
47
+ // 'customtabs' and 'webview'.
48
+ fallbackType: 'customtabs',
49
+ enableSiteSettingsShortcut: 'true',
50
+ orientation: 'natural',
51
+ ]
52
+
53
+ android {
54
+ compileSdkVersion 35
55
+ namespace "dev.khoj.app"
56
+ defaultConfig {
57
+ applicationId "dev.khoj.app"
58
+ minSdkVersion 19
59
+ targetSdkVersion 35
60
+ versionCode 4
61
+ versionName "4"
62
+
63
+ // The name for the application
64
+ resValue "string", "appName", twaManifest.name
65
+
66
+ // The name for the application on the Android Launcher
67
+ resValue "string", "launcherName", twaManifest.launcherName
68
+
69
+ // The URL that will be used when launching the TWA from the Android Launcher
70
+ def launchUrl = "https://" + twaManifest.hostName + twaManifest.launchUrl
71
+ resValue "string", "launchUrl", launchUrl
72
+
73
+
74
+ // The URL the Web Manifest for the Progressive Web App that the TWA points to. This
75
+ // is used by Chrome OS and Meta Quest to open the Web version of the PWA instead of
76
+ // the TWA, as it will probably give a better user experience for non-mobile devices.
77
+ resValue "string", "webManifestUrl", 'https://app.khoj.dev/static/khoj.webmanifest'
78
+
79
+
80
+
81
+ // This is used by Meta Quest.
82
+ resValue "string", "fullScopeUrl", 'https://app.khoj.dev/'
83
+
84
+
85
+
86
+
87
+ // The hostname is used when building the intent-filter, so the TWA is able to
88
+ // handle Intents to open host url of the application.
89
+ resValue "string", "hostName", twaManifest.hostName
90
+
91
+ // This attribute sets the status bar color for the TWA. It can be either set here or in
92
+ // `res/values/colors.xml`. Setting in both places is an error and the app will not
93
+ // compile. If not set, the status bar color defaults to #FFFFFF - white.
94
+ resValue "color", "colorPrimary", twaManifest.themeColor
95
+
96
+ // This attribute sets the dark status bar color for the TWA. It can be either set here or in
97
+ // `res/values/colors.xml`. Setting in both places is an error and the app will not
98
+ // compile. If not set, the status bar color defaults to #000000 - white.
99
+ resValue "color", "colorPrimaryDark", twaManifest.themeColorDark
100
+
101
+ // This attribute sets the navigation bar color for the TWA. It can be either set here or
102
+ // in `res/values/colors.xml`. Setting in both places is an error and the app will not
103
+ // compile. If not set, the navigation bar color defaults to #FFFFFF - white.
104
+ resValue "color", "navigationColor", twaManifest.navigationColor
105
+
106
+ // This attribute sets the dark navigation bar color for the TWA. It can be either set here
107
+ // or in `res/values/colors.xml`. Setting in both places is an error and the app will not
108
+ // compile. If not set, the navigation bar color defaults to #000000 - black.
109
+ resValue "color", "navigationColorDark", twaManifest.navigationColorDark
110
+
111
+ // This attribute sets the navbar divider color for the TWA. It can be either
112
+ // set here or in `res/values/colors.xml`. Setting in both places is an error and the app
113
+ // will not compile. If not set, the divider color defaults to #00000000 - transparent.
114
+ resValue "color", "navigationDividerColor", twaManifest.navigationDividerColor
115
+
116
+ // This attribute sets the dark navbar divider color for the TWA. It can be either
117
+ // set here or in `res/values/colors.xml`. Setting in both places is an error and the
118
+ //app will not compile. If not set, the divider color defaults to #000000 - black.
119
+ resValue "color", "navigationDividerColorDark", twaManifest.navigationDividerColorDark
120
+
121
+ // Sets the color for the background used for the splash screen when launching the
122
+ // Trusted Web Activity.
123
+ resValue "color", "backgroundColor", twaManifest.backgroundColor
124
+
125
+ // Defines a provider authority for the Splash Screen
126
+ resValue "string", "providerAuthority", twaManifest.applicationId + '.fileprovider'
127
+
128
+ // The enableNotification resource is used to enable or disable the
129
+ // TrustedWebActivityService, by changing the android:enabled and android:exported
130
+ // attributes
131
+ resValue "bool", "enableNotification", twaManifest.enableNotifications.toString()
132
+
133
+ twaManifest.shortcuts.eachWithIndex { shortcut, index ->
134
+ resValue "string", "shortcut_name_$index", "$shortcut.name"
135
+ resValue "string", "shortcut_short_name_$index", "$shortcut.short_name"
136
+ }
137
+
138
+ // The splashScreenFadeOutDuration resource is used to set the duration of fade out animation in milliseconds
139
+ // to be played when removing splash screen. The default is 0 (no animation).
140
+ resValue "integer", "splashScreenFadeOutDuration", twaManifest.splashScreenFadeOutDuration.toString()
141
+
142
+ resValue "string", "generatorApp", twaManifest.generatorApp
143
+
144
+ resValue "string", "fallbackType", twaManifest.fallbackType
145
+
146
+ resValue "bool", "enableSiteSettingsShortcut", twaManifest.enableSiteSettingsShortcut
147
+ resValue "string", "orientation", twaManifest.orientation
148
+ }
149
+ buildTypes {
150
+ release {
151
+ minifyEnabled true
152
+ }
153
+ }
154
+ compileOptions {
155
+ sourceCompatibility JavaVersion.VERSION_1_8
156
+ targetCompatibility JavaVersion.VERSION_1_8
157
+ }
158
+ lintOptions {
159
+ checkReleaseBuilds false
160
+ }
161
+ }
162
+
163
+ task generateShorcutsFile {
164
+ assert twaManifest.shortcuts.size() < 5, "You can have at most 4 shortcuts."
165
+ twaManifest.shortcuts.eachWithIndex { s, i ->
166
+ assert s.name != null, 'Missing `name` in shortcut #' + i
167
+ assert s.short_name != null, 'Missing `short_name` in shortcut #' + i
168
+ assert s.url != null, 'Missing `icon` in shortcut #' + i
169
+ assert s.icon != null, 'Missing `url` in shortcut #' + i
170
+ }
171
+
172
+ def shortcutsFile = new File("$projectDir/src/main/res/xml", "shortcuts.xml")
173
+
174
+ def xmlWriter = new StringWriter()
175
+ def xmlMarkup = new MarkupBuilder(new IndentPrinter(xmlWriter, " ", true))
176
+
177
+ xmlMarkup
178
+ .'shortcuts'('xmlns:android': 'http://schemas.android.com/apk/res/android') {
179
+ twaManifest.shortcuts.eachWithIndex { s, i ->
180
+ 'shortcut'(
181
+ 'android:shortcutId': 'shortcut' + i,
182
+ 'android:enabled': 'true',
183
+ 'android:icon': '@drawable/' + s.icon,
184
+ 'android:shortcutShortLabel': '@string/shortcut_short_name_' + i,
185
+ 'android:shortcutLongLabel': '@string/shortcut_name_' + i) {
186
+ 'intent'(
187
+ 'android:action': 'android.intent.action.MAIN',
188
+ 'android:targetPackage': twaManifest.applicationId,
189
+ 'android:targetClass': twaManifest.applicationId + '.LauncherActivity',
190
+ 'android:data': s.url)
191
+ 'categories'('android:name': 'android.intent.category.LAUNCHER')
192
+ }
193
+ }
194
+ }
195
+ shortcutsFile.text = xmlWriter.toString() + '\n'
196
+ }
197
+
198
+ preBuild.dependsOn(generateShorcutsFile)
199
+
200
+ repositories {
201
+
202
+ }
203
+
204
+ dependencies {
205
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
206
+
207
+ implementation 'com.google.androidbrowserhelper:locationdelegation:1.1.1'
208
+
209
+ implementation 'com.google.androidbrowserhelper:androidbrowserhelper:2.5.0'
210
+
211
+ }
src/interface/android/app/src/main/AndroidManifest.xml ADDED
@@ -0,0 +1,188 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--
2
+ Copyright 2019 Google Inc. All Rights Reserved.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ -->
16
+
17
+ <!-- The "package" attribute is rewritten by the Gradle build with the value of applicationId.
18
+ It is still required here, as it is used to derive paths, for instance when referring
19
+ to an Activity by ".MyActivity" instead of the full name. If more Activities are added to the
20
+ application, the package attribute will need to reflect the correct path in order to use
21
+ the abbreviated format. -->
22
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
23
+ package="dev.khoj.app">
24
+
25
+
26
+ <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+ <application
36
+ android:name="Application"
37
+ android:allowBackup="true"
38
+ android:icon="@mipmap/ic_launcher"
39
+ android:label="@string/appName"
40
+
41
+ android:manageSpaceActivity="com.google.androidbrowserhelper.trusted.ManageDataLauncherActivity"
42
+
43
+ android:supportsRtl="true"
44
+ android:theme="@android:style/Theme.Translucent.NoTitleBar">
45
+
46
+ <meta-data
47
+ android:name="asset_statements"
48
+ android:resource="@string/assetStatements" />
49
+
50
+
51
+ <meta-data
52
+ android:name="web_manifest_url"
53
+ android:value="@string/webManifestUrl" />
54
+
55
+
56
+ <meta-data
57
+ android:name="twa_generator"
58
+ android:value="@string/generatorApp" />
59
+
60
+
61
+
62
+
63
+
64
+
65
+ <activity android:name="com.google.androidbrowserhelper.trusted.ManageDataLauncherActivity">
66
+ <meta-data
67
+ android:name="android.support.customtabs.trusted.MANAGE_SPACE_URL"
68
+ android:value="@string/launchUrl" />
69
+ </activity>
70
+
71
+
72
+ <activity android:name="LauncherActivity"
73
+ android:alwaysRetainTaskState="true"
74
+ android:label="@string/launcherName"
75
+ android:exported="true">
76
+ <meta-data android:name="android.support.customtabs.trusted.DEFAULT_URL"
77
+ android:value="@string/launchUrl" />
78
+
79
+ <meta-data
80
+ android:name="android.support.customtabs.trusted.STATUS_BAR_COLOR"
81
+ android:resource="@color/colorPrimary" />
82
+
83
+ <meta-data
84
+ android:name="android.support.customtabs.trusted.STATUS_BAR_COLOR_DARK"
85
+ android:resource="@color/colorPrimaryDark" />
86
+
87
+ <meta-data
88
+ android:name="android.support.customtabs.trusted.NAVIGATION_BAR_COLOR"
89
+ android:resource="@color/navigationColor" />
90
+
91
+ <meta-data
92
+ android:name="android.support.customtabs.trusted.NAVIGATION_BAR_COLOR_DARK"
93
+ android:resource="@color/navigationColorDark" />
94
+
95
+ <meta-data
96
+ android:name="androix.browser.trusted.NAVIGATION_BAR_DIVIDER_COLOR"
97
+ android:resource="@color/navigationDividerColor" />
98
+
99
+ <meta-data
100
+ android:name="androix.browser.trusted.NAVIGATION_BAR_DIVIDER_COLOR_DARK"
101
+ android:resource="@color/navigationDividerColorDark" />
102
+
103
+ <meta-data android:name="android.support.customtabs.trusted.SPLASH_IMAGE_DRAWABLE"
104
+ android:resource="@drawable/splash"/>
105
+
106
+ <meta-data android:name="android.support.customtabs.trusted.SPLASH_SCREEN_BACKGROUND_COLOR"
107
+ android:resource="@color/backgroundColor"/>
108
+
109
+ <meta-data android:name="android.support.customtabs.trusted.SPLASH_SCREEN_FADE_OUT_DURATION"
110
+ android:value="@integer/splashScreenFadeOutDuration"/>
111
+
112
+ <meta-data android:name="android.support.customtabs.trusted.FILE_PROVIDER_AUTHORITY"
113
+ android:value="@string/providerAuthority"/>
114
+
115
+ <meta-data android:name="android.app.shortcuts" android:resource="@xml/shortcuts" />
116
+
117
+ <meta-data android:name="android.support.customtabs.trusted.FALLBACK_STRATEGY"
118
+ android:value="@string/fallbackType" />
119
+
120
+
121
+
122
+
123
+
124
+ <meta-data android:name="android.support.customtabs.trusted.SCREEN_ORIENTATION"
125
+ android:value="@string/orientation"/>
126
+
127
+
128
+
129
+
130
+
131
+ <intent-filter>
132
+ <action android:name="android.intent.action.MAIN" />
133
+ <category android:name="android.intent.category.LAUNCHER" />
134
+ </intent-filter>
135
+
136
+ <intent-filter android:autoVerify="true">
137
+ <action android:name="android.intent.action.VIEW"/>
138
+ <category android:name="android.intent.category.DEFAULT" />
139
+ <category android:name="android.intent.category.BROWSABLE"/>
140
+ <data android:scheme="https"
141
+ android:host="@string/hostName"/>
142
+ </intent-filter>
143
+
144
+
145
+ </activity>
146
+
147
+ <activity android:name="com.google.androidbrowserhelper.trusted.FocusActivity" />
148
+
149
+ <activity android:name="com.google.androidbrowserhelper.trusted.WebViewFallbackActivity"
150
+ android:configChanges="orientation|screenSize" />
151
+
152
+ <provider
153
+ android:name="androidx.core.content.FileProvider"
154
+ android:authorities="@string/providerAuthority"
155
+ android:grantUriPermissions="true"
156
+ android:exported="false">
157
+ <meta-data
158
+ android:name="android.support.FILE_PROVIDER_PATHS"
159
+ android:resource="@xml/filepaths" />
160
+ </provider>
161
+
162
+ <service
163
+ android:name=".DelegationService"
164
+ android:enabled="@bool/enableNotification"
165
+ android:exported="@bool/enableNotification">
166
+
167
+
168
+ <meta-data
169
+ android:name="android.support.customtabs.trusted.SMALL_ICON"
170
+ android:resource="@drawable/ic_notification_icon" />
171
+
172
+
173
+ <intent-filter>
174
+ <action android:name="android.support.customtabs.trusted.TRUSTED_WEB_ACTIVITY_SERVICE"/>
175
+ <category android:name="android.intent.category.DEFAULT"/>
176
+ </intent-filter>
177
+ </service>
178
+
179
+
180
+ <activity android:name="com.google.androidbrowserhelper.trusted.NotificationPermissionRequestActivity" />
181
+
182
+
183
+
184
+ <activity android:name=
185
+ "com.google.androidbrowserhelper.locationdelegation.PermissionRequestActivity"/>
186
+
187
+ </application>
188
+ </manifest>
src/interface/android/app/src/main/java/dev/khoj/app/Application.java ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright 2020 Google Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ package dev.khoj.app;
17
+
18
+
19
+
20
+ public class Application extends android.app.Application {
21
+
22
+
23
+
24
+ @Override
25
+ public void onCreate() {
26
+ super.onCreate();
27
+
28
+ }
29
+ }
src/interface/android/app/src/main/java/dev/khoj/app/DelegationService.java ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package dev.khoj.app;
2
+
3
+
4
+ import com.google.androidbrowserhelper.locationdelegation.LocationDelegationExtraCommandHandler;
5
+
6
+
7
+ public class DelegationService extends
8
+ com.google.androidbrowserhelper.trusted.DelegationService {
9
+ @Override
10
+ public void onCreate() {
11
+ super.onCreate();
12
+
13
+
14
+ registerExtraCommandHandler(new LocationDelegationExtraCommandHandler());
15
+
16
+ }
17
+ }
src/interface/android/app/src/main/java/dev/khoj/app/LauncherActivity.java ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright 2020 Google Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ package dev.khoj.app;
17
+
18
+ import android.content.pm.ActivityInfo;
19
+ import android.net.Uri;
20
+ import android.os.Bundle;
21
+
22
+
23
+
24
+ public class LauncherActivity
25
+ extends com.google.androidbrowserhelper.trusted.LauncherActivity {
26
+
27
+
28
+
29
+
30
+ @Override
31
+ protected void onCreate(Bundle savedInstanceState) {
32
+ super.onCreate(savedInstanceState);
33
+ // Setting an orientation crashes the app due to the transparent background on Android 8.0
34
+ // Oreo and below. We only set the orientation on Oreo and above. This only affects the
35
+ // splash screen and Chrome will still respect the orientation.
36
+ // See https://github.com/GoogleChromeLabs/bubblewrap/issues/496 for details.
37
+ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
38
+ }
39
+
40
+ @Override
41
+ protected Uri getLaunchingUrl() {
42
+ // Get the original launch Url.
43
+ Uri uri = super.getLaunchingUrl();
44
+
45
+
46
+
47
+ return uri;
48
+ }
49
+ }
src/interface/android/app/src/main/res/drawable-anydpi/shortcut_legacy_background.xml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--
2
+ Copyright 2020 Google Inc. All Rights Reserved.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ -->
16
+ <inset xmlns:android="http://schemas.android.com/apk/res/android"
17
+ xmlns:aapt="http://schemas.android.com/aapt"
18
+ android:inset="2dp">
19
+ <aapt:attr name="android:drawable">
20
+ <shape android:shape="oval">
21
+ <solid android:color="@color/shortcut_background" />
22
+ <size android:width="44dp" android:height="44dp" />
23
+ </shape>
24
+ </aapt:attr>
25
+ </inset>
src/interface/android/app/src/main/res/drawable-hdpi/ic_notification_icon.png ADDED
src/interface/android/app/src/main/res/drawable-hdpi/splash.png ADDED
src/interface/android/app/src/main/res/drawable-mdpi/ic_notification_icon.png ADDED
src/interface/android/app/src/main/res/drawable-mdpi/splash.png ADDED
src/interface/android/app/src/main/res/drawable-xhdpi/ic_notification_icon.png ADDED
src/interface/android/app/src/main/res/drawable-xhdpi/splash.png ADDED
src/interface/android/app/src/main/res/drawable-xxhdpi/ic_notification_icon.png ADDED
src/interface/android/app/src/main/res/drawable-xxhdpi/splash.png ADDED
src/interface/android/app/src/main/res/drawable-xxxhdpi/ic_notification_icon.png ADDED
src/interface/android/app/src/main/res/drawable-xxxhdpi/splash.png ADDED
src/interface/android/app/src/main/res/mipmap-hdpi/ic_launcher.png ADDED
src/interface/android/app/src/main/res/mipmap-mdpi/ic_launcher.png ADDED
src/interface/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png ADDED
src/interface/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png ADDED
src/interface/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png ADDED
src/interface/android/app/src/main/res/raw/web_app_manifest.json ADDED
@@ -0,0 +1 @@
 
 
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"}]}
src/interface/android/app/src/main/res/values/colors.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--
2
+ Copyright 2020 Google Inc. All Rights Reserved.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ -->
16
+ <resources>
17
+ <color name="shortcut_background">#F5F5F5</color>
18
+ </resources>
src/interface/android/app/src/main/res/values/strings.xml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!--
3
+ Copyright 2021 Google Inc. All Rights Reserved.
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+ -->
17
+ <resources>
18
+
19
+
20
+ <!--
21
+ This variable below expresses the relationship between the app and the site,
22
+ as documented in the TWA documentation at
23
+ https://developers.google.com/web/updates/2017/10/using-twa#set_up_digital_asset_links_in_an_android_app
24
+ and is injected into the AndroidManifest.xml
25
+ -->
26
+ <string name="assetStatements">
27
+ [{
28
+ \"relation\": [\"delegate_permission/common.handle_all_urls\"],
29
+ \"target\": {
30
+ \"namespace\": \"web\",
31
+ \"site\": \"https://app.khoj.dev\"
32
+ }
33
+ }]
34
+
35
+ </string>
36
+ </resources>
src/interface/android/app/src/main/res/xml/filepaths.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--
2
+ Copyright 2019 Google Inc. All Rights Reserved.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ -->
16
+ <paths>
17
+ <files-path path="twa_splash/" name="twa_splash" />
18
+ </paths>
src/interface/android/app/src/main/res/xml/shortcuts.xml ADDED
@@ -0,0 +1 @@
 
 
1
+ <shortcuts xmlns:android='http://schemas.android.com/apk/res/android' />
src/interface/android/build.gradle ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright 2019 Google Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ // Top-level build file where you can add configuration options common to all sub-projects/modules.
18
+
19
+ buildscript {
20
+
21
+ repositories {
22
+ google()
23
+ mavenCentral()
24
+ }
25
+ dependencies {
26
+ classpath 'com.android.tools.build:gradle:8.7.2'
27
+
28
+ // NOTE: Do not place your application dependencies here; they belong
29
+ // in the individual module build.gradle files
30
+ }
31
+ }
32
+
33
+ allprojects {
34
+ repositories {
35
+ google()
36
+ mavenCentral()
37
+ }
38
+ }
39
+
40
+ tasks.register('clean', Delete) {
41
+ delete rootProject.buildDir
42
+ }
src/interface/android/gradle.properties ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Project-wide Gradle settings.
2
+ # IDE (e.g. Android Studio) users:
3
+ # Gradle settings configured through the IDE *will override*
4
+ # any settings specified in this file.
5
+ # For more details on how to configure your build environment visit
6
+ # http://www.gradle.org/docs/current/userguide/build_environment.html
7
+ # Specifies the JVM arguments used for the daemon process.
8
+ # The setting is particularly useful for tweaking memory settings.
9
+ org.gradle.jvmargs=-Xmx1536m
10
+ # When configured, Gradle will run in incubating parallel mode.
11
+ # This option should only be used with decoupled projects. More details, visit
12
+ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13
+ # org.gradle.parallel=true
14
+ android.useAndroidX=true
src/interface/android/gradle/wrapper/gradle-wrapper.jar ADDED
Binary file (55.6 kB). View file
 
src/interface/android/gradle/wrapper/gradle-wrapper.properties ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ distributionBase=GRADLE_USER_HOME
2
+ distributionPath=wrapper/dists
3
+ zipStoreBase=GRADLE_USER_HOME
4
+ zipStorePath=wrapper/dists
5
+ distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
6
+ networkTimeout=10000
7
+ validateDistributionUrl=true
src/interface/android/gradlew ADDED
@@ -0,0 +1,249 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+
3
+ #
4
+ # Copyright © 2015-2021 the original authors.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # https://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ ##############################################################################
20
+ #
21
+ # Gradle start up script for POSIX generated by Gradle.
22
+ #
23
+ # Important for running:
24
+ #
25
+ # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26
+ # noncompliant, but you have some other compliant shell such as ksh or
27
+ # bash, then to run this script, type that shell name before the whole
28
+ # command line, like:
29
+ #
30
+ # ksh Gradle
31
+ #
32
+ # Busybox and similar reduced shells will NOT work, because this script
33
+ # requires all of these POSIX shell features:
34
+ # * functions;
35
+ # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36
+ # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37
+ # * compound commands having a testable exit status, especially «case»;
38
+ # * various built-in commands including «command», «set», and «ulimit».
39
+ #
40
+ # Important for patching:
41
+ #
42
+ # (2) This script targets any POSIX shell, so it avoids extensions provided
43
+ # by Bash, Ksh, etc; in particular arrays are avoided.
44
+ #
45
+ # The "traditional" practice of packing multiple parameters into a
46
+ # space-separated string is a well documented source of bugs and security
47
+ # problems, so this is (mostly) avoided, by progressively accumulating
48
+ # options in "$@", and eventually passing that to Java.
49
+ #
50
+ # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51
+ # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
52
+ # see the in-line comments for details.
53
+ #
54
+ # There are tweaks for specific operating systems such as AIX, CygWin,
55
+ # Darwin, MinGW, and NonStop.
56
+ #
57
+ # (3) This script is generated from the Groovy template
58
+ # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59
+ # within the Gradle project.
60
+ #
61
+ # You can find Gradle at https://github.com/gradle/gradle/.
62
+ #
63
+ ##############################################################################
64
+
65
+ # Attempt to set APP_HOME
66
+
67
+ # Resolve links: $0 may be a link
68
+ app_path=$0
69
+
70
+ # Need this for daisy-chained symlinks.
71
+ while
72
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
73
+ [ -h "$app_path" ]
74
+ do
75
+ ls=$( ls -ld "$app_path" )
76
+ link=${ls#*' -> '}
77
+ case $link in #(
78
+ /*) app_path=$link ;; #(
79
+ *) app_path=$APP_HOME$link ;;
80
+ esac
81
+ done
82
+
83
+ # This is normally unused
84
+ # shellcheck disable=SC2034
85
+ APP_BASE_NAME=${0##*/}
86
+ # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87
+ APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
88
+
89
+ # Use the maximum available, or set MAX_FD != -1 to use that value.
90
+ MAX_FD=maximum
91
+
92
+ warn () {
93
+ echo "$*"
94
+ } >&2
95
+
96
+ die () {
97
+ echo
98
+ echo "$*"
99
+ echo
100
+ exit 1
101
+ } >&2
102
+
103
+ # OS specific support (must be 'true' or 'false').
104
+ cygwin=false
105
+ msys=false
106
+ darwin=false
107
+ nonstop=false
108
+ case "$( uname )" in #(
109
+ CYGWIN* ) cygwin=true ;; #(
110
+ Darwin* ) darwin=true ;; #(
111
+ MSYS* | MINGW* ) msys=true ;; #(
112
+ NONSTOP* ) nonstop=true ;;
113
+ esac
114
+
115
+ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
116
+
117
+
118
+ # Determine the Java command to use to start the JVM.
119
+ if [ -n "$JAVA_HOME" ] ; then
120
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
121
+ # IBM's JDK on AIX uses strange locations for the executables
122
+ JAVACMD=$JAVA_HOME/jre/sh/java
123
+ else
124
+ JAVACMD=$JAVA_HOME/bin/java
125
+ fi
126
+ if [ ! -x "$JAVACMD" ] ; then
127
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
128
+
129
+ Please set the JAVA_HOME variable in your environment to match the
130
+ location of your Java installation."
131
+ fi
132
+ else
133
+ JAVACMD=java
134
+ if ! command -v java >/dev/null 2>&1
135
+ then
136
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137
+
138
+ Please set the JAVA_HOME variable in your environment to match the
139
+ location of your Java installation."
140
+ fi
141
+ fi
142
+
143
+ # Increase the maximum file descriptors if we can.
144
+ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
145
+ case $MAX_FD in #(
146
+ max*)
147
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
148
+ # shellcheck disable=SC2039,SC3045
149
+ MAX_FD=$( ulimit -H -n ) ||
150
+ warn "Could not query maximum file descriptor limit"
151
+ esac
152
+ case $MAX_FD in #(
153
+ '' | soft) :;; #(
154
+ *)
155
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
156
+ # shellcheck disable=SC2039,SC3045
157
+ ulimit -n "$MAX_FD" ||
158
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
159
+ esac
160
+ fi
161
+
162
+ # Collect all arguments for the java command, stacking in reverse order:
163
+ # * args from the command line
164
+ # * the main class name
165
+ # * -classpath
166
+ # * -D...appname settings
167
+ # * --module-path (only if needed)
168
+ # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
169
+
170
+ # For Cygwin or MSYS, switch paths to Windows format before running java
171
+ if "$cygwin" || "$msys" ; then
172
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
173
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
174
+
175
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
176
+
177
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
178
+ for arg do
179
+ if
180
+ case $arg in #(
181
+ -*) false ;; # don't mess with options #(
182
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
183
+ [ -e "$t" ] ;; #(
184
+ *) false ;;
185
+ esac
186
+ then
187
+ arg=$( cygpath --path --ignore --mixed "$arg" )
188
+ fi
189
+ # Roll the args list around exactly as many times as the number of
190
+ # args, so each arg winds up back in the position where it started, but
191
+ # possibly modified.
192
+ #
193
+ # NB: a `for` loop captures its iteration list before it begins, so
194
+ # changing the positional parameters here affects neither the number of
195
+ # iterations, nor the values presented in `arg`.
196
+ shift # remove old arg
197
+ set -- "$@" "$arg" # push replacement arg
198
+ done
199
+ fi
200
+
201
+
202
+ # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
203
+ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
204
+
205
+ # Collect all arguments for the java command:
206
+ # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207
+ # and any embedded shellness will be escaped.
208
+ # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209
+ # treated as '${Hostname}' itself on the command line.
210
+
211
+ set -- \
212
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
213
+ -classpath "$CLASSPATH" \
214
+ org.gradle.wrapper.GradleWrapperMain \
215
+ "$@"
216
+
217
+ # Stop when "xargs" is not available.
218
+ if ! command -v xargs >/dev/null 2>&1
219
+ then
220
+ die "xargs is not available"
221
+ fi
222
+
223
+ # Use "xargs" to parse quoted args.
224
+ #
225
+ # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
226
+ #
227
+ # In Bash we could simply go:
228
+ #
229
+ # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
230
+ # set -- "${ARGS[@]}" "$@"
231
+ #
232
+ # but POSIX shell has neither arrays nor command substitution, so instead we
233
+ # post-process each arg (as a line of input to sed) to backslash-escape any
234
+ # character that might be a shell metacharacter, then use eval to reverse
235
+ # that process (while maintaining the separation between arguments), and wrap
236
+ # the whole thing up as a single "set" statement.
237
+ #
238
+ # This will of course break if any of these variables contains a newline or
239
+ # an unmatched quote.
240
+ #
241
+
242
+ eval "set -- $(
243
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
244
+ xargs -n1 |
245
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
246
+ tr '\n' ' '
247
+ )" '"$@"'
248
+
249
+ exec "$JAVACMD" "$@"
src/interface/android/gradlew.bat ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @rem
2
+ @rem Copyright 2015 the original author or authors.
3
+ @rem
4
+ @rem Licensed under the Apache License, Version 2.0 (the "License");
5
+ @rem you may not use this file except in compliance with the License.
6
+ @rem You may obtain a copy of the License at
7
+ @rem
8
+ @rem https://www.apache.org/licenses/LICENSE-2.0
9
+ @rem
10
+ @rem Unless required by applicable law or agreed to in writing, software
11
+ @rem distributed under the License is distributed on an "AS IS" BASIS,
12
+ @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ @rem See the License for the specific language governing permissions and
14
+ @rem limitations under the License.
15
+ @rem
16
+
17
+ @if "%DEBUG%"=="" @echo off
18
+ @rem ##########################################################################
19
+ @rem
20
+ @rem Gradle startup script for Windows
21
+ @rem
22
+ @rem ##########################################################################
23
+
24
+ @rem Set local scope for the variables with windows NT shell
25
+ if "%OS%"=="Windows_NT" setlocal
26
+
27
+ set DIRNAME=%~dp0
28
+ if "%DIRNAME%"=="" set DIRNAME=.
29
+ @rem This is normally unused
30
+ set APP_BASE_NAME=%~n0
31
+ set APP_HOME=%DIRNAME%
32
+
33
+ @rem Resolve any "." and ".." in APP_HOME to make it shorter.
34
+ for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
35
+
36
+ @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
37
+ set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
38
+
39
+ @rem Find java.exe
40
+ if defined JAVA_HOME goto findJavaFromJavaHome
41
+
42
+ set JAVA_EXE=java.exe
43
+ %JAVA_EXE% -version >NUL 2>&1
44
+ if %ERRORLEVEL% equ 0 goto execute
45
+
46
+ echo. 1>&2
47
+ echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
48
+ echo. 1>&2
49
+ echo Please set the JAVA_HOME variable in your environment to match the 1>&2
50
+ echo location of your Java installation. 1>&2
51
+
52
+ goto fail
53
+
54
+ :findJavaFromJavaHome
55
+ set JAVA_HOME=%JAVA_HOME:"=%
56
+ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
57
+
58
+ if exist "%JAVA_EXE%" goto execute
59
+
60
+ echo. 1>&2
61
+ echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
62
+ echo. 1>&2
63
+ echo Please set the JAVA_HOME variable in your environment to match the 1>&2
64
+ echo location of your Java installation. 1>&2
65
+
66
+ goto fail
67
+
68
+ :execute
69
+ @rem Setup the command line
70
+
71
+ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
72
+
73
+
74
+ @rem Execute Gradle
75
+ "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
76
+
77
+ :end
78
+ @rem End local scope for the variables with windows NT shell
79
+ if %ERRORLEVEL% equ 0 goto mainEnd
80
+
81
+ :fail
82
+ rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83
+ rem the _cmd.exe /c_ return code!
84
+ set EXIT_CODE=%ERRORLEVEL%
85
+ if %EXIT_CODE% equ 0 set EXIT_CODE=1
86
+ if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87
+ exit /b %EXIT_CODE%
88
+
89
+ :mainEnd
90
+ if "%OS%"=="Windows_NT" endlocal
91
+
92
+ :omega
src/interface/android/manifest-checksum.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ 6ee1711cf4f745dafc80c1cc13c3025342a0f5da
src/interface/android/settings.gradle ADDED
@@ -0,0 +1 @@
 
 
1
+ include ':app'
src/interface/android/store_icon.png ADDED
src/interface/android/twa-manifest.json ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "packageId": "dev.khoj.app",
3
+ "host": "app.khoj.dev",
4
+ "name": "Khoj AI",
5
+ "launcherName": "Khoj",
6
+ "display": "standalone",
7
+ "themeColor": "#FFFFFF",
8
+ "themeColorDark": "#000000",
9
+ "navigationColor": "#000000",
10
+ "navigationColorDark": "#000000",
11
+ "navigationDividerColor": "#000000",
12
+ "navigationDividerColorDark": "#000000",
13
+ "backgroundColor": "#FFFFFF",
14
+ "enableNotifications": true,
15
+ "startUrl": "/",
16
+ "iconUrl": "https://assets.khoj.dev/khoj_lantern_1200x1200.png",
17
+ "splashScreenFadeOutDuration": 300,
18
+ "signingKey": {
19
+ "path": "android.keystore",
20
+ "alias": "android"
21
+ },
22
+ "appVersionName": "4",
23
+ "appVersionCode": 4,
24
+ "shortcuts": [],
25
+ "generatorApp": "bubblewrap-cli",
26
+ "webManifestUrl": "https://app.khoj.dev/static/khoj.webmanifest",
27
+ "fallbackType": "customtabs",
28
+ "features": {
29
+ "locationDelegation": {
30
+ "enabled": true
31
+ }
32
+ },
33
+ "alphaDependencies": {
34
+ "enabled": false
35
+ },
36
+ "enableSiteSettingsShortcut": true,
37
+ "isChromeOSOnly": false,
38
+ "isMetaQuest": false,
39
+ "fullScopeUrl": "https://app.khoj.dev/",
40
+ "minSdkVersion": 19,
41
+ "orientation": "natural",
42
+ "fingerprints": [
43
+ {
44
+ "name": "signing",
45
+ "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"
46
+ },
47
+ {
48
+ "name": "upload",
49
+ "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"
50
+ }
51
+ ],
52
+ "additionalTrustedOrigins": [],
53
+ "retainedBundles": [],
54
+ "appVersion": "4"
55
+ }
src/interface/desktop/README.md ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Run it locally
2
+
3
+ ## Prerequisites
4
+
5
+ Install the runtime dependencies. This command should install all dev dependencies.
6
+
7
+ ```bash
8
+ yarn install
9
+ ```
10
+
11
+ Run the application
12
+
13
+ ```bash
14
+ yarn start
15
+ ```
16
+
17
+ # Deploying the Electron App
18
+
19
+ ## Prerequisites
20
+
21
+ Install the ToDesktop CLI. Full documentation can be found here: https://www.npmjs.com/package/@todesktop/cli
22
+
23
+ ```bash
24
+ yarn global add @todesktop/cli
25
+ ```
26
+
27
+ Configure the `todesktop.json` file. Fill in the `id` based on the application ID.
28
+
29
+ ## Build
30
+
31
+ This will prompt you to login. It triggers builds for all platforms.
32
+
33
+ ```bash
34
+ todesktop build
35
+ ```
36
+
37
+ If you get an error saying the command is not found, make sure that your `yarn` global bin directory is in your `PATH` environment variable. You can find the location of the global bin directory by running `yarn global bin`. Add this line to your `.bashrc` or `.zshrc` file: `export PATH="$PATH:$(yarn global bin)"`.
src/interface/desktop/about.html ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <html>
2
+ <head>
3
+ <meta charset="utf-8">
4
+ <meta name="viewport" content="width=device-width, initial-scale=1.0 maximum-scale=1.0">
5
+ <title>Khoj - About</title>
6
+
7
+ <link rel="icon" type="image/png" sizes="128x128" href="./assets/icons/favicon-128x128.png">
8
+ <link rel="manifest" href="/static/khoj.webmanifest">
9
+ <link rel="stylesheet" href="./assets/khoj.css">
10
+ </head>
11
+ <script type="text/javascript" src="./utils.js"></script>
12
+ <style>
13
+ html, body {
14
+ height: 100%;
15
+ width: 100%;
16
+ padding: 0px;
17
+ margin: 0px;
18
+ }
19
+ body {
20
+ display: grid;
21
+ grid-template-rows: auto;
22
+ background: var(--background-color);
23
+ color: var(--main-text-color);
24
+ text-align: center;
25
+ font-family: var(--font-family);
26
+ font-size: small;
27
+ font-weight: 300;
28
+ line-height: 1.5em;
29
+ }
30
+ header > *,
31
+ body > * {
32
+ padding: 0px;
33
+ margin: 0px;
34
+ }
35
+ header > * {
36
+ margin-top: 20px;
37
+ }
38
+
39
+ img {
40
+ width: 100px;
41
+ height: 100px;
42
+ margin-top: 32px;
43
+ }
44
+
45
+ p {
46
+ font-size: 14px;
47
+ }
48
+ #about-page-version {
49
+ margin: 0;
50
+ }
51
+
52
+ .button {
53
+ display: block;
54
+ width: 60%;
55
+ padding: 10px 16px;
56
+ margin: 10px auto;
57
+ background-color: var(--primary);
58
+ border: none;
59
+ border-radius: 8px;
60
+ cursor: pointer;
61
+ transition: background-color 0.3s;
62
+ }
63
+
64
+ .button:hover {
65
+ background-color: var(--primary-hover);
66
+ }
67
+
68
+ footer {
69
+ font-size: 10px;
70
+ color: slategray;
71
+ margin-top: 10px;
72
+ }
73
+ </style>
74
+ <body>
75
+ <header>
76
+ <img id="logo" src="./assets/icons/favicon-128x128.png" alt="Khoj Logo">
77
+ <p id="about-page-title"><b>Khoj for Desktop</b>
78
+ <p id="about-page-version"></p>
79
+ </header>
80
+ <div class="action">
81
+ <button class="button" onclick="window.open('https://khoj.dev/terms-of-service', '_blank')">Terms of Service</button>
82
+ <button class="button" onclick="window.open('https://khoj.dev/privacy-policy', '_blank')">Privacy Policy</button>
83
+ <button class="button" onclick="window.open('https://github.com/khoj-ai/khoj', '_blank')">Source Code</button>
84
+ </div>
85
+ <footer>
86
+ © 2024 Khoj Inc. All rights reserved.
87
+ </footer>
88
+ </body>
89
+ </html>
src/interface/desktop/assets/icons/clock.svg ADDED
src/interface/desktop/assets/icons/copy-button-success.svg ADDED
src/interface/desktop/assets/icons/copy-button.svg ADDED
src/interface/desktop/assets/icons/favicon-128x128.ico ADDED

Git LFS Details

  • SHA256: 7a082ef81fefdf3d51e77123385848aaa3e72020467686b0d719dcd0daf31dc9
  • Pointer size: 131 Bytes
  • Size of remote file: 174 kB
src/interface/desktop/assets/icons/favicon-128x128.png ADDED
src/interface/desktop/assets/icons/favicon-20x20.png ADDED
src/interface/desktop/assets/icons/favicon-256x256.png ADDED
src/interface/desktop/assets/icons/favicon.icns ADDED
Binary file (63.2 kB). View file
 
src/interface/desktop/assets/icons/favicon.ico ADDED

Git LFS Details

  • SHA256: 7a082ef81fefdf3d51e77123385848aaa3e72020467686b0d719dcd0daf31dc9
  • Pointer size: 131 Bytes
  • Size of remote file: 174 kB
src/interface/desktop/assets/icons/file-not-synced.svg ADDED
src/interface/desktop/assets/icons/file-synced.svg ADDED