From fce2474a215e5b8efb2539961fd93f8f46048936 Mon Sep 17 00:00:00 2001
From: Difegue <8237712+Difegue@users.noreply.github.com>
Date: Tue, 26 May 2026 13:59:54 +0000
Subject: [PATCH 01/30] Make "Edit Metadata" links in post-upload open in a new
tab
---
public/js/upload.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/public/js/upload.js b/public/js/upload.js
index 9524fc22a..f900082cd 100644
--- a/public/js/upload.js
+++ b/public/js/upload.js
@@ -101,6 +101,7 @@ function handleCompletedUpload(jobID, d) {
if (d.result.id) {
$(`#${jobID}-name`).attr("href", new LRR.ApiURL(`/reader?id=${d.result.id}`));
$(`#${jobID}-link`).attr("href", new LRR.ApiURL(`/edit?id=${d.result.id}`));
+ $(`#${jobID}-link`).attr("target", "_blank");
}
if (d.result.success) {
From 6d59439f1839739371ee0a9fc44e077d3f06e87c Mon Sep 17 00:00:00 2001
From: Difegue <8237712+Difegue@users.noreply.github.com>
Date: Mon, 25 May 2026 18:58:47 +0000
Subject: [PATCH 02/30] Implement Tank progress API in webclient
---
lib/LANraragi/Utils/Database.pm | 2 +-
public/js/mod/index.js | 13 ++++++++++---
public/js/mod/server.js | 6 +++++-
public/js/reader.js | 11 +++++++----
templates/reader.html.tt2 | 2 +-
5 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/lib/LANraragi/Utils/Database.pm b/lib/LANraragi/Utils/Database.pm
index 1c9ca528f..a1256afa0 100644
--- a/lib/LANraragi/Utils/Database.pm
+++ b/lib/LANraragi/Utils/Database.pm
@@ -307,7 +307,7 @@ sub build_tank_json ($id) {
$aggregate_isnew = $aggregate_isnew || (%$archive_info{isnew} eq "true");
$aggregate_pagecount = $aggregate_pagecount + %$archive_info{pagecount};
$aggregate_size = $aggregate_size + %$archive_info{size};
- $latest_readtime = max( $latest_readtime, %$archive_info{lastreadtime} );
+ $latest_readtime = max( $latest_readtime, %$archive_info{lastreadtime} // 0);
}
chop $aggregate_names;
diff --git a/public/js/mod/index.js b/public/js/mod/index.js
index 060bfecfe..f3d0b2617 100644
--- a/public/js/mod/index.js
+++ b/public/js/mod/index.js
@@ -954,8 +954,15 @@ export function migrateProgress() {
const promises = [];
localProgressKeys.forEach((id) => {
const progress = localStorage.getItem(`${id}-reader`);
+ const metadataUrl = id.startsWith("TANK_") ?
+ new LRR.ApiURL(`api/tankoubons/${id}`) :
+ new LRR.ApiURL(`api/archives/${id}/metadata`);
- promises.push(fetch(new LRR.ApiURL(`api/archives/${id}/metadata`), { method: "GET" })
+ const progressUrl = id.startsWith("TANK_") ?
+ `api/tankoubons/${id}/progress/${progress}?force=1` :
+ `api/archives/${id}/progress/${progress}?force=1`;
+
+ promises.push(fetch(metadataUrl), { method: "GET" })
.then((response) => response.json())
.then((data) => {
// Don't migrate if the server progress is already further
@@ -963,13 +970,13 @@ export function migrateProgress() {
&& data !== undefined
&& data !== null
&& progress > data.progress) {
- Server.callAPI(`api/archives/${id}/progress/${progress}?force=1`, "PUT", null, I18N.LocalProgressionError, null);
+ Server.callAPI(progressUrl, "PUT", null, I18N.LocalProgressionError, null);
}
// Clear out localStorage'd progress
localStorage.removeItem(`${id}-reader`);
localStorage.removeItem(`${id}-totalPages`);
- }));
+ });
});
Promise.all(promises).then(() => LRR.toast({
diff --git a/public/js/mod/server.js b/public/js/mod/server.js
index 61e012556..0a674cd3f 100644
--- a/public/js/mod/server.js
+++ b/public/js/mod/server.js
@@ -356,7 +356,11 @@ export function loadBookmarkCategoryId() {
* @param {number} currentPage Page the user navigated to
*/
export function updateServerSideProgress(id, currentPage) {
- let endpointUrl = new LRR.ApiURL(`/api/archives/${id}/progress/${currentPage}`);
+
+ let endpointUrl = id.startsWith("TANK_") ?
+ new LRR.ApiURL(`/api/tankoubons/${id}/progress/${currentPage}`) :
+ new LRR.ApiURL(`/api/archives/${id}/progress/${currentPage}`);
+
return fetch(endpointUrl, { method: "PUT" })
.then((response) => (response.ok ? {code: response.status, data: response.json()} : { code: response.status, data: {success: 0, error: I18N.GenericReponseError} }))
.then((response) => {
diff --git a/public/js/reader.js b/public/js/reader.js
index aa803c71f..3c3931142 100644
--- a/public/js/reader.js
+++ b/public/js/reader.js
@@ -1270,18 +1270,21 @@ function updateProgress() {
// Clear markers
markers = [];
renderMarkers();
+
+ let page = currentPage + 1; // progress is 1-indexed
+
// Send an API request to update progress on the server
if (state.authenticateProgress && LRR.isUserLogged()) {
- Server.updateServerSideProgress(id, currentPage + 1);
+ Server.updateServerSideProgress(id, page);
} else if (state.trackProgressLocally) {
- localStorage.setItem(`${id}-reader`, currentPage + 1);
+ localStorage.setItem(`${id}-reader`, page);
} else if (!state.authenticateProgress) {
- Server.updateServerSideProgress(id, currentPage + 1);
+ Server.updateServerSideProgress(id, page);
}
// Load stamps
if (!infiniteScroll) {
- const stamps = loadStamps(currentPage + 1);
+ const stamps = loadStamps(page);
}
}
diff --git a/templates/reader.html.tt2 b/templates/reader.html.tt2
index 16c38c324..312069f7f 100644
--- a/templates/reader.html.tt2
+++ b/templates/reader.html.tt2
@@ -93,7 +93,7 @@