Move Duktape stub to extensions-lib (#9954)

* Move Duktape stub to extensions-lib

* Formatting fixes

* Address build errors
This commit is contained in:
arkon 2021-11-28 13:00:39 -05:00 committed by GitHub
parent 7e29955d00
commit 39b7fe8c4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 12 additions and 71 deletions

View File

@ -101,16 +101,6 @@ The extension's version name is generated automatically by concatenating `libVer
Extensions rely on [extensions-lib](https://github.com/tachiyomiorg/extensions-lib), which provides some interfaces and stubs from the [app](https://github.com/tachiyomiorg/tachiyomi) for compilation purposes. The actual implementations can be found [here](https://github.com/tachiyomiorg/tachiyomi/tree/master/app/src/main/java/eu/kanade/tachiyomi/source). Referencing the actual implementation will help with understanding extensions' call flow.
#### Duktape stub
[`duktape-stub`](https://github.com/tachiyomiorg/tachiyomi-extensions/tree/master/lib/duktape-stub) provides stubs for using Duktape functionality without pulling in the full library. Functionality is bundled into the main Tachiyomi app.
```gradle
dependencies {
compileOnly project(':duktape-stub')
}
```
#### Rate limiting library
[`lib-ratelimit`](https://github.com/tachiyomiorg/tachiyomi-extensions/tree/master/lib/ratelimit) is a library for adding rate limiting functionality as an [OkHttp interceptor](https://square.github.io/okhttp/interceptors/).

View File

@ -1,7 +1,7 @@
// used both in common.gradle and themesources library
dependencies {
// Lib 1.2, but using specific commit so we don't need to bump up the version
compileOnly "com.github.tachiyomiorg:extensions-lib:cfa9530"
compileOnly "com.github.tachiyomiorg:extensions-lib:58b2d3a"
// These are provided by the app itself
compileOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
@ -14,6 +14,4 @@ dependencies {
compileOnly 'com.github.salomonbrys.kotson:kotson:2.5.0'
compileOnly 'org.jetbrains.kotlinx:kotlinx-serialization-protobuf:1.2.0'
compileOnly 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.0'
compileOnly project(':duktape-stub')
}

View File

@ -1,16 +0,0 @@
plugins {
java
}
sourceSets {
main {
java {
srcDirs(listOf("src"))
}
}
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

View File

@ -1,26 +0,0 @@
package com.squareup.duktape;
import java.io.Closeable;
import java.io.IOException;
@SuppressWarnings("all")
public class Duktape implements Closeable {
public static Duktape create() {
throw new RuntimeException("Stub!");
}
@Override
public synchronized void close() throws IOException {
throw new RuntimeException("Stub!");
}
public synchronized Object evaluate(String script) {
throw new RuntimeException("Stub!");
}
public synchronized <T> void set(String name, Class<T> type, T object) {
throw new RuntimeException("Stub!");
}
}

View File

@ -42,7 +42,7 @@ class FoolSlideCustomizable : FoolSlide("FoolSlide Customizable", "", "other") {
companion object {
private const val DEFAULT_BASEURL = "https://127.0.0.1"
private const val BASE_URL_PREF_TITLE = "Example URL: https://domain.com/path_to/directory/"
private const val BASE_URL_PREF = "overrideBaseUrl_v${BuildConfig.VERSION_NAME}"
private val BASE_URL_PREF = "overrideBaseUrl_v${BuildConfig.VERSION_NAME}"
private const val BASE_URL_PREF_SUMMARY = "Connect to a designated FoolSlide server"
private const val RESTART_TACHIYOMI = "Restart Tachiyomi to apply new setting."
}

View File

@ -135,7 +135,7 @@ class NeoxScanlator :
private const val REFERER = "https://google.com/"
private const val DEFAULT_BASE_URL = "https://neoxscans.net"
private const val BASE_URL_PREF_KEY = "base_url_${BuildConfig.VERSION_NAME}"
private val BASE_URL_PREF_KEY = "base_url_${BuildConfig.VERSION_NAME}"
private const val BASE_URL_PREF_TITLE = "URL da fonte"
private const val BASE_URL_PREF_SUMMARY = "Para uso temporário. Quando você atualizar a " +
"extensão, esta configuração será apagada."

View File

@ -65,7 +65,7 @@ class NeoXXXScans :
companion object {
private const val DEFAULT_BASE_URL = "https://xxx.neoxscans.net"
private const val BASE_URL_PREF_KEY = "base_url_${BuildConfig.VERSION_NAME}"
private val BASE_URL_PREF_KEY = "base_url_${BuildConfig.VERSION_NAME}"
private const val BASE_URL_PREF_TITLE = "URL da fonte"
private const val BASE_URL_PREF_SUMMARY = "Para uso temporário. Quando você atualizar a " +
"extensão, esta configuração será apagada."

View File

@ -3,9 +3,6 @@ include(":core")
include(":lib-ratelimit")
project(":lib-ratelimit").projectDir = File("lib/ratelimit")
include(":duktape-stub")
project(":duktape-stub").projectDir = File("lib/duktape-stub")
include(":lib-dataimage")
project(":lib-dataimage").projectDir = File("lib/dataimage")

View File

@ -39,7 +39,7 @@ open class MangaPark(
override val name: String = "MangaPark v3"
override val baseUrl: String = "https://v35.mangapark.net" //temporary url change to keep the ext working after update return to https://mangapark.net or https://v36.mangapark.net at later date
override val baseUrl: String = "https://v35.mangapark.net" // temporary url change to keep the ext working after update return to https://mangapark.net or https://v36.mangapark.net at later date
override val supportsLatest = true

View File

@ -1,6 +1,5 @@
package eu.kanade.tachiyomi.extension.all.tappytoon
import android.util.Log
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.source.model.Filter
import eu.kanade.tachiyomi.source.model.FilterList

View File

@ -146,7 +146,7 @@ class MangaLink : ConfigurableSource, ParsedHttpSource() {
Type("غير معروف", "6"),
)
//Preferences
// Preferences
override fun setupPreferenceScreen(screen: PreferenceScreen) {
val domainPref = ListPreference(screen.context).apply {

View File

@ -58,7 +58,7 @@ class MangaDig : ConfigurableSource, ParsedHttpSource() {
private val commonNextPageSelector = "a:contains(Next):not(.fed-btns-disad)"
private fun commonMangaFromElement(element: Element): SManga {
val picElement = element.select("a.fed-list-pics").first()
return SManga.create().apply {
title = element.select("a.fed-list-title").first().text()
thumbnail_url = picElement.attr("data-original")

View File

@ -569,7 +569,7 @@ class TuMangaOnline : ConfigurableSource, ParsedHttpSource() {
private const val IMAGE_CDN_RATELIMIT_PREF_SUMMARY = "Este valor afecta la cantidad de solicitudes de red para descargar imágenes. Reducir este valor puede disminuir errores al cargar imagenes, pero la velocidad de descarga será más lenta. Se requiere reiniciar Tachiyomi. \nValor actual: %s"
private const val IMAGE_CDN_RATELIMIT_PREF_DEFAULT_VALUE = "10"
private val ENTRIES_ARRAY = listOf(1,2,3,5,6,7,8,9,10,15,20,30,40,50,100).map { i -> i.toString() }.toTypedArray()
private val ENTRIES_ARRAY = listOf(1, 2, 3, 5, 6, 7, 8, 9, 10, 15, 20, 30, 40, 50, 100).map { i -> i.toString() }.toTypedArray()
const val PREFIX_LIBRARY = "library"
const val PREFIX_ID_SEARCH = "id:"

View File

@ -24,11 +24,11 @@ class DoujinDesu : ParsedHttpSource() {
override val client: OkHttpClient = network.cloudflareClient
// Private stuff
private val DATE_FORMAT by lazy {
SimpleDateFormat("MMMM d, yyyy", Locale("id"))
}
private fun parseStatus(status: String) = when {
status.toLowerCase(Locale.US).contains("finished") -> SManga.ONGOING
status.toLowerCase(Locale.US).contains("publishing") -> SManga.COMPLETED

View File

@ -201,7 +201,7 @@ class JMana : ConfigurableSource, ParsedHttpSource() {
const val DETAIL_DESCRIPTION = "설명 : "
const val DEFAULT_BASEURL = "https://jmana1.net"
private const val BASE_URL_PREF_TITLE = "Override BaseUrl"
private const val BASE_URL_PREF = "overrideBaseUrl_v${BuildConfig.VERSION_NAME}"
private val BASE_URL_PREF = "overrideBaseUrl_v${BuildConfig.VERSION_NAME}"
private const val BASE_URL_PREF_SUMMARY = "For temporary uses. Update extension will erase this setting."
private const val RESTART_TACHIYOMI = "Restart Tachiyomi to apply new setting."
}

View File

@ -375,7 +375,7 @@ open class NewToki(override val name: String, private val defaultBaseUrl: String
private const val RESTART_TACHIYOMI = "Restart Tachiyomi to apply new setting."
private const val BASE_URL_PREF_TITLE = "Override BaseUrl"
private const val BASE_URL_PREF = "overrideBaseUrl_v${BuildConfig.VERSION_NAME}"
private val BASE_URL_PREF = "overrideBaseUrl_v${BuildConfig.VERSION_NAME}"
private const val BASE_URL_PREF_SUMMARY = "For temporary uses. Update extension will erase this setting."
// Setting: Experimental Latest Fetcher

View File

@ -23,7 +23,6 @@ import okhttp3.Request
import okhttp3.Response
import rx.Observable
import uy.kohesive.injekt.injectLazy
import java.util.ArrayList
class Desu : HttpSource() {
override val name = "Desu"