* [#1496] First conversion attempt
* [#1496] Configurable conversion
* Fix: allow nested configs (map)
* [#1496] Support explicit `none` conversion
* Use MimeUtils for provided download
* [1496] Support image conversion on load for downloaded images
* Lint
* [#1496] Support conversion on fresh download as well
Previous commit was only for already downloaded images, now also for
fresh and cached
* [#1496] Refactor: Move where conversion for download happens
* Rewrite config handling, improve custom types
* Lint
* Add format to pages mutation
* Lint
* Standardize url encode
* Lint
* Config: Allow additional conversion parameters
* Implement conversion quality parameter
* Lint
* Implement a conversion util to allow fallback readers
* Add downloadConversions to api and backup, fix updateValue issues
* Lint
* Minor cleanup
* Update libs.versions.toml
---------
Co-authored-by: Syer10 <syer10@users.noreply.github.com>
* [#1497] WebView: Localstorage
* WebView: Transition to our own header/postData system
This is also what is recommended by most other posts, I haven't seen the
context used anywhere, and `KCEFResourceRequestHandler` seems to just
bypass a lot of CEF
* Lint
* [#1349] Stub basic cookie authentication
* [#1349] Basic login page
Also adjusts WebView header color and shadow to match WebUI. WebUI uses
a background-image gradient to change the perceived color, which was not
noticed originally.
* [#1349] Handle login post
* [#1349] Redirect to previous URL
* [#1349] Return a basic 401 for api endpoints
Instead of redirecting to a visual login page, API should just indicate
the bad state
* Use more appropriate 303 redirect
* Update server/src/main/kotlin/suwayomi/tachidesk/server/JavalinSetup.kt
Co-authored-by: Mitchell Syer <Syer10@users.noreply.github.com>
* Update server/src/main/kotlin/suwayomi/tachidesk/server/JavalinSetup.kt
Co-authored-by: Mitchell Syer <Syer10@users.noreply.github.com>
* Lint
* Transition to AuthMode enum with migration path
* Make basicAuthEnabled auto property, Lint
* ConfigManager: Make sure to re-parse the config after migration
* basicAuth{Username,Password} -> auth{Username,Password}
* Lint
* Update server settings backup model
* Update comment
* Minor cleanup
* Improve backup legacy settings fix
* Lint
* Simplify config value migration
---------
Co-authored-by: Mitchell Syer <Syer10@users.noreply.github.com>
* 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>
* Bitmap: Use provided config
* Bitmap: implement copy
* Bitmap: Simplify getPixels
This also fixes a bug where the returned data may not be in the correct
format
Android getPixels():
> The returned colors are non-premultiplied ARGB values in the sRGB color space.
BufferedImage getRGB():
> Returns an array of integer pixels in the default RGB color model (TYPE_INT_ARGB) and default sRGB color space
* Stub TextPaint and Paint
* Paint: Implement some required functions
* Stub StaticLayout and Layout
* Implement some Paint support
* Draw Bounds
* WebP write support
* First text rendering
* Paint: Fix text size, font metrics
* Paint: Fix not copying new properties
Fixes font size in draw
* Canvas: Stroke add cap/join for better aliasing
Otherwise we get bad artifacts on sharp corners
Based on https://stackoverflow.com/a/35222059/
* Remove logs
* Canvas: Implement other drawText methods
* Bitmap: support erase
* Layout: Fix text direction
Should be LTR, otherwise 0 is read, which is automatically interpreted
as RTL without explicit check
* Bitmap: scale to destination rectangle
* Canvas: drawBitmap with just x/y
* Bitmap: Convert image on JPEG export to RGB
JPEG does not support alpha, so will throw "bogus color space"
* Switch to newer fork
* LoadData: Use regular load but intercept request
The method we used before, `createBrowserWithHtml`, is implemented by
KCEF. This method creates a `file://` url and adds handlers for that.
Instead, use regular `createBrowser` and intercept the request later on.
This has the effect of creating the page with the correct origin, while
still setting the requested HTML instead of live data. This is important
for scripts due to CORS.
Also fixes a mistake in the ResourceRequestHandler, where (a) the status
was not set, resulting in ABORT, (b) the return value of `readResponse`
was correct (`false` too early) and (c) the callback was unnecessarily
called on the MainLoop.
Based on https://stackoverflow.com/a/52423252/
* Convince the compiler we're doing it right
Invoking "public final" methods would fail. Not sure why this only
happens for some extensions, but it does. We need to tell the compiler
we're sure we have access to it, for some reason...
* JS: Invoke result handler on the loop
Some extensions call WebView methods on the result, so this should be on
the same loop as the WebView itself
* JS: Await arguments
* Fix using wrong URL property for errors
* Implement Android's Looper
Looper handles thread messaging. This is used by extensions when they
want to enqueue actions e.g. for sleeping while WebView does someting
* Stub WebView
* Continue stubbing ViewGroup for WebView
* Implement WebView via Playwright
* Lint
* Implement request interception
Supports Yidan
* Support WebChromeClient
For Bokugen
* Fix onPageStarted
* Make Playwright configurable
* Subscribe to config changes
* Fix exposing of functions
* Support data urls
* Looper: Fix infinite sleep
* Looper: Avoid killing the loop on exception
Just log it and continue
* Pump playwright's message queue periodically
https://playwright.dev/java/docs/multithreading#pagewaitfortimeout-vs-threadsleep
* Update server/src/main/kotlin/suwayomi/tachidesk/graphql/types/SettingsType.kt
Co-authored-by: Mitchell Syer <Syer10@users.noreply.github.com>
* Stub a KCef WebViewProvider
* Initial Kcef Webview implementation
Still buggy, on the second call it just seems to fall over
* Format, restructure to create browser on load
This is much more consistent, before we would sometimes see errors from
about:blank, which block the actual page
* Implement some small useful properties
* Move inline objects to class
* Handle requests in Kcef
* Move Playwright implementation
* Document Playwright settings, fix deprecated warnings
* Inject default user agent from NetworkHelper
* Move playwright to libs.versions.toml
* Lint
* Fix missing imports after lint
* Update server/src/main/kotlin/suwayomi/tachidesk/server/ServerSetup.kt
Co-authored-by: Mitchell Syer <Syer10@users.noreply.github.com>
* Fix default user agent set/get
Use System.getProperty instead of SystemProperties.get
* Configurable WebView provider implementation
* Simplify Playwright settings init
* Minor cleanup and improvements
* Remove playwright WebView impl
* Document WebView for Linux
---------
Co-authored-by: Mitchell Syer <Syer10@users.noreply.github.com>
* Update to exposed-migrations v3.5.0
* Update to kotlin-logging v7.0.0
* Update to exposed v0.46.0
* Update to exposed v0.47.0
* Update to exposed v0.55.0
* Update to exposed v0.56.0
* Update to exposed v0.57.0
* Validate setting values on mutation
* Handle invalid negative setting values
* Ensure at least one source is downloading at all times
* Prevent possible IllegalArgumentException
The "serverConfig.maxSourcesInParallel" value could have changed after the if-condition
* Keep up to 31 log files
On average one log file per day gets created, thus, increasing to 31 files will store log files for one month
* Decrease total log files size to 100mb
* Make log appender settings configurable
* add trackers support
* Cleanup Tracker Code
* Add GraphQL support for Tracking
* Fix lint and deprecation errors
* remove password from logs
* Fixes after merge
* Disable tracking for now
* More disabled
---------
Co-authored-by: Syer10 <syer10@users.noreply.github.com>
* Switch to new Ktlint plugin
* Add ktlintCheck to PR builds
* Run formatter
* Put ktlint version in libs toml
* Fix lint
* Use Zip4Java from libs.toml
In case the user config file has to be updated, the file needs to get reset.
While doing the reset, the already loaded internal state of the config got also reset, but was never updated again.
Due to this, the internal state of the config was the default config reference until the next server startup
Regression introduced with a31446557d.
* Set graphql logs to error level
Set log level for loggers with names
- ExecutionStrategy (spams logs with "... completing field ...")
- notprivacysafe (logs every received request up to 4 times (received, parse, validate, execute))
* Extract logic to get logger for name into function
* Add function to set log level for a logger
* Add settings to enable graphql debug logging
* Add "uiName" to WebUI enum
* Add "Custom" WebUI to enum
* Rename "WebUI" enum to "WebUIFlavor"
* Add "WebUIInterface" enum
* Add query for server settings
* Add mutation for server settings
* Add mutation to reset the server settings
* Only update the config in case the value changed
In case the value of the config is already the same as the new value of the state flow, it is not necessary to update the config file
* Make server config value changes subscribable
* Make server config value changes subscribable - Update usage
* Add util functions to listen to server config value changes
* Listen to server config value changes - Auto backups
* Listen to server config value changes - Auto global update
* Listen to server config value changes - WebUI auto updates
* Listen to server config value changes - Javalin update ip and port
* Listen to server config value changes - Update socks proxy
* Listen to server config value changes - Update debug log level
* Listen to server config value changes - Update system tray icon
* Update config values one at a time
In case settings are changed in quick succession it's possible that each setting update reverts the change of the previous changed setting because the internal config hasn't been updated yet.
E.g.
1. settingA changed
2. settingB changed
3. settingA updates config file
4. settingB updates config file (internal config hasn't been updated yet with change from settingA)
5. settingA updates internal config (settingA updated)
6. settingB updates internal config (settingB updated, settingA outdated)
now settingA is unchanged because settingB reverted its change while updating the config with its new value
* Always add log interceptor to OkHttpClient
In case debug logs are disabled then the KotlinLogging log level will be set to level > debug and thus, these logs won't get logged
* Rename "maxParallelUpdateRequests" to "maxSourcesInParallel"
* Use server setting "maxSourcesInParallel" for downloads
* Listen to server config value changes - downloads
* Always use latest server settings - Browser
* Always use latest server settings - folders
* [Test] Fix type error
* Setup "logback" to write to file
To be able to dynamically set the log file save location, logback has to be setup via code instead of a config file
* Log OkHttp via logback
Otherwise, the logs would only get written to the console and thus, not be included in the log file
* Init logback
Has to be done after the config was loaded, otherwise, the root directory would be unknown.
Moved the log of the loaded config to the "applicationSetup" since otherwise, the log would not be included in the log file
The server reference config file was only able to be read while in dev mode.
Using the build jar, the content of the file was empty, since in the build jar resources aren't actual files anymore, instead they are streams.
This caused the user config content to be replaced with an empty string.
Currently, the "UserConfig" was created in case it was missing.
But in case settings changed (added/removed), an already existing "UserConfig" never reflected these changes and thus, was out of date
* replace quickjs with jdk 8 default js engine
* replace quickjs with rhino engine and translate type for read comic online extension
* move quick js to AndroidCompat
* fix commicabc long type cast exception
* add support for MultiSelectListPreference
* Update AndroidCompat/src/main/java/xyz/nulldev/androidcompat/io/sharedprefs/JavaSharedPreferences.kt
Co-authored-by: Mitchell Syer <Mitchellptbo@gmail.com>
* don't convert to list
* fix by @Syer10
Co-authored-by: Mitchell Syer <Mitchellptbo@gmail.com>