From 3892265bcd5015d47d43ec003b8326ad11179304 Mon Sep 17 00:00:00 2001 From: RAZGRIZ219104 Date: Fri, 14 Jun 2024 17:57:27 +0200 Subject: [PATCH] fix: deleted brew install part --- src-tauri/src/main.rs | 42 ------------------------- src-tauri/tauri.conf.json | 27 +--------------- src/lib/api/Downloads.ts | 56 +-------------------------------- src/pages/settings/Password.tsx | 11 ++++--- 4 files changed, 8 insertions(+), 128 deletions(-) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index e8be8338..4904f319 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -62,7 +62,6 @@ async fn main() -> std::io::Result<()> { download_and_unzip_macos, download_and_untarbz2_macos, download_and_unzip_windows, - install_dependencies_for_d53_on_mac, run_exe, run_url_args, run_linux, @@ -1150,47 +1149,6 @@ fn run_exe(url: String) { } } -#[tauri::command] -async fn install_dependencies_for_d53_on_mac() { - println!("install_dependencies_for_d53_on_mac"); - - let output = tokio::process::Command - ::new("brew") - .arg("install") - .args( - &[ - "cmake", - "freetype", - "gettext", - "gmp", - "hiredis", - "jpeg-turbo", - "jsoncpp", - "leveldb", - "libogg", - "libpng", - "libvorbis", - "luajit", - "zstd", - "gettext", - "ffmpeg@6", - "mysql-client", - ] - ) - .output().await - .expect("Failed to execute command"); - - if output.status.success() { - println!("install_dependencies_for_d53_on_mac executed successfully"); - let stdout = String::from_utf8_lossy(&output.stdout); - println!("{}", stdout); - } else { - eprintln!("install_dependencies_for_d53_on_mac failed to execute"); - let stderr = String::from_utf8_lossy(&output.stderr); - eprintln!("{}", stderr); - } -} - #[tauri::command] fn run_url_args(url: String, args: Vec) { println!("{}", url); diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index f7009f36..d4549134 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -46,32 +46,7 @@ "all": true, "execute": true, "sidecar": true, - "open": true, - "scope": [ - { - "name": "brew", - "cmd": "/usr/local/bin/brew", - "args": [ - "install", - "cmake", - "freetype", - "gettext", - "gmp", - "hiredis", - "jpeg-turbo", - "jsoncpp", - "leveldb", - "libogg", - "libpng", - "libvorbis", - "luajit", - "zstd", - "gettext", - "ffmpeg@6", - "mysql-client" - ] - } - ] + "open": true }, "notification": { "all": true diff --git a/src/lib/api/Downloads.ts b/src/lib/api/Downloads.ts index f9af8e68..12d5eb6b 100644 --- a/src/lib/api/Downloads.ts +++ b/src/lib/api/Downloads.ts @@ -1,8 +1,4 @@ -import { - exists, - readDir, - // readTextFile, -} from "@tauri-apps/api/fs"; +import { exists, readDir } from "@tauri-apps/api/fs"; import { appDataDir } from "@tauri-apps/api/path"; import { type, arch } from "@tauri-apps/api/os"; import { invoke } from "@tauri-apps/api/tauri"; @@ -12,8 +8,6 @@ import { local_server_port, production_version, tymt_version } from "../../confi import { ISaltToken } from "../../types/accountTypes"; import tymtStorage from "../Storage"; import path from "path"; -import { Command } from "@tauri-apps/api/shell"; -import { emit } from "@tauri-apps/api/event"; export async function downloadAppImageLinux(url: string, targetDir: string) { return invoke("download_appimage_linux", { @@ -189,51 +183,6 @@ export async function downloadGame(game_key: string) { } break; } - // Install depencies for D53 on mac, temp solution - if (game_key === "district53") { - try { - console.log("install_dependencies_for_d53_on_mac"); - emit("install_dependencies_for_d53_on_mac", true); - const command = new Command("brew", [ - "install", - "cmake", - "freetype", - "gettext", - "gmp", - "hiredis", - "jpeg-turbo", - "jsoncpp", - "leveldb", - "libogg", - "libpng", - "libvorbis", - "luajit", - "zstd", - "gettext", - "ffmpeg@6", - "mysql-client", - ]); - - command.on("close", (data) => { - console.log(`command finished with code ${data.code} and signal ${data.signal}`); - emit("install_dependencies_for_d53_on_mac", false); - }); - - command.stdout.on("data", (line) => { - console.log(`stdout: ${line}`); - }); - - command.stderr.on("data", (line) => { - console.error(`stderr: ${line}`); - }); - - await command.spawn(); - console.log("install_dependencies_for_d53_on_mac: Finished!"); - } catch (err) { - console.error("Failed to install_dependencies_for_d53_on_mac: ", err); - emit("install_dependencies_for_d53_on_mac", false); - } - } break; case "Windows_NT": await downloadAndUnzipWindows(url, `/v${tymt_version}/games/${game_key}`); @@ -292,9 +241,6 @@ export async function runGame(game_key: string, serverIp?: string) { } let url = path.join(dataDir, `v${tymt_version}`, `games`, game_key, exePath); let args: string[]; - // const filePath: string = dataDir + `games.config.json`; - // let configJson = JSON.parse(await readTextFile(filePath)); - // let url = configJson[game_key].path; if (!(await exists(url))) { console.error("Failed to runGame: url not existing"); return false; diff --git a/src/pages/settings/Password.tsx b/src/pages/settings/Password.tsx index 57b36197..12c32897 100644 --- a/src/pages/settings/Password.tsx +++ b/src/pages/settings/Password.tsx @@ -12,6 +12,7 @@ import { accountType, custodialType, nonCustodialType, walletEnum } from "../../ import { getNonCustodial, setNonCustodial } from "../../features/account/NonCustodialSlice"; import { getCustodial, setCustodial } from "../../features/account/CustodialSlice"; import { useNotification } from "../../providers/NotificationProvider"; +import createKeccakHash from "keccak"; const Password = ({ view, setView }: propsType) => { const classname = SettingStyle(); @@ -28,7 +29,7 @@ const Password = ({ view, setView }: propsType) => { const { setNotificationStatus, setNotificationTitle, setNotificationDetail, setNotificationOpen, setNotificationLink } = useNotification(); const updatePassword = useCallback(() => { - if (userStore.password != oldPwd) { + if (userStore.password !== createKeccakHash("keccak256").update(oldPwd).digest("hex")) { setNotificationStatus("failed"); setNotificationTitle(t("alt-15_update-password")); setNotificationDetail(t("alt-16_update-password-old")); @@ -36,7 +37,7 @@ const Password = ({ view, setView }: propsType) => { setNotificationLink(null); return; } - if (userStore.password == newPwd) { + if (userStore.password === createKeccakHash("keccak256").update(newPwd).digest("hex")) { setNotificationStatus("failed"); setNotificationTitle(t("alt-15_update-password")); setNotificationDetail(t("alt-17_update-password-new")); @@ -44,7 +45,7 @@ const Password = ({ view, setView }: propsType) => { setNotificationLink(null); return; } - if (cfmPwd != newPwd) { + if (cfmPwd !== newPwd) { setNotificationStatus("failed"); setNotificationTitle(t("alt-15_update-password")); setNotificationDetail(t("alt-18_update-password-new-not")); @@ -58,8 +59,8 @@ const Password = ({ view, setView }: propsType) => { setNotificationOpen(true); setNotificationLink(null); account.wallet === walletEnum.noncustodial - ? dispatch(setNonCustodial({ ...nonCustodialStore, password: newPwd })) - : dispatch(setCustodial({ ...custodialStore, password: newPwd })); + ? dispatch(setNonCustodial({ ...nonCustodialStore, password: createKeccakHash("keccak256").update(newPwd).digest("hex") })) + : dispatch(setCustodial({ ...custodialStore, password: createKeccakHash("keccak256").update(newPwd).digest("hex") })); }, [account, nonCustodialStore, custodialStore, newPwd, oldPwd, cfmPwd]); return ( <>