mirror of
https://github.com/tachiyomiorg/tachiyomi-extensions-inspector.git
synced 2024-12-25 16:21:50 +01:00
This is better.
This commit is contained in:
parent
7a52e19235
commit
177c971b52
@ -9,9 +9,10 @@ import net.harawata.appdirs.AppDirsFactory
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
fun tachideskRootDir(): String {
|
val ApplicationRootDir: String
|
||||||
|
get(): String {
|
||||||
return System.getProperty(
|
return System.getProperty(
|
||||||
"ir.armor.tachidesk.rootDir",
|
"ir.armor.tachidesk.rootDir",
|
||||||
AppDirsFactory.getInstance().getUserDataDir("Tachidesk", null, null)
|
AppDirsFactory.getInstance().getUserDataDir("Tachidesk", null, null)
|
||||||
)
|
)
|
||||||
}
|
}
|
@ -46,7 +46,7 @@ open class ConfigManager {
|
|||||||
|
|
||||||
//Load user config
|
//Load user config
|
||||||
val userConfig =
|
val userConfig =
|
||||||
File(tachideskRootDir(), "server.conf").let {
|
File(ApplicationRootDir, "server.conf").let {
|
||||||
ConfigFactory.parseFile(it)
|
ConfigFactory.parseFile(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,6 @@ object Extension {
|
|||||||
private val logger = KotlinLogging.logger {}
|
private val logger = KotlinLogging.logger {}
|
||||||
private val applicationDirs by DI.global.instance<ApplicationDirs>()
|
private val applicationDirs by DI.global.instance<ApplicationDirs>()
|
||||||
|
|
||||||
|
|
||||||
data class InstallableAPK(
|
data class InstallableAPK(
|
||||||
val apkFilePath: String,
|
val apkFilePath: String,
|
||||||
val pkgName: String
|
val pkgName: String
|
||||||
|
@ -20,15 +20,15 @@ import org.kodein.di.singleton
|
|||||||
import org.slf4j.Logger
|
import org.slf4j.Logger
|
||||||
import xyz.nulldev.androidcompat.AndroidCompat
|
import xyz.nulldev.androidcompat.AndroidCompat
|
||||||
import xyz.nulldev.androidcompat.AndroidCompatInitializer
|
import xyz.nulldev.androidcompat.AndroidCompatInitializer
|
||||||
|
import xyz.nulldev.ts.config.ApplicationRootDir
|
||||||
import xyz.nulldev.ts.config.ConfigKodeinModule
|
import xyz.nulldev.ts.config.ConfigKodeinModule
|
||||||
import xyz.nulldev.ts.config.GlobalConfigManager
|
import xyz.nulldev.ts.config.GlobalConfigManager
|
||||||
import xyz.nulldev.ts.config.tachideskRootDir
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
private val logger = KotlinLogging.logger {}
|
private val logger = KotlinLogging.logger {}
|
||||||
|
|
||||||
class ApplicationDirs(
|
class ApplicationDirs(
|
||||||
val dataRoot: String = tachideskRootDir()
|
val dataRoot: String = ApplicationRootDir
|
||||||
) {
|
) {
|
||||||
val extensionsRoot = "$dataRoot/extensions"
|
val extensionsRoot = "$dataRoot/extensions"
|
||||||
val thumbnailsRoot = "$dataRoot/thumbnails"
|
val thumbnailsRoot = "$dataRoot/thumbnails"
|
||||||
@ -44,9 +44,11 @@ val androidCompat by lazy { AndroidCompat() }
|
|||||||
fun applicationSetup() {
|
fun applicationSetup() {
|
||||||
// Application dirs
|
// Application dirs
|
||||||
val applicationDirs = ApplicationDirs()
|
val applicationDirs = ApplicationDirs()
|
||||||
DI.global.addImport(DI.Module("Server") {
|
DI.global.addImport(
|
||||||
|
DI.Module("Server") {
|
||||||
bind<ApplicationDirs>() with singleton { applicationDirs }
|
bind<ApplicationDirs>() with singleton { applicationDirs }
|
||||||
})
|
}
|
||||||
|
)
|
||||||
|
|
||||||
// make dirs we need
|
// make dirs we need
|
||||||
listOf(
|
listOf(
|
||||||
@ -58,6 +60,7 @@ fun applicationSetup() {
|
|||||||
File(it).mkdirs()
|
File(it).mkdirs()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// register Tachidesk's config which is dubbed "ServerConfig"
|
||||||
GlobalConfigManager.registerModule(
|
GlobalConfigManager.registerModule(
|
||||||
ServerConfig.register(GlobalConfigManager.config)
|
ServerConfig.register(GlobalConfigManager.config)
|
||||||
)
|
)
|
||||||
|
@ -75,9 +75,11 @@ class TestExtensions {
|
|||||||
semaphore.withPermit {
|
semaphore.withPermit {
|
||||||
logger.info { "$index - Now fetching popular manga from $source" }
|
logger.info { "$index - Now fetching popular manga from $source" }
|
||||||
try {
|
try {
|
||||||
mangaToFetch += source to (source.fetchPopularManga(1)
|
mangaToFetch += source to (
|
||||||
|
source.fetchPopularManga(1)
|
||||||
.awaitSingleRepeat().mangas.firstOrNull()
|
.awaitSingleRepeat().mangas.firstOrNull()
|
||||||
?: throw Exception("Source returned no manga"))
|
?: throw Exception("Source returned no manga")
|
||||||
|
)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
logger.warn { "Failed to fetch popular manga from $source: ${e.message}" }
|
logger.warn { "Failed to fetch popular manga from $source: ${e.message}" }
|
||||||
failedToFetch += source to e
|
failedToFetch += source to e
|
||||||
|
Loading…
Reference in New Issue
Block a user