-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support for Extensions Lib 1.4 (#496)
* Support extensions lib 1.4 * Fix build * Support UpdateStrategy * Update extension lib min/max to match Tachiyomi * Use HttpSource.getMangaUrl and add Chapter.realUrl
- Loading branch information
Showing
24 changed files
with
316 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
server/src/main/kotlin/eu/kanade/tachiyomi/network/JavaScriptEngine.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package eu.kanade.tachiyomi.network | ||
|
||
import android.content.Context | ||
import app.cash.quickjs.QuickJs | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.withContext | ||
|
||
/** | ||
* Util for evaluating JavaScript in sources. | ||
*/ | ||
class JavaScriptEngine(context: Context) { | ||
|
||
/** | ||
* Evaluate arbitrary JavaScript code and get the result as a primitive type | ||
* (e.g., String, Int). | ||
* | ||
* @since extensions-lib 1.4 | ||
* @param script JavaScript to execute. | ||
* @return Result of JavaScript code as a primitive type. | ||
*/ | ||
@Suppress("UNUSED", "UNCHECKED_CAST") | ||
suspend fun <T> evaluate(script: String): T = withContext(Dispatchers.IO) { | ||
QuickJs.create().use { | ||
it.evaluate(script) as T | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
server/src/main/kotlin/eu/kanade/tachiyomi/source/model/UpdateStrategy.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package eu.kanade.tachiyomi.source.model | ||
|
||
enum class UpdateStrategy { | ||
ALWAYS_UPDATE, | ||
ONLY_FETCH_ONCE | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.