diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1c79222c..161708bb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,11 +43,12 @@ jobs: MAIN_VITE_API_URL: ${{ vars.MAIN_VITE_STAGING_API_URL }} MAIN_VITE_AUTH_URL: ${{ vars.MAIN_VITE_STAGING_AUTH_URL }} MAIN_VITE_CHECKOUT_URL: ${{ vars.MAIN_VITE_STAGING_CHECKOUT_URL }} - MAIN_VITE_ANALYTICS_API_URL: ${{ vars.MAIN_VITE_ANALYTICS_API_URL }} RENDERER_VITE_INTERCOM_APP_ID: ${{ vars.RENDERER_VITE_INTERCOM_APP_ID }} - RENDERER_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.RENDERER_VITE_EXTERNAL_RESOURCES_URL }} + RENDERER_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.EXTERNAL_RESOURCES_URL }} + MAIN_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.EXTERNAL_RESOURCES_URL }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - MAIN_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.MAIN_VITE_EXTERNAL_RESOURCES_URL }} + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + RENDERER_VITE_SENTRY_DSN: ${{ vars.SENTRY_DSN }} - name: Build Windows if: matrix.os == 'windows-latest' @@ -56,11 +57,12 @@ jobs: MAIN_VITE_API_URL: ${{ vars.MAIN_VITE_STAGING_API_URL }} MAIN_VITE_AUTH_URL: ${{ vars.MAIN_VITE_STAGING_AUTH_URL }} MAIN_VITE_CHECKOUT_URL: ${{ vars.MAIN_VITE_STAGING_CHECKOUT_URL }} - MAIN_VITE_ANALYTICS_API_URL: ${{ vars.MAIN_VITE_ANALYTICS_API_URL }} RENDERER_VITE_INTERCOM_APP_ID: ${{ vars.RENDERER_VITE_INTERCOM_APP_ID }} - RENDERER_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.RENDERER_VITE_EXTERNAL_RESOURCES_URL }} + RENDERER_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.EXTERNAL_RESOURCES_URL }} + MAIN_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.EXTERNAL_RESOURCES_URL }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - MAIN_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.MAIN_VITE_EXTERNAL_RESOURCES_URL }} + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + RENDERER_VITE_SENTRY_DSN: ${{ vars.SENTRY_DSN }} - name: Test Upload build env: @@ -72,6 +74,7 @@ jobs: BUILDS_URL: ${{ secrets.BUILDS_URL }} BUILD_WEBHOOK_URL: ${{ secrets.BUILD_WEBHOOK_URL }} GITHUB_ACTOR: ${{ github.actor }} + run: node scripts/upload-build.cjs - name: Create artifact diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 101221d1..afa5502c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -47,9 +47,12 @@ jobs: MAIN_VITE_CHECKOUT_URL: ${{ vars.MAIN_VITE_CHECKOUT_URL }} MAIN_VITE_ANALYTICS_API_URL: ${{ vars.MAIN_VITE_ANALYTICS_API_URL }} RENDERER_VITE_INTERCOM_APP_ID: ${{ vars.RENDERER_VITE_INTERCOM_APP_ID }} - RENDERER_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.RENDERER_VITE_EXTERNAL_RESOURCES_URL }} + RENDERER_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.EXTERNAL_RESOURCES_URL }} + MAIN_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.EXTERNAL_RESOURCES_URL }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - MAIN_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.MAIN_VITE_EXTERNAL_RESOURCES_URL }} + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + RENDERER_VITE_SENTRY_DSN: ${{ vars.SENTRY_DSN }} + - name: Build Windows if: matrix.os == 'windows-latest' run: yarn build:win @@ -59,9 +62,12 @@ jobs: MAIN_VITE_CHECKOUT_URL: ${{ vars.MAIN_VITE_CHECKOUT_URL }} MAIN_VITE_ANALYTICS_API_URL: ${{ vars.MAIN_VITE_ANALYTICS_API_URL }} RENDERER_VITE_INTERCOM_APP_ID: ${{ vars.RENDERER_VITE_INTERCOM_APP_ID }} - RENDERER_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.RENDERER_VITE_EXTERNAL_RESOURCES_URL }} + RENDERER_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.EXTERNAL_RESOURCES_URL }} + MAIN_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.EXTERNAL_RESOURCES_URL }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - MAIN_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.MAIN_VITE_EXTERNAL_RESOURCES_URL }} + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + RENDERER_VITE_SENTRY_DSN: ${{ vars.SENTRY_DSN }} + - name: Create artifact uses: actions/upload-artifact@v4 with: diff --git a/.gitignore b/.gitignore index 68b8342c..36e620fc 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,6 @@ ludusavi/ hydra-python-rpc/ aria2/ .python-version + +# Sentry Config File +.env.sentry-build-plugin diff --git a/electron.vite.config.ts b/electron.vite.config.ts index be37cc40..cd08b6d4 100644 --- a/electron.vite.config.ts +++ b/electron.vite.config.ts @@ -8,6 +8,7 @@ import { import react from "@vitejs/plugin-react"; import { vanillaExtractPlugin } from "@vanilla-extract/vite-plugin"; import svgr from "vite-plugin-svgr"; +import { sentryVitePlugin } from "@sentry/vite-plugin"; export default defineConfig(({ mode }) => { loadEnv(mode); @@ -44,7 +45,16 @@ export default defineConfig(({ mode }) => { "@shared": resolve("src/shared"), }, }, - plugins: [svgr(), react(), vanillaExtractPlugin()], + plugins: [ + svgr(), + react(), + vanillaExtractPlugin(), + sentryVitePlugin({ + authToken: process.env.SENTRY_AUTH_TOKEN, + org: "hydra-launcher", + project: "hydra-renderer", + }), + ], }, }; }); diff --git a/package.json b/package.json index 625b1c9c..f8ff14dd 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,8 @@ "@primer/octicons-react": "^19.9.0", "@radix-ui/react-dropdown-menu": "^2.1.2", "@reduxjs/toolkit": "^2.2.3", + "@sentry/react": "^8.47.0", + "@sentry/vite-plugin": "^2.22.7", "@vanilla-extract/css": "^1.14.2", "@vanilla-extract/dynamic": "^2.1.2", "@vanilla-extract/recipes": "^0.5.2", diff --git a/scripts/postinstall.cjs b/scripts/postinstall.cjs index 17edb025..70768a7d 100644 --- a/scripts/postinstall.cjs +++ b/scripts/postinstall.cjs @@ -48,11 +48,6 @@ const downloadLudusavi = async () => { }; const downloadAria2WindowsAndLinux = async () => { - if (fs.existsSync("aria2")) { - console.log("Aria2 already exists, skipping download..."); - return; - } - const file = process.platform === "win32" ? "aria2-1.37.0-win-64bit-build1.zip" @@ -111,10 +106,17 @@ const copyAria2Macos = async () => { await exec(`cp $(which aria2c) aria2/aria2c`); }; -if (process.platform == "darwin") { - copyAria2Macos(); -} else { - downloadAria2WindowsAndLinux(); -} +const copyAria2 = () => { + if (fs.existsSync("aria2")) { + console.log("Aria2 already exists, skipping download..."); + return; + } + if (process.platform == "darwin") { + copyAria2Macos(); + } else { + downloadAria2WindowsAndLinux(); + } +}; +copyAria2(); downloadLudusavi(); diff --git a/src/renderer/src/main.tsx b/src/renderer/src/main.tsx index 221c2726..61c561f1 100644 --- a/src/renderer/src/main.tsx +++ b/src/renderer/src/main.tsx @@ -34,6 +34,19 @@ const Achievements = React.lazy( () => import("./pages/achievements/achievements") ); +import * as Sentry from "@sentry/react"; + +Sentry.init({ + dsn: import.meta.env.RENDERER_VITE_SENTRY_DSN, + integrations: [ + Sentry.browserTracingIntegration(), + Sentry.replayIntegration(), + ], + tracesSampleRate: 1.0, + replaysSessionSampleRate: 0.1, + replaysOnErrorSampleRate: 1.0, +}); + console.log = logger.log; const isStaging = await window.electron.isStaging(); diff --git a/src/renderer/src/pages/game-details/cloud-sync-modal/cloud-sync-modal.tsx b/src/renderer/src/pages/game-details/cloud-sync-modal/cloud-sync-modal.tsx index b4665f15..3e8cc7f1 100644 --- a/src/renderer/src/pages/game-details/cloud-sync-modal/cloud-sync-modal.tsx +++ b/src/renderer/src/pages/game-details/cloud-sync-modal/cloud-sync-modal.tsx @@ -88,6 +88,9 @@ export function CloudSyncModal({ visible, onClose }: CloudSyncModalProps) { } }, [getGameBackupPreview, visible]); + const userDetails = useAppSelector((state) => state.userDetails.userDetails); + const backupsPerGameLimit = userDetails?.quirks?.backupsPerGameLimit ?? 0; + const backupStateLabel = useMemo(() => { if (uploadingBackup) { return ( @@ -120,7 +123,7 @@ export function CloudSyncModal({ visible, onClose }: CloudSyncModalProps) { ); } - if (artifacts.length >= 2) { + if (artifacts.length >= backupsPerGameLimit) { return t("max_number_of_artifacts_reached"); } @@ -140,14 +143,12 @@ export function CloudSyncModal({ visible, onClose }: CloudSyncModalProps) { restoringBackup, loadingPreview, artifacts, + backupsPerGameLimit, t, ]); const disableActions = uploadingBackup || restoringBackup || deletingArtifact; - const userDetails = useAppSelector((state) => state.userDetails.userDetails); - const backupsPerGameLimit = userDetails?.quirks.backupsPerGameLimit ?? 0; - return (