mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-11 13:56:16 +00:00
feat: adding uuid library
This commit is contained in:
@@ -13,12 +13,3 @@ RUN yarn install --frozen-lockfile --ignore-scripts
|
||||
COPY . .
|
||||
|
||||
RUN yarn electron-vite build
|
||||
|
||||
FROM nginx:alpine
|
||||
|
||||
COPY --from=builder /app/out/renderer /usr/share/nginx/html
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
|
||||
|
||||
@@ -87,6 +87,7 @@
|
||||
"tar": "^7.4.3",
|
||||
"tough-cookie": "^5.1.1",
|
||||
"user-agents": "^1.1.387",
|
||||
"uuid": "^13.0.0",
|
||||
"winreg": "^1.2.5",
|
||||
"ws": "^8.18.1",
|
||||
"yaml": "^2.6.1",
|
||||
|
||||
@@ -27,6 +27,7 @@ import { downloadSourcesWorker } from "./workers";
|
||||
import { downloadSourcesTable } from "./dexie";
|
||||
import { useSubscription } from "./hooks/use-subscription";
|
||||
import { HydraCloudModal } from "./pages/shared-modals/hydra-cloud/hydra-cloud-modal";
|
||||
import { generateUUID } from "./helpers";
|
||||
|
||||
import { injectCustomCss, removeCustomCss } from "./helpers";
|
||||
import "./app.scss";
|
||||
@@ -212,7 +213,7 @@ export function App() {
|
||||
useEffect(() => {
|
||||
updateRepacks();
|
||||
|
||||
const id = `${Date.now()}-${Math.random()}`;
|
||||
const id = generateUUID();
|
||||
const channel = new BroadcastChannel(`download_sources:sync:${id}`);
|
||||
|
||||
channel.onmessage = async (event: MessageEvent<number>) => {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { GameShop } from "@types";
|
||||
|
||||
import Color from "color";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { THEME_WEB_STORE_URL } from "./constants";
|
||||
|
||||
export const formatDownloadProgress = (
|
||||
@@ -112,3 +113,11 @@ export const formatNumber = (num: number): string => {
|
||||
maximumFractionDigits: 1,
|
||||
}).format(num);
|
||||
};
|
||||
|
||||
/**
|
||||
* Generates a UUID v4
|
||||
* @returns A random UUID string
|
||||
*/
|
||||
export const generateUUID = (): string => {
|
||||
return uuidv4();
|
||||
};
|
||||
|
||||
@@ -9,6 +9,7 @@ import { useForm } from "react-hook-form";
|
||||
import * as yup from "yup";
|
||||
import { yupResolver } from "@hookform/resolvers/yup";
|
||||
import { useCallback } from "react";
|
||||
import { generateUUID } from "@renderer/helpers";
|
||||
|
||||
import "./modals.scss";
|
||||
|
||||
@@ -79,7 +80,7 @@ export function AddThemeModal({
|
||||
const onSubmit = useCallback(
|
||||
async (values: FormValues) => {
|
||||
const theme: Theme = {
|
||||
id: `${Date.now()}-${Math.random()}`,
|
||||
id: generateUUID(),
|
||||
name: values.name,
|
||||
isActive: false,
|
||||
author: userDetails?.id,
|
||||
|
||||
@@ -3,7 +3,11 @@ import { Modal } from "@renderer/components/modal/modal";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import "./modals.scss";
|
||||
import { Theme } from "@types";
|
||||
import { injectCustomCss, removeCustomCss } from "@renderer/helpers";
|
||||
import {
|
||||
injectCustomCss,
|
||||
removeCustomCss,
|
||||
generateUUID,
|
||||
} from "@renderer/helpers";
|
||||
import { useToast } from "@renderer/hooks";
|
||||
import { THEME_WEB_STORE_URL } from "@renderer/constants";
|
||||
import { logger } from "@renderer/logger";
|
||||
@@ -30,7 +34,7 @@ export const ImportThemeModal = ({
|
||||
|
||||
const handleImportTheme = async () => {
|
||||
const theme: Theme = {
|
||||
id: `${Date.now()}-${Math.random()}`,
|
||||
id: generateUUID(),
|
||||
name: themeName,
|
||||
isActive: false,
|
||||
author: authorId,
|
||||
|
||||
@@ -23,6 +23,7 @@ import { downloadSourcesTable } from "@renderer/dexie";
|
||||
import { downloadSourcesWorker } from "@renderer/workers";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { setFilters, clearFilters } from "@renderer/features";
|
||||
import { generateUUID } from "@renderer/helpers";
|
||||
import "./settings-download-sources.scss";
|
||||
|
||||
export function SettingsDownloadSources() {
|
||||
@@ -95,7 +96,7 @@ export function SettingsDownloadSources() {
|
||||
const handleRemoveAllDownloadSources = () => {
|
||||
setIsRemovingDownloadSource(true);
|
||||
|
||||
const id = `${Date.now()}-${Math.random()}`;
|
||||
const id = generateUUID();
|
||||
const channel = new BroadcastChannel(`download_sources:delete_all:${id}`);
|
||||
|
||||
downloadSourcesWorker.postMessage(["DELETE_ALL_DOWNLOAD_SOURCES", id]);
|
||||
@@ -120,7 +121,7 @@ export function SettingsDownloadSources() {
|
||||
const syncDownloadSources = async () => {
|
||||
setIsSyncingDownloadSources(true);
|
||||
|
||||
const id = `${Date.now()}-${Math.random()}`;
|
||||
const id = generateUUID();
|
||||
const channel = new BroadcastChannel(`download_sources:sync:${id}`);
|
||||
|
||||
downloadSourcesWorker.postMessage(["SYNC_DOWNLOAD_SOURCES", id]);
|
||||
|
||||
@@ -9479,6 +9479,11 @@ util-deprecate@^1.0.1:
|
||||
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
|
||||
integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==
|
||||
|
||||
uuid@^13.0.0:
|
||||
version "13.0.0"
|
||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-13.0.0.tgz#263dc341b19b4d755eb8fe36b78d95a6b65707e8"
|
||||
integrity sha512-XQegIaBTVUjSHliKqcnFqYypAd4S+WCYt5NIeRs6w/UAry7z8Y9j5ZwRRL4kzq9U3sD6v+85er9FvkEaBpji2w==
|
||||
|
||||
uuid@^9.0.1:
|
||||
version "9.0.1"
|
||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.1.tgz#e188d4c8853cc722220392c424cd637f32293f30"
|
||||
|
||||
Reference in New Issue
Block a user