mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 02:54:15 +00:00
handle open dev tool showing a warning
This commit is contained in:
parent
9e3d4b90b5
commit
9c94efd3dd
@ -271,6 +271,18 @@ class App extends React.Component {
|
||||
{(t) => t("You have been disconnected from the server, trying to reconnect.")}
|
||||
</Translation>
|
||||
})
|
||||
},
|
||||
"devtool-opened": () => {
|
||||
// show warning
|
||||
antd.notification.open({
|
||||
message: <Translation>
|
||||
{(t) => t("Devtool opened")}
|
||||
</Translation>,
|
||||
description: <Translation>
|
||||
{(t) => t("You have opened the devtool for the first time, please be aware that this is a security risk and you should close it as soon as possible.")}
|
||||
</Translation>,
|
||||
icon: <Icons.MdOutlineWarning />,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -452,12 +464,14 @@ class App extends React.Component {
|
||||
}, () => {
|
||||
App.publicMethods.openCreator()
|
||||
})
|
||||
|
||||
|
||||
app.eventBus.emit("app.initialization.start")
|
||||
|
||||
|
||||
await this.initialization()
|
||||
|
||||
|
||||
app.eventBus.emit("app.initialization.finish")
|
||||
|
||||
Utils.handleOpenDevTools()
|
||||
}
|
||||
|
||||
initialization = async () => {
|
||||
|
17
packages/app/src/utils/handleOpenDevTools/index.js
Normal file
17
packages/app/src/utils/handleOpenDevTools/index.js
Normal file
@ -0,0 +1,17 @@
|
||||
export default () => {
|
||||
var devtools = function () { }
|
||||
|
||||
devtools.toString = function () {
|
||||
console.log(
|
||||
"%cStop!\n",
|
||||
"color: red; font-size: 40px; font-weight: bold;",
|
||||
)
|
||||
|
||||
console.log(
|
||||
`%cYou have opened the devtools. This is a browser feature intended for developers. If someone told you to copy and paste something here to enable a feature or "hack" someone's account, it is a scam and will give them access to your account and data.`,
|
||||
"color: black; font-size: 20px; font-weight: bold;"
|
||||
)
|
||||
}
|
||||
|
||||
console.log('%c', devtools)
|
||||
}
|
@ -4,4 +4,5 @@ export { default as cursorPosition } from "./cursorPosition"
|
||||
export { default as getBase64 } from "./getBase64"
|
||||
export { default as Haptics } from "./haptics"
|
||||
export { default as processString } from "./processString"
|
||||
export { default as deleteInternalStorage } from "./deleteInternalStorage"
|
||||
export { default as deleteInternalStorage } from "./deleteInternalStorage"
|
||||
export { default as handleOpenDevTools } from "./handleOpenDevTools"
|
Loading…
x
Reference in New Issue
Block a user