mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-18 12:15:44 +01:00
MISC: Remove js-sha256 (#1278)
This commit is contained in:
parent
eeac3f7dd1
commit
9a77b47241
6
package-lock.json
generated
6
package-lock.json
generated
@ -30,7 +30,6 @@
|
||||
"clsx": "^1.2.1",
|
||||
"date-fns": "^2.30.0",
|
||||
"escodegen": "^2.1.0",
|
||||
"js-sha256": "^0.9.0",
|
||||
"jszip": "^3.10.1",
|
||||
"material-ui-color": "^1.2.0",
|
||||
"material-ui-popup-state": "^1.9.3",
|
||||
@ -12636,11 +12635,6 @@
|
||||
"integrity": "sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/js-sha256": {
|
||||
"version": "0.9.0",
|
||||
"resolved": "https://registry.npmjs.org/js-sha256/-/js-sha256-0.9.0.tgz",
|
||||
"integrity": "sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA=="
|
||||
},
|
||||
"node_modules/js-tokens": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
||||
|
@ -30,7 +30,6 @@
|
||||
"clsx": "^1.2.1",
|
||||
"date-fns": "^2.30.0",
|
||||
"escodegen": "^2.1.0",
|
||||
"js-sha256": "^0.9.0",
|
||||
"jszip": "^3.10.1",
|
||||
"material-ui-color": "^1.2.0",
|
||||
"material-ui-popup-state": "^1.9.3",
|
||||
|
@ -3,7 +3,7 @@ import { EventEmitter } from "../../utils/EventEmitter";
|
||||
import { Modal } from "./Modal";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Box from "@mui/material/Box";
|
||||
import { sha256 } from "js-sha256";
|
||||
import { cyrb53 } from "../../utils/StringHelperFunctions";
|
||||
|
||||
export const AlertEvents = new EventEmitter<[string | JSX.Element]>();
|
||||
|
||||
@ -17,8 +17,8 @@ export function AlertManager({ hidden }: { hidden: boolean }): React.ReactElemen
|
||||
useEffect(
|
||||
() =>
|
||||
AlertEvents.subscribe((text: string | JSX.Element) => {
|
||||
const hash = getMessageHash(text);
|
||||
setAlerts((old) => {
|
||||
const hash = getMessageHash(text);
|
||||
if (old.some((a) => a.hash === hash)) {
|
||||
return old;
|
||||
}
|
||||
@ -47,8 +47,10 @@ export function AlertManager({ hidden }: { hidden: boolean }): React.ReactElemen
|
||||
const alertMessage = alerts[0]?.text || "No alert to show";
|
||||
|
||||
function getMessageHash(text: string | JSX.Element): string {
|
||||
if (typeof text === "string") return sha256(text);
|
||||
return sha256(JSON.stringify(text.props));
|
||||
if (typeof text === "string") {
|
||||
return cyrb53(text);
|
||||
}
|
||||
return cyrb53(JSON.stringify(text.props));
|
||||
}
|
||||
|
||||
function close(): void {
|
||||
|
Loading…
Reference in New Issue
Block a user