Closed hek4te closed 10 months ago
Yandex is down now.
Searx goes down but comes back up often.
ability to choose the searx instance would be nice. even better if it was searxNG (theres an issue for this)
You already should be able to select a different searx instance because you can enter any url.
No, you can't. you can enter any image url, but searx is hardcoded to searx.prvcy.eu
Don't fight me on this, I literally implemented what i suggested myself, I've seen the code
Oh you are correct. Maybe it was the initial implementation of searx where you could change the url and then I decided to hardcode it because most of the instances were either dead or had some other issues. I see.
Yandex is fixed.
As for searx I can't find any working instances they all give me error 429. Do you know any working urls?
I was using searx.thegpm.org for a while. recently I've just switched to searx.ru, but I think the only sane route is to do what I did and make it configurable, given apparently they die. I'll share my patch if you want
Nothing major
commit 9492f19fd3ae89d80a01d48f9ab61627f9b89a80
Author: bqv <bqv@fron.io>
Date: Sun Jan 7 21:41:20 2024 +0000
make searx configurable
diff --git a/Kuroba/app/src/main/java/com/github/k1rakishou/chan/features/reply_image_search/ImageSearchControllerViewModel.kt b/Kuroba/app/src/main/java/com/github/k1rakishou/chan/features/reply_image_search/ImageSearchControllerViewModel.kt
index edd34206d..60b475b58 100644
--- a/Kuroba/app/src/main/java/com/github/k1rakishou/chan/features/reply_image_search/ImageSearchControllerViewModel.kt
+++ b/Kuroba/app/src/main/java/com/github/k1rakishou/chan/features/reply_image_search/ImageSearchControllerViewModel.kt
@@ -62,7 +62,7 @@ class ImageSearchControllerViewModel : BaseViewModel() {
_searchInstances[imageSearchInstance.type] = imageSearchInstance
}
- _lastUsedSearchInstance.value = ImageSearchInstanceType.Yandex
+ _lastUsedSearchInstance.value = ImageSearchInstanceType.Searx
searchQuery.value = ""
}
}
@@ -257,4 +257,4 @@ class ImageSearchControllerViewModel : BaseViewModel() {
companion object {
private const val TAG = "ImageSearchControllerViewModel"
}
-}
\ No newline at end of file
+}
diff --git a/Kuroba/app/src/main/java/com/github/k1rakishou/chan/features/reply_image_search/ImageSearchInstance.kt b/Kuroba/app/src/main/java/com/github/k1rakishou/chan/features/reply_image_search/ImageSearchInstance.kt
index 0b0b8da43..3fe070d9b 100644
--- a/Kuroba/app/src/main/java/com/github/k1rakishou/chan/features/reply_image_search/ImageSearchInstance.kt
+++ b/Kuroba/app/src/main/java/com/github/k1rakishou/chan/features/reply_image_search/ImageSearchInstance.kt
@@ -3,6 +3,7 @@ package com.github.k1rakishou.chan.features.reply_image_search
import androidx.annotation.DrawableRes
import com.github.k1rakishou.chan.R
import com.github.k1rakishou.persist_state.PersistableChanState
+import com.github.k1rakishou.ChanSettings
import okhttp3.HttpUrl
import okhttp3.HttpUrl.Companion.toHttpUrl
@@ -55,7 +56,7 @@ abstract class ImageSearchInstance(
class SearxInstance : ImageSearchInstance(
type = ImageSearchInstanceType.Searx,
- baseUrl = "https://searx.prvcy.eu".toHttpUrl(),
+ baseUrl = ChanSettings.searxInstanceUrl.get().toHttpUrl(),
icon = R.drawable.searx_favicon
) {
@@ -66,6 +67,7 @@ class SearxInstance : ImageSearchInstance(
}
override fun buildSearchUrl(query: String, page: Int?): HttpUrl {
+ val baseUrl = ChanSettings.searxInstanceUrl.get().toHttpUrl() // meh :/
return with(baseUrl.newBuilder()) {
addPathSegment("search")
addQueryParameter("q", query)
@@ -123,4 +125,4 @@ class YandexInstance : ImageSearchInstance(
enum class ImageSearchInstanceType {
Searx,
Yandex
-}
\ No newline at end of file
+}
diff --git a/Kuroba/app/src/main/java/com/github/k1rakishou/chan/features/settings/SettingsIdentifier.kt b/Kuroba/app/src/main/java/com/github/k1rakishou/chan/features/settings/SettingsIdentifier.kt
index fae8a7e02..ade8486b8 100644
--- a/Kuroba/app/src/main/java/com/github/k1rakishou/chan/features/settings/SettingsIdentifier.kt
+++ b/Kuroba/app/src/main/java/com/github/k1rakishou/chan/features/settings/SettingsIdentifier.kt
@@ -436,6 +436,7 @@ sealed class BehaviorScreen(
object CaptchaSetup : GeneralGroup("catpcha_setup")
object JsCaptchaCookiesEditor : GeneralGroup("js_captcha_cookies_editor")
object ClearPostHides : GeneralGroup("clear_post_hides")
+ object SearxInstance : RepliesGroup("searx_instance")
companion object : IGroupIdentifier() {
override fun screenIdentifier(): ScreenIdentifier = BehaviorScreen.screenIdentifier()
@@ -806,4 +807,4 @@ sealed class ExperimentalScreen(
companion object : IScreenIdentifier() {
override fun screenIdentifier(): ScreenIdentifier = ScreenIdentifier("experimental_screen")
}
-}
\ No newline at end of file
+}
diff --git a/Kuroba/app/src/main/java/com/github/k1rakishou/chan/features/settings/screens/BehaviourSettingsScreen.kt b/Kuroba/app/src/main/java/com/github/k1rakishou/chan/features/settings/screens/BehaviourSettingsScreen.kt
index a19216560..fa3144f64 100644
--- a/Kuroba/app/src/main/java/com/github/k1rakishou/chan/features/settings/screens/BehaviourSettingsScreen.kt
+++ b/Kuroba/app/src/main/java/com/github/k1rakishou/chan/features/settings/screens/BehaviourSettingsScreen.kt
@@ -20,6 +20,7 @@ import com.github.k1rakishou.chan.ui.controller.settings.captcha.JsCaptchaCookie
import com.github.k1rakishou.chan.ui.helper.AppSettingsUpdateAppRefreshHelper
import com.github.k1rakishou.chan.utils.AppModuleAndroidUtils.showToast
import com.github.k1rakishou.common.AndroidUtils
+import com.github.k1rakishou.prefs.StringSetting
class BehaviourSettingsScreen(
context: Context,
@@ -296,8 +297,17 @@ class BehaviourSettingsScreen(
}
)
+ group += InputSettingV2.createBuilder<String>(
+ context = context,
+ identifier = BehaviorScreen.GeneralGroup.SearxInstance,
+ topDescriptionIdFunc = { R.string.setting_searx_instance },
+ bottomDescriptionStringFunc = { ChanSettings.searxInstanceUrl.get() },
+ setting = ChanSettings.searxInstanceUrl,
+ inputType = DialogFactory.DialogInputType.String
+ )
+
group
}
)
}
-}
\ No newline at end of file
+}
diff --git a/Kuroba/app/src/main/res/values/strings.xml b/Kuroba/app/src/main/res/values/strings.xml
index a07670e42..86a381fd5 100644
--- a/Kuroba/app/src/main/res/values/strings.xml
+++ b/Kuroba/app/src/main/res/values/strings.xml
@@ -762,6 +762,7 @@ Usually that means that you forgot to remove a space from the beginning or the e
<string name="setting_js_captcha_cookies_description">By inputting your desktop browser captcha cookies, captcha solving may become easier</string>
<string name="setting_load_last_opened_board_upon_app_start_title">Restore last visited catalog upon app start</string>
<string name="setting_load_last_opened_thread_upon_app_start_title">Restore last visited thread upon app start</string>
+ <string name="setting_searx_instance">Searx Instance URL</string>
<!-- Behavior post group -->
<string name="settings_group_post">Post</string>
diff --git a/Kuroba/core-settings/src/main/java/com/github/k1rakishou/ChanSettings.java b/Kuroba/core-settings/src/main/java/com/github/k1rakishou/ChanSettings.java
index 3fa71eba9..bf0c4d707 100644
--- a/Kuroba/core-settings/src/main/java/com/github/k1rakishou/ChanSettings.java
+++ b/Kuroba/core-settings/src/main/java/com/github/k1rakishou/ChanSettings.java
@@ -343,6 +343,7 @@ public class ChanSettings {
public static StringSetting jsCaptchaCookies;
public static BooleanSetting loadLastOpenedBoardUponAppStart;
public static BooleanSetting loadLastOpenedThreadUponAppStart;
+ public static StringSetting searxInstanceUrl;
// Reply
public static BooleanSetting postPinThread;
@@ -585,6 +586,7 @@ public class ChanSettings {
jsCaptchaCookies = new StringSetting(provider, "js_captcha_cookies", EMPTY_JSON);
loadLastOpenedBoardUponAppStart = new BooleanSetting(provider, "load_last_opened_board_upon_app_start", true);
loadLastOpenedThreadUponAppStart = new BooleanSetting(provider, "load_last_opened_thread_upon_app_start", true);
+ searxInstanceUrl = new StringSetting(provider, "searx_instance", "https://searx.prvcy.eu");
// Reply
postPinThread = new BooleanSetting(provider, "preference_pin_on_post", false);
diff --git a/Kuroba/gradlew b/Kuroba/gradlew
old mode 100644
new mode 100755
Both Yandex and the Searx options don't work. Yandex comes up with nothing and Searx says bad status 502.