Add auto-load progress feature

This commit is contained in:
SKProCH committed 2025-10-16 15:35:20 +03:00
1 parent 0ddb76051c
commit cf761bcbee
16 files changed
+132 -14

No files matched your search

+3
View File
@@ -163,4 +163,7 @@
"batchSize": "Batch-Größe", "batchSize": "Batch-Größe",
"speedOn": "An", "speedOn": "An",
"speedOff": "Aus" "speedOff": "Aus"
,
"autoLoadProgress": "Gespeicherten Fortschritt automatisch laden",
"autoLoadProgressDesc": "Wenn aktiviert, wird der gespeicherte Fortschritt automatisch geladen, nachdem der Token-Generator beim Laden der Seite initialisiert wurde."
} }
+3 -1
View File
@@ -162,5 +162,7 @@
"paintingModeAuto": "Auto", "paintingModeAuto": "Auto",
"paintingModeAssist": "Assist", "paintingModeAssist": "Assist",
"paintingModeAutoDesc": "Bot will automatically paint pixels", "paintingModeAutoDesc": "Bot will automatically paint pixels",
"paintingModeAssistDesc": "Overlay will guide your manual pixel placement" "paintingModeAssistDesc": "Overlay will guide your manual pixel placement",
"autoLoadProgress": "Auto-load saved progress",
"autoLoadProgressDesc": "If enabled, will automatically load saved progress after the token generator initializes on page load."
} }
+3 -1
View File
@@ -162,5 +162,7 @@
"paintingModeAuto": "Automático", "paintingModeAuto": "Automático",
"paintingModeAssist": "Asistir", "paintingModeAssist": "Asistir",
"paintingModeAutoDesc": "El bot pintará píxeles automáticamente", "paintingModeAutoDesc": "El bot pintará píxeles automáticamente",
"paintingModeAssistDesc": "La superposición guiará tu colocación manual de píxeles" "paintingModeAssistDesc": "La superposición guiará tu colocación manual de píxeles",
"autoLoadProgress": "Cargar progreso guardado automáticamente",
"autoLoadProgressDesc": "Si está activado, cargará automáticamente el progreso guardado después de que el generador de tokens se inicialice al cargar la página."
} }
+3 -1
View File
@@ -163,6 +163,8 @@
"paintingFinalBatchFailed": "⚠️ Lot final de {count} pixels échoué après plusieurs tentatives.", "paintingFinalBatchFailed": "⚠️ Lot final de {count} pixels échoué après plusieurs tentatives.",
"paintingStoppedByUser": "⏹️ Peinture arrêtée par l'utilisateur", "paintingStoppedByUser": "⏹️ Peinture arrêtée par l'utilisateur",
"fullChargeIn": "Pleine charge dans", "fullChargeIn": "Pleine charge dans",
"batchSize": "Taille du lot" "batchSize": "Taille du lot",
"autoLoadProgress": "Charger automatiquement la progression sauvegardée",
"autoLoadProgressDesc": "Si activé, chargera automatiquement la progression sauvegardée après l’initialisation du générateur de jetons lors du chargement de la page."
} }
+3 -1
View File
@@ -163,6 +163,8 @@
"paintingFinalBatchFailed": "⚠️ Batch akhir {count} piksel gagal setelah beberapa percobaan.", "paintingFinalBatchFailed": "⚠️ Batch akhir {count} piksel gagal setelah beberapa percobaan.",
"paintingStoppedByUser": "⏹️ Melukis dihentikan oleh pengguna", "paintingStoppedByUser": "⏹️ Melukis dihentikan oleh pengguna",
"fullChargeIn": "Muatan penuh dalam", "fullChargeIn": "Muatan penuh dalam",
"batchSize": "Ukuran batch" "batchSize": "Ukuran batch",
"autoLoadProgress": "Muat otomatis progres tersimpan",
"autoLoadProgressDesc": "Jika diaktifkan, akan otomatis memuat progres tersimpan setelah generator token diinisialisasi saat halaman dimuat."
} }
+3 -1
View File
@@ -163,6 +163,8 @@
"paintingFinalBatchFailed": "⚠️ {count} ピクセルの最終バッチが複数回の試行後に失敗しました。", "paintingFinalBatchFailed": "⚠️ {count} ピクセルの最終バッチが複数回の試行後に失敗しました。",
"paintingStoppedByUser": "⏹️ ユーザーにより停止されました", "paintingStoppedByUser": "⏹️ ユーザーにより停止されました",
"fullChargeIn": "フル充電まで", "fullChargeIn": "フル充電まで",
"batchSize": "バッチサイズ" "batchSize": "バッチサイズ",
"autoLoadProgress": "保存された進行状況を自動読み込み",
"autoLoadProgressDesc": "有効にすると、ページ読み込み時にトークンジェネレーターが初期化された後、保存された進行状況を自動的に読み込みます。"
} }
+3 -1
View File
@@ -163,6 +163,8 @@
"paintingFinalBatchFailed": "⚠️ {count}개 픽셀의 최종 배치가 여러 번 시도 후 실패했습니다.", "paintingFinalBatchFailed": "⚠️ {count}개 픽셀의 최종 배치가 여러 번 시도 후 실패했습니다.",
"paintingStoppedByUser": "⏹️ 사용자에 의해 중지됨", "paintingStoppedByUser": "⏹️ 사용자에 의해 중지됨",
"fullChargeIn": "완전 충전까지", "fullChargeIn": "완전 충전까지",
"batchSize": "배치 크기" "batchSize": "배치 크기",
"autoLoadProgress": "저장된 진행 상황 자동 불러오기",
"autoLoadProgressDesc": "활성화하면 페이지 로드 시 토큰 생성기가 초기화된 후 저장된 진행 상황을 자동으로 불러옵니다."
} }
+3 -1
View File
@@ -149,5 +149,7 @@
"paintingModeAuto": "Automático", "paintingModeAuto": "Automático",
"paintingModeAssist": "Asistir", "paintingModeAssist": "Asistir",
"paintingModeAutoDesc": "El bot pintará píxeles automáticamente", "paintingModeAutoDesc": "El bot pintará píxeles automáticamente",
"paintingModeAssistDesc": "La superposición guiará tu colocación manual de píxeles" "paintingModeAssistDesc": "La superposición guiará tu colocación manual de píxeles",
"autoLoadProgress": "Cargar progreso guardado automáticamente",
"autoLoadProgressDesc": "Si está activado, cargará automáticamente el progreso guardado después de que el generador de tokens se inicialice al cargar la página."
} }
+3 -1
View File
@@ -162,5 +162,7 @@
"paintingFinalBatchFailed": "⚠️ Lote final de {count} pixels falhou após várias tentativas.", "paintingFinalBatchFailed": "⚠️ Lote final de {count} pixels falhou após várias tentativas.",
"paintingStoppedByUser": "⏹️ Pintura interrompida pelo usuário", "paintingStoppedByUser": "⏹️ Pintura interrompida pelo usuário",
"fullChargeIn": "Carga completa em", "fullChargeIn": "Carga completa em",
"batchSize": "Tamanho do lote" "batchSize": "Tamanho do lote",
"autoLoadProgress": "Auto-carregar progresso salvo",
"autoLoadProgressDesc": "Se ativado, carregará automaticamente o progresso salvo após a inicialização do gerador de tokens ao carregar a página."
} }
+3 -1
View File
@@ -162,5 +162,7 @@
"paintingFinalBatchFailed": "⚠️ Финальный пакет из {count} пикселей не удалось отправить после нескольких попыток.", "paintingFinalBatchFailed": "⚠️ Финальный пакет из {count} пикселей не удалось отправить после нескольких попыток.",
"paintingStoppedByUser": "⏹️ Рисование остановлено пользователем", "paintingStoppedByUser": "⏹️ Рисование остановлено пользователем",
"fullChargeIn": "Полная зарядка через", "fullChargeIn": "Полная зарядка через",
"batchSize": "Размер пакета" "batchSize": "Размер пакета",
"autoLoadProgress": "Автозагрузка прогресса",
"autoLoadProgressDesc": "Если включено, автоматически загрузит сохранённый прогресс после инициализации генератора токенов при загрузке страницы."
} }
+3 -1
View File
@@ -163,6 +163,8 @@
"paintingFinalBatchFailed": "⚠️ {count} pikselden oluşan son topluluk birkaç denemeden sonra başarısız oldu.", "paintingFinalBatchFailed": "⚠️ {count} pikselden oluşan son topluluk birkaç denemeden sonra başarısız oldu.",
"paintingStoppedByUser": "⏹️ Boyama kullanıcı tarafından durduruldu", "paintingStoppedByUser": "⏹️ Boyama kullanıcı tarafından durduruldu",
"fullChargeIn": "Tam dolum süresi", "fullChargeIn": "Tam dolum süresi",
"batchSize": "Topluluk boyutu" "batchSize": "Topluluk boyutu",
"autoLoadProgress": "Kaydedilen ilerlemeyi otomatik yükle",
"autoLoadProgressDesc": "Etkinleştirildiğinde, sayfa yüklenirken jeton oluşturucu başlatıldıktan sonra kaydedilen ilerleme otomatik olarak yüklenir."
} }
+3 -1
View File
@@ -163,6 +163,8 @@
"paintingFinalBatchFailed": "⚠️ Фінальний пакет з {count} пікселів не вдалося відправити після кількох спроб.", "paintingFinalBatchFailed": "⚠️ Фінальний пакет з {count} пікселів не вдалося відправити після кількох спроб.",
"paintingStoppedByUser": "⏹️ Малювання зупинено користувачем", "paintingStoppedByUser": "⏹️ Малювання зупинено користувачем",
"fullChargeIn": "Повний заряд через", "fullChargeIn": "Повний заряд через",
"batchSize": "Розмір пакета" "batchSize": "Розмір пакета",
"autoLoadProgress": "Автозавантаження прогресу",
"autoLoadProgressDesc": "Якщо ввімкнено, автоматично завантажить збережений прогрес після ініціалізації генератора токенів під час завантаження сторінки."
} }
+3 -1
View File
@@ -163,6 +163,8 @@
"paintingFinalBatchFailed": "⚠️ Lô cuối cùng gồm {count} pixel thất bại sau nhiều lần thử.", "paintingFinalBatchFailed": "⚠️ Lô cuối cùng gồm {count} pixel thất bại sau nhiều lần thử.",
"paintingStoppedByUser": "⏹️ Người dùng đã dừng vẽ", "paintingStoppedByUser": "⏹️ Người dùng đã dừng vẽ",
"fullChargeIn": "Sạc đầy trong", "fullChargeIn": "Sạc đầy trong",
"batchSize": "Kích thước lô" "batchSize": "Kích thước lô",
"autoLoadProgress": "Tự động tải tiến trình đã lưu",
"autoLoadProgressDesc": "Nếu bật, sẽ tự động tải tiến trình đã lưu sau khi bộ tạo token được khởi tạo khi tải trang."
} }
+3 -1
View File
@@ -163,6 +163,8 @@
"paintingFinalBatchFailed": "⚠️ {count} 个像素的最终批次在多次尝试后失败。", "paintingFinalBatchFailed": "⚠️ {count} 个像素的最终批次在多次尝试后失败。",
"paintingStoppedByUser": "⏹️ 已被用户停止", "paintingStoppedByUser": "⏹️ 已被用户停止",
"fullChargeIn": "完全充电时间", "fullChargeIn": "完全充电时间",
"batchSize": "批次大小" "batchSize": "批次大小",
"autoLoadProgress": "自动加载已保存的进度",
"autoLoadProgressDesc": "如果启用,将在页面加载时令牌生成器初始化后自动加载已保存的进度。"
} }
+3 -1
View File
@@ -163,6 +163,8 @@
"paintingFinalBatchFailed": "⚠️ {count} 個像素的最終批次在多次嘗試後失敗。", "paintingFinalBatchFailed": "⚠️ {count} 個像素的最終批次在多次嘗試後失敗。",
"paintingStoppedByUser": "⏹️ 已被使用者停止", "paintingStoppedByUser": "⏹️ 已被使用者停止",
"fullChargeIn": "完全充電時間", "fullChargeIn": "完全充電時間",
"batchSize": "批次大小" "batchSize": "批次大小",
"autoLoadProgress": "自動載入已儲存的進度",
"autoLoadProgressDesc": "若啟用,將在頁面載入時於權杖產生器初始化後自動載入已儲存的進度。"
} }
+87
View File
@@ -1053,6 +1053,8 @@ localStorage.removeItem("lp");
chargesThresholdInterval: null, chargesThresholdInterval: null,
tokenSource: CONFIG.TOKEN_SOURCE, // "generator" or "manual" tokenSource: CONFIG.TOKEN_SOURCE, // "generator" or "manual"
initialSetupComplete: false, // Track if initial startup setup is complete (only happens once) initialSetupComplete: false, // Track if initial startup setup is complete (only happens once)
autoLoadProgress: false, // New: automatically load saved progress after Turnstile init
_autoLoadAttempted: false, // Internal: ensure auto-load runs at most once
overlayOpacity: CONFIG.OVERLAY.OPACITY_DEFAULT, overlayOpacity: CONFIG.OVERLAY.OPACITY_DEFAULT,
blueMarbleEnabled: CONFIG.OVERLAY.BLUE_MARBLE_DEFAULT, blueMarbleEnabled: CONFIG.OVERLAY.BLUE_MARBLE_DEFAULT,
ditheringEnabled: false, ditheringEnabled: false,
@@ -2940,6 +2942,19 @@ localStorage.removeItem("lp");
${Utils.t('automation')} ${Utils.t('automation')}
</label> </label>
<!-- Token generator is always enabled - settings moved to Token Source above --> <!-- Token generator is always enabled - settings moved to Token Source above -->
<div class="wplace-settings-section-wrapper">
<label for="autoLoadProgressToggle" class="wplace-settings-toggle">
<div>
<span class="wplace-settings-toggle-title" style="color: ${theme.text || 'white'};">
${Utils.t('autoLoadProgress')}
</span>
<p class="wplace-settings-toggle-description" style="color: ${theme.text ? `${theme.text}BB` : 'rgba(255,255,255,0.7)'};">
${Utils.t('autoLoadProgressDesc')}
</p>
</div>
<input type="checkbox" id="autoLoadProgressToggle" ${state.autoLoadProgress ? 'checked' : ''} class="wplace-settings-checkbox" style="accent-color: ${theme.highlight || '#48dbfb'};"/>
</label>
</div>
</div> </div>
<!-- Overlay Settings Section --> <!-- Overlay Settings Section -->
@@ -4148,6 +4163,7 @@ localStorage.removeItem("lp");
const settingsPaintTransparentToggle = settingsContainer.querySelector( const settingsPaintTransparentToggle = settingsContainer.querySelector(
'#settingsPaintTransparentToggle' '#settingsPaintTransparentToggle'
); );
const autoLoadProgressToggle = settingsContainer.querySelector('#autoLoadProgressToggle');
if (overlayOpacitySlider && overlayOpacityValue) { if (overlayOpacitySlider && overlayOpacityValue) {
const updateOpacity = (newValue) => { const updateOpacity = (newValue) => {
@@ -4193,6 +4209,15 @@ localStorage.removeItem("lp");
}); });
} }
if (autoLoadProgressToggle) {
autoLoadProgressToggle.checked = state.autoLoadProgress;
autoLoadProgressToggle.addEventListener('change', (e) => {
state.autoLoadProgress = !!e.target.checked;
saveBotSettings();
console.log(`🔄 Auto-load progress ${state.autoLoadProgress ? 'enabled' : 'disabled'}`);
});
}
// Speed controls - both slider and input // Speed controls - both slider and input
const speedSlider = settingsContainer.querySelector('#speedSlider'); const speedSlider = settingsContainer.querySelector('#speedSlider');
const speedInput = settingsContainer.querySelector('#speedInput'); const speedInput = settingsContainer.querySelector('#speedInput');
@@ -9837,6 +9862,7 @@ localStorage.removeItem("lp");
randomBatchMax: state.randomBatchMax, randomBatchMax: state.randomBatchMax,
cooldownChargeThreshold: state.cooldownChargeThreshold, cooldownChargeThreshold: state.cooldownChargeThreshold,
tokenSource: state.tokenSource, // "generator", "hybrid", or "manual" tokenSource: state.tokenSource, // "generator", "hybrid", or "manual"
autoLoadProgress: state.autoLoadProgress,
minimized: state.minimized, minimized: state.minimized,
overlayOpacity: state.overlayOpacity, overlayOpacity: state.overlayOpacity,
blueMarbleEnabled: document.getElementById('enableBlueMarbleToggle')?.checked, blueMarbleEnabled: document.getElementById('enableBlueMarbleToggle')?.checked,
@@ -9901,6 +9927,7 @@ localStorage.removeItem("lp");
settings.cooldownChargeThreshold || CONFIG.COOLDOWN_CHARGE_THRESHOLD; settings.cooldownChargeThreshold || CONFIG.COOLDOWN_CHARGE_THRESHOLD;
state.tokenSource = settings.tokenSource || CONFIG.TOKEN_SOURCE; // Default to "generator" state.tokenSource = settings.tokenSource || CONFIG.TOKEN_SOURCE; // Default to "generator"
state.minimized = settings.minimized ?? false; state.minimized = settings.minimized ?? false;
state.autoLoadProgress = settings.autoLoadProgress ?? false;
CONFIG.PAINTING_SPEED_ENABLED = settings.paintingSpeedEnabled ?? false; CONFIG.PAINTING_SPEED_ENABLED = settings.paintingSpeedEnabled ?? false;
CONFIG.AUTO_CAPTCHA_ENABLED = settings.autoCaptchaEnabled ?? false; CONFIG.AUTO_CAPTCHA_ENABLED = settings.autoCaptchaEnabled ?? false;
state.overlayOpacity = settings.overlayOpacity ?? CONFIG.OVERLAY.OPACITY_DEFAULT; state.overlayOpacity = settings.overlayOpacity ?? CONFIG.OVERLAY.OPACITY_DEFAULT;
@@ -10123,6 +10150,61 @@ localStorage.removeItem("lp");
const fpStr32 = tokenManager._randStr(32); const fpStr32 = tokenManager._randStr(32);
console.log('🔑 Generated fingerprint string for API requests'); console.log('🔑 Generated fingerprint string for API requests');
// Function to auto-load saved progress after init if enabled
async function attemptAutoLoadProgress() {
if (state._autoLoadAttempted) return;
state._autoLoadAttempted = true;
try {
const savedData = Utils.loadProgress();
if (!savedData) return;
const hasCompleteData = savedData.state && savedData.imageData &&
savedData.state.availableColors &&
savedData.state.availableColors.length > 0;
const success = Utils.restoreProgress(savedData);
if (success) {
if (hasCompleteData) {
state.initialSetupComplete = true;
}
updateUI('dataLoaded', 'success');
Utils.showAlert(Utils.t('dataLoaded'), 'success');
updateDataButtons();
await updateStats();
const statsContainer = document.getElementById('wplace-stats-container');
if (statsContainer && typeof updateStats === 'function') {
setTimeout(async () => { await updateStats(); }, 100);
}
Utils.restoreOverlayFromData().catch((error) => {
console.error('Failed to restore overlay from localStorage:', error);
});
const uploadBtn = document.getElementById('uploadBtn');
const selectPosBtn = document.getElementById('selectPosBtn');
const loadExtractedBtn = document.getElementById('loadExtractedBtn');
if (!state.colorsChecked) {
if (uploadBtn) uploadBtn.disabled = false;
if (loadExtractedBtn) loadExtractedBtn.disabled = false;
} else {
if (uploadBtn) uploadBtn.disabled = false;
if (loadExtractedBtn) loadExtractedBtn.disabled = false;
if (selectPosBtn) selectPosBtn.disabled = false;
}
const startBtn = document.getElementById('startBtn');
if (state.imageLoaded && state.startPosition && state.region && state.colorsChecked) {
if (startBtn) startBtn.disabled = false;
}
}
} catch (e) {
console.error('Auto-load progress failed:', e);
}
}
// Function to enable file operations after initial startup setup is complete // Function to enable file operations after initial startup setup is complete
function enableFileOperations() { function enableFileOperations() {
state.initialSetupComplete = true; state.initialSetupComplete = true;
@@ -10174,6 +10256,11 @@ localStorage.removeItem("lp");
// Show a notification that file operations are now available // Show a notification that file operations are now available
Utils.showAlert(Utils.t('fileOperationsAvailable'), 'success'); Utils.showAlert(Utils.t('fileOperationsAvailable'), 'success');
// Auto-load saved progress on init if enabled
if (state.autoLoadProgress) {
attemptAutoLoadProgress();
}
} }
// Optimized token initialization with better timing and error handling // Optimized token initialization with better timing and error handling