mirror of
https://gitlab.com/mangadex-pub/mangadex_at_home.git
synced 2024-01-19 02:48:37 +00:00
merge
This commit is contained in:
parent
d7bf45af0b
commit
541890190a
|
@ -3,7 +3,7 @@ package mdnet.base;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
|
|
||||||
public class Constants {
|
public class Constants {
|
||||||
public static final int CLIENT_BUILD = 3;
|
public static final int CLIENT_BUILD = 4;
|
||||||
public static final String CLIENT_VERSION = "1.0";
|
public static final String CLIENT_VERSION = "1.0";
|
||||||
public static final Duration MAX_AGE_CACHE = Duration.ofDays(14);
|
public static final Duration MAX_AGE_CACHE = Duration.ofDays(14);
|
||||||
}
|
}
|
||||||
|
|
8
src/main/java/mdnet/cache/DiskLruCache.java
vendored
8
src/main/java/mdnet/cache/DiskLruCache.java
vendored
|
@ -966,6 +966,10 @@ public final class DiskLruCache implements Closeable {
|
||||||
// Move files to new caching tree if exists
|
// Move files to new caching tree if exists
|
||||||
Path oldCache = Paths.get(directory + File.separator + key + "." + i);
|
Path oldCache = Paths.get(directory + File.separator + key + "." + i);
|
||||||
Path newCache = Paths.get(directory + subKeyPath + File.separator + key + "." + i);
|
Path newCache = Paths.get(directory + subKeyPath + File.separator + key + "." + i);
|
||||||
|
|
||||||
|
File newCacheDirectory = new File(directory + subKeyPath, key + "." + i + ".tmp");
|
||||||
|
newCacheDirectory.getParentFile().mkdirs();
|
||||||
|
|
||||||
if (Files.exists(oldCache)) {
|
if (Files.exists(oldCache)) {
|
||||||
try {
|
try {
|
||||||
Files.move(oldCache, newCache, StandardCopyOption.ATOMIC_MOVE);
|
Files.move(oldCache, newCache, StandardCopyOption.ATOMIC_MOVE);
|
||||||
|
@ -985,6 +989,10 @@ public final class DiskLruCache implements Closeable {
|
||||||
// Move files to new caching tree if exists
|
// Move files to new caching tree if exists
|
||||||
Path oldCache = Paths.get(directory + File.separator + key + "." + i + ".tmp");
|
Path oldCache = Paths.get(directory + File.separator + key + "." + i + ".tmp");
|
||||||
Path newCache = Paths.get(directory + subKeyPath + File.separator + key + "." + i + ".tmp");
|
Path newCache = Paths.get(directory + subKeyPath + File.separator + key + "." + i + ".tmp");
|
||||||
|
|
||||||
|
File newCacheDirectory = new File(directory + subKeyPath, key + "." + i + ".tmp");
|
||||||
|
newCacheDirectory.getParentFile().mkdirs();
|
||||||
|
|
||||||
if (Files.exists(oldCache)) {
|
if (Files.exists(oldCache)) {
|
||||||
try {
|
try {
|
||||||
Files.move(oldCache, newCache, StandardCopyOption.ATOMIC_MOVE);
|
Files.move(oldCache, newCache, StandardCopyOption.ATOMIC_MOVE);
|
||||||
|
|
|
@ -19,10 +19,8 @@ import org.http4k.filter.CachingFilters
|
||||||
import org.http4k.filter.MaxAgeTtl
|
import org.http4k.filter.MaxAgeTtl
|
||||||
import org.http4k.filter.ServerFilters
|
import org.http4k.filter.ServerFilters
|
||||||
import org.http4k.lens.Path
|
import org.http4k.lens.Path
|
||||||
import org.http4k.routing.ResourceLoader
|
|
||||||
import org.http4k.routing.bind
|
import org.http4k.routing.bind
|
||||||
import org.http4k.routing.routes
|
import org.http4k.routing.routes
|
||||||
import org.http4k.routing.singlePageApp
|
|
||||||
import org.http4k.server.Http4kServer
|
import org.http4k.server.Http4kServer
|
||||||
import org.http4k.server.asServer
|
import org.http4k.server.asServer
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
|
@ -214,9 +212,7 @@ fun getServer(cache: DiskLruCache, serverSettings: ServerSettings, clientSetting
|
||||||
"/data/{chapterHash}/{fileName}" bind Method.GET to app(false),
|
"/data/{chapterHash}/{fileName}" bind Method.GET to app(false),
|
||||||
"/data-saver/{chapterHash}/{fileName}" bind Method.GET to app(true),
|
"/data-saver/{chapterHash}/{fileName}" bind Method.GET to app(true),
|
||||||
"/{token}/data/{chapterHash}/{fileName}" bind Method.GET to app(false),
|
"/{token}/data/{chapterHash}/{fileName}" bind Method.GET to app(false),
|
||||||
"/{token}/data-saver/{chapterHash}/{fileName}" bind Method.GET to app(true),
|
"/{token}/data-saver/{chapterHash}/{fileName}" bind Method.GET to app(true)
|
||||||
|
|
||||||
singlePageApp(ResourceLoader.Classpath("/webui"))
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.asServer(Netty(serverSettings.tls, clientSettings, statistics))
|
.asServer(Netty(serverSettings.tls, clientSettings, statistics))
|
||||||
|
|
Loading…
Reference in a new issue