mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-06-30 09:24:34 -05:00
Browser Webview (#1486)
* WebView: Add initial controller Co-authored-by: Mitchell Syer <Syer10@users.noreply.github.com> * WebView: Prepare page * WebView: Basic HTML setup * WebView: Improve navigation * WebView: Refactor message class deserialization * WebView: Refactor event message serialization * WebView: Handle click events * WebView: Fix events after refactor * WebView: Fix normalizing of URLs * WebView: HTML remove navigation buttons * WebView: Handle more events * WebView: Handle document change in events * WebView: Refactor to send mutation events * WebView: More mouse events * WebView: Include bubbles, cancelable in event Those seem to be important * WebView: Attempt to support nested iframe * WebView: Handle long titles * WebView: Avoid setting invalid url * WebView: Send mousemove * WebView: Start switch to canvas-based render * WebView: Send on every render * WebView: Dynamic size * WebView: Keyboard events * WebView: Handle mouse events in CEF This is important because JS can't click into iFrames, meaning the previous solution doesn't work for captchas * WebView: Cleanup * WebView: Cleanup 2 * WebView: Document title * WebView: Also send title on address change * WebView: Load and flush cookies from store * WebView: remove outdated TODOs * Offline WebView: Load cookies from store * Cleanup * Add KcefCookieManager, need to figure out how to inject it * ktLintFormat * Fix a few cookie bugs * Fix Webview on Windows * Minor cleanup * WebView: Remove /tmp image write, lint * Remove custom cookie manager * Multiple cookie fixes * Minor fix * Minor cleanup and add support for MacOS meta key * Get enter working * WebView HTML: Make responsive for mobile pages * WebView: Translate touch events to mouse scroll * WebView: Overlay an actual input to allow typing on mobile Browsers will only show the keyboard if an input is focused. This also removes the `tabstop` hack. * WebView: Protect against occasional NullPointerException * WebView: Use float for clientX/Y * WebView: Fix ChromeAndroid being a pain * Simplify enter fix * NetworkHelper: Fix cache * Improve CookieStore url matching, fix another cookie conversion issue * Move distinctBy * WebView: Mouse direction toggle * Remove accidentally copied comment --------- Co-authored-by: Mitchell Syer <Syer10@users.noreply.github.com>
This commit is contained in:
@@ -96,7 +96,7 @@ class JavaSharedPreferences(
|
||||
} else {
|
||||
preferences.decodeValueOrNull(SetSerializer(String.serializer()), key)
|
||||
}
|
||||
} catch (e: SerializationException) {
|
||||
} catch (_: SerializationException) {
|
||||
throw ClassCastException("$key was not a StringSet")
|
||||
}
|
||||
}
|
||||
@@ -153,11 +153,12 @@ class JavaSharedPreferences(
|
||||
key: String,
|
||||
value: String?,
|
||||
): SharedPreferences.Editor {
|
||||
if (value != null) {
|
||||
actions += Action.Add(key, value)
|
||||
} else {
|
||||
actions += Action.Remove(key)
|
||||
}
|
||||
actions +=
|
||||
if (value != null) {
|
||||
Action.Add(key, value)
|
||||
} else {
|
||||
Action.Remove(key)
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
@@ -165,11 +166,12 @@ class JavaSharedPreferences(
|
||||
key: String,
|
||||
values: MutableSet<String>?,
|
||||
): SharedPreferences.Editor {
|
||||
if (values != null) {
|
||||
actions += Action.Add(key, values)
|
||||
} else {
|
||||
actions += Action.Remove(key)
|
||||
}
|
||||
actions +=
|
||||
if (values != null) {
|
||||
Action.Add(key, values)
|
||||
} else {
|
||||
Action.Remove(key)
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
@@ -82,6 +82,7 @@ import org.cef.network.CefPostData
|
||||
import org.cef.network.CefPostDataElement
|
||||
import org.cef.network.CefRequest
|
||||
import org.cef.network.CefResponse
|
||||
import org.koin.mp.KoinPlatformTools
|
||||
import java.io.BufferedWriter
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
@@ -110,6 +111,12 @@ class KcefWebViewProvider(
|
||||
const val TAG = "KcefWebViewProvider"
|
||||
const val QUERY_FN = "__\$_suwayomiQuery"
|
||||
const val QUERY_CANCEL_FN = "__\$_suwayomiQueryCancel"
|
||||
|
||||
private val initHandler: InitBrowserHandler by KoinPlatformTools.defaultContext().get().inject()
|
||||
}
|
||||
|
||||
public interface InitBrowserHandler {
|
||||
public fun init(provider: KcefWebViewProvider): Unit
|
||||
}
|
||||
|
||||
private class CefWebResourceRequest(
|
||||
@@ -451,6 +458,7 @@ class KcefWebViewProvider(
|
||||
config.jsCancelFunction = QUERY_CANCEL_FN
|
||||
addMessageRouter(CefMessageRouter.create(config, MessageRouterHandler()))
|
||||
}
|
||||
initHandler.init(this)
|
||||
}
|
||||
|
||||
// Deprecated - should never be called
|
||||
|
||||
Reference in New Issue
Block a user