Compare commits

..

6 Commits

Author SHA1 Message Date
Sosthene
2e2754a41f Download the backup json as a file 2025-07-16 10:55:02 +02:00
Sosthene
9d00695be8 Add import profile step in login 2025-07-16 10:54:59 +02:00
Sosthene
8c0f2f8018 Add create backup button in my account 2025-07-16 10:54:15 +02:00
Sosthene
bad6385270 Add exportBackupFile in MessageBus 2025-07-16 10:54:15 +02:00
Sosthene
26edba3504 Add StepImportProfile component 2025-07-16 10:54:15 +02:00
Sosthene
bd4c9205d9 [bug] make MessageBus more reliable 2025-07-16 10:52:47 +02:00
3 changed files with 11 additions and 6 deletions

View File

@ -12,6 +12,9 @@ function Iframe({ showIframe = false }: IframeProps) {
if (iframeRef.current) {
IframeReference.setIframe(iframeRef.current);
}
return () => {
IframeReference.setIframe(null);
};
}, [iframeRef.current]);
return (

View File

@ -5,11 +5,6 @@ export default class IframeReference {
private constructor() { }
public static setTargetOrigin(targetOrigin: string): void {
if (this.targetOrigin) {
console.debug("targetOrigin is already set");
return;
}
try {
new URL(targetOrigin);
this.targetOrigin = targetOrigin;

View File

@ -809,10 +809,17 @@ export default class MessageBus {
}
try {
const iframe = IframeReference.getIframe();
if (event.source !== iframe.contentWindow) {
console.error('[MessageBus] handleMessage: source not match');
return;
}
const targetOrigin = IframeReference.getTargetOrigin();
if (event.origin !== targetOrigin) {
throw new Error(`origin don't match: expected ${targetOrigin}, got ${event.origin} with type ${event.data.type}`);
throw new Error('origin not match');
}
if (!event.data || typeof event.data !== 'object') {