mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-04 11:24:35 -05:00
fix apk log and apk name
This commit is contained in:
@@ -8,11 +8,14 @@ package suwayomi.tachidesk.manga.controller
|
|||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
import io.javalin.http.Context
|
import io.javalin.http.Context
|
||||||
|
import mu.KotlinLogging
|
||||||
import suwayomi.tachidesk.manga.impl.extension.Extension
|
import suwayomi.tachidesk.manga.impl.extension.Extension
|
||||||
import suwayomi.tachidesk.manga.impl.extension.ExtensionsList
|
import suwayomi.tachidesk.manga.impl.extension.ExtensionsList
|
||||||
import suwayomi.tachidesk.server.JavalinSetup.future
|
import suwayomi.tachidesk.server.JavalinSetup.future
|
||||||
|
|
||||||
object ExtensionController {
|
object ExtensionController {
|
||||||
|
private val logger = KotlinLogging.logger {}
|
||||||
|
|
||||||
/** list all extensions */
|
/** list all extensions */
|
||||||
fun list(ctx: Context) {
|
fun list(ctx: Context) {
|
||||||
ctx.json(
|
ctx.json(
|
||||||
@@ -37,11 +40,11 @@ object ExtensionController {
|
|||||||
fun installFile(ctx: Context) {
|
fun installFile(ctx: Context) {
|
||||||
|
|
||||||
val uploadedFile = ctx.uploadedFile("file")!!
|
val uploadedFile = ctx.uploadedFile("file")!!
|
||||||
println(uploadedFile.filename)
|
logger.debug { "Uploaded extension file name: " + uploadedFile.filename }
|
||||||
|
|
||||||
ctx.json(
|
ctx.json(
|
||||||
future {
|
future {
|
||||||
Extension.installExternalExtension(uploadedFile.content)
|
Extension.installExternalExtension(uploadedFile.content, uploadedFile.filename)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,9 +68,8 @@ object Extension {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun installExternalExtension(inputStream: InputStream): Int {
|
suspend fun installExternalExtension(inputStream: InputStream, apkName: String): Int {
|
||||||
return installAPK {
|
return installAPK {
|
||||||
val apkName = "apkToSave.apk"
|
|
||||||
val savePath = "${applicationDirs.extensionsRoot}/$apkName"
|
val savePath = "${applicationDirs.extensionsRoot}/$apkName"
|
||||||
// download apk file
|
// download apk file
|
||||||
val downloadedFile = File(savePath)
|
val downloadedFile = File(savePath)
|
||||||
|
|||||||
Reference in New Issue
Block a user