diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d19c5b98..882c3125 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,7 +22,7 @@ jobs: uses: "actions/checkout@v2" - name: "Install modules" - run: "npm run install:ci" + run: "npm set strict-ssl false && npm run install:ci" - name: "Test" run: "npm run jest:ci" diff --git a/.github/workflows/deploy-web.yml b/.github/workflows/deploy-web.yml index 351497a9..917f3e05 100644 --- a/.github/workflows/deploy-web.yml +++ b/.github/workflows/deploy-web.yml @@ -20,7 +20,7 @@ jobs: uses: actions/checkout@v2 - name: "Install modules" - run: "npm run install:ci" + run: "npm set strict-ssl false && npm run install:ci" - name: "Generate build information json" run: "node generateInfo.js" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f9a35375..00f85550 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ jobs: uses: "actions/checkout@v2" - name: "Install modules" - run: "npm run install:ci" + run: "npm set strict-ssl false && npm run install:ci" - name: "Test" run: "npm run jest:ci" @@ -57,8 +57,6 @@ jobs: cd linux-installer chmod +x *.AppImage chmod +x *.sh - chmod +x mtga-tracker-daemon/*.sh - chmod +x mtga-tracker-daemon/bin/mtga-tracker-daemon tar czvf "../dist/mtgatool-desktop-linux-installer.tar.gz" * cd .. diff --git a/craco.web.config.js b/craco.web.config.js index a5f78ee5..d33a272c 100644 --- a/craco.web.config.js +++ b/craco.web.config.js @@ -1,5 +1,5 @@ -const ModuleReplacement = require("./module-resolver-file"); const WebpackReactComponentNamePlugin = require("webpack-react-component-name"); +const ModuleReplacement = require("./module-resolver-file"); process.env.PORT = 3006; @@ -14,7 +14,7 @@ module.exports = { }, plugins: [ ...ModuleReplacement({ webIndex: true, electronIndex: false }), - new WebpackReactComponentNamePlugin() + new WebpackReactComponentNamePlugin(), ], }, eslint: { diff --git a/package.json b/package.json index eac36fe3..f7f3bc68 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,8 @@ "electron-log": "^5.0.0", "electron-updater": "^6.1.4", "extract-zip": "^2.0.1", + "find-process": "^1.4.7", + "mtga-reader": "https://mtgatool.com/libs/mtga-reader-1.0.0.tgz", "follow-redirects": "^1.14.3", "google-protobuf": "^3.15.6", "history": "^4.10.1", @@ -202,4 +204,4 @@ "type": "git", "url": "https://github.com/mtgatool/mtgatool-desktop.git" } -} +} \ No newline at end of file diff --git a/public/tooldb-worker/index.js b/public/tooldb-worker/index.js index 8c94d9c6..55ec8f0f 100644 --- a/public/tooldb-worker/index.js +++ b/public/tooldb-worker/index.js @@ -722,7 +722,6 @@ function login(username, password) { return keys; }) .catch((err) => { - console.warn("Login error:", err); self.postMessage({ type: "LOGIN_ERR", err }); }); } diff --git a/src/background/onLabel/MatchGameRoomStateChangedEvent.ts b/src/background/onLabel/MatchGameRoomStateChangedEvent.ts index d88507c7..08329051 100644 --- a/src/background/onLabel/MatchGameRoomStateChangedEvent.ts +++ b/src/background/onLabel/MatchGameRoomStateChangedEvent.ts @@ -8,10 +8,8 @@ import { } from "mtgatool-shared"; import postChannelMessage from "../../broadcastChannel/postChannelMessage"; -import MtgaTrackerDaemon from "../../daemon/mtgaTrackerDaemon"; import LogEntry from "../../types/logDecoder"; import getLocalSetting from "../../utils/getLocalSetting"; -import isLimitedEventId from "../../utils/isLimitedEventId"; import actionLog from "../actionLog"; import saveMatch from "../saveMatch"; import selectDeck from "../selectDeck"; @@ -29,7 +27,7 @@ interface Entry extends LogEntry { json: MatchGameRoomStateChange; } -const rankClass: Record = { +export const rankClass: Record = { "-1": "Unranked", "0": "Beginner", "1": "Bronze", @@ -180,53 +178,53 @@ export default function onLabelMatchGameRoomStateChangedEvent( } */ - if ((window as any).daemon) { - const isLimited = isLimitedEventId(gameRoom.gameRoomConfig.eventId); + // if ((window as any).daemon) { + // const isLimited = isLimitedEventId(gameRoom.gameRoomConfig.eventId); - ((window as any).daemon as MtgaTrackerDaemon) - .getMatchState() - .then((state) => { - if ( - state && - state.matchId === gameRoom.gameRoomConfig.matchId && - state.playerRank.class > 0 - ) { - const opponent = { - tier: state.opponentRank.tier, - rank: rankClass[state.opponentRank.class], - percentile: state.opponentRank.mythicPercentile, - leaderboardPlace: state.opponentRank.mythicPlacement, - }; - setOpponent(opponent); + // ((window as any).daemon as MtgaTrackerDaemon) + // .getMatchState() + // .then((state) => { + // if ( + // state && + // state.matchId === gameRoom.gameRoomConfig.matchId && + // state.playerRank.class > 0 + // ) { + // const opponent = { + // tier: state.opponentRank.tier, + // rank: rankClass[state.opponentRank.class], + // percentile: state.opponentRank.mythicPercentile, + // leaderboardPlace: state.opponentRank.mythicPlacement, + // }; + // setOpponent(opponent); - const player = { - tier: state.playerRank.tier, - rank: rankClass[state.playerRank.class], - percentile: state.playerRank.mythicPercentile, - leaderboardPlace: state.playerRank.mythicPlacement, - }; - setPlayer(player); + // const player = { + // tier: state.playerRank.tier, + // rank: rankClass[state.playerRank.class], + // percentile: state.playerRank.mythicPercentile, + // leaderboardPlace: state.playerRank.mythicPlacement, + // }; + // setPlayer(player); - if (isLimited) { - postChannelMessage({ - type: "UPSERT_DB_RANK", - value: { - limitedClass: rankClass[state.playerRank.class], - limitedLevel: state.playerRank.tier, - }, - }); - } else { - postChannelMessage({ - type: "UPSERT_DB_RANK", - value: { - constructedClass: rankClass[state.playerRank.class], - constructedLevel: state.playerRank.tier, - }, - }); - } - } - }); - } + // if (isLimited) { + // postChannelMessage({ + // type: "UPSERT_DB_RANK", + // value: { + // limitedClass: rankClass[state.playerRank.class], + // limitedLevel: state.playerRank.tier, + // }, + // }); + // } else { + // postChannelMessage({ + // type: "UPSERT_DB_RANK", + // value: { + // constructedClass: rankClass[state.playerRank.class], + // constructedLevel: state.playerRank.tier, + // }, + // }); + // } + // } + // }); + // } setEventId(eventId); diff --git a/src/broadcastChannel/mainChannelListeners.ts b/src/broadcastChannel/mainChannelListeners.ts index 5afa35e7..3859e1f4 100644 --- a/src/broadcastChannel/mainChannelListeners.ts +++ b/src/broadcastChannel/mainChannelListeners.ts @@ -15,7 +15,6 @@ import upsertDbRank from "../toolDb/upsertDbRank"; import { putData } from "../toolDb/worker-wrapper"; import LogEntry from "../types/logDecoder"; import bcConnect from "../utils/bcConnect"; -import electron from "../utils/electron/electronWrapper"; import globalData from "../utils/globalData"; import switchPlayerUUID from "../utils/switchPlayerUUID"; import { ChannelMessage } from "./channelMessages"; @@ -27,23 +26,6 @@ export default function mainChannelListeners() { let logReadFinished = false; - if (electron) { - electron.ipcRenderer.on( - "mtgaTrackerDaemonVersion", - (event: any, d: any) => { - console.log("mtgaTrackerDaemonVersion", d); - globalData.latestDaemon = d; - if (globalData.daemon) { - globalData.daemon.downloadLatestDaemon().finally(() => { - if (globalData.daemon) { - globalData.daemon.startDaemon(); - } - }); - } - } - ); - } - channel.onmessage = (msg: MessageEvent) => { // console.log(msg.data.type); if (logReadFinished && msg.data.type === "OVERLAY_UPDATE") { diff --git a/src/components/views/settings/DaemonSettingsPanel.tsx b/src/components/views/settings/DaemonSettingsPanel.tsx index 1f8733bf..ea524c99 100644 --- a/src/components/views/settings/DaemonSettingsPanel.tsx +++ b/src/components/views/settings/DaemonSettingsPanel.tsx @@ -1,103 +1,23 @@ /* eslint-disable no-nested-ternary */ /* eslint-disable radix */ -import { ChangeEvent, useCallback, useEffect, useState } from "react"; +import { useEffect, useState } from "react"; -import getLocalSetting from "../../../utils/getLocalSetting"; import globalData from "../../../utils/globalData"; -import openExternal from "../../../utils/openExternal"; -import Button from "../../ui/Button"; export default function DaemonSettingsPanel(): JSX.Element { const [daemonStatus, setDaemonStatus] = useState("warn"); - const [daemonPort, setDaemonPort] = useState( - parseInt(getLocalSetting("daemonPort")) - ); - - const [daemonPortReal, setDaemonPortReal] = useState( - parseInt(getLocalSetting("daemonPort")) - ); - - const handleSetDaemonPort = useCallback( - (event: ChangeEvent): void => { - setDaemonPort(parseInt(event.target.value)); - }, - [] - ); - - const changeDaemonPort = useCallback((): void => { - if (globalData.daemon) { - globalData.daemon.port = daemonPort; - } - setDaemonPortReal(daemonPort); - }, [daemonPort]); useEffect(() => { - if (globalData.daemon) { - globalData.daemon - .getStatus() - .then((s) => { - if (s && s.isRunning) { - setDaemonStatus("ok"); - } else { - setDaemonStatus("err"); - } - }) - .catch(() => { - setDaemonStatus("warn"); - }); - } else { - setDaemonStatus("warn"); - } - }, [daemonPortReal]); + if (globalData.mtgaReader.status === "CONNECTED") setDaemonStatus("ok"); + else if (globalData.mtgaReader.status === "DISCONNECTED") + setDaemonStatus("err"); + else setDaemonStatus("warn"); + }, []); return ( <> -
-

- Mtga Tracker Daemon is a utility service app that reads MTG - Arena's process memory to access some of the information that is - not available on the logs. You can read more about it here;{" "} - - openExternal("https://github.com/frcaton/mtga-tracker-daemon") - } - > - mtga-tracker-daemon - -

-
-
- -
-
- -
-
-