Skip to content

Commit

Permalink
fix: deleted brew install part
Browse files Browse the repository at this point in the history
  • Loading branch information
RAZGRIZ219104 committed Jun 14, 2024
1 parent 5bbf8dc commit 3892265
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 128 deletions.
42 changes: 0 additions & 42 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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<String>) {
println!("{}", url);
Expand Down
27 changes: 1 addition & 26 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
56 changes: 1 addition & 55 deletions src/lib/api/Downloads.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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", {
Expand Down Expand Up @@ -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}`);
Expand Down Expand Up @@ -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;
Expand Down
11 changes: 6 additions & 5 deletions src/pages/settings/Password.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -28,23 +29,23 @@ 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"));
setNotificationOpen(true);
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"));
setNotificationOpen(true);
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"));
Expand All @@ -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 (
<>
Expand Down

0 comments on commit 3892265

Please sign in to comment.