feat: Remove duplicate checking functionality
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
@@ -37,8 +37,8 @@ let socket;
|
||||
let allCompleteBannerShown = false;
|
||||
|
||||
// Status precedence: never regress (e.g., uploading -> done shouldn't go back to uploading)
|
||||
const STATUS_ORDER = { queued: 0, checking: 1, uploading: 2, duplicate: 3, done: 3, error: 4 };
|
||||
const FINAL_STATES = new Set(['done','duplicate','error']);
|
||||
const STATUS_ORDER = { queued: 0, checking: 1, uploading: 2, done: 3, error: 4 };
|
||||
const FINAL_STATES = new Set(['done','error']);
|
||||
|
||||
// --- Dark mode ---
|
||||
function initDarkMode() {
|
||||
@@ -119,7 +119,7 @@ function render(){
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-3 h-2 w-full overflow-hidden rounded-full bg-gray-100 dark:bg-gray-700">
|
||||
<div class="h-full ${it.status==='done'?'bg-green-500':it.status==='duplicate'?'bg-amber-500':it.status==='error'?'bg-red-500':'bg-blue-500'}" style="width:${Math.max(it.progress, (it.status==='done'||it.status==='duplicate'||it.status==='error')?100:it.progress)}%"></div>
|
||||
<div class="h-full ${it.status==='done'?'bg-green-500':it.status==='error'?'bg-red-500':'bg-blue-500'}" style="width:${Math.max(it.progress, (it.status==='done'||it.status==='error')?100:it.progress)}%"></div>
|
||||
</div>
|
||||
<div class="mt-2 text-sm text-gray-600 dark:text-gray-400">
|
||||
${it.status==='uploading' ? `Uploading… ${it.progress}%` : it.status.charAt(0).toUpperCase()+it.status.slice(1)}
|
||||
@@ -144,18 +144,16 @@ function render(){
|
||||
});
|
||||
} catch {}
|
||||
|
||||
const c = {queued:0,uploading:0,done:0,dup:0,err:0};
|
||||
const c = {queued:0,uploading:0,done:0,err:0};
|
||||
for(const it of items){
|
||||
if(['queued','checking'].includes(it.status)) c.queued++;
|
||||
if(it.status==='uploading') c.uploading++;
|
||||
if(it.status==='done') c.done++;
|
||||
if(it.status==='duplicate') c.dup++;
|
||||
if(it.status==='error') c.err++;
|
||||
}
|
||||
document.getElementById('countQueued').textContent=c.queued;
|
||||
document.getElementById('countUploading').textContent=c.uploading;
|
||||
document.getElementById('countDone').textContent=c.done;
|
||||
document.getElementById('countDup').textContent=c.dup;
|
||||
document.getElementById('countErr').textContent=c.err;
|
||||
|
||||
if (!allCompleteBannerShown && items.length > 0) {
|
||||
@@ -252,12 +250,10 @@ async function uploadWhole(next){
|
||||
render();
|
||||
} else if (res.ok) {
|
||||
const statusText = (body && body.status) ? String(body.status) : '';
|
||||
const isDuplicate = /duplicate/i.test(statusText);
|
||||
next.status = isDuplicate ? 'duplicate' : 'done';
|
||||
next.message = statusText || (isDuplicate ? 'Duplicate' : 'Uploaded');
|
||||
next.status = 'done';
|
||||
next.message = statusText || 'Uploaded';
|
||||
next.progress = 100;
|
||||
render();
|
||||
try { if (isDuplicate) showBanner(`Duplicate: ${next.name}`, 'warn'); } catch {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,9 +319,8 @@ async function uploadChunked(next){
|
||||
render();
|
||||
} else if (rc.ok) {
|
||||
const statusText = (body && body.status) ? String(body.status) : '';
|
||||
const isDuplicate = /duplicate/i.test(statusText);
|
||||
next.status = isDuplicate ? 'duplicate' : 'done';
|
||||
next.message = statusText || (isDuplicate ? 'Duplicate' : 'Uploaded');
|
||||
next.status = 'done';
|
||||
next.message = statusText || 'Uploaded';
|
||||
next.progress = 100;
|
||||
render();
|
||||
}
|
||||
@@ -491,7 +486,7 @@ if (btnMobilePick) {
|
||||
|
||||
// --- Clear buttons ---
|
||||
btnClearFinished.onclick = ()=>{
|
||||
items = items.filter(i => !['done','duplicate'].includes(i.status));
|
||||
items = items.filter(i => !['done'].includes(i.status));
|
||||
render();
|
||||
// also tell server to refresh album cache so a renamed album triggers a new one
|
||||
fetch('/api/album/reset', { method: 'POST' }).catch(()=>{});
|
||||
|
||||
Reference in New Issue
Block a user