Adding a "allowApi" property to authorize the API in a website.
This commit is contained in:
parent
ce3c53ae3f
commit
5bb29e99ba
3 changed files with 46 additions and 0 deletions
|
@ -200,6 +200,7 @@ export class GameScene extends DirtyScene {
|
|||
private startPositionCalculator!: StartPositionCalculator;
|
||||
private sharedVariablesManager!: SharedVariablesManager;
|
||||
private objectsByType = new Map<string, ITiledMapObject[]>();
|
||||
private inMapIframes = new Array<HTMLIFrameElement>();
|
||||
|
||||
constructor(private room: Room, MapUrlFile: string, customKey?: string | undefined) {
|
||||
super({
|
||||
|
@ -497,6 +498,15 @@ export class GameScene extends DirtyScene {
|
|||
iframe.style.border = "none";
|
||||
|
||||
this.add.dom(object.x, object.y).setElement(iframe).setOrigin(0, 0);
|
||||
|
||||
const allowApi = PropertyUtils.findBooleanProperty(
|
||||
"allowApi",
|
||||
object.properties,
|
||||
);
|
||||
if (allowApi) {
|
||||
iframeListener.registerIframe(iframe);
|
||||
this.inMapIframes.push(iframe);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1293,6 +1303,9 @@ ${escapedMessage}
|
|||
for (const script of scripts) {
|
||||
iframeListener.unregisterScript(script);
|
||||
}
|
||||
for (const iframe of this.inMapIframes) {
|
||||
iframeListener.unregisterIframe(iframe);
|
||||
}
|
||||
|
||||
this.stopJitsi();
|
||||
audioManager.unloadAudio();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue