Merge pull request #205 from SKProCH/main

Auto-load, improve droplets purchases, mics
This commit is contained in:
MiraclePatrickLumowa authored and GitHub committed 2025-10-25 02:12:06 +08:00
commit 934a30d8c7
18 files changed
+11730 -11641

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
.idea
.claude
+36 -112
View File
@@ -14,6 +14,38 @@ chrome.runtime.onInstalled.addListener(async () => {
});
// Helper to load and inject a local script file into the page (MAIN world)
async function injectPlainScriptFromExtension(tabId, relativePath, friendlyName, color, emoji) {
const url = chrome.runtime.getURL(relativePath);
try {
const response = await fetch(url);
if (!response.ok) {
console.warn(`⚠️ Could not load ${relativePath}, proceeding without it`);
return false;
}
const code = await response.text();
console.log(`${emoji} ${friendlyName} loaded, injecting...`);
await chrome.scripting.executeScript({
target: { tabId: tabId },
world: "MAIN",
func: (code, friendlyName, color, emoji) => {
console.log(`%c${emoji} Loading ${friendlyName}...`, `color: ${color}; font-weight: bold;`);
const script = document.createElement('script');
script.textContent = code;
document.head.appendChild(script);
script.remove();
console.log(`%c✅ ${friendlyName} loaded successfully`, `color: ${color}; font-weight: bold;`);
},
args: [code, friendlyName, color, emoji]
});
console.log(`✅ ${friendlyName} injected successfully`);
return true;
} catch (e) {
console.warn(`⚠️ Error injecting ${friendlyName}:`, e);
return false;
}
}
async function executeLocalScript(scriptName, tabId) {
try {
console.log(`Loading script: ${scriptName}`);
@@ -23,118 +55,10 @@ async function executeLocalScript(scriptName, tabId) {
console.log(`🔑 ${scriptName} detected, ensuring dependencies are loaded first...`);
try {
// First inject token-manager.js
const tokenManagerUrl = chrome.runtime.getURL('scripts/token-manager.js');
const tokenManagerResponse = await fetch(tokenManagerUrl);
if (tokenManagerResponse.ok) {
const tokenManagerCode = await tokenManagerResponse.text();
console.log('🔑 Token manager loaded, injecting first...');
// Execute token manager first
await chrome.scripting.executeScript({
target: { tabId: tabId },
world: "MAIN",
func: (code) => {
console.log('%c🔑 Loading WPlace Token Manager...', 'color: #4ade80; font-weight: bold;');
const script = document.createElement('script');
script.textContent = code;
document.head.appendChild(script);
script.remove();
console.log('%c✅ Token Manager loaded successfully', 'color: #4ade80; font-weight: bold;');
},
args: [tokenManagerCode]
});
console.log('✅ Token manager injected successfully');
} else {
console.warn('⚠️ Could not load token-manager.js, proceeding without it');
}
// Then inject image-processor.js
const imageProcessorUrl = chrome.runtime.getURL('scripts/image-processor.js');
const imageProcessorResponse = await fetch(imageProcessorUrl);
if (imageProcessorResponse.ok) {
const imageProcessorCode = await imageProcessorResponse.text();
console.log('🖼️ Image processor loaded, injecting second...');
// Execute image processor second
await chrome.scripting.executeScript({
target: { tabId: tabId },
world: "MAIN",
func: (code) => {
console.log('%c🖼️ Loading WPlace Image Processor...', 'color: #3b82f6; font-weight: bold;');
const script = document.createElement('script');
script.textContent = code;
document.head.appendChild(script);
script.remove();
console.log('%c✅ Image Processor loaded successfully', 'color: #3b82f6; font-weight: bold;');
},
args: [imageProcessorCode]
});
console.log('✅ Image processor injected successfully');
} else {
console.warn('⚠️ Could not load image-processor.js, proceeding without it');
}
// Then inject overlay-manager.js
const overlayManagerUrl = chrome.runtime.getURL('scripts/overlay-manager.js');
const overlayManagerResponse = await fetch(overlayManagerUrl);
if (overlayManagerResponse.ok) {
const overlayManagerCode = await overlayManagerResponse.text();
console.log('🎨 Overlay manager loaded, injecting third...');
// Execute overlay manager thirds
await chrome.scripting.executeScript({
target: { tabId: tabId },
world: "MAIN",
func: (code) => {
console.log('%c🎨 Loading WPlace Overlay Manager...', 'color: #8b5cf6; font-weight: bold;');
const script = document.createElement('script');
script.textContent = code;
document.head.appendChild(script);
script.remove();
console.log('%c✅ Overlay Manager loaded successfully', 'color: #8b5cf6; font-weight: bold;');
},
args: [overlayManagerCode]
});
console.log('✅ Overlay manager injected successfully');
} else {
console.warn('⚠️ Could not load overlay-manager.js, proceeding without it');
}
// Finally inject utils-manager.js
const utilsManagerUrl = chrome.runtime.getURL('scripts/utils-manager.js');
const utilsManagerResponse = await fetch(utilsManagerUrl);
if (utilsManagerResponse.ok) {
const utilsManagerCode = await utilsManagerResponse.text();
console.log('🛠️ Utils manager loaded, injecting fourth...');
// Execute utils manager fourth
await chrome.scripting.executeScript({
target: { tabId: tabId },
world: "MAIN",
func: (code) => {
console.log('%c🛠️ Loading WPlace Utils Manager...', 'color: #f59e0b; font-weight: bold;');
const script = document.createElement('script');
script.textContent = code;
document.head.appendChild(script);
script.remove();
console.log('%c✅ Utils Manager loaded successfully', 'color: #f59e0b; font-weight: bold;');
},
args: [utilsManagerCode]
});
console.log('✅ Utils manager injected successfully');
} else {
console.warn('⚠️ Could not load utils-manager.js, proceeding without it');
}
await injectPlainScriptFromExtension(tabId, 'scripts/token-manager.js', 'WPlace Token Manager', '#4ade80', '🔑');
await injectPlainScriptFromExtension(tabId, 'scripts/image-processor.js', 'WPlace Image Processor', '#3b82f6', '🖼️');
await injectPlainScriptFromExtension(tabId, 'scripts/overlay-manager.js', 'WPlace Overlay Manager', '#8b5cf6', '🎨');
await injectPlainScriptFromExtension(tabId, 'scripts/utils-manager.js', 'WPlace Utils Manager', '#f59e0b', '🛠️');
// Small delay to ensure dependencies are fully initialized
await new Promise(resolve => setTimeout(resolve, 200));
} catch (error) {
+3
View File
@@ -163,4 +163,7 @@
"batchSize": "Batch-Größe",
"speedOn": "An",
"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",
"paintingModeAssist": "Assist",
"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",
"paintingModeAssist": "Asistir",
"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.",
"paintingStoppedByUser": "⏹️ Peinture arrêtée par l'utilisateur",
"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.",
"paintingStoppedByUser": "⏹️ Melukis dihentikan oleh pengguna",
"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} ピクセルの最終バッチが複数回の試行後に失敗しました。",
"paintingStoppedByUser": "⏹️ ユーザーにより停止されました",
"fullChargeIn": "フル充電まで",
"batchSize": "バッチサイズ"
"batchSize": "バッチサイズ",
"autoLoadProgress": "保存された進行状況を自動読み込み",
"autoLoadProgressDesc": "有効にすると、ページ読み込み時にトークンジェネレーターが初期化された後、保存された進行状況を自動的に読み込みます。"
}
+3 -1
View File
@@ -163,6 +163,8 @@
"paintingFinalBatchFailed": "⚠️ {count}개 픽셀의 최종 배치가 여러 번 시도 후 실패했습니다.",
"paintingStoppedByUser": "⏹️ 사용자에 의해 중지됨",
"fullChargeIn": "완전 충전까지",
"batchSize": "배치 크기"
"batchSize": "배치 크기",
"autoLoadProgress": "저장된 진행 상황 자동 불러오기",
"autoLoadProgressDesc": "활성화하면 페이지 로드 시 토큰 생성기가 초기화된 후 저장된 진행 상황을 자동으로 불러옵니다."
}
+3 -1
View File
@@ -149,5 +149,7 @@
"paintingModeAuto": "Automático",
"paintingModeAssist": "Asistir",
"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.",
"paintingStoppedByUser": "⏹️ Pintura interrompida pelo usuário",
"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} пикселей не удалось отправить после нескольких попыток.",
"paintingStoppedByUser": "⏹️ Рисование остановлено пользователем",
"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.",
"paintingStoppedByUser": "⏹️ Boyama kullanıcı tarafından durduruldu",
"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} пікселів не вдалося відправити після кількох спроб.",
"paintingStoppedByUser": "⏹️ Малювання зупинено користувачем",
"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ử.",
"paintingStoppedByUser": "⏹️ Người dùng đã dừng vẽ",
"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} 个像素的最终批次在多次尝试后失败。",
"paintingStoppedByUser": "⏹️ 已被用户停止",
"fullChargeIn": "完全充电时间",
"batchSize": "批次大小"
"batchSize": "批次大小",
"autoLoadProgress": "自动加载已保存的进度",
"autoLoadProgressDesc": "如果启用,将在页面加载时令牌生成器初始化后自动加载已保存的进度。"
}
+3 -1
View File
@@ -163,6 +163,8 @@
"paintingFinalBatchFailed": "⚠️ {count} 個像素的最終批次在多次嘗試後失敗。",
"paintingStoppedByUser": "⏹️ 已被使用者停止",
"fullChargeIn": "完全充電時間",
"batchSize": "批次大小"
"batchSize": "批次大小",
"autoLoadProgress": "自動載入已儲存的進度",
"autoLoadProgressDesc": "若啟用,將在頁面載入時於權杖產生器初始化後自動載入已儲存的進度。"
}
+11647 -11515
View File
File diff suppressed because it is too large. Load diff