starts of legacy backup support

This commit is contained in:
Aria Moradi 2021-03-30 01:18:57 +04:30
parent bc3ad75328
commit 71a9396952
5 changed files with 25 additions and 6 deletions

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
# Ignore Gradle project-specific cache directory # Ignore Gradle project-specific cache directory
.gradle .gradle
.idea .idea
gradle.properties
# Ignore Gradle build output directory # Ignore Gradle build output directory
build build

View File

@ -85,9 +85,7 @@ internal class ExtensionGithubApi {
} }
companion object { companion object {
// const val BASE_URL = "https://raw.githubusercontent.com" const val BASE_URL = "https://raw.githubusercontent.com"
// const val REPO_URL_PREFIX = "${BASE_URL}/tachiyomiorg/tachiyomi-extensions/repo" const val REPO_URL_PREFIX = "$BASE_URL/tachiyomiorg/tachiyomi-extensions/repo"
const val BASE_URL = "http://127.0.0.1:8000"
const val REPO_URL_PREFIX = "$BASE_URL/repo"
} }
} }

View File

@ -28,7 +28,8 @@ object ExtensionListData {
var updateMap = ConcurrentHashMap<String, Extension.Available>() var updateMap = ConcurrentHashMap<String, Extension.Available>()
} }
const val ExtensionUpdateDelayTime = 0 // 60 seconds // const val ExtensionUpdateDelayTime = 60 * 1000 // 60,000 milliseconds = 60 seconds
const val ExtensionUpdateDelayTime = 0
fun getExtensionList(): List<ExtensionDataClass> { fun getExtensionList(): List<ExtensionDataClass> {
// update if {ExtensionUpdateDelayTime} seconds has passed or requested offline and database is empty // update if {ExtensionUpdateDelayTime} seconds has passed or requested offline and database is empty

View File

@ -32,6 +32,7 @@ import ir.armor.tachidesk.impl.updateCategory
import ir.armor.tachidesk.impl.updateExtension import ir.armor.tachidesk.impl.updateExtension
import ir.armor.tachidesk.server.util.openInBrowser import ir.armor.tachidesk.server.util.openInBrowser
import mu.KotlinLogging import mu.KotlinLogging
import java.io.IOException
/* /*
* Copyright (C) Contributors to the Suwayomi project * Copyright (C) Contributors to the Suwayomi project
@ -66,6 +67,12 @@ fun javalinSetup() {
ctx.status(404) ctx.status(404)
} }
app.exception(IOException::class.java) { e, ctx ->
logger.error("IOException while handling the request", e)
ctx.status(500)
ctx.result(e.message ?: "Internal Server Error")
}
app.get("/api/v1/extension/list") { ctx -> app.get("/api/v1/extension/list") { ctx ->
ctx.json(getExtensionList()) ctx.json(getExtensionList())
} }
@ -266,4 +273,16 @@ fun javalinSetup() {
val categoryId = ctx.pathParam("categoryId").toInt() val categoryId = ctx.pathParam("categoryId").toInt()
ctx.json(getCategoryMangaList(categoryId)) ctx.json(getCategoryMangaList(categoryId))
} }
// expects a Tachiyomi legacy backup file to be uploaded
app.get("/api/v1/backup/legacy/import") { ctx ->
val categoryId = ctx.pathParam("categoryId").toInt()
ctx.json(getCategoryMangaList(categoryId))
}
// returns a Tachiyomi legacy backup file created from the current database
app.get("/api/v1/backup/legacy/export") { ctx ->
val categoryId = ctx.pathParam("categoryId").toInt()
ctx.json(getCategoryMangaList(categoryId))
}
} }

View File

@ -96,7 +96,7 @@ fun applicationSetup() {
// socks proxy settings // socks proxy settings
if (serverConfig.socksProxyEnabled) { if (serverConfig.socksProxyEnabled) {
System.getProperties()["proxySet"] = "true" // System.getProperties()["proxySet"] = "true"
System.getProperties()["socksProxyHost"] = serverConfig.socksProxyHost System.getProperties()["socksProxyHost"] = serverConfig.socksProxyHost
System.getProperties()["socksProxyPort"] = serverConfig.socksProxyPort System.getProperties()["socksProxyPort"] = serverConfig.socksProxyPort
logger.info("Socks Proxy is enabled to ${serverConfig.socksProxyHost}:${serverConfig.socksProxyPort}") logger.info("Socks Proxy is enabled to ${serverConfig.socksProxyHost}:${serverConfig.socksProxyPort}")