mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-09 12:56:19 +00:00
Merge branch 'main' into feat/vikingfile-support
This commit is contained in:
@@ -91,6 +91,7 @@
|
||||
"user-agents": "^1.1.387",
|
||||
"uuid": "^13.0.0",
|
||||
"winreg": "^1.2.5",
|
||||
"workwonders-sdk": "0.0.10",
|
||||
"ws": "^8.18.1",
|
||||
"yaml": "^2.6.1",
|
||||
"yup": "^1.5.0"
|
||||
|
||||
@@ -735,7 +735,6 @@
|
||||
"game_added_to_pinned": "Game added to pinned",
|
||||
"karma": "Karma",
|
||||
"karma_count": "karma",
|
||||
"karma_description": "Earned from positive likes on reviews",
|
||||
"user_reviews": "Reviews",
|
||||
"delete_review": "Delete Review",
|
||||
"loading_reviews": "Loading reviews...",
|
||||
|
||||
@@ -722,7 +722,6 @@
|
||||
"amount_minutes_short": "{{amount}}m",
|
||||
"karma": "Karma",
|
||||
"karma_count": "karma",
|
||||
"karma_description": "Conseguido por me gustas positivos en reseñas",
|
||||
"sort_by": "Filtrar por:",
|
||||
"game_added_to_pinned": "Juego añadido a fijados",
|
||||
"user_reviews": "Reseñas",
|
||||
|
||||
@@ -673,8 +673,7 @@
|
||||
"game_removed_from_pinned": "Peli poistettu kiinnitetyistä",
|
||||
"game_added_to_pinned": "Peli lisätty kiinnitettyihin",
|
||||
"karma": "Karma",
|
||||
"karma_count": "karmaa",
|
||||
"karma_description": "Ansittu positiivisilla arvosteluäänillä"
|
||||
"karma_count": "karmaa"
|
||||
},
|
||||
"achievement": {
|
||||
"achievement_unlocked": "Saavutus avattu",
|
||||
|
||||
@@ -718,7 +718,6 @@
|
||||
"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",
|
||||
"user_reviews": "Vélemények",
|
||||
"delete_review": "Vélemény Törlése",
|
||||
"loading_reviews": "Vélemények betöltése..."
|
||||
|
||||
@@ -673,8 +673,7 @@
|
||||
"game_removed_from_pinned": "Spēle dzēsta no piespraustajiem",
|
||||
"game_added_to_pinned": "Spēle pievienota piespraustajiem",
|
||||
"karma": "Karma",
|
||||
"karma_count": "karma",
|
||||
"karma_description": "Nopelnīta ar pozitīviem atsauksmju vērtējumiem"
|
||||
"karma_count": "karma"
|
||||
},
|
||||
"achievement": {
|
||||
"achievement_unlocked": "Sasniegums atbloķēts",
|
||||
|
||||
@@ -732,7 +732,6 @@
|
||||
"achievements_earned": "Conquistas recebidas",
|
||||
"karma": "Karma",
|
||||
"karma_count": "karma",
|
||||
"karma_description": "Ganho a partir de curtidas positivas em avaliações",
|
||||
"manual_playtime_tooltip": "Este tempo de jogo foi atualizado manualmente",
|
||||
"user_reviews": "Avaliações",
|
||||
"loading_reviews": "Carregando avaliações...",
|
||||
|
||||
@@ -721,7 +721,6 @@
|
||||
"game_added_to_pinned": "Игра добавлена в закрепленные",
|
||||
"karma": "Карма",
|
||||
"karma_count": "карма",
|
||||
"karma_description": "Заработана положительными оценками отзывов",
|
||||
"user_reviews": "Отзывы",
|
||||
"loading_reviews": "Загрузка отзывов...",
|
||||
"wrapped_2025": "Wrapped 2025",
|
||||
|
||||
@@ -706,7 +706,6 @@
|
||||
"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..."
|
||||
|
||||
@@ -668,8 +668,7 @@
|
||||
"game_removed_from_pinned": "Гру видалено із закріплених",
|
||||
"game_added_to_pinned": "Гру додано до закріплених",
|
||||
"karma": "Карма",
|
||||
"karma_count": "карма",
|
||||
"karma_description": "Зароблена позитивними оцінками на відгуках"
|
||||
"karma_count": "карма"
|
||||
},
|
||||
"achievement": {
|
||||
"achievement_unlocked": "Досягнення розблоковано",
|
||||
|
||||
@@ -689,7 +689,6 @@
|
||||
"game_removed_from_pinned": "游戏已从置顶移除",
|
||||
"karma": "业力",
|
||||
"karma_count": "业力值",
|
||||
"karma_description": "通过评论获得的点赞",
|
||||
"loading_reviews": "正在加载评价...",
|
||||
"manual_playtime_tooltip": "该游戏时长已手动更新",
|
||||
"pinned": "已置顶",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { Sidebar, BottomPanel, Header, Toast } from "@renderer/components";
|
||||
|
||||
import { WorkWondersSdk } from "workwonders-sdk";
|
||||
import {
|
||||
useAppDispatch,
|
||||
useAppSelector,
|
||||
@@ -52,6 +52,8 @@ export function App() {
|
||||
|
||||
const { clearDownload, setLastPacket } = useDownload();
|
||||
|
||||
const wokwondersRef = useRef<WorkWondersSdk | null>(null);
|
||||
|
||||
const {
|
||||
hasActiveSubscription,
|
||||
fetchUserDetails,
|
||||
@@ -114,7 +116,29 @@ export function App() {
|
||||
return () => unsubscribe();
|
||||
}, [updateLibrary]);
|
||||
|
||||
useEffect(() => {
|
||||
const setupWorkWonders = useCallback(
|
||||
async (token?: string, locale?: string) => {
|
||||
if (wokwondersRef.current) return;
|
||||
|
||||
const possibleLocales = ["en", "pt", "ru"];
|
||||
|
||||
const parsedLocale =
|
||||
possibleLocales.find((l) => l === locale?.slice(0, 2)) ?? "en";
|
||||
|
||||
wokwondersRef.current = new WorkWondersSdk();
|
||||
await wokwondersRef.current.init({
|
||||
organization: "hydra",
|
||||
token,
|
||||
locale: parsedLocale,
|
||||
});
|
||||
|
||||
await wokwondersRef.current.initChangelogWidget();
|
||||
wokwondersRef.current.initChangelogWidgetMini();
|
||||
},
|
||||
[wokwondersRef]
|
||||
);
|
||||
|
||||
const setupExternalResources = useCallback(async () => {
|
||||
const cachedUserDetails = window.localStorage.getItem("userDetails");
|
||||
|
||||
if (cachedUserDetails) {
|
||||
@@ -125,21 +149,26 @@ export function App() {
|
||||
dispatch(setProfileBackground(profileBackground));
|
||||
}
|
||||
|
||||
fetchUserDetails()
|
||||
.then((response) => {
|
||||
if (response) {
|
||||
updateUserDetails(response);
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
if (document.getElementById("external-resources")) return;
|
||||
const userPreferences = await window.electron.getUserPreferences();
|
||||
const userDetails = await fetchUserDetails().catch(() => null);
|
||||
|
||||
const $script = document.createElement("script");
|
||||
$script.id = "external-resources";
|
||||
$script.src = `${import.meta.env.RENDERER_VITE_EXTERNAL_RESOURCES_URL}/bundle.js?t=${Date.now()}`;
|
||||
document.head.appendChild($script);
|
||||
});
|
||||
}, [fetchUserDetails, updateUserDetails, dispatch]);
|
||||
if (userDetails) {
|
||||
updateUserDetails(userDetails);
|
||||
}
|
||||
|
||||
setupWorkWonders(userDetails?.workwondersJwt, userPreferences?.language);
|
||||
|
||||
if (!document.getElementById("external-resources")) {
|
||||
const $script = document.createElement("script");
|
||||
$script.id = "external-resources";
|
||||
$script.src = `${import.meta.env.RENDERER_VITE_EXTERNAL_RESOURCES_URL}/bundle.js?t=${Date.now()}`;
|
||||
document.head.appendChild($script);
|
||||
}
|
||||
}, [fetchUserDetails, updateUserDetails, dispatch, setupWorkWonders]);
|
||||
|
||||
useEffect(() => {
|
||||
setupExternalResources();
|
||||
}, [setupExternalResources]);
|
||||
|
||||
const onSignIn = useCallback(() => {
|
||||
fetchUserDetails().then((response) => {
|
||||
@@ -203,6 +232,7 @@ export function App() {
|
||||
|
||||
useEffect(() => {
|
||||
if (contentRef.current) contentRef.current.scrollTop = 0;
|
||||
wokwondersRef.current?.notifyUrlChange();
|
||||
}, [location.pathname, location.search]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -59,6 +59,7 @@ export function useUserDetails() {
|
||||
username: userDetails?.username || "",
|
||||
subscription: userDetails?.subscription || null,
|
||||
featurebaseJwt: userDetails?.featurebaseJwt || "",
|
||||
workwondersJwt: userDetails?.workwondersJwt || "",
|
||||
karma: userDetails?.karma || 0,
|
||||
});
|
||||
},
|
||||
@@ -111,7 +112,7 @@ export function useUserDetails() {
|
||||
);
|
||||
|
||||
const undoFriendship = (userId: string) =>
|
||||
window.electron.hydraApi.delete(`/profile/friends/${userId}`);
|
||||
window.electron.hydraApi.delete(`/profile/friend-requests/${userId}`);
|
||||
|
||||
const blockUser = (userId: string) =>
|
||||
window.electron.hydraApi.post(`/users/${userId}/block`);
|
||||
|
||||
@@ -100,8 +100,10 @@
|
||||
padding: calc(globals.$spacing-unit * 1.5);
|
||||
background-color: rgba(255, 255, 255, 0.05);
|
||||
border-radius: 8px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
transition: all ease 0.2s;
|
||||
text-align: left;
|
||||
|
||||
&:hover {
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
|
||||
@@ -123,11 +123,6 @@ export function UserStatsBox() {
|
||||
{t("karma_count")}
|
||||
</p>
|
||||
</div>
|
||||
<div className="user-stats__karma-info">
|
||||
<small className="user-stats__karma-info-text">
|
||||
{t("karma_description")}
|
||||
</small>
|
||||
</div>
|
||||
</li>
|
||||
)}
|
||||
</ul>
|
||||
|
||||
@@ -188,6 +188,7 @@ export interface UserDetails {
|
||||
profileVisibility: ProfileVisibility;
|
||||
bio: string;
|
||||
featurebaseJwt: string;
|
||||
workwondersJwt: string;
|
||||
subscription: Subscription | null;
|
||||
karma: number;
|
||||
quirks?: {
|
||||
|
||||
12
yarn.lock
12
yarn.lock
@@ -6354,6 +6354,11 @@ keyv@^4.0.0, keyv@^4.5.3:
|
||||
dependencies:
|
||||
json-buffer "3.0.1"
|
||||
|
||||
ky@^1.11.0:
|
||||
version "1.14.1"
|
||||
resolved "https://registry.yarnpkg.com/ky/-/ky-1.14.1.tgz#16f20b3bf3939abcc04e2a9613f47360fe5f64c9"
|
||||
integrity sha512-hYje4L9JCmpEQBtudo+v52X5X8tgWXUYyPcxKSuxQNboqufecl9VMWjGiucAFH060AwPXHZuH+WB2rrqfkmafw==
|
||||
|
||||
language-subtag-registry@^0.3.20:
|
||||
version "0.3.23"
|
||||
resolved "https://registry.yarnpkg.com/language-subtag-registry/-/language-subtag-registry-0.3.23.tgz#23529e04d9e3b74679d70142df3fd2eb6ec572e7"
|
||||
@@ -9123,6 +9128,13 @@ word-wrap@^1.2.5:
|
||||
resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34"
|
||||
integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==
|
||||
|
||||
workwonders-sdk@0.0.10:
|
||||
version "0.0.10"
|
||||
resolved "https://registry.yarnpkg.com/workwonders-sdk/-/workwonders-sdk-0.0.10.tgz#377167370a39c905c5228f8972c37c19004b7b21"
|
||||
integrity sha512-bnswhlLRz1TCiqGV8l+VEOBej7u1SAkzLMEv6A60Sp0+S4j4pnmSve92KeOts/GYtUeNDuNM7fLPwZwMKY3sAg==
|
||||
dependencies:
|
||||
ky "^1.11.0"
|
||||
|
||||
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
|
||||
version "7.0.0"
|
||||
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
|
||||
|
||||
Reference in New Issue
Block a user