mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-06-30 17:34:39 -05:00
Fix Oracle JRE Extension Install (#670)
* Minor cleanup * Fix Oracle JRE Write issue
This commit is contained in:
@@ -11,11 +11,7 @@ abstract class ChaptersFilesProvider(val mangaId: Int, val chapterId: Int) : Dow
|
|||||||
abstract fun getImageImpl(index: Int): Pair<InputStream, String>
|
abstract fun getImageImpl(index: Int): Pair<InputStream, String>
|
||||||
|
|
||||||
override fun getImage(): RetrieveFile1Args<Int> {
|
override fun getImage(): RetrieveFile1Args<Int> {
|
||||||
return object : RetrieveFile1Args<Int> {
|
return RetrieveFile1Args(::getImageImpl)
|
||||||
override fun execute(a: Int): Pair<InputStream, String> {
|
|
||||||
return getImageImpl(a)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract suspend fun downloadImpl(
|
abstract suspend fun downloadImpl(
|
||||||
@@ -25,15 +21,7 @@ abstract class ChaptersFilesProvider(val mangaId: Int, val chapterId: Int) : Dow
|
|||||||
): Boolean
|
): Boolean
|
||||||
|
|
||||||
override fun download(): FileDownload3Args<DownloadChapter, CoroutineScope, suspend (DownloadChapter?, Boolean) -> Unit> {
|
override fun download(): FileDownload3Args<DownloadChapter, CoroutineScope, suspend (DownloadChapter?, Boolean) -> Unit> {
|
||||||
return object : FileDownload3Args<DownloadChapter, CoroutineScope, suspend (DownloadChapter?, Boolean) -> Unit> {
|
return FileDownload3Args(::downloadImpl)
|
||||||
override suspend fun execute(
|
|
||||||
a: DownloadChapter,
|
|
||||||
b: CoroutineScope,
|
|
||||||
c: suspend (DownloadChapter?, Boolean) -> Unit
|
|
||||||
): Boolean {
|
|
||||||
return downloadImpl(a, b, c)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract override fun delete(): Boolean
|
abstract override fun delete(): Boolean
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
package suwayomi.tachidesk.manga.impl.download.fileProvider
|
package suwayomi.tachidesk.manga.impl.download.fileProvider
|
||||||
|
|
||||||
@FunctionalInterface
|
fun interface FileDownload {
|
||||||
interface FileDownload {
|
|
||||||
suspend fun executeDownload(vararg args: Any): Boolean
|
suspend fun executeDownload(vararg args: Any): Boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
@FunctionalInterface
|
fun interface FileDownload0Args : FileDownload {
|
||||||
interface FileDownload0Args : FileDownload {
|
|
||||||
suspend fun execute(): Boolean
|
suspend fun execute(): Boolean
|
||||||
|
|
||||||
override suspend fun executeDownload(vararg args: Any): Boolean {
|
override suspend fun executeDownload(vararg args: Any): Boolean {
|
||||||
@@ -14,8 +12,7 @@ interface FileDownload0Args : FileDownload {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@FunctionalInterface
|
fun interface FileDownload3Args<A, B, C> : FileDownload {
|
||||||
interface FileDownload3Args<A, B, C> : FileDownload {
|
|
||||||
suspend fun execute(a: A, b: B, c: C): Boolean
|
suspend fun execute(a: A, b: B, c: C): Boolean
|
||||||
|
|
||||||
override suspend fun executeDownload(vararg args: Any): Boolean {
|
override suspend fun executeDownload(vararg args: Any): Boolean {
|
||||||
@@ -23,7 +20,6 @@ interface FileDownload3Args<A, B, C> : FileDownload {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@FunctionalInterface
|
fun interface FileDownloader {
|
||||||
interface FileDownloader {
|
|
||||||
fun download(): FileDownload
|
fun download(): FileDownload
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,11 @@ package suwayomi.tachidesk.manga.impl.download.fileProvider
|
|||||||
|
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
|
|
||||||
@FunctionalInterface
|
fun interface RetrieveFile {
|
||||||
interface RetrieveFile {
|
|
||||||
fun executeGetImage(vararg args: Any): Pair<InputStream, String>
|
fun executeGetImage(vararg args: Any): Pair<InputStream, String>
|
||||||
}
|
}
|
||||||
|
|
||||||
@FunctionalInterface
|
fun interface RetrieveFile0Args : RetrieveFile {
|
||||||
interface RetrieveFile0Args : RetrieveFile {
|
|
||||||
fun execute(): Pair<InputStream, String>
|
fun execute(): Pair<InputStream, String>
|
||||||
|
|
||||||
override fun executeGetImage(vararg args: Any): Pair<InputStream, String> {
|
override fun executeGetImage(vararg args: Any): Pair<InputStream, String> {
|
||||||
@@ -16,8 +14,7 @@ interface RetrieveFile0Args : RetrieveFile {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@FunctionalInterface
|
fun interface RetrieveFile1Args<A> : RetrieveFile {
|
||||||
interface RetrieveFile1Args<A> : RetrieveFile {
|
|
||||||
fun execute(a: A): Pair<InputStream, String>
|
fun execute(a: A): Pair<InputStream, String>
|
||||||
|
|
||||||
override fun executeGetImage(vararg args: Any): Pair<InputStream, String> {
|
override fun executeGetImage(vararg args: Any): Pair<InputStream, String> {
|
||||||
@@ -25,7 +22,6 @@ interface RetrieveFile1Args<A> : RetrieveFile {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@FunctionalInterface
|
fun interface FileRetriever {
|
||||||
interface FileRetriever {
|
|
||||||
fun getImage(): RetrieveFile
|
fun getImage(): RetrieveFile
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,14 +37,10 @@ class ThumbnailFileProvider(val mangaId: Int) : DownloadedFilesProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getImage(): RetrieveFile0Args {
|
override fun getImage(): RetrieveFile0Args {
|
||||||
return object : RetrieveFile0Args {
|
return RetrieveFile0Args(::getImageImpl)
|
||||||
override fun execute(): Pair<InputStream, String> {
|
|
||||||
return getImageImpl()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun downloadImpl(): Boolean {
|
private suspend fun downloadImpl(): Boolean {
|
||||||
val isExistingFile = getFilePath() != null
|
val isExistingFile = getFilePath() != null
|
||||||
if (isExistingFile) {
|
if (isExistingFile) {
|
||||||
return true
|
return true
|
||||||
@@ -60,11 +56,7 @@ class ThumbnailFileProvider(val mangaId: Int) : DownloadedFilesProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun download(): FileDownload0Args {
|
override fun download(): FileDownload0Args {
|
||||||
return object : FileDownload0Args {
|
return FileDownload0Args(::downloadImpl)
|
||||||
override suspend fun execute(): Boolean {
|
|
||||||
return downloadImpl()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun delete(): Boolean {
|
override fun delete(): Boolean {
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import org.objectweb.asm.Opcodes
|
|||||||
import java.nio.file.FileSystems
|
import java.nio.file.FileSystems
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
|
import java.nio.file.StandardOpenOption
|
||||||
import kotlin.streams.asSequence
|
import kotlin.streams.asSequence
|
||||||
|
|
||||||
object BytecodeEditor {
|
object BytecodeEditor {
|
||||||
@@ -257,6 +258,11 @@ object BytecodeEditor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun write(pair: Pair<Path, ByteArray>) {
|
private fun write(pair: Pair<Path, ByteArray>) {
|
||||||
Files.write(pair.first, pair.second)
|
Files.write(
|
||||||
|
pair.first,
|
||||||
|
pair.second,
|
||||||
|
StandardOpenOption.CREATE,
|
||||||
|
StandardOpenOption.TRUNCATE_EXISTING
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user