mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-11 13:56:16 +00:00
Compare commits
49 Commits
feat/custo
...
fix/use-lo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d6b38771a8 | ||
|
|
8400edd000 | ||
|
|
6e3c5cac7e | ||
|
|
4f2d6f3302 | ||
|
|
72c3219fc0 | ||
|
|
048c56d670 | ||
|
|
43505a281f | ||
|
|
c380e5f5a0 | ||
|
|
5c32e61569 | ||
|
|
f594cd298a | ||
|
|
20c0d3174b | ||
|
|
bcd6db24c9 | ||
|
|
c2216bbf95 | ||
|
|
f84917a00b | ||
|
|
94ebf94abc | ||
|
|
cd3fa10bf7 | ||
|
|
a57cc83076 | ||
|
|
c75a6ad439 | ||
|
|
05d68fa23b | ||
|
|
527a65e9bc | ||
|
|
fe6bb5763d | ||
|
|
002dff098c | ||
|
|
436d1b74be | ||
|
|
b89de065fe | ||
|
|
7fcdab07cb | ||
|
|
aebf6d1cae | ||
|
|
a2148dd1ef | ||
|
|
8dc5be1bdf | ||
|
|
133168c6c7 | ||
|
|
d59b96f446 | ||
|
|
a1eef4eab6 | ||
|
|
25103e5eb7 | ||
|
|
9cf0ef4b62 | ||
|
|
1521d7c058 | ||
|
|
14eb0f8172 | ||
|
|
860030a510 | ||
|
|
f0e4d241f9 | ||
|
|
44b24ab63d | ||
|
|
7c1adb70ea | ||
|
|
9854ed2f53 | ||
|
|
20338fa20b | ||
|
|
b578af4612 | ||
|
|
6f6b7d49ac | ||
|
|
5c445f8a90 | ||
|
|
87d35da9fc | ||
|
|
5067cf163e | ||
|
|
efab242c74 | ||
|
|
4dd3c9de76 | ||
|
|
101bc35460 |
3
.github/workflows/build.yml
vendored
3
.github/workflows/build.yml
vendored
@@ -2,6 +2,9 @@ name: Build
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
|
||||
@@ -153,8 +153,11 @@ def profile_image():
|
||||
data = request.get_json()
|
||||
image_path = data.get('image_path')
|
||||
|
||||
# use webp as default value for target_extension
|
||||
target_extension = data.get('target_extension') or 'webp'
|
||||
|
||||
try:
|
||||
processed_image_path, mime_type = ProfileImageProcessor.process_image(image_path)
|
||||
processed_image_path, mime_type = ProfileImageProcessor.process_image(image_path, target_extension)
|
||||
return jsonify({'imagePath': processed_image_path, 'mimeType': mime_type}), 200
|
||||
except Exception as e:
|
||||
return jsonify({"error": str(e)}), 400
|
||||
|
||||
@@ -4,7 +4,7 @@ import os, uuid, tempfile
|
||||
class ProfileImageProcessor:
|
||||
|
||||
@staticmethod
|
||||
def get_parsed_image_data(image_path):
|
||||
def get_parsed_image_data(image_path, target_extension):
|
||||
Image.MAX_IMAGE_PIXELS = 933120000
|
||||
|
||||
image = Image.open(image_path)
|
||||
@@ -16,7 +16,7 @@ class ProfileImageProcessor:
|
||||
return image_path, mime_type
|
||||
else:
|
||||
new_uuid = str(uuid.uuid4())
|
||||
new_image_path = os.path.join(tempfile.gettempdir(), new_uuid) + ".webp"
|
||||
new_image_path = os.path.join(tempfile.gettempdir(), new_uuid) + "." + target_extension
|
||||
image.save(new_image_path)
|
||||
|
||||
new_image = Image.open(new_image_path)
|
||||
@@ -26,5 +26,5 @@ class ProfileImageProcessor:
|
||||
|
||||
|
||||
@staticmethod
|
||||
def process_image(image_path):
|
||||
return ProfileImageProcessor.get_parsed_image_data(image_path)
|
||||
def process_image(image_path, target_extension):
|
||||
return ProfileImageProcessor.get_parsed_image_data(image_path, target_extension)
|
||||
|
||||
@@ -197,6 +197,7 @@
|
||||
"download_in_progress": "Download in progress",
|
||||
"download_paused": "Download paused",
|
||||
"last_downloaded_option": "Last downloaded option",
|
||||
"new_download_option": "New",
|
||||
"create_steam_shortcut": "Create Steam shortcut",
|
||||
"create_shortcut_success": "Shortcut created successfully",
|
||||
"you_might_need_to_restart_steam": "You might need to restart Steam to see the changes",
|
||||
|
||||
@@ -193,6 +193,7 @@
|
||||
"download_in_progress": "Descarga en progreso",
|
||||
"download_paused": "Descarga pausada",
|
||||
"last_downloaded_option": "Última opción de descarga",
|
||||
"new_download_option": "Nuevo",
|
||||
"create_steam_shortcut": "Crear atajo de Steam",
|
||||
"create_shortcut_success": "Atajo creado con éxito",
|
||||
"you_might_need_to_restart_steam": "Probablemente necesités reiniciar Steam para ver cambios",
|
||||
|
||||
@@ -8,11 +8,12 @@
|
||||
"no_results": "Nincs találat",
|
||||
"start_typing": "Kereséshez gépelj...",
|
||||
"hot": "Most felkapott",
|
||||
"weekly": "📅 A hét felkapottjai",
|
||||
"weekly": "📅 Heti kiemeltek",
|
||||
"achievements": "🏆 Achievement támogatott"
|
||||
},
|
||||
"sidebar": {
|
||||
"catalogue": "Katalógus",
|
||||
"library": "Könyvtár",
|
||||
"downloads": "Letöltések",
|
||||
"settings": "Beállítások",
|
||||
"my_library": "Könyvtáram",
|
||||
@@ -81,7 +82,7 @@
|
||||
"update_decky_plugin": "Decky Plugin Frissítése",
|
||||
"decky_plugin_installed_version": "Decky Plugin (v{{version}})",
|
||||
"install_decky_plugin_title": "Telepítsd a Hydra Decky Plugint",
|
||||
"install_decky_plugin_message": "Ez letölti és telepíteni fogja a Hydra plugint a Decky Loaderhez. Előfordulhat, hogy rendszergazdai jogosultságra lesz szükség. Folytatod?",
|
||||
"install_decky_plugin_message": "Ez letölti és telepíti a Hydra plugint a Decky Loaderhez. Előfordulhat, hogy rendszergazdai jogosultságra lesz szükség. Folytatod?",
|
||||
"update_decky_plugin_title": "Hydra Decky Plugin Frissítése",
|
||||
"update_decky_plugin_message": "Egy új verzió elérhető a Hydra Decky Pluginhoz. Szeretnéd frissíteni?",
|
||||
"decky_plugin_installed": "Decky plugin v{{version}} sikeresen telepítve",
|
||||
@@ -92,8 +93,10 @@
|
||||
},
|
||||
"header": {
|
||||
"search": "Keresés",
|
||||
"search_library": "Könyvtár böngészése",
|
||||
"home": "Főoldal",
|
||||
"catalogue": "Katalógus",
|
||||
"library": "Könyvtár",
|
||||
"downloads": "Letöltések",
|
||||
"search_results": "Keresési találatok",
|
||||
"settings": "Beállítások",
|
||||
@@ -117,7 +120,7 @@
|
||||
"tags": "Címkék",
|
||||
"publishers": "Kiadók",
|
||||
"download_sources": "Letöltési források",
|
||||
"result_count": "{{resultCount}} találatok",
|
||||
"result_count": "{{resultCount}} találat",
|
||||
"filter_count": "{{filterCount}} elérhető",
|
||||
"clear_filters": "{{filterCount}} kiválaszott szűrő törlése"
|
||||
},
|
||||
@@ -166,11 +169,11 @@
|
||||
"download_now": "Letöltés",
|
||||
"no_shop_details": "A bolt adatai nem érhetőek el.",
|
||||
"download_options": "Letöltési opciók",
|
||||
"download_path": "Letöltis hely",
|
||||
"download_path": "Letöltési hely",
|
||||
"previous_screenshot": "Előző screenshot",
|
||||
"next_screenshot": "Következő screenshot",
|
||||
"screenshot": "Screenshot {{number}}",
|
||||
"open_screenshot": "Screenshot megnyitása {{number}}",
|
||||
"open_screenshot": "{{number}} Screenshot megnyitása ",
|
||||
"download_settings": "Letöltési beállítások",
|
||||
"downloader": "Letöltési mód",
|
||||
"select_executable": "Tallózás",
|
||||
@@ -194,6 +197,7 @@
|
||||
"download_in_progress": "Letöltés folyamatban",
|
||||
"download_paused": "Letöltés szüneteltetve",
|
||||
"last_downloaded_option": "Utoljára letöltött",
|
||||
"new_download_option": "Új",
|
||||
"create_steam_shortcut": "Steam parancsikon létrehozása",
|
||||
"create_shortcut_success": "A parancsikon létrehozása sikeres",
|
||||
"you_might_need_to_restart_steam": "Lehetséges hogy újrakell indítsd a Steamet hogy lásd a változást.",
|
||||
@@ -223,6 +227,7 @@
|
||||
"show_more": "Mutass többet",
|
||||
"show_less": "Mutass kevesebbet",
|
||||
"reviews": "Vélemények",
|
||||
"review_played_for": "Játszva",
|
||||
"leave_a_review": "Hagyd itt a véleményed",
|
||||
"write_review_placeholder": "Oszd meg gondolatod a játékról...",
|
||||
"sort_newest": "Legújabb",
|
||||
@@ -361,7 +366,10 @@
|
||||
"show_original": "Eredeti megjelenítése",
|
||||
"show_translation": "Fordítás megjelenítése",
|
||||
"show_original_translated_from": "Eredeti megjelenítése (fordítva: {{language}})",
|
||||
"hide_original": "Eredeti elrejtése"
|
||||
"hide_original": "Eredeti elrejtése",
|
||||
"review_from_blocked_user": "Letiltott felhasználó véleménye",
|
||||
"show": "Megjelenítés",
|
||||
"hide": "Elrejtés"
|
||||
},
|
||||
"activation": {
|
||||
"title": "Hydra Aktiválása",
|
||||
@@ -488,11 +496,11 @@
|
||||
"no_email_account": "Még nincs beállított emailed",
|
||||
"account_data_updated_successfully": "Fiókadatok változtatása sikeres",
|
||||
"renew_subscription": "Hydra Cloud Megújítása",
|
||||
"subscription_expired_at": "Az előfizetésed lejárt, ekkor: {{date}}",
|
||||
"subscription_expired_at": "Az előfizetésed lejárt: {{date}}",
|
||||
"no_subscription": "Élvezd a Hydrát a lehető legjobb módon",
|
||||
"become_subscriber": "Légy Hydra Cloud tag",
|
||||
"subscription_renew_cancelled": "Automatikus megújítás kikapcsolva",
|
||||
"subscription_renews_on": "Az előfizetésed megújul, ekkor: {{date}}",
|
||||
"subscription_renews_on": "Az előfizetésed megújul: {{date}}",
|
||||
"bill_sent_until": "A következő számlát ezen napon küldjük",
|
||||
"no_themes": "Úgy látszik nincs egyetlen témád sem még, de ne aggódj, kattints ide hogy elkészítsd a remekművedet.",
|
||||
"editor_tab_code": "Code",
|
||||
@@ -551,10 +559,19 @@
|
||||
"platinum": "Platina",
|
||||
"hidden": "Rejtett",
|
||||
"test_notification": "Értesítés tesztelése",
|
||||
"achievement_sound_volume": "Achievement hangereje",
|
||||
"select_achievement_sound": "Achievement hang kiválasztása",
|
||||
"change_achievement_sound": "Achievement hang megváltoztatása",
|
||||
"remove_achievement_sound": "Achievement hang eltávolítása",
|
||||
"preview_sound": "Hang előnézet",
|
||||
"select": "Kiválaszt",
|
||||
"preview": "Előnézet",
|
||||
"remove": "Eltávolít",
|
||||
"no_sound_file_selected": "Nincs hangfájl kiválasztva",
|
||||
"notification_preview": "Achievement Értesítés Előnézete",
|
||||
"enable_friend_start_game_notifications": "Amikor egy barátod elkezd játszani egy játékot",
|
||||
"autoplay_trailers_on_game_page": "Játékelőzetes automatikus lejátszása a játék oldalán",
|
||||
"hide_to_tray_on_game_start": "Hydra elrejtése játék elindításakor a tálcára"
|
||||
"hide_to_tray_on_game_start": "Hydra elrejtése játék indításakor a tálcára"
|
||||
},
|
||||
"notifications": {
|
||||
"download_complete": "Letöltés befejezve",
|
||||
@@ -670,7 +687,7 @@
|
||||
"report_reason_other": "Egyéb",
|
||||
"profile_reported": "Profil bejelentve",
|
||||
"your_friend_code": "A barát kódod:",
|
||||
"upload_banner": "Borítókép feltöltés",
|
||||
"upload_banner": "Borítókép feltöltése",
|
||||
"uploading_banner": "Borítókép feltöltése…",
|
||||
"background_image_updated": "Borítókép frissítve",
|
||||
"stats": "Statisztikák",
|
||||
@@ -689,7 +706,31 @@
|
||||
"game_added_to_pinned": "Játék hozzáadva a kitűzöttekhez",
|
||||
"karma": "Karma",
|
||||
"karma_count": "karma",
|
||||
"karma_description": "Pozitív értékelésekkel szerzett pontok"
|
||||
"karma_description": "Pozitív értékelésekkel szerzett pontok",
|
||||
"user_reviews": "Vélemények",
|
||||
"delete_review": "Vélemény Törlése",
|
||||
"loading_reviews": "Vélemények betöltése..."
|
||||
},
|
||||
"library": {
|
||||
"library": "Könyvtár",
|
||||
"play": "Játék",
|
||||
"download": "Letöltés",
|
||||
"downloading": "Letöltés..",
|
||||
"game": "játék",
|
||||
"games": "játékok",
|
||||
"grid_view": "Rács nézet",
|
||||
"compact_view": "Kompakt nézet",
|
||||
"large_view": "Nagy nézet",
|
||||
"no_games_title": "A könyvtárad üres",
|
||||
"no_games_description": "Adj játékokat a katalógusból hozzá vagy töltsd le őket hogy bele vágj",
|
||||
"amount_hours": "{{amount}} óra",
|
||||
"amount_minutes": "{{amount}} perc",
|
||||
"amount_hours_short": "{{amount}}ó",
|
||||
"amount_minutes_short": "{{amount}}p",
|
||||
"manual_playtime_tooltip": "Ez a játszottidő manuálisan lett frissítve",
|
||||
"all_games": "Összes Játék",
|
||||
"recently_played": "Nemrég Játszva",
|
||||
"favorites": "Kedvencek"
|
||||
},
|
||||
"achievement": {
|
||||
"achievement_unlocked": "Achievement feloldva",
|
||||
|
||||
@@ -183,6 +183,7 @@
|
||||
"download_in_progress": "Download em andamento",
|
||||
"download_paused": "Download pausado",
|
||||
"last_downloaded_option": "Última opção baixada",
|
||||
"new_download_option": "Novo",
|
||||
"create_steam_shortcut": "Criar atalho na Steam",
|
||||
"create_shortcut_success": "Atalho criado com sucesso",
|
||||
"you_might_need_to_restart_steam": "Você pode precisar reiniciar a Steam para ver as alterações",
|
||||
|
||||
@@ -195,6 +195,7 @@
|
||||
"download_in_progress": "Идёт загрузка",
|
||||
"download_paused": "Загрузка приостановлена",
|
||||
"last_downloaded_option": "Последний вариант загрузки",
|
||||
"new_download_option": "Новый",
|
||||
"create_steam_shortcut": "Создать ярлык Steam",
|
||||
"create_shortcut_success": "Ярлык создан",
|
||||
"you_might_need_to_restart_steam": "Возможно, вам потребуется перезапустить Steam, чтобы увидеть изменения",
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
"downloads": "İndirilenler",
|
||||
"settings": "Ayarlar",
|
||||
"my_library": "Kütüphanem",
|
||||
"library": "Kütüphane",
|
||||
"downloading_metadata": "{{title}} (Meta verileri indiriliyor…)",
|
||||
"paused": "{{title}} (Duraklatıldı)",
|
||||
"downloading": "{{title}} (%{{percentage}} - İndiriliyor…)",
|
||||
@@ -26,7 +27,69 @@
|
||||
"sign_in": "Giriş Yap",
|
||||
"friends": "Arkadaşlar",
|
||||
"need_help": "Yardıma mı ihtiyacınız var?",
|
||||
"favorites": "Favoriler"
|
||||
"favorites": "Favoriler",
|
||||
"playable_button_title": "Şu anda oynayabileceğin oyunları göster",
|
||||
"add_custom_game_tooltip": "Özel Oyun Ekle",
|
||||
"show_playable_only_tooltip": "Sadece Oynanabilirleri Göster",
|
||||
"custom_game_modal": "Özel Oyun Ekle",
|
||||
"custom_game_modal_description": "Çalıştırılabilir bir dosya seçerek kütüphanene özel oyun ekle",
|
||||
"custom_game_modal_executable_path": "Çalıştırılabilir Dosya Yolu",
|
||||
"custom_game_modal_select_executable": "Çalıştırılabilir dosya seç",
|
||||
"custom_game_modal_title": "Başlık",
|
||||
"custom_game_modal_enter_title": "Başlık gir",
|
||||
"custom_game_modal_browse": "Gözat",
|
||||
"custom_game_modal_cancel": "İptal",
|
||||
"custom_game_modal_add": "Oyun Ekle",
|
||||
"custom_game_modal_adding": "Oyun Ekleniyor...",
|
||||
"custom_game_modal_success": "Özel oyun başarıyla eklendi",
|
||||
"custom_game_modal_failed": "Özel oyun eklenemedi",
|
||||
"custom_game_modal_executable": "Çalıştırılabilir",
|
||||
"edit_game_modal": "Varlıkları Özelleştir",
|
||||
"edit_game_modal_description": "Oyun varlıklarını ve detaylarını özelleştir",
|
||||
"edit_game_modal_title": "Başlık",
|
||||
"edit_game_modal_enter_title": "Başlık gir",
|
||||
"edit_game_modal_image": "Görsel",
|
||||
"edit_game_modal_select_image": "Görsel seç",
|
||||
"edit_game_modal_browse": "Gözat",
|
||||
"edit_game_modal_image_preview": "Görsel önizleme",
|
||||
"edit_game_modal_icon": "İkon",
|
||||
"edit_game_modal_select_icon": "İkon seç",
|
||||
"edit_game_modal_icon_preview": "İkon önizleme",
|
||||
"edit_game_modal_logo": "Logo",
|
||||
"edit_game_modal_select_logo": "Logo seç",
|
||||
"edit_game_modal_logo_preview": "Logo önizleme",
|
||||
"edit_game_modal_hero": "Kütüphane Hero",
|
||||
"edit_game_modal_select_hero": "Kütüphane hero görseli seç",
|
||||
"edit_game_modal_hero_preview": "Kütüphane hero görseli önizleme",
|
||||
"edit_game_modal_cancel": "İptal et",
|
||||
"edit_game_modal_update": "Güncelle",
|
||||
"edit_game_modal_updating": "Güncelleniyor...",
|
||||
"edit_game_modal_fill_required": "Lütfen tüm gerekli alanları doldur",
|
||||
"edit_game_modal_success": "Varlıklar başarıyla güncellendi",
|
||||
"edit_game_modal_failed": "Varlıklar güncellenemedi",
|
||||
"edit_game_modal_image_filter": "Görsel",
|
||||
"edit_game_modal_icon_resolution": "Önerilen çözünürlük: 256x256px",
|
||||
"edit_game_modal_logo_resolution": "Önerilen çözünürlük: 640x360px",
|
||||
"edit_game_modal_hero_resolution": "Önerilen çözünürlük: 1920x620px",
|
||||
"edit_game_modal_assets": "Varlıklar",
|
||||
"edit_game_modal_drop_icon_image_here": "İkon görselini buraya bırak",
|
||||
"edit_game_modal_drop_logo_image_here": "Logo görselini buraya bırak",
|
||||
"edit_game_modal_drop_hero_image_here": "Hero görselini buraya bırak",
|
||||
"edit_game_modal_drop_to_replace_icon": "İkonu değiştirmek için buraya bırak",
|
||||
"edit_game_modal_drop_to_replace_logo": "Logoyu değiştirmek için buraya bırak",
|
||||
"edit_game_modal_drop_to_replace_hero": "Hero'yu değiştirmek için buraya bırak",
|
||||
"install_decky_plugin": "Decky Plugin Kur",
|
||||
"update_decky_plugin": "Decky Plugin Güncelle",
|
||||
"decky_plugin_installed_version": "Decky Plugin (v{{version}})",
|
||||
"install_decky_plugin_title": "Hydra Decky Plugin Kur",
|
||||
"install_decky_plugin_message": "Bu işlem Decky Loader için Hydra plugin'ini indirecek ve kuracak. Bu işlem yükseltilmiş izinler gerektirebilir. Devam et?",
|
||||
"update_decky_plugin_title": "Hydra Decky Plugin Güncelle",
|
||||
"update_decky_plugin_message": "Hydra Decky plugin'inin yeni bir sürümü mevcut. Şimdi güncellemek ister misin?",
|
||||
"decky_plugin_installed": "Decky plugin v{{version}} başarıyla kuruldu",
|
||||
"decky_plugin_installation_failed": "Decky plugin kurulamadı: {{error}}",
|
||||
"decky_plugin_installation_error": "Decky plugin kurulumu hatası: {{error}}",
|
||||
"confirm": "Onayla",
|
||||
"cancel": "İptal"
|
||||
},
|
||||
"header": {
|
||||
"search": "Oyunlarda Ara",
|
||||
@@ -35,6 +98,8 @@
|
||||
"downloads": "İndirilenler",
|
||||
"search_results": "Arama Sonuçları",
|
||||
"settings": "Ayarlar",
|
||||
"search_library": "Kütüphanede ara",
|
||||
"library": "Kütüphane",
|
||||
"version_available_install": "{{version}} sürümü mevcut. Yeniden başlatıp yüklemek için tıklayın.",
|
||||
"version_available_download": "{{version}} sürümü mevcut. İndirmek için tıklayın."
|
||||
},
|
||||
@@ -203,7 +268,108 @@
|
||||
"create_start_menu_shortcut": "Başlat Menüsüne kısayol oluştur",
|
||||
"invalid_wine_prefix_path": "Geçersiz Wine ön ek yolu",
|
||||
"invalid_wine_prefix_path_description": "Wine ön ek yolu hatalı. Lütfen yolu kontrol edin ve tekrar deneyin.",
|
||||
"missing_wine_prefix": "Linux'ta yedekleme oluşturmak için Wine ön eki gereklidir"
|
||||
"missing_wine_prefix": "Linux'ta yedekleme oluşturmak için Wine ön eki gereklidir",
|
||||
"already_in_library": "Zaten kütüphanede",
|
||||
"create_shortcut_simple": "Kısayol oluştur",
|
||||
"properties": "Özellikler",
|
||||
"new_download_option": "Yeni",
|
||||
"add_to_favorites": "Favorilere ekle",
|
||||
"remove_from_favorites": "Favorilerden çıkar",
|
||||
"failed_update_favorites": "Favoriler güncellenemedi",
|
||||
"game_removed_from_library": "Oyun kütüphaneden çıkarıldı",
|
||||
"failed_remove_from_library": "Kütüphaneden çıkarılamadı",
|
||||
"files_removed_success": "Dosyalar başarıyla kaldırıldı",
|
||||
"failed_remove_files": "Dosyalar kaldırılamadı",
|
||||
"rating_count": "Puan",
|
||||
"show_more": "Daha fazla göster",
|
||||
"show_less": "Daha az göster",
|
||||
"reviews": "İncelemeler",
|
||||
"review_played_for": "Oynama süresi",
|
||||
"leave_a_review": "İnceleme Yap",
|
||||
"write_review_placeholder": "Bu oyun hakkındaki düşüncelerini paylaş...",
|
||||
"sort_newest": "En yeni",
|
||||
"no_reviews_yet": "Henüz inceleme yok",
|
||||
"be_first_to_review": "Bu oyun hakkındaki düşüncelerini paylaşan ilk kişi ol!",
|
||||
"sort_oldest": "En eski",
|
||||
"sort_highest_score": "En yüksek puan",
|
||||
"sort_lowest_score": "En düşük puan",
|
||||
"sort_most_voted": "En çok oy",
|
||||
"rating": "Puan",
|
||||
"rating_stats": "Puan",
|
||||
"rating_very_negative": "Çok Olumsuz",
|
||||
"rating_negative": "Olumsuz",
|
||||
"rating_neutral": "Nötr",
|
||||
"rating_positive": "Olumlu",
|
||||
"rating_very_positive": "Çok Olumlu",
|
||||
"submit_review": "Gönder",
|
||||
"submitting": "Gönderiliyor...",
|
||||
"review_submitted_successfully": "İnceleme başarıyla gönderildi!",
|
||||
"review_submission_failed": "İnceleme gönderilemedi. Lütfen tekrar dene.",
|
||||
"review_cannot_be_empty": "İnceleme metin alanı boş olamaz.",
|
||||
"review_deleted_successfully": "İnceleme başarıyla silindi.",
|
||||
"review_deletion_failed": "İnceleme silinemedi. Lütfen tekrar dene.",
|
||||
"loading_reviews": "İncelemeler yükleniyor...",
|
||||
"loading_more_reviews": "Daha fazla inceleme yükleniyor...",
|
||||
"load_more_reviews": "Daha fazla inceleme yükle",
|
||||
"you_seemed_to_enjoy_this_game": "Bu oyunu beğenmiş görünüyorsun",
|
||||
"would_you_recommend_this_game": "Bu oyun hakkında bir inceleme yazmak ister misin?",
|
||||
"yes": "Evet",
|
||||
"maybe_later": "Belki sonra",
|
||||
"backup_failed": "Yedekleme başarısız",
|
||||
"update_playtime_title": "Oynama süresini güncelle",
|
||||
"update_playtime_description": "{{game}} için oynama süresini manuel olarak güncelle",
|
||||
"update_playtime": "Oynama süresini güncelle",
|
||||
"update_playtime_success": "Oynama süresi başarıyla güncellendi",
|
||||
"update_playtime_error": "Oynama süresi güncellenemedi",
|
||||
"update_game_playtime": "Oyun oynama süresini güncelle",
|
||||
"manual_playtime_warning": "Saatlerin manuel olarak güncellendiği işaretlenecek ve bu geri alınamaz.",
|
||||
"manual_playtime_tooltip": "Bu oynama süresi manuel olarak güncellendi",
|
||||
"game_removed_from_pinned": "Oyun sabitlenmişlerden çıkarıldı",
|
||||
"game_added_to_pinned": "Oyun sabitlenmişlere eklendi",
|
||||
"artifact_renamed": "Yedekleme başarıyla yeniden adlandırıldı",
|
||||
"rename_artifact": "Yedeklemeyi Yeniden Adlandır",
|
||||
"rename_artifact_description": "Yedeklemeyi daha açıklayıcı bir isimle yeniden adlandır",
|
||||
"artifact_name_label": "Yedekleme adı",
|
||||
"artifact_name_placeholder": "Yedekleme için bir isim gir",
|
||||
"save_changes": "Değişiklikleri kaydet",
|
||||
"required_field": "Bu alan gereklidir",
|
||||
"max_length_field": "Bu alan {{length}} karakterden az olmalıdır",
|
||||
"freeze_backup": "Otomatik yedeklemeler tarafından üzerine yazılmasın diye sabitle",
|
||||
"unfreeze_backup": "Sabitlemeyi kaldır",
|
||||
"backup_frozen": "Yedekleme sabitlendi",
|
||||
"backup_unfrozen": "Yedekleme sabitlemesi kaldırıldı",
|
||||
"backup_freeze_failed": "Yedekleme sabitlenemedi",
|
||||
"backup_freeze_failed_description": "Otomatik yedeklemeler için en az bir boş alan bırakmalısın",
|
||||
"edit_game_modal_button": "Oyun varlıklarını özelleştir",
|
||||
"game_details": "Oyun Detayları",
|
||||
"currency_symbol": "₺",
|
||||
"currency_country": "tr",
|
||||
"prices": "Fiyatlar",
|
||||
"no_prices_found": "Fiyat bulunamadı",
|
||||
"view_all_prices": "Tüm fiyatları görüntülemek için tıkla",
|
||||
"retail_price": "Perakende fiyatı",
|
||||
"keyshop_price": "Anahtar dükkanı fiyatı",
|
||||
"historical_retail": "Geçmiş perakende",
|
||||
"historical_keyshop": "Geçmiş anahtar dükkanı",
|
||||
"language": "Dil",
|
||||
"caption": "Altyazı",
|
||||
"audio": "Ses",
|
||||
"filter_by_source": "Kaynağa göre filtrele",
|
||||
"no_repacks_found": "Bu oyun için kaynak bulunamadı",
|
||||
"delete_review": "İncelemeyi sil",
|
||||
"remove_review": "İncelemeyi Kaldır",
|
||||
"delete_review_modal_title": "İncelemeni silmek istediğinden emin misin?",
|
||||
"delete_review_modal_description": "Bu işlem geri alınamaz.",
|
||||
"delete_review_modal_delete_button": "Sil",
|
||||
"delete_review_modal_cancel_button": "İptal",
|
||||
"vote_failed": "Oyun kaydı başarısız oldu. Lütfen tekrar dene.",
|
||||
"show_original": "Orijinali göster",
|
||||
"show_translation": "Çeviriyi göster",
|
||||
"show_original_translated_from": "Orijinali göster ({{language}} dilinden çevrilmiştir)",
|
||||
"hide_original": "Orijinali gizle",
|
||||
"review_from_blocked_user": "Engellenen kullanıcıdan gelen inceleme",
|
||||
"show": "Göster",
|
||||
"hide": "Gizle"
|
||||
},
|
||||
"activation": {
|
||||
"title": "Hydra'yı Etkinleştir",
|
||||
@@ -379,7 +545,33 @@
|
||||
"hidden": "Gizli",
|
||||
"test_notification": "Test bildirimi",
|
||||
"notification_preview": "Başarı Bildirimi Önizlemesi",
|
||||
"enable_friend_start_game_notifications": "Bir arkadaşınız oyun oynamaya başladığında"
|
||||
"enable_friend_start_game_notifications": "Bir arkadaşınız oyun oynamaya başladığında",
|
||||
"adding": "Ekleniyor…",
|
||||
"failed_add_download_source": "İndirme kaynağı eklenemedi. Lütfen tekrar dene.",
|
||||
"download_source_already_exists": "Bu indirme kaynağı URL'si zaten mevcut.",
|
||||
"download_source_pending_matching": "Yakında güncellenecek",
|
||||
"download_source_matched": "Güncel",
|
||||
"download_source_matching": "Güncelleniyor",
|
||||
"download_source_failed": "Hata",
|
||||
"download_source_no_information": "Bilgi mevcut değil",
|
||||
"removed_all_download_sources": "Tüm indirme kaynakları kaldırıldı",
|
||||
"download_sources_synced_successfully": "Tüm indirme kaynakları senkronize edildi",
|
||||
"importing": "İçe aktarılıyor...",
|
||||
"hydra_cloud": "Hydra Cloud",
|
||||
"debrid": "Debrid",
|
||||
"debrid_description": "Debrid servisleri, internet hızınızla sınırlı, çeşitli dosya barındırma hizmetlerinde barındırılan dosyaları hızla indirmenize olanak tanıyan premium sınırsız indiricilerdir.",
|
||||
"enable_steam_achievements": "Steam başarımları aramasını etkinleştir",
|
||||
"achievement_sound_volume": "Başarım ses seviyesi",
|
||||
"select_achievement_sound": "Başarım sesi seç",
|
||||
"change_achievement_sound": "Başarım sesini değiştir",
|
||||
"remove_achievement_sound": "Başarım sesini kaldır",
|
||||
"preview_sound": "Sesi önizle",
|
||||
"select": "Seç",
|
||||
"preview": "Önizle",
|
||||
"remove": "Kaldır",
|
||||
"no_sound_file_selected": "Ses dosyası seçilmedi",
|
||||
"autoplay_trailers_on_game_page": "Oyun sayfasında fragmanları otomatik olarak oynat",
|
||||
"hide_to_tray_on_game_start": "Oyun başlatıldığında Hydra'yı sistem tepsisine gizle"
|
||||
},
|
||||
"notifications": {
|
||||
"download_complete": "İndirme tamamlandı",
|
||||
@@ -406,7 +598,8 @@
|
||||
"game_card": {
|
||||
"available_one": "Mevcut",
|
||||
"available_other": "Mevcut",
|
||||
"no_downloads": "İndirme mevcut değil"
|
||||
"no_downloads": "İndirme mevcut değil",
|
||||
"calculating": "Hesaplanıyor"
|
||||
},
|
||||
"binary_not_found_modal": {
|
||||
"title": "Programlar Yüklü Değil",
|
||||
@@ -498,7 +691,46 @@
|
||||
"achievements_unlocked": "Açılan başarımlar",
|
||||
"earned_points": "Kazanılan puanlar",
|
||||
"show_achievements_on_profile": "Başarımlarını profilinde göster",
|
||||
"show_points_on_profile": "Kazanılan puanlarını profilinde göster"
|
||||
"show_points_on_profile": "Kazanılan puanlarını profilinde göster",
|
||||
"amount_hours_short": "{{amount}}s",
|
||||
"amount_minutes_short": "{{amount}}d",
|
||||
"pinned": "Sabitlenmiş",
|
||||
"sort_by": "Sırala:",
|
||||
"achievements_earned": "Kazanılan başarımlar",
|
||||
"played_recently": "Son oynanan",
|
||||
"playtime": "Oynama süresi",
|
||||
"manual_playtime_tooltip": "Bu oynama süresi manuel olarak güncellendi",
|
||||
"error_adding_friend": "Arkadaş isteği gönderilemedi. Lütfen arkadaş kodunu kontrol et",
|
||||
"friend_code_length_error": "Arkadaş kodu 8 karakter olmalıdır",
|
||||
"game_removed_from_pinned": "Oyun sabitlenmişlerden çıkarıldı",
|
||||
"game_added_to_pinned": "Oyun sabitlenmişlere eklendi",
|
||||
"karma": "Karma",
|
||||
"karma_count": "karma",
|
||||
"karma_description": "İncelemelerdeki olumlu beğenilerden kazanılır",
|
||||
"user_reviews": "İncelemeler",
|
||||
"delete_review": "İncelemeyi Sil",
|
||||
"loading_reviews": "İncelemeler yükleniyor..."
|
||||
},
|
||||
"library": {
|
||||
"library": "Kütüphane",
|
||||
"play": "Oyna",
|
||||
"download": "İndir",
|
||||
"downloading": "İndiriliyor",
|
||||
"game": "oyun",
|
||||
"games": "oyunlar",
|
||||
"grid_view": "Izgara görünümü",
|
||||
"compact_view": "Kompakt görünüm",
|
||||
"large_view": "Büyük görünüm",
|
||||
"no_games_title": "Kütüphanen boş",
|
||||
"no_games_description": "Başlamak için katalogdan oyun ekle veya indir",
|
||||
"amount_hours": "{{amount}} saat",
|
||||
"amount_minutes": "{{amount}} dakika",
|
||||
"amount_hours_short": "{{amount}}s",
|
||||
"amount_minutes_short": "{{amount}}d",
|
||||
"manual_playtime_tooltip": "Bu oynama süresi manuel olarak güncellendi",
|
||||
"all_games": "Tüm Oyunlar",
|
||||
"recently_played": "Son Oynanan",
|
||||
"favorites": "Favoriler"
|
||||
},
|
||||
"achievement": {
|
||||
"achievement_unlocked": "Başarım açıldı",
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import { getDownloadSourcesCheckBaseline } from "@main/level";
|
||||
import { registerEvent } from "../register-event";
|
||||
|
||||
const getDownloadSourcesCheckBaselineHandler = async (
|
||||
_event: Electron.IpcMainInvokeEvent
|
||||
) => {
|
||||
return await getDownloadSourcesCheckBaseline();
|
||||
};
|
||||
|
||||
registerEvent(
|
||||
"getDownloadSourcesCheckBaseline",
|
||||
getDownloadSourcesCheckBaselineHandler
|
||||
);
|
||||
@@ -0,0 +1,13 @@
|
||||
import { getDownloadSourcesSinceValue } from "@main/level";
|
||||
import { registerEvent } from "../register-event";
|
||||
|
||||
const getDownloadSourcesSinceValueHandler = async (
|
||||
_event: Electron.IpcMainInvokeEvent
|
||||
) => {
|
||||
return await getDownloadSourcesSinceValue();
|
||||
};
|
||||
|
||||
registerEvent(
|
||||
"getDownloadSourcesSinceValue",
|
||||
getDownloadSourcesSinceValueHandler
|
||||
);
|
||||
@@ -20,6 +20,7 @@ import "./library/get-game-by-object-id";
|
||||
import "./library/get-library";
|
||||
import "./library/refresh-library-assets";
|
||||
import "./library/extract-game-download";
|
||||
import "./library/clear-new-download-options";
|
||||
import "./library/open-game";
|
||||
import "./library/open-game-executable-path";
|
||||
import "./library/open-game-installer";
|
||||
@@ -65,6 +66,8 @@ import "./user-preferences/authenticate-real-debrid";
|
||||
import "./user-preferences/authenticate-torbox";
|
||||
import "./download-sources/add-download-source";
|
||||
import "./download-sources/sync-download-sources";
|
||||
import "./download-sources/get-download-sources-check-baseline";
|
||||
import "./download-sources/get-download-sources-since-value";
|
||||
import "./auth/sign-out";
|
||||
import "./auth/open-auth-window";
|
||||
import "./auth/get-session-hash";
|
||||
|
||||
27
src/main/events/library/clear-new-download-options.ts
Normal file
27
src/main/events/library/clear-new-download-options.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { registerEvent } from "../register-event";
|
||||
import { gamesSublevel, levelKeys } from "@main/level";
|
||||
import { logger } from "@main/services";
|
||||
import type { GameShop } from "@types";
|
||||
|
||||
const clearNewDownloadOptions = async (
|
||||
_event: Electron.IpcMainInvokeEvent,
|
||||
shop: GameShop,
|
||||
objectId: string
|
||||
) => {
|
||||
const gameKey = levelKeys.game(shop, objectId);
|
||||
|
||||
const game = await gamesSublevel.get(gameKey);
|
||||
if (!game) return;
|
||||
|
||||
try {
|
||||
await gamesSublevel.put(gameKey, {
|
||||
...game,
|
||||
newDownloadOptionsCount: undefined,
|
||||
});
|
||||
logger.info(`Cleared newDownloadOptionsCount for game ${gameKey}`);
|
||||
} catch (error) {
|
||||
logger.error(`Failed to clear newDownloadOptionsCount: ${error}`);
|
||||
}
|
||||
};
|
||||
|
||||
registerEvent("clearNewDownloadOptions", clearNewDownloadOptions);
|
||||
@@ -2,9 +2,9 @@ import type { LibraryGame } from "@types";
|
||||
import { registerEvent } from "../register-event";
|
||||
import {
|
||||
downloadsSublevel,
|
||||
gameAchievementsSublevel,
|
||||
gamesShopAssetsSublevel,
|
||||
gamesSublevel,
|
||||
gameAchievementsSublevel,
|
||||
} from "@main/level";
|
||||
|
||||
const getLibrary = async (): Promise<LibraryGame[]> => {
|
||||
@@ -19,18 +19,13 @@ const getLibrary = async (): Promise<LibraryGame[]> => {
|
||||
const download = await downloadsSublevel.get(key);
|
||||
const gameAssets = await gamesShopAssetsSublevel.get(key);
|
||||
|
||||
let unlockedAchievementCount = 0;
|
||||
let achievementCount = 0;
|
||||
let unlockedAchievementCount = game.unlockedAchievementCount ?? 0;
|
||||
|
||||
try {
|
||||
if (!game.unlockedAchievementCount) {
|
||||
const achievements = await gameAchievementsSublevel.get(key);
|
||||
if (achievements) {
|
||||
achievementCount = achievements.achievements.length;
|
||||
unlockedAchievementCount =
|
||||
achievements.unlockedAchievements.length;
|
||||
}
|
||||
} catch {
|
||||
// No achievements data for this game
|
||||
|
||||
unlockedAchievementCount =
|
||||
achievements?.unlockedAchievements.length ?? 0;
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -38,14 +33,14 @@ const getLibrary = async (): Promise<LibraryGame[]> => {
|
||||
...game,
|
||||
download: download ?? null,
|
||||
unlockedAchievementCount,
|
||||
achievementCount,
|
||||
achievementCount: game.achievementCount ?? 0,
|
||||
// Spread gameAssets last to ensure all image URLs are properly set
|
||||
...gameAssets,
|
||||
// Preserve custom image URLs from game if they exist
|
||||
customIconUrl: game.customIconUrl,
|
||||
customLogoImageUrl: game.customLogoImageUrl,
|
||||
customHeroImageUrl: game.customHeroImageUrl,
|
||||
} as LibraryGame;
|
||||
};
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
import { registerEvent } from "../register-event";
|
||||
import { PythonRPC } from "@main/services/python-rpc";
|
||||
|
||||
const processProfileImage = async (
|
||||
const processProfileImageEvent = async (
|
||||
_event: Electron.IpcMainInvokeEvent,
|
||||
path: string
|
||||
) => {
|
||||
return processProfileImage(path, "webp");
|
||||
};
|
||||
|
||||
export const processProfileImage = async (path: string, extension?: string) => {
|
||||
return PythonRPC.rpc
|
||||
.post<{
|
||||
imagePath: string;
|
||||
mimeType: string;
|
||||
}>("/profile-image", { image_path: path })
|
||||
}>("/profile-image", { image_path: path, target_extension: extension })
|
||||
.then((response) => response.data);
|
||||
};
|
||||
|
||||
registerEvent("processProfileImage", processProfileImage);
|
||||
registerEvent("processProfileImage", processProfileImageEvent);
|
||||
|
||||
59
src/main/level/sublevels/downloadSourcesCheckTimestamp.ts
Normal file
59
src/main/level/sublevels/downloadSourcesCheckTimestamp.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import { levelKeys } from "./keys";
|
||||
import { db } from "../level";
|
||||
import { logger } from "@main/services";
|
||||
|
||||
// Gets when we last started the app (for next API call's 'since')
|
||||
export const getDownloadSourcesCheckBaseline = async (): Promise<
|
||||
string | null
|
||||
> => {
|
||||
try {
|
||||
const timestamp = await db.get(levelKeys.downloadSourcesCheckBaseline);
|
||||
return timestamp;
|
||||
} catch (error) {
|
||||
if (error instanceof Error && error.name === "NotFoundError") {
|
||||
logger.debug("Download sources check baseline not found, returning null");
|
||||
} else {
|
||||
logger.error(
|
||||
"Unexpected error while getting download sources check baseline",
|
||||
error
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
// Updates to current time (when app starts)
|
||||
export const updateDownloadSourcesCheckBaseline = async (
|
||||
timestamp: string
|
||||
): Promise<void> => {
|
||||
const utcTimestamp = new Date(timestamp).toISOString();
|
||||
await db.put(levelKeys.downloadSourcesCheckBaseline, utcTimestamp);
|
||||
};
|
||||
|
||||
// Gets the 'since' value the API used in the last check (for modal comparison)
|
||||
export const getDownloadSourcesSinceValue = async (): Promise<
|
||||
string | null
|
||||
> => {
|
||||
try {
|
||||
const timestamp = await db.get(levelKeys.downloadSourcesSinceValue);
|
||||
return timestamp;
|
||||
} catch (error) {
|
||||
if (error instanceof Error && error.name === "NotFoundError") {
|
||||
logger.debug("Download sources since value not found, returning null");
|
||||
} else {
|
||||
logger.error(
|
||||
"Unexpected error while getting download sources since value",
|
||||
error
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
// Saves the 'since' value we used in the API call (for modal to compare against)
|
||||
export const updateDownloadSourcesSinceValue = async (
|
||||
timestamp: string
|
||||
): Promise<void> => {
|
||||
const utcTimestamp = new Date(timestamp).toISOString();
|
||||
await db.put(levelKeys.downloadSourcesSinceValue, utcTimestamp);
|
||||
};
|
||||
@@ -7,3 +7,4 @@ export * from "./game-achievements";
|
||||
export * from "./keys";
|
||||
export * from "./themes";
|
||||
export * from "./download-sources";
|
||||
export * from "./downloadSourcesCheckTimestamp";
|
||||
|
||||
@@ -18,4 +18,6 @@ export const levelKeys = {
|
||||
screenState: "screenState",
|
||||
rpcPassword: "rpcPassword",
|
||||
downloadSources: "downloadSources",
|
||||
downloadSourcesCheckBaseline: "downloadSourcesCheckBaseline", // When we last started the app
|
||||
downloadSourcesSinceValue: "downloadSourcesSinceValue", // The 'since' value API used (for modal comparison)
|
||||
};
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
Ludusavi,
|
||||
Lock,
|
||||
DeckyPlugin,
|
||||
DownloadSourcesChecker,
|
||||
WSClient,
|
||||
} from "@main/services";
|
||||
import { migrateDownloadSources } from "./helpers/migrate-download-sources";
|
||||
@@ -57,6 +58,9 @@ export const loadState = async () => {
|
||||
|
||||
const { syncDownloadSourcesFromApi } = await import("./services/user");
|
||||
void syncDownloadSourcesFromApi();
|
||||
|
||||
// Check for new download options on startup
|
||||
DownloadSourcesChecker.checkForChanges();
|
||||
WSClient.connect();
|
||||
});
|
||||
|
||||
|
||||
188
src/main/services/download-sources-checker.ts
Normal file
188
src/main/services/download-sources-checker.ts
Normal file
@@ -0,0 +1,188 @@
|
||||
import { HydraApi } from "./hydra-api";
|
||||
import {
|
||||
gamesSublevel,
|
||||
getDownloadSourcesCheckBaseline,
|
||||
updateDownloadSourcesCheckBaseline,
|
||||
updateDownloadSourcesSinceValue,
|
||||
downloadSourcesSublevel,
|
||||
} from "@main/level";
|
||||
import { logger } from "./logger";
|
||||
import { WindowManager } from "./window-manager";
|
||||
import type { Game } from "@types";
|
||||
|
||||
interface DownloadSourcesChangeResponse {
|
||||
shop: string;
|
||||
objectId: string;
|
||||
newDownloadOptionsCount: number;
|
||||
downloadSourceIds: string[];
|
||||
}
|
||||
|
||||
export class DownloadSourcesChecker {
|
||||
private static async clearStaleBadges(
|
||||
nonCustomGames: Game[]
|
||||
): Promise<{ gameId: string; count: number }[]> {
|
||||
const previouslyFlaggedGames = nonCustomGames.filter(
|
||||
(game: Game) =>
|
||||
game.newDownloadOptionsCount && game.newDownloadOptionsCount > 0
|
||||
);
|
||||
|
||||
const clearedPayload: { gameId: string; count: number }[] = [];
|
||||
if (previouslyFlaggedGames.length > 0) {
|
||||
logger.info(
|
||||
`Clearing stale newDownloadOptionsCount for ${previouslyFlaggedGames.length} games`
|
||||
);
|
||||
for (const game of previouslyFlaggedGames) {
|
||||
await gamesSublevel.put(`${game.shop}:${game.objectId}`, {
|
||||
...game,
|
||||
newDownloadOptionsCount: undefined,
|
||||
});
|
||||
clearedPayload.push({
|
||||
gameId: `${game.shop}:${game.objectId}`,
|
||||
count: 0,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return clearedPayload;
|
||||
}
|
||||
|
||||
private static async processApiResponse(
|
||||
response: unknown,
|
||||
nonCustomGames: Game[]
|
||||
): Promise<{ gameId: string; count: number }[]> {
|
||||
if (!response || !Array.isArray(response)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const gamesWithNewOptions: { gameId: string; count: number }[] = [];
|
||||
|
||||
for (const gameUpdate of response as DownloadSourcesChangeResponse[]) {
|
||||
if (gameUpdate.newDownloadOptionsCount > 0) {
|
||||
const game = nonCustomGames.find(
|
||||
(g) =>
|
||||
g.shop === gameUpdate.shop && g.objectId === gameUpdate.objectId
|
||||
);
|
||||
|
||||
if (game) {
|
||||
await gamesSublevel.put(`${game.shop}:${game.objectId}`, {
|
||||
...game,
|
||||
newDownloadOptionsCount: gameUpdate.newDownloadOptionsCount,
|
||||
});
|
||||
|
||||
gamesWithNewOptions.push({
|
||||
gameId: `${game.shop}:${game.objectId}`,
|
||||
count: gameUpdate.newDownloadOptionsCount,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return gamesWithNewOptions;
|
||||
}
|
||||
|
||||
private static sendNewDownloadOptionsEvent(
|
||||
clearedPayload: { gameId: string; count: number }[],
|
||||
gamesWithNewOptions: { gameId: string; count: number }[]
|
||||
): void {
|
||||
const eventPayload = [...clearedPayload, ...gamesWithNewOptions];
|
||||
if (eventPayload.length > 0 && WindowManager.mainWindow) {
|
||||
WindowManager.mainWindow.webContents.send(
|
||||
"on-new-download-options",
|
||||
eventPayload
|
||||
);
|
||||
}
|
||||
|
||||
logger.info(
|
||||
`Found new download options for ${gamesWithNewOptions.length} games`
|
||||
);
|
||||
}
|
||||
|
||||
static async checkForChanges(): Promise<void> {
|
||||
logger.info("DownloadSourcesChecker.checkForChanges() called");
|
||||
|
||||
try {
|
||||
// Get all installed games (excluding custom games)
|
||||
const installedGames = await gamesSublevel.values().all();
|
||||
const nonCustomGames = installedGames.filter(
|
||||
(game: Game) => game.shop !== "custom"
|
||||
);
|
||||
logger.info(
|
||||
`Found ${installedGames.length} total games, ${nonCustomGames.length} non-custom games`
|
||||
);
|
||||
|
||||
if (nonCustomGames.length === 0) {
|
||||
logger.info(
|
||||
"No non-custom games found, skipping download sources check"
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const downloadSources = await downloadSourcesSublevel.values().all();
|
||||
const downloadSourceIds = downloadSources.map((source) => source.id);
|
||||
logger.info(
|
||||
`Found ${downloadSourceIds.length} download sources: ${downloadSourceIds.join(", ")}`
|
||||
);
|
||||
|
||||
if (downloadSourceIds.length === 0) {
|
||||
logger.info(
|
||||
"No download sources found, skipping download sources check"
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const previousBaseline = await getDownloadSourcesCheckBaseline();
|
||||
const since =
|
||||
previousBaseline ||
|
||||
new Date(Date.now() - 24 * 60 * 60 * 1000).toISOString();
|
||||
|
||||
logger.info(`Using since: ${since} (from last app start)`);
|
||||
|
||||
const clearedPayload = await this.clearStaleBadges(nonCustomGames);
|
||||
|
||||
const games = nonCustomGames.map((game: Game) => ({
|
||||
shop: game.shop,
|
||||
objectId: game.objectId,
|
||||
}));
|
||||
|
||||
logger.info(
|
||||
`Checking download sources changes for ${games.length} non-custom games since ${since}`
|
||||
);
|
||||
logger.info(
|
||||
`Making API call to HydraApi.checkDownloadSourcesChanges with:`,
|
||||
{
|
||||
downloadSourceIds,
|
||||
gamesCount: games.length,
|
||||
since,
|
||||
}
|
||||
);
|
||||
|
||||
const response = await HydraApi.checkDownloadSourcesChanges(
|
||||
downloadSourceIds,
|
||||
games,
|
||||
since
|
||||
);
|
||||
|
||||
logger.info("API call completed, response:", response);
|
||||
|
||||
await updateDownloadSourcesSinceValue(since);
|
||||
logger.info(`Saved 'since' value: ${since} (for modal comparison)`);
|
||||
|
||||
const now = new Date().toISOString();
|
||||
await updateDownloadSourcesCheckBaseline(now);
|
||||
logger.info(
|
||||
`Updated baseline to: ${now} (will be 'since' on next app start)`
|
||||
);
|
||||
|
||||
const gamesWithNewOptions = await this.processApiResponse(
|
||||
response,
|
||||
nonCustomGames
|
||||
);
|
||||
|
||||
this.sendNewDownloadOptionsEvent(clearedPayload, gamesWithNewOptions);
|
||||
|
||||
logger.info("Download sources check completed successfully");
|
||||
} catch (error) {
|
||||
logger.error("Failed to check download sources changes:", error);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -400,4 +400,45 @@ export class HydraApi {
|
||||
.then((response) => response.data)
|
||||
.catch(this.handleUnauthorizedError);
|
||||
}
|
||||
|
||||
static async checkDownloadSourcesChanges(
|
||||
downloadSourceIds: string[],
|
||||
games: Array<{ shop: string; objectId: string }>,
|
||||
since: string
|
||||
) {
|
||||
logger.info("HydraApi.checkDownloadSourcesChanges called with:", {
|
||||
downloadSourceIds,
|
||||
gamesCount: games.length,
|
||||
since,
|
||||
isLoggedIn: this.isLoggedIn(),
|
||||
});
|
||||
|
||||
try {
|
||||
const result = await this.post<
|
||||
Array<{
|
||||
shop: string;
|
||||
objectId: string;
|
||||
newDownloadOptionsCount: number;
|
||||
downloadSourceIds: string[];
|
||||
}>
|
||||
>(
|
||||
"/download-sources/changes",
|
||||
{
|
||||
downloadSourceIds,
|
||||
games,
|
||||
since,
|
||||
},
|
||||
{ needsAuth: true }
|
||||
);
|
||||
|
||||
logger.info(
|
||||
"HydraApi.checkDownloadSourcesChanges completed successfully:",
|
||||
result
|
||||
);
|
||||
return result;
|
||||
} catch (error) {
|
||||
logger.error("HydraApi.checkDownloadSourcesChanges failed:", error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,3 +19,4 @@ export * from "./wine";
|
||||
export * from "./lock";
|
||||
export * from "./decky-plugin";
|
||||
export * from "./user";
|
||||
export * from "./download-sources-checker";
|
||||
|
||||
@@ -9,6 +9,8 @@ type ProfileGame = {
|
||||
hasManuallyUpdatedPlaytime: boolean;
|
||||
isFavorite?: boolean;
|
||||
isPinned?: boolean;
|
||||
achievementCount: number;
|
||||
unlockedAchievementCount: number;
|
||||
} & ShopAssets;
|
||||
|
||||
export const mergeWithRemoteGames = async () => {
|
||||
@@ -39,6 +41,8 @@ export const mergeWithRemoteGames = async () => {
|
||||
playTimeInMilliseconds: updatedPlayTime,
|
||||
favorite: game.isFavorite ?? localGame.favorite,
|
||||
isPinned: game.isPinned ?? localGame.isPinned,
|
||||
achievementCount: game.achievementCount,
|
||||
unlockedAchievementCount: game.unlockedAchievementCount,
|
||||
});
|
||||
} else {
|
||||
await gamesSublevel.put(gameKey, {
|
||||
@@ -55,6 +59,8 @@ export const mergeWithRemoteGames = async () => {
|
||||
isDeleted: false,
|
||||
favorite: game.isFavorite ?? false,
|
||||
isPinned: game.isPinned ?? false,
|
||||
achievementCount: game.achievementCount,
|
||||
unlockedAchievementCount: game.unlockedAchievementCount,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,13 @@ import { db, levelKeys, themesSublevel } from "@main/level";
|
||||
import { restartAndInstallUpdate } from "@main/events/autoupdater/restart-and-install-update";
|
||||
import { SystemPath } from "../system-path";
|
||||
import { getThemeSoundPath } from "@main/helpers";
|
||||
import { processProfileImage } from "@main/events/profile/process-profile-image";
|
||||
|
||||
const getStaticImage = async (path: string) => {
|
||||
return processProfileImage(path, "jpg")
|
||||
.then((response) => response.imagePath)
|
||||
.catch(() => path);
|
||||
};
|
||||
|
||||
async function downloadImage(url: string | null) {
|
||||
if (!url) return undefined;
|
||||
@@ -31,8 +38,9 @@ async function downloadImage(url: string | null) {
|
||||
response.data.pipe(writer);
|
||||
|
||||
return new Promise<string | undefined>((resolve) => {
|
||||
writer.on("finish", () => {
|
||||
resolve(outputPath);
|
||||
writer.on("finish", async () => {
|
||||
const staticImagePath = await getStaticImage(outputPath);
|
||||
resolve(staticImagePath);
|
||||
});
|
||||
writer.on("error", () => {
|
||||
logger.error("Failed to download image", { url });
|
||||
|
||||
@@ -8,9 +8,11 @@ export const friendRequestEvent = async (payload: FriendRequest) => {
|
||||
friendRequestCount: payload.friendRequestCount,
|
||||
});
|
||||
|
||||
const user = await HydraApi.get(`/users/${payload.senderId}`);
|
||||
if (payload.senderId) {
|
||||
const user = await HydraApi.get(`/users/${payload.senderId}`);
|
||||
|
||||
if (user) {
|
||||
publishNewFriendRequestNotification(user);
|
||||
if (user) {
|
||||
publishNewFriendRequestNotification(user);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -103,6 +103,10 @@ contextBridge.exposeInMainWorld("electron", {
|
||||
ipcRenderer.invoke("removeDownloadSource", url, removeAll),
|
||||
getDownloadSources: () => ipcRenderer.invoke("getDownloadSources"),
|
||||
syncDownloadSources: () => ipcRenderer.invoke("syncDownloadSources"),
|
||||
getDownloadSourcesCheckBaseline: () =>
|
||||
ipcRenderer.invoke("getDownloadSourcesCheckBaseline"),
|
||||
getDownloadSourcesSinceValue: () =>
|
||||
ipcRenderer.invoke("getDownloadSourcesSinceValue"),
|
||||
|
||||
/* Library */
|
||||
toggleAutomaticCloudSync: (
|
||||
@@ -179,6 +183,8 @@ contextBridge.exposeInMainWorld("electron", {
|
||||
ipcRenderer.invoke("addGameToFavorites", shop, objectId),
|
||||
removeGameFromFavorites: (shop: GameShop, objectId: string) =>
|
||||
ipcRenderer.invoke("removeGameFromFavorites", shop, objectId),
|
||||
clearNewDownloadOptions: (shop: GameShop, objectId: string) =>
|
||||
ipcRenderer.invoke("clearNewDownloadOptions", shop, objectId),
|
||||
toggleGamePin: (shop: GameShop, objectId: string, pinned: boolean) =>
|
||||
ipcRenderer.invoke("toggleGamePin", shop, objectId, pinned),
|
||||
updateLaunchOptions: (
|
||||
@@ -600,6 +606,17 @@ contextBridge.exposeInMainWorld("electron", {
|
||||
return () =>
|
||||
ipcRenderer.removeListener("on-custom-theme-updated", listener);
|
||||
},
|
||||
onNewDownloadOptions: (
|
||||
cb: (gamesWithNewOptions: { gameId: string; count: number }[]) => void
|
||||
) => {
|
||||
const listener = (
|
||||
_event: Electron.IpcRendererEvent,
|
||||
gamesWithNewOptions: { gameId: string; count: number }[]
|
||||
) => cb(gamesWithNewOptions);
|
||||
ipcRenderer.on("on-new-download-options", listener);
|
||||
return () =>
|
||||
ipcRenderer.removeListener("on-new-download-options", listener);
|
||||
},
|
||||
closeEditorWindow: (themeId?: string) =>
|
||||
ipcRenderer.invoke("closeEditorWindow", themeId),
|
||||
});
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
useToast,
|
||||
useUserDetails,
|
||||
} from "@renderer/hooks";
|
||||
import { useDownloadOptionsListener } from "@renderer/hooks/use-download-options-listener";
|
||||
|
||||
import { Outlet, useLocation, useNavigate } from "react-router-dom";
|
||||
import {
|
||||
@@ -40,6 +41,9 @@ export function App() {
|
||||
const contentRef = useRef<HTMLDivElement>(null);
|
||||
const { updateLibrary, library } = useLibrary();
|
||||
|
||||
// Listen for new download options updates
|
||||
useDownloadOptionsListener();
|
||||
|
||||
const { t } = useTranslation("app");
|
||||
|
||||
const { clearDownload, setLastPacket } = useDownload();
|
||||
|
||||
@@ -47,7 +47,7 @@ export function GameCard({ game, ...props }: GameCardProps) {
|
||||
>
|
||||
<div className="game-card__backdrop">
|
||||
<img
|
||||
src={game.libraryImageUrl}
|
||||
src={game.libraryImageUrl ?? undefined}
|
||||
alt={game.title}
|
||||
className="game-card__cover"
|
||||
loading="lazy"
|
||||
|
||||
@@ -50,14 +50,14 @@ export function Hero() {
|
||||
>
|
||||
<div className="hero__backdrop">
|
||||
<img
|
||||
src={game.libraryHeroImageUrl}
|
||||
src={game.libraryHeroImageUrl ?? undefined}
|
||||
alt={game.description ?? ""}
|
||||
className="hero__media"
|
||||
/>
|
||||
|
||||
<div className="hero__content">
|
||||
<img
|
||||
src={game.logoImageUrl}
|
||||
src={game.logoImageUrl ?? undefined}
|
||||
width="250px"
|
||||
alt={game.description ?? ""}
|
||||
loading="eager"
|
||||
|
||||
@@ -80,6 +80,12 @@ export function SidebarGameItem({
|
||||
<span className="sidebar__menu-item-button-label">
|
||||
{getGameTitle(game)}
|
||||
</span>
|
||||
|
||||
{(game.newDownloadOptionsCount ?? 0) > 0 && (
|
||||
<span className="sidebar__game-badge">
|
||||
+{game.newDownloadOptionsCount}
|
||||
</span>
|
||||
)}
|
||||
</button>
|
||||
</li>
|
||||
|
||||
|
||||
@@ -115,6 +115,19 @@
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
&__game-badge {
|
||||
background-color: rgba(34, 197, 94, 0.15);
|
||||
color: rgb(187, 247, 208);
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
padding: 4px 6px;
|
||||
border-radius: 6px;
|
||||
display: flex;
|
||||
margin-left: auto;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
border: 1px solid rgba(34, 197, 94, 0.5);
|
||||
}
|
||||
|
||||
&__section-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
11
src/renderer/src/declaration.d.ts
vendored
11
src/renderer/src/declaration.d.ts
vendored
@@ -142,6 +142,10 @@ declare global {
|
||||
shop: GameShop,
|
||||
objectId: string
|
||||
) => Promise<void>;
|
||||
clearNewDownloadOptions: (
|
||||
shop: GameShop,
|
||||
objectId: string
|
||||
) => Promise<void>;
|
||||
toggleGamePin: (
|
||||
shop: GameShop,
|
||||
objectId: string,
|
||||
@@ -215,6 +219,8 @@ declare global {
|
||||
) => Promise<void>;
|
||||
getDownloadSources: () => Promise<DownloadSource[]>;
|
||||
syncDownloadSources: () => Promise<void>;
|
||||
getDownloadSourcesCheckBaseline: () => Promise<string | null>;
|
||||
getDownloadSourcesSinceValue: () => Promise<string | null>;
|
||||
|
||||
/* Hardware */
|
||||
getDiskFreeSpace: (path: string) => Promise<DiskUsage>;
|
||||
@@ -427,6 +433,11 @@ declare global {
|
||||
openEditorWindow: (themeId: string) => Promise<void>;
|
||||
onCustomThemeUpdated: (cb: () => void) => () => Electron.IpcRenderer;
|
||||
closeEditorWindow: (themeId?: string) => Promise<void>;
|
||||
|
||||
/* Download Options */
|
||||
onNewDownloadOptions: (
|
||||
cb: (gamesWithNewOptions: { gameId: string; count: number }[]) => void
|
||||
) => () => Electron.IpcRenderer;
|
||||
}
|
||||
|
||||
interface Window {
|
||||
|
||||
@@ -20,10 +20,34 @@ export const librarySlice = createSlice({
|
||||
setLibrary: (state, action: PayloadAction<LibraryState["value"]>) => {
|
||||
state.value = action.payload;
|
||||
},
|
||||
|
||||
updateGameNewDownloadOptions: (
|
||||
state,
|
||||
action: PayloadAction<{ gameId: string; count: number }>
|
||||
) => {
|
||||
const game = state.value.find((g) => g.id === action.payload.gameId);
|
||||
if (game) {
|
||||
game.newDownloadOptionsCount = action.payload.count;
|
||||
}
|
||||
},
|
||||
clearNewDownloadOptions: (
|
||||
state,
|
||||
action: PayloadAction<{ gameId: string }>
|
||||
) => {
|
||||
const game = state.value.find((g) => g.id === action.payload.gameId);
|
||||
if (game) {
|
||||
game.newDownloadOptionsCount = undefined;
|
||||
}
|
||||
},
|
||||
setLibrarySearchQuery: (state, action: PayloadAction<string>) => {
|
||||
state.searchQuery = action.payload;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const { setLibrary, setLibrarySearchQuery } = librarySlice.actions;
|
||||
export const {
|
||||
setLibrary,
|
||||
updateGameNewDownloadOptions,
|
||||
clearNewDownloadOptions,
|
||||
setLibrarySearchQuery,
|
||||
} = librarySlice.actions;
|
||||
|
||||
@@ -6,4 +6,5 @@ export * from "./redux";
|
||||
export * from "./use-user-details";
|
||||
export * from "./use-format";
|
||||
export * from "./use-feature";
|
||||
export * from "./use-download-options-listener";
|
||||
export * from "./use-game-card";
|
||||
|
||||
19
src/renderer/src/hooks/use-download-options-listener.ts
Normal file
19
src/renderer/src/hooks/use-download-options-listener.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { useEffect } from "react";
|
||||
import { useAppDispatch } from "./redux";
|
||||
import { updateGameNewDownloadOptions } from "@renderer/features";
|
||||
|
||||
export function useDownloadOptionsListener() {
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
useEffect(() => {
|
||||
const unsubscribe = window.electron.onNewDownloadOptions(
|
||||
(gamesWithNewOptions) => {
|
||||
for (const { gameId, count } of gamesWithNewOptions) {
|
||||
dispatch(updateGameNewDownloadOptions({ gameId, count }));
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
return unsubscribe;
|
||||
}, [dispatch]);
|
||||
}
|
||||
@@ -45,12 +45,26 @@
|
||||
&__repack-title {
|
||||
color: globals.$muted-color;
|
||||
word-break: break-word;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: calc(globals.$spacing-unit * 1);
|
||||
}
|
||||
|
||||
&__repack-info {
|
||||
font-size: globals.$small-font-size;
|
||||
}
|
||||
|
||||
&__new-badge {
|
||||
background-color: rgba(34, 197, 94, 0.15);
|
||||
color: rgb(187, 247, 208);
|
||||
padding: 2px 8px;
|
||||
border-radius: 6px;
|
||||
font-size: 9px;
|
||||
text-align: center;
|
||||
flex-shrink: 0;
|
||||
border: 1px solid rgba(34, 197, 94, 0.5);
|
||||
}
|
||||
|
||||
&__no-results {
|
||||
width: 100%;
|
||||
padding: calc(globals.$spacing-unit * 4) 0;
|
||||
|
||||
@@ -15,14 +15,14 @@ import {
|
||||
TextField,
|
||||
CheckboxField,
|
||||
} from "@renderer/components";
|
||||
import type { DownloadSource } from "@types";
|
||||
import type { GameRepack } from "@types";
|
||||
import type { DownloadSource, GameRepack } from "@types";
|
||||
|
||||
import { DownloadSettingsModal } from "./download-settings-modal";
|
||||
import { gameDetailsContext } from "@renderer/context";
|
||||
import { Downloader } from "@shared";
|
||||
import { orderBy } from "lodash-es";
|
||||
import { useDate, useFeature } from "@renderer/hooks";
|
||||
import { useDate, useFeature, useAppDispatch } from "@renderer/hooks";
|
||||
import { clearNewDownloadOptions } from "@renderer/features";
|
||||
import "./repacks-modal.scss";
|
||||
|
||||
export interface RepacksModalProps {
|
||||
@@ -53,6 +53,13 @@ export function RepacksModal({
|
||||
const [hashesInDebrid, setHashesInDebrid] = useState<Record<string, boolean>>(
|
||||
{}
|
||||
);
|
||||
const [lastCheckTimestamp, setLastCheckTimestamp] = useState<string | null>(
|
||||
null
|
||||
);
|
||||
const [isLoadingTimestamp, setIsLoadingTimestamp] = useState(true);
|
||||
const [viewedRepackIds, setViewedRepackIds] = useState<Set<string>>(
|
||||
new Set()
|
||||
);
|
||||
|
||||
const { game, repacks } = useContext(gameDetailsContext);
|
||||
|
||||
@@ -60,6 +67,7 @@ export function RepacksModal({
|
||||
|
||||
const { formatDate } = useDate();
|
||||
const navigate = useNavigate();
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
const getHashFromMagnet = (magnet: string) => {
|
||||
if (!magnet || typeof magnet !== "string") {
|
||||
@@ -97,6 +105,34 @@ export function RepacksModal({
|
||||
fetchDownloadSources();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchLastCheckTimestamp = async () => {
|
||||
setIsLoadingTimestamp(true);
|
||||
|
||||
const timestamp = await window.electron.getDownloadSourcesSinceValue();
|
||||
|
||||
setLastCheckTimestamp(timestamp);
|
||||
setIsLoadingTimestamp(false);
|
||||
};
|
||||
|
||||
if (visible) {
|
||||
fetchLastCheckTimestamp();
|
||||
}
|
||||
}, [visible, repacks]);
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
visible &&
|
||||
game?.newDownloadOptionsCount &&
|
||||
game.newDownloadOptionsCount > 0
|
||||
) {
|
||||
globalThis.electron.clearNewDownloadOptions(game.shop, game.objectId);
|
||||
|
||||
const gameId = `${game.shop}:${game.objectId}`;
|
||||
dispatch(clearNewDownloadOptions({ gameId }));
|
||||
}
|
||||
}, [visible, game, dispatch]);
|
||||
|
||||
const sortedRepacks = useMemo(() => {
|
||||
return orderBy(
|
||||
repacks,
|
||||
@@ -139,6 +175,7 @@ export function RepacksModal({
|
||||
const handleRepackClick = (repack: GameRepack) => {
|
||||
setRepack(repack);
|
||||
setShowSelectFolderModal(true);
|
||||
setViewedRepackIds((prev) => new Set(prev).add(repack.id));
|
||||
};
|
||||
|
||||
const handleFilter: React.ChangeEventHandler<HTMLInputElement> = (event) => {
|
||||
@@ -158,6 +195,20 @@ export function RepacksModal({
|
||||
return repack.uris.some((uri) => uri.includes(game.download!.uri));
|
||||
};
|
||||
|
||||
const isNewRepack = (repack: GameRepack): boolean => {
|
||||
if (isLoadingTimestamp) return false;
|
||||
|
||||
if (viewedRepackIds.has(repack.id)) return false;
|
||||
|
||||
if (!lastCheckTimestamp || !repack.createdAt) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const lastCheckUtc = new Date(lastCheckTimestamp).toISOString();
|
||||
|
||||
return repack.createdAt > lastCheckUtc;
|
||||
};
|
||||
|
||||
const [isFilterDrawerOpen, setIsFilterDrawerOpen] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -273,7 +324,14 @@ export function RepacksModal({
|
||||
onClick={() => handleRepackClick(repack)}
|
||||
className="repacks-modal__repack-button"
|
||||
>
|
||||
<p className="repacks-modal__repack-title">{repack.title}</p>
|
||||
<p className="repacks-modal__repack-title">
|
||||
{repack.title}
|
||||
{isNewRepack(repack) && (
|
||||
<span className="repacks-modal__new-badge">
|
||||
{t("new_download_option")}
|
||||
</span>
|
||||
)}
|
||||
</p>
|
||||
|
||||
{isLastDownloadedOption && (
|
||||
<Badge>{t("last_downloaded_option")}</Badge>
|
||||
|
||||
@@ -84,7 +84,6 @@
|
||||
gap: calc(globals.$spacing-unit);
|
||||
}
|
||||
|
||||
|
||||
&__logo-container {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
@@ -207,5 +206,4 @@
|
||||
color: rgba(255, 255, 255, 0.85);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
import { LibraryGame } from "@types";
|
||||
import { useGameCard } from "@renderer/hooks";
|
||||
import {
|
||||
ClockIcon,
|
||||
AlertFillIcon,
|
||||
TrophyIcon,
|
||||
} from "@primer/octicons-react";
|
||||
import { memo, useMemo } from "react";
|
||||
import { ClockIcon, AlertFillIcon, TrophyIcon } from "@primer/octicons-react";
|
||||
import { memo, useEffect, useMemo, useState } from "react";
|
||||
import "./library-game-card-large.scss";
|
||||
|
||||
interface LibraryGameCardLargeProps {
|
||||
@@ -16,47 +12,70 @@ interface LibraryGameCardLargeProps {
|
||||
) => void;
|
||||
}
|
||||
|
||||
const normalizePathForCss = (url: string | null | undefined): string => {
|
||||
if (!url) return "";
|
||||
return url.replaceAll("\\", "/");
|
||||
};
|
||||
|
||||
const getImageWithCustomPriority = (
|
||||
customUrl: string | null | undefined,
|
||||
originalUrl: string | null | undefined,
|
||||
fallbackUrl?: string | null | undefined
|
||||
) => {
|
||||
return customUrl || originalUrl || fallbackUrl || "";
|
||||
const selectedUrl = customUrl || originalUrl || fallbackUrl || "";
|
||||
return normalizePathForCss(selectedUrl);
|
||||
};
|
||||
|
||||
export const LibraryGameCardLarge = memo(function LibraryGameCardLarge({
|
||||
game,
|
||||
onContextMenu,
|
||||
}: Readonly<LibraryGameCardLargeProps>) {
|
||||
const {
|
||||
formatPlayTime,
|
||||
handleCardClick,
|
||||
handleContextMenuClick,
|
||||
} = useGameCard(game, onContextMenu);
|
||||
const { formatPlayTime, handleCardClick, handleContextMenuClick } =
|
||||
useGameCard(game, onContextMenu);
|
||||
|
||||
const backgroundImage = useMemo(
|
||||
() =>
|
||||
getImageWithCustomPriority(
|
||||
game.customHeroImageUrl,
|
||||
game.libraryHeroImageUrl,
|
||||
game.libraryImageUrl,
|
||||
game.iconUrl
|
||||
game.libraryImageUrl ?? game.iconUrl
|
||||
),
|
||||
[game.libraryHeroImageUrl, game.libraryImageUrl, game.iconUrl]
|
||||
[
|
||||
game.customHeroImageUrl,
|
||||
game.libraryHeroImageUrl,
|
||||
game.libraryImageUrl,
|
||||
game.iconUrl,
|
||||
]
|
||||
);
|
||||
|
||||
const [unlockedAchievementsCount, setUnlockedAchievementsCount] = useState(
|
||||
game.unlockedAchievementCount ?? 0
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (game.unlockedAchievementCount) return;
|
||||
|
||||
window.electron
|
||||
.getUnlockedAchievements(game.objectId, game.shop)
|
||||
.then((achievements) => {
|
||||
setUnlockedAchievementsCount(achievements.length);
|
||||
});
|
||||
}, [game]);
|
||||
|
||||
const backgroundStyle = useMemo(
|
||||
() => ({ backgroundImage: `url(${backgroundImage})` }),
|
||||
() =>
|
||||
backgroundImage ? { backgroundImage: `url(${backgroundImage})` } : {},
|
||||
[backgroundImage]
|
||||
);
|
||||
|
||||
const achievementBarStyle = useMemo(
|
||||
() => ({
|
||||
width: `${((game.unlockedAchievementCount ?? 0) / (game.achievementCount ?? 1)) * 100}%`,
|
||||
width: `${(unlockedAchievementsCount / (game.achievementCount ?? 1)) * 100}%`,
|
||||
}),
|
||||
[game.unlockedAchievementCount, game.achievementCount]
|
||||
[unlockedAchievementsCount, game.achievementCount]
|
||||
);
|
||||
|
||||
const logoImage = game.logoImageUrl;
|
||||
const logoImage = game.customLogoImageUrl ?? game.logoImageUrl;
|
||||
|
||||
return (
|
||||
<button
|
||||
@@ -111,14 +130,12 @@ export const LibraryGameCardLarge = memo(function LibraryGameCardLarge({
|
||||
className="library-game-card-large__achievement-trophy"
|
||||
/>
|
||||
<span className="library-game-card-large__achievement-count">
|
||||
{game.unlockedAchievementCount ?? 0} /{" "}
|
||||
{game.achievementCount ?? 0}
|
||||
{unlockedAchievementsCount} / {game.achievementCount ?? 0}
|
||||
</span>
|
||||
</div>
|
||||
<span className="library-game-card-large__achievement-percentage">
|
||||
{Math.round(
|
||||
((game.unlockedAchievementCount ?? 0) /
|
||||
(game.achievementCount ?? 1)) *
|
||||
(unlockedAchievementsCount / (game.achievementCount ?? 1)) *
|
||||
100
|
||||
)}
|
||||
%
|
||||
|
||||
@@ -209,8 +209,6 @@
|
||||
transform: scale(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
&__game-image {
|
||||
object-fit: cover;
|
||||
border-radius: 4px;
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
import { LibraryGame } from "@types";
|
||||
import { useGameCard } from "@renderer/hooks";
|
||||
import { memo } from "react";
|
||||
import {
|
||||
ClockIcon,
|
||||
AlertFillIcon,
|
||||
TrophyIcon,
|
||||
} from "@primer/octicons-react";
|
||||
import { ClockIcon, AlertFillIcon, TrophyIcon } from "@primer/octicons-react";
|
||||
import "./library-game-card.scss";
|
||||
|
||||
interface LibraryGameCardProps {
|
||||
@@ -26,18 +22,17 @@ export const LibraryGameCard = memo(function LibraryGameCard({
|
||||
onMouseLeave,
|
||||
onContextMenu,
|
||||
}: Readonly<LibraryGameCardProps>) {
|
||||
const {
|
||||
formatPlayTime,
|
||||
handleCardClick,
|
||||
handleContextMenuClick,
|
||||
} = useGameCard(game, onContextMenu);
|
||||
const { formatPlayTime, handleCardClick, handleContextMenuClick } =
|
||||
useGameCard(game, onContextMenu);
|
||||
|
||||
const coverImage =
|
||||
const coverImage = (
|
||||
game.customIconUrl ??
|
||||
game.coverImageUrl ??
|
||||
game.libraryImageUrl ??
|
||||
game.libraryHeroImageUrl ??
|
||||
game.iconUrl ??
|
||||
undefined;
|
||||
""
|
||||
).replaceAll("\\", "/");
|
||||
|
||||
return (
|
||||
<button
|
||||
|
||||
@@ -14,12 +14,11 @@ import "./library.scss";
|
||||
|
||||
export default function Library() {
|
||||
const { library, updateLibrary } = useLibrary();
|
||||
type ElectronAPI = {
|
||||
refreshLibraryAssets?: () => Promise<unknown>;
|
||||
onLibraryBatchComplete?: (cb: () => void) => () => void;
|
||||
};
|
||||
|
||||
const [viewMode, setViewMode] = useState<ViewMode>("compact");
|
||||
const [viewMode, setViewMode] = useState<ViewMode>(() => {
|
||||
const savedViewMode = localStorage.getItem("library-view-mode");
|
||||
return (savedViewMode as ViewMode) || "compact";
|
||||
});
|
||||
const [filterBy, setFilterBy] = useState<FilterOption>("all");
|
||||
const [contextMenu, setContextMenu] = useState<{
|
||||
game: LibraryGame | null;
|
||||
@@ -31,24 +30,22 @@ export default function Library() {
|
||||
const dispatch = useAppDispatch();
|
||||
const { t } = useTranslation("library");
|
||||
|
||||
const handleViewModeChange = useCallback((mode: ViewMode) => {
|
||||
setViewMode(mode);
|
||||
localStorage.setItem("library-view-mode", mode);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(setHeaderTitle(t("library")));
|
||||
const electron = (globalThis as unknown as { electron?: ElectronAPI })
|
||||
.electron;
|
||||
let unsubscribe: () => void = () => undefined;
|
||||
if (electron?.refreshLibraryAssets) {
|
||||
electron
|
||||
.refreshLibraryAssets()
|
||||
.then(() => updateLibrary())
|
||||
.catch(() => updateLibrary());
|
||||
if (electron.onLibraryBatchComplete) {
|
||||
unsubscribe = electron.onLibraryBatchComplete(() => {
|
||||
updateLibrary();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
||||
const unsubscribe = window.electron.onLibraryBatchComplete(() => {
|
||||
updateLibrary();
|
||||
}
|
||||
});
|
||||
|
||||
window.electron
|
||||
.refreshLibraryAssets()
|
||||
.then(() => updateLibrary())
|
||||
.catch(() => updateLibrary());
|
||||
|
||||
return () => {
|
||||
unsubscribe();
|
||||
@@ -71,7 +68,7 @@ export default function Library() {
|
||||
);
|
||||
|
||||
const handleCloseContextMenu = useCallback(() => {
|
||||
setContextMenu({ game: null, visible: false, position: { x: 0, y: 0 } });
|
||||
setContextMenu((prev) => ({ ...prev, visible: false }));
|
||||
}, []);
|
||||
|
||||
const filteredLibrary = useMemo(() => {
|
||||
@@ -147,7 +144,10 @@ export default function Library() {
|
||||
</div>
|
||||
|
||||
<div className="library__controls-right">
|
||||
<ViewOptions viewMode={viewMode} onViewModeChange={setViewMode} />
|
||||
<ViewOptions
|
||||
viewMode={viewMode}
|
||||
onViewModeChange={handleViewModeChange}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -23,6 +23,7 @@ export interface GameRepack {
|
||||
uploadDate: string | null;
|
||||
downloadSourceId: string;
|
||||
downloadSourceName: string;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
export interface DownloadSource {
|
||||
@@ -41,9 +42,9 @@ export interface ShopAssets {
|
||||
shop: GameShop;
|
||||
title: string;
|
||||
iconUrl: string | null;
|
||||
libraryHeroImageUrl: string;
|
||||
libraryImageUrl: string;
|
||||
logoImageUrl: string;
|
||||
libraryHeroImageUrl: string | null;
|
||||
libraryImageUrl: string | null;
|
||||
logoImageUrl: string | null;
|
||||
logoPosition: string | null;
|
||||
coverImageUrl: string | null;
|
||||
downloadSources: string[];
|
||||
|
||||
@@ -56,9 +56,12 @@ export interface Game {
|
||||
launchOptions?: string | null;
|
||||
favorite?: boolean;
|
||||
isPinned?: boolean;
|
||||
achievementCount?: number;
|
||||
unlockedAchievementCount?: number;
|
||||
pinnedDate?: Date | null;
|
||||
automaticCloudSync?: boolean;
|
||||
hasManuallyUpdatedPlaytime?: boolean;
|
||||
newDownloadOptionsCount?: number;
|
||||
}
|
||||
|
||||
export interface Download {
|
||||
|
||||
Reference in New Issue
Block a user