mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-04-20 02:05:52 +00:00
add different origin condition
This commit is contained in:
parent
8b14717b53
commit
96636bd0e3
@ -680,10 +680,14 @@ function App() {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
// Handler function for incoming messages
|
||||
const messageHandler = (event) => {
|
||||
if (event.origin !== window.location.origin) {
|
||||
return;
|
||||
}
|
||||
const message = event.data;
|
||||
|
||||
if (message?.action === "CHECK_FOCUS") {
|
||||
|
@ -2578,6 +2578,9 @@ async function getChatHeadsDirect() {
|
||||
|
||||
function setupMessageListener() {
|
||||
window.addEventListener("message", async (event) => {
|
||||
if (event.origin !== window.location.origin) {
|
||||
return;
|
||||
}
|
||||
const request = event.data;
|
||||
|
||||
// Check if the message is intended for this listener
|
||||
@ -2719,7 +2722,6 @@ function setupMessageListener() {
|
||||
publishOnQDNCase(request, event);
|
||||
break;
|
||||
case "handleActiveGroupDataFromSocket":
|
||||
console.log('handleActiveGroupDataFromSocket2', event)
|
||||
handleActiveGroupDataFromSocketCase(request, event);
|
||||
break;
|
||||
case "getThreadActivity":
|
||||
|
@ -893,6 +893,9 @@ export const Group = ({
|
||||
useEffect(() => {
|
||||
// Handler function for incoming messages
|
||||
const messageHandler = (event) => {
|
||||
if (event.origin !== window.location.origin) {
|
||||
return;
|
||||
}
|
||||
const message = event.data;
|
||||
if (message?.action === "SET_GROUPS") {
|
||||
|
||||
|
@ -107,7 +107,9 @@ export const WebSocketActive = ({ myAddress, setIsLoadingGroups }) => {
|
||||
}
|
||||
};
|
||||
|
||||
initWebsocketMessageGroup(); // Initialize WebSocket on component mount
|
||||
|
||||
initWebsocketMessageGroup(); // Initialize WebSocket on component mount
|
||||
|
||||
|
||||
return () => {
|
||||
forceCloseWebSocket(); // Clean up WebSocket on component unmount
|
||||
|
Loading…
x
Reference in New Issue
Block a user