mirror of
https://github.com/tachiyomiorg/tachiyomi-extensions-inspector.git
synced 2024-12-26 00:31:49 +01:00
fix slow manga thumbnails issue, next manga reset page issue
This commit is contained in:
parent
57274a0a01
commit
9d38f478e3
@ -23,8 +23,9 @@ object CachedImageResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun findFileNameStartingWith(directoryPath: String, fileName: String): String? {
|
private fun findFileNameStartingWith(directoryPath: String, fileName: String): String? {
|
||||||
|
val target = "$fileName."
|
||||||
File(directoryPath).listFiles().forEach { file ->
|
File(directoryPath).listFiles().forEach { file ->
|
||||||
if (file.name.startsWith("$fileName."))
|
if (file.name.startsWith(target))
|
||||||
return "$directoryPath/${file.name}"
|
return "$directoryPath/${file.name}"
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
|
@ -36,9 +36,8 @@ import ir.armor.tachidesk.impl.backup.legacy.LegacyBackupImport.restoreLegacyBac
|
|||||||
import ir.armor.tachidesk.server.internal.About.getAbout
|
import ir.armor.tachidesk.server.internal.About.getAbout
|
||||||
import ir.armor.tachidesk.server.util.openInBrowser
|
import ir.armor.tachidesk.server.util.openInBrowser
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.SupervisorJob
|
|
||||||
import kotlinx.coroutines.future.future
|
import kotlinx.coroutines.future.future
|
||||||
|
import kotlinx.coroutines.newFixedThreadPoolContext
|
||||||
import mu.KotlinLogging
|
import mu.KotlinLogging
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
@ -55,7 +54,9 @@ import kotlin.concurrent.thread
|
|||||||
|
|
||||||
object JavalinSetup {
|
object JavalinSetup {
|
||||||
private val logger = KotlinLogging.logger {}
|
private val logger = KotlinLogging.logger {}
|
||||||
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Default)
|
|
||||||
|
@kotlinx.coroutines.ObsoleteCoroutinesApi
|
||||||
|
private val scope = CoroutineScope(newFixedThreadPoolContext(200, "javalin-future"))
|
||||||
|
|
||||||
private fun <T> future(block: suspend CoroutineScope.() -> T): CompletableFuture<T> {
|
private fun <T> future(block: suspend CoroutineScope.() -> T): CompletableFuture<T> {
|
||||||
return scope.future(block = block)
|
return scope.future(block = block)
|
||||||
|
@ -46,7 +46,7 @@ const useStyles = (settings: IReaderSettings) => makeStyles((theme: Theme) => ({
|
|||||||
position: settings.staticNav ? 'sticky' : 'fixed',
|
position: settings.staticNav ? 'sticky' : 'fixed',
|
||||||
top: 0,
|
top: 0,
|
||||||
left: 0,
|
left: 0,
|
||||||
minWidth: '300px',
|
width: '300px',
|
||||||
height: '100vh',
|
height: '100vh',
|
||||||
overflowY: 'auto',
|
overflowY: 'auto',
|
||||||
backgroundColor: '#0a0b0b',
|
backgroundColor: '#0a0b0b',
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* 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 { makeStyles } from '@material-ui/core/styles';
|
import { makeStyles } from '@material-ui/core/styles';
|
||||||
import React, { useEffect } from 'react';
|
import React, { useEffect, useRef } from 'react';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
import Page from '../Page';
|
import Page from '../Page';
|
||||||
|
|
||||||
@ -30,11 +30,12 @@ export default function PagedReader(props: IReaderProps) {
|
|||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
|
||||||
|
const pageRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
function nextPage() {
|
function nextPage() {
|
||||||
if (curPage < pages.length - 1) {
|
if (curPage < pages.length - 1) {
|
||||||
setCurPage(curPage + 1);
|
setCurPage(curPage + 1);
|
||||||
} else if (settings.loadNextonEnding) {
|
} else if (settings.loadNextonEnding) {
|
||||||
setCurPage(0);
|
|
||||||
history.push(`/manga/${manga.id}/chapter/${chapter.index + 1}`);
|
history.push(`/manga/${manga.id}/chapter/${chapter.index + 1}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -66,16 +67,16 @@ export default function PagedReader(props: IReaderProps) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
document.addEventListener('keyup', keyboardControl, false);
|
document.addEventListener('keyup', keyboardControl, false);
|
||||||
document.addEventListener('click', clickControl);
|
pageRef.current?.addEventListener('click', clickControl);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
document.removeEventListener('keyup', keyboardControl);
|
document.removeEventListener('keyup', keyboardControl);
|
||||||
document.removeEventListener('click', clickControl);
|
pageRef.current?.removeEventListener('click', clickControl);
|
||||||
};
|
};
|
||||||
}, [curPage]);
|
}, [curPage, pageRef]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classes.reader}>
|
<div ref={pageRef} className={classes.reader}>
|
||||||
<Page
|
<Page
|
||||||
key={curPage}
|
key={curPage}
|
||||||
index={curPage}
|
index={curPage}
|
||||||
|
@ -117,6 +117,7 @@ export default function Reader() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setChapter(initialChapter);
|
setChapter(initialChapter);
|
||||||
|
setCurPage(0);
|
||||||
client.get(`/api/v1/manga/${mangaId}/chapter/${chapterIndex}`)
|
client.get(`/api/v1/manga/${mangaId}/chapter/${chapterIndex}`)
|
||||||
.then((response) => response.data)
|
.then((response) => response.data)
|
||||||
.then((data:IChapter) => {
|
.then((data:IChapter) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user