Merge branch 'develop' of github.com:thecodingmachine/workadventure
This commit is contained in:
commit
ee6443670a
@ -66,6 +66,7 @@ services:
|
|||||||
API_URL: back:50051
|
API_URL: back:50051
|
||||||
JITSI_URL: $JITSI_URL
|
JITSI_URL: $JITSI_URL
|
||||||
JITSI_ISS: $JITSI_ISS
|
JITSI_ISS: $JITSI_ISS
|
||||||
|
FRONT_URL: https://play.${DOMAIN}
|
||||||
labels:
|
labels:
|
||||||
- "traefik.http.routers.pusher.rule=Host(`pusher.${DOMAIN}`)"
|
- "traefik.http.routers.pusher.rule=Host(`pusher.${DOMAIN}`)"
|
||||||
- "traefik.http.routers.pusher.entryPoints=web,traefik"
|
- "traefik.http.routers.pusher.entryPoints=web,traefik"
|
||||||
|
@ -101,7 +101,10 @@
|
|||||||
"host": {
|
"host": {
|
||||||
"url": "maps-"+url
|
"url": "maps-"+url
|
||||||
},
|
},
|
||||||
"ports": [80]
|
"ports": [80],
|
||||||
|
"env": {
|
||||||
|
"FRONT_URL": "https://play-"+url
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"redis": {
|
"redis": {
|
||||||
"image": "redis:6",
|
"image": "redis:6",
|
||||||
|
@ -28,7 +28,7 @@ services:
|
|||||||
NODE_ENV: development
|
NODE_ENV: development
|
||||||
PUSHER_URL: /pusher
|
PUSHER_URL: /pusher
|
||||||
UPLOADER_URL: /uploader
|
UPLOADER_URL: /uploader
|
||||||
ADMIN_URL: /admin
|
#ADMIN_URL: /admin
|
||||||
MAPS_URL: /maps
|
MAPS_URL: /maps
|
||||||
ICON_URL: /icon
|
ICON_URL: /icon
|
||||||
STARTUP_COMMAND_1: ./templater.sh
|
STARTUP_COMMAND_1: ./templater.sh
|
||||||
@ -92,11 +92,12 @@ services:
|
|||||||
- "traefik.http.routers.pusher-ssl.service=pusher"
|
- "traefik.http.routers.pusher-ssl.service=pusher"
|
||||||
|
|
||||||
maps:
|
maps:
|
||||||
image: thecodingmachine/nodejs:12-apache
|
image: thecodingmachine/php:8.1-v4-apache-node12
|
||||||
environment:
|
environment:
|
||||||
DEBUG_MODE: "$DEBUG_MODE"
|
DEBUG_MODE: "$DEBUG_MODE"
|
||||||
HOST: "0.0.0.0"
|
HOST: "0.0.0.0"
|
||||||
NODE_ENV: development
|
NODE_ENV: development
|
||||||
|
FRONT_URL: http://play.workadventure.localhost
|
||||||
#APACHE_DOCUMENT_ROOT: dist/
|
#APACHE_DOCUMENT_ROOT: dist/
|
||||||
#APACHE_EXTENSIONS: headers
|
#APACHE_EXTENSIONS: headers
|
||||||
#APACHE_EXTENSION_HEADERS: 1
|
#APACHE_EXTENSION_HEADERS: 1
|
||||||
|
@ -34,7 +34,7 @@ services:
|
|||||||
NODE_ENV: development
|
NODE_ENV: development
|
||||||
PUSHER_URL: //pusher.workadventure.localhost
|
PUSHER_URL: //pusher.workadventure.localhost
|
||||||
UPLOADER_URL: //uploader.workadventure.localhost
|
UPLOADER_URL: //uploader.workadventure.localhost
|
||||||
ADMIN_URL: //workadventure.localhost
|
#ADMIN_URL: //workadventure.localhost
|
||||||
ICON_URL: //icon.workadventure.localhost
|
ICON_URL: //icon.workadventure.localhost
|
||||||
STARTUP_COMMAND_1: ./templater.sh
|
STARTUP_COMMAND_1: ./templater.sh
|
||||||
STARTUP_COMMAND_2: yarn install
|
STARTUP_COMMAND_2: yarn install
|
||||||
@ -96,11 +96,12 @@ services:
|
|||||||
- "traefik.http.routers.pusher-ssl.service=pusher"
|
- "traefik.http.routers.pusher-ssl.service=pusher"
|
||||||
|
|
||||||
maps:
|
maps:
|
||||||
image: thecodingmachine/nodejs:12-apache
|
image: thecodingmachine/php:8.1-v4-apache-node12
|
||||||
environment:
|
environment:
|
||||||
DEBUG_MODE: "$DEBUG_MODE"
|
DEBUG_MODE: "$DEBUG_MODE"
|
||||||
HOST: "0.0.0.0"
|
HOST: "0.0.0.0"
|
||||||
NODE_ENV: development
|
NODE_ENV: development
|
||||||
|
FRONT_URL: http://play.workadventure.localhost
|
||||||
#APACHE_DOCUMENT_ROOT: dist/
|
#APACHE_DOCUMENT_ROOT: dist/
|
||||||
#APACHE_EXTENSIONS: headers
|
#APACHE_EXTENSIONS: headers
|
||||||
#APACHE_EXTENSION_HEADERS: 1
|
#APACHE_EXTENSION_HEADERS: 1
|
||||||
|
@ -164,12 +164,13 @@ class ConnectionManager {
|
|||||||
console.error(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
const query = urlParams.toString();
|
||||||
roomPath =
|
roomPath =
|
||||||
window.location.protocol +
|
window.location.protocol +
|
||||||
"//" +
|
"//" +
|
||||||
window.location.host +
|
window.location.host +
|
||||||
window.location.pathname +
|
window.location.pathname +
|
||||||
urlParams.toString() + //use urlParams because the token param must be deleted
|
(query ? "?" + query : "") + //use urlParams because the token param must be deleted
|
||||||
window.location.hash;
|
window.location.hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ const cowebsiteContainerDomId = "cowebsite-container"; // the id of the whole co
|
|||||||
const cowebsiteMainDomId = "cowebsite-slot-0"; // the id of the parent div of the iframe.
|
const cowebsiteMainDomId = "cowebsite-slot-0"; // the id of the parent div of the iframe.
|
||||||
const cowebsiteBufferDomId = "cowebsite-buffer"; // the id of the container who contains cowebsite iframes.
|
const cowebsiteBufferDomId = "cowebsite-buffer"; // the id of the container who contains cowebsite iframes.
|
||||||
const cowebsiteAsideDomId = "cowebsite-aside"; // the id of the parent div of the iframe.
|
const cowebsiteAsideDomId = "cowebsite-aside"; // the id of the parent div of the iframe.
|
||||||
|
const cowebsiteAsideHolderDomId = "cowebsite-aside-holder";
|
||||||
const cowebsiteSubIconsDomId = "cowebsite-sub-icons";
|
const cowebsiteSubIconsDomId = "cowebsite-sub-icons";
|
||||||
export const cowebsiteCloseButtonId = "cowebsite-close";
|
export const cowebsiteCloseButtonId = "cowebsite-close";
|
||||||
const cowebsiteFullScreenButtonId = "cowebsite-fullscreen";
|
const cowebsiteFullScreenButtonId = "cowebsite-fullscreen";
|
||||||
@ -60,6 +61,7 @@ class CoWebsiteManager {
|
|||||||
private cowebsiteMainDom: HTMLDivElement;
|
private cowebsiteMainDom: HTMLDivElement;
|
||||||
private cowebsiteBufferDom: HTMLDivElement;
|
private cowebsiteBufferDom: HTMLDivElement;
|
||||||
private cowebsiteAsideDom: HTMLDivElement;
|
private cowebsiteAsideDom: HTMLDivElement;
|
||||||
|
private cowebsiteAsideHolderDom: HTMLDivElement;
|
||||||
private cowebsiteSubIconsDom: HTMLDivElement;
|
private cowebsiteSubIconsDom: HTMLDivElement;
|
||||||
private previousTouchMoveCoordinates: TouchMoveCoordinates | null = null; //only use on touchscreens to track touch movement
|
private previousTouchMoveCoordinates: TouchMoveCoordinates | null = null; //only use on touchscreens to track touch movement
|
||||||
|
|
||||||
@ -105,6 +107,7 @@ class CoWebsiteManager {
|
|||||||
this.cowebsiteMainDom = HtmlUtils.getElementByIdOrFail<HTMLDivElement>(cowebsiteMainDomId);
|
this.cowebsiteMainDom = HtmlUtils.getElementByIdOrFail<HTMLDivElement>(cowebsiteMainDomId);
|
||||||
this.cowebsiteBufferDom = HtmlUtils.getElementByIdOrFail<HTMLDivElement>(cowebsiteBufferDomId);
|
this.cowebsiteBufferDom = HtmlUtils.getElementByIdOrFail<HTMLDivElement>(cowebsiteBufferDomId);
|
||||||
this.cowebsiteAsideDom = HtmlUtils.getElementByIdOrFail<HTMLDivElement>(cowebsiteAsideDomId);
|
this.cowebsiteAsideDom = HtmlUtils.getElementByIdOrFail<HTMLDivElement>(cowebsiteAsideDomId);
|
||||||
|
this.cowebsiteAsideHolderDom = HtmlUtils.getElementByIdOrFail<HTMLDivElement>(cowebsiteAsideHolderDomId);
|
||||||
this.cowebsiteSubIconsDom = HtmlUtils.getElementByIdOrFail<HTMLDivElement>(cowebsiteSubIconsDomId);
|
this.cowebsiteSubIconsDom = HtmlUtils.getElementByIdOrFail<HTMLDivElement>(cowebsiteSubIconsDomId);
|
||||||
this.initResizeListeners();
|
this.initResizeListeners();
|
||||||
|
|
||||||
@ -194,21 +197,23 @@ class CoWebsiteManager {
|
|||||||
this.fire();
|
this.fire();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.cowebsiteAsideDom.addEventListener("mousedown", (event) => {
|
this.cowebsiteAsideHolderDom.addEventListener("mousedown", (event) => {
|
||||||
|
if (this.isFullScreen) return;
|
||||||
this.cowebsiteMainDom.style.display = "none";
|
this.cowebsiteMainDom.style.display = "none";
|
||||||
this.resizing = true;
|
this.resizing = true;
|
||||||
document.addEventListener("mousemove", movecallback);
|
document.addEventListener("mousemove", movecallback);
|
||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener("mouseup", (event) => {
|
document.addEventListener("mouseup", (event) => {
|
||||||
if (!this.resizing) return;
|
if (!this.resizing || this.isFullScreen) return;
|
||||||
document.removeEventListener("mousemove", movecallback);
|
document.removeEventListener("mousemove", movecallback);
|
||||||
this.cowebsiteMainDom.style.display = "block";
|
this.cowebsiteMainDom.style.display = "block";
|
||||||
this.resizing = false;
|
this.resizing = false;
|
||||||
this.cowebsiteMainDom.style.display = "flex";
|
this.cowebsiteMainDom.style.display = "flex";
|
||||||
});
|
});
|
||||||
|
|
||||||
this.cowebsiteAsideDom.addEventListener("touchstart", (event) => {
|
this.cowebsiteAsideHolderDom.addEventListener("touchstart", (event) => {
|
||||||
|
if (this.isFullScreen) return;
|
||||||
this.cowebsiteMainDom.style.display = "none";
|
this.cowebsiteMainDom.style.display = "none";
|
||||||
this.resizing = true;
|
this.resizing = true;
|
||||||
const touchEvent = event.touches[0];
|
const touchEvent = event.touches[0];
|
||||||
@ -217,7 +222,7 @@ class CoWebsiteManager {
|
|||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener("touchend", (event) => {
|
document.addEventListener("touchend", (event) => {
|
||||||
if (!this.resizing) return;
|
if (!this.resizing || this.isFullScreen) return;
|
||||||
this.previousTouchMoveCoordinates = null;
|
this.previousTouchMoveCoordinates = null;
|
||||||
document.removeEventListener("touchmove", movecallback);
|
document.removeEventListener("touchmove", movecallback);
|
||||||
this.cowebsiteMainDom.style.display = "block";
|
this.cowebsiteMainDom.style.display = "block";
|
||||||
@ -642,17 +647,22 @@ class CoWebsiteManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fullscreen(): void {
|
private fullscreen(): void {
|
||||||
|
const openFullscreenImage = HtmlUtils.getElementByIdOrFail(cowebsiteOpenFullScreenImageId);
|
||||||
|
const closeFullScreenImage = HtmlUtils.getElementByIdOrFail(cowebsiteCloseFullScreenImageId);
|
||||||
|
|
||||||
if (this.isFullScreen) {
|
if (this.isFullScreen) {
|
||||||
this.resetStyleMain();
|
this.resetStyleMain();
|
||||||
this.fire();
|
this.fire();
|
||||||
//we don't trigger a resize of the phaser game since it won't be visible anyway.
|
//we don't trigger a resize of the phaser game since it won't be visible anyway.
|
||||||
HtmlUtils.getElementByIdOrFail(cowebsiteOpenFullScreenImageId).style.display = "inline";
|
this.cowebsiteAsideHolderDom.style.visibility = "visible";
|
||||||
HtmlUtils.getElementByIdOrFail(cowebsiteCloseFullScreenImageId).style.display = "none";
|
openFullscreenImage.style.display = "inline";
|
||||||
|
closeFullScreenImage.style.display = "none";
|
||||||
} else {
|
} else {
|
||||||
this.verticalMode ? (this.height = window.innerHeight) : (this.width = window.innerWidth);
|
this.verticalMode ? (this.height = window.innerHeight) : (this.width = window.innerWidth);
|
||||||
//we don't trigger a resize of the phaser game since it won't be visible anyway.
|
//we don't trigger a resize of the phaser game since it won't be visible anyway.
|
||||||
HtmlUtils.getElementByIdOrFail(cowebsiteOpenFullScreenImageId).style.display = "none";
|
this.cowebsiteAsideHolderDom.style.visibility = "hidden";
|
||||||
HtmlUtils.getElementByIdOrFail(cowebsiteCloseFullScreenImageId).style.display = "inline";
|
openFullscreenImage.style.display = "none";
|
||||||
|
closeFullScreenImage.style.display = "inline";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
||||||
#cowebsite-aside-holder {
|
#cowebsite-aside-holder {
|
||||||
pointer-events: none;
|
background: gray;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
img {
|
img {
|
||||||
width: 80%;
|
width: 80%;
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,12 +207,14 @@
|
|||||||
|
|
||||||
aside {
|
aside {
|
||||||
width: 30px;
|
width: 30px;
|
||||||
cursor: ew-resize;
|
|
||||||
|
|
||||||
img {
|
img {
|
||||||
cursor: ew-resize;
|
|
||||||
transform: rotate(90deg);
|
transform: rotate(90deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&-aside-holder {
|
||||||
|
cursor: ew-resize;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,7 @@ module.exports = {
|
|||||||
DISABLE_NOTIFICATIONS: false,
|
DISABLE_NOTIFICATIONS: false,
|
||||||
PUSHER_URL: undefined,
|
PUSHER_URL: undefined,
|
||||||
UPLOADER_URL: null,
|
UPLOADER_URL: null,
|
||||||
ADMIN_URL: undefined,
|
ADMIN_URL: null,
|
||||||
CONTACT_URL: null,
|
CONTACT_URL: null,
|
||||||
PROFILE_URL: null,
|
PROFILE_URL: null,
|
||||||
ICON_URL: null,
|
ICON_URL: null,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
FROM thecodingmachine/nodejs:12-apache
|
FROM thecodingmachine/php:8.1-v4-apache-node12
|
||||||
|
|
||||||
COPY --chown=docker:docker . .
|
COPY --chown=docker:docker . .
|
||||||
#RUN yarn install
|
#RUN yarn install
|
||||||
@ -6,4 +6,5 @@ COPY --chown=docker:docker . .
|
|||||||
#ENV NODE_ENV=production
|
#ENV NODE_ENV=production
|
||||||
#ENV STARTUP_COMMAND_1="yarn run build"
|
#ENV STARTUP_COMMAND_1="yarn run build"
|
||||||
#ENV APACHE_DOCUMENT_ROOT=dist/
|
#ENV APACHE_DOCUMENT_ROOT=dist/
|
||||||
RUN sudo a2enmod headers
|
#RUN sudo a2enmod headers
|
||||||
|
ENV APACHE_EXTENSION_HEADERS=1
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
{
|
{
|
||||||
"name":"openWebsite",
|
"name":"openWebsite",
|
||||||
"type":"string",
|
"type":"string",
|
||||||
"value":"website_in_map_script.html"
|
"value":"website_in_map_script.php"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name":"openWebsiteAllowApi",
|
"name":"openWebsiteAllowApi",
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
<script src="<?php echo $_SERVER["FRONT_URL"] ?>/iframe_api.js"></script>
|
||||||
<script>
|
<script>
|
||||||
var script = document.createElement('script');
|
|
||||||
// Don't do this at home kids! The "document.referrer" part is actually inserting a XSS security.
|
|
||||||
// We are OK in this precise case because the HTML page is hosted on the "maps" domain that contains only static files.
|
|
||||||
script.setAttribute('src', document.referrer + 'iframe_api.js');
|
|
||||||
document.head.appendChild(script);
|
|
||||||
window.addEventListener('load', () => {
|
window.addEventListener('load', () => {
|
||||||
console.log('On load');
|
console.log('On load');
|
||||||
WA.onInit().then(() => {
|
WA.onInit().then(() => {
|
@ -1,18 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<script>
|
|
||||||
var script = document.createElement('script');
|
|
||||||
// Don't do this at home kids! The "document.referrer" part is actually inserting a XSS security.
|
|
||||||
// We are OK in this precise case because the HTML page is hosted on the "maps" domain that contains only static files.
|
|
||||||
script.setAttribute('src', document.referrer + 'iframe_api.js');
|
|
||||||
document.head.appendChild(script);
|
|
||||||
window.addEventListener('load', () => {
|
|
||||||
WA.chat.sendChatMessage('The iframe opened by a script works !', 'Mr Robot');
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Website opened by script.</p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1 +1 @@
|
|||||||
WA.nav.openCoWebSite("cowebsiteAllowApi.html", true, "");
|
WA.nav.openCoWebSite("cowebsiteAllowApi.php", true, "");
|
||||||
|
14
maps/tests/Metadata/cowebsiteAllowApi.php
Normal file
14
maps/tests/Metadata/cowebsiteAllowApi.php
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<script src="<?php echo $_SERVER["FRONT_URL"] ?>/iframe_api.js"></script>
|
||||||
|
<script>
|
||||||
|
window.addEventListener('load', () => {
|
||||||
|
WA.chat.sendChatMessage('The iframe opened by a script works !', 'Mr Robot');
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>Website opened by script.</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -1,20 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<title>API in iframe menu</title>
|
|
||||||
<script>
|
|
||||||
var script = document.createElement('script');
|
|
||||||
// Don't do this at home kids! The "document.referrer" part is actually inserting a XSS security.
|
|
||||||
// We are OK in this precise case because the HTML page is hosted on the "maps" domain that contains only static files.
|
|
||||||
script.setAttribute('src', document.referrer + 'iframe_api.js');
|
|
||||||
document.head.appendChild(script);
|
|
||||||
window.addEventListener('load', () => {
|
|
||||||
WA.chat.sendChatMessage('The iframe opened by a script works !', 'Mr Robot');
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="text-align: center">
|
|
||||||
<p style="color: whitesmoke">This is an iframe in a custom menu.</p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
16
maps/tests/Metadata/customIframeMenuApi.php
Normal file
16
maps/tests/Metadata/customIframeMenuApi.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>API in iframe menu</title>
|
||||||
|
<script src="<?php echo $_SERVER["FRONT_URL"] ?>/iframe_api.js"></script>
|
||||||
|
<script>
|
||||||
|
window.addEventListener('load', () => {
|
||||||
|
WA.chat.sendChatMessage('The iframe opened by a script works !', 'Mr Robot');
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body style="text-align: center">
|
||||||
|
<p style="color: whitesmoke">This is an iframe in a custom menu.</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -1,18 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<script>
|
|
||||||
var script = document.createElement('script');
|
|
||||||
// Don't do this at home kids! The "document.referrer" part is actually inserting a XSS security.
|
|
||||||
// We are OK in this precise case because the HTML page is hosted on the "maps" domain that contains only static files.
|
|
||||||
script.setAttribute('src', document.referrer + 'iframe_api.js');
|
|
||||||
document.head.appendChild(script);
|
|
||||||
window.addEventListener('load', () => {
|
|
||||||
WA.ui.registerMenuCommand('test', 'customIframeMenu.html', {autoClose: true});
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Add a custom menu</p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -7,7 +7,7 @@ WA.ui.registerMenuCommand('custom callback menu', () => {
|
|||||||
WA.ui.registerMenuCommand('custom iframe menu', {iframe: 'customIframeMenu.html'});
|
WA.ui.registerMenuCommand('custom iframe menu', {iframe: 'customIframeMenu.html'});
|
||||||
|
|
||||||
WA.room.onEnterZone('iframeMenu', () => {
|
WA.room.onEnterZone('iframeMenu', () => {
|
||||||
menuIframeApi = WA.ui.registerMenuCommand('IFRAME USE API', {iframe: 'customIframeMenuApi.html', allowApi: true});
|
menuIframeApi = WA.ui.registerMenuCommand('IFRAME USE API', {iframe: 'customIframeMenuApi.php', allowApi: true});
|
||||||
})
|
})
|
||||||
|
|
||||||
WA.room.onLeaveZone('iframeMenu', () => {
|
WA.room.onLeaveZone('iframeMenu', () => {
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
{
|
{
|
||||||
"name":"openWebsite",
|
"name":"openWebsite",
|
||||||
"type":"string",
|
"type":"string",
|
||||||
"value":"customMenu.html"
|
"value":"customMenu.php"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name":"openWebsiteAllowApi",
|
"name":"openWebsiteAllowApi",
|
||||||
|
14
maps/tests/Metadata/customMenu.php
Normal file
14
maps/tests/Metadata/customMenu.php
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<script src="<?php echo $_SERVER["FRONT_URL"] ?>/iframe_api.js"></script>
|
||||||
|
<script>
|
||||||
|
window.addEventListener('load', () => {
|
||||||
|
WA.ui.registerMenuCommand('test', 'customIframeMenu.html', {autoClose: true});
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>Add a custom menu</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -1,18 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<script>
|
|
||||||
var script = document.createElement('script');
|
|
||||||
// Don't do this at home kids! The "document.referrer" part is actually inserting a XSS security.
|
|
||||||
// We are OK in this precise case because the HTML page is hosted on the "maps" domain that contains only static files.
|
|
||||||
script.setAttribute('src', document.referrer + 'iframe_api.js');
|
|
||||||
document.head.appendChild(script);
|
|
||||||
window.addEventListener('load', () => {
|
|
||||||
WA.player.onPlayerMove(console.log);
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Log in the console the movement of the current player in the zone of the iframe</p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -36,7 +36,7 @@
|
|||||||
{
|
{
|
||||||
"name":"openWebsite",
|
"name":"openWebsite",
|
||||||
"type":"string",
|
"type":"string",
|
||||||
"value":"playerMove.html"
|
"value":"playerMove.php"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name":"openWebsiteAllowApi",
|
"name":"openWebsiteAllowApi",
|
||||||
|
14
maps/tests/Metadata/playerMove.php
Normal file
14
maps/tests/Metadata/playerMove.php
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<script src="<?php echo $_SERVER["FRONT_URL"] ?>/iframe_api.js"></script>
|
||||||
|
<script>
|
||||||
|
window.addEventListener('load', () => {
|
||||||
|
WA.player.onPlayerMove(console.log);
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>Log in the console the movement of the current player in the zone of the iframe</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -36,7 +36,7 @@
|
|||||||
{
|
{
|
||||||
"name":"openWebsite",
|
"name":"openWebsite",
|
||||||
"type":"string",
|
"type":"string",
|
||||||
"value":"setProperty.html"
|
"value":"setProperty.php"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name":"openWebsiteAllowApi",
|
"name":"openWebsiteAllowApi",
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
<script src="<?php echo $_SERVER["FRONT_URL"] ?>/iframe_api.js"></script>
|
||||||
<script>
|
<script>
|
||||||
var script = document.createElement('script');
|
|
||||||
// Don't do this at home kids! The "document.referrer" part is actually inserting a XSS security.
|
|
||||||
// We are OK in this precise case because the HTML page is hosted on the "maps" domain that contains only static files.
|
|
||||||
script.setAttribute('src', document.referrer + 'iframe_api.js');
|
|
||||||
document.head.appendChild(script);
|
|
||||||
window.addEventListener('load', () => {
|
window.addEventListener('load', () => {
|
||||||
WA.room.setProperty('iframeTest', 'openWebsite', 'https://www.wikipedia.org/');
|
WA.room.setProperty('iframeTest', 'openWebsite', 'https://www.wikipedia.org/');
|
||||||
WA.room.setProperty('metadata', 'openWebsite', 'https://www.wikipedia.org/');
|
WA.room.setProperty('metadata', 'openWebsite', 'https://www.wikipedia.org/');
|
@ -1,12 +1,8 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
<script src="<?php echo $_SERVER["FRONT_URL"] ?>/iframe_api.js"></script>
|
||||||
<script>
|
<script>
|
||||||
var script = document.createElement('script');
|
|
||||||
// Don't do this at home kids! The "document.referrer" part is actually inserting a XSS security.
|
|
||||||
// We are OK in this precise case because the HTML page is hosted on the "maps" domain that contains only static files.
|
|
||||||
script.setAttribute('src', document.referrer + 'iframe_api.js');
|
|
||||||
document.head.appendChild(script);
|
|
||||||
|
|
||||||
window.addEventListener('load', () => {
|
window.addEventListener('load', () => {
|
||||||
WA.room.setTiles([
|
WA.room.setTiles([
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
{
|
{
|
||||||
"name":"openWebsite",
|
"name":"openWebsite",
|
||||||
"type":"string",
|
"type":"string",
|
||||||
"value":"setTiles.html"
|
"value":"setTiles.php"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name":"openWebsiteAllowApi",
|
"name":"openWebsiteAllowApi",
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
<script src="<?php echo $_SERVER["FRONT_URL"] ?>/iframe_api.js"></script>
|
||||||
<script>
|
<script>
|
||||||
var script = document.createElement('script');
|
|
||||||
// Don't do this at home kids! The "document.referrer" part is actually inserting a XSS security.
|
|
||||||
// We are OK in this precise case because the HTML page is hosted on the "maps" domain that contains only static files.
|
|
||||||
script.setAttribute('src', document.referrer + 'iframe_api.js');
|
|
||||||
document.head.appendChild(script);
|
|
||||||
window.addEventListener('load', () => {
|
window.addEventListener('load', () => {
|
||||||
document.getElementById('show/hideLayer').onclick = () => {
|
document.getElementById('show/hideLayer').onclick = () => {
|
||||||
if (document.getElementById('show/hideLayer').checked) {
|
if (document.getElementById('show/hideLayer').checked) {
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
{
|
{
|
||||||
"name":"openWebsite",
|
"name":"openWebsite",
|
||||||
"type":"string",
|
"type":"string",
|
||||||
"value":"showHideLayer.html"
|
"value":"showHideLayer.php"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name":"openWebsiteAllowApi",
|
"name":"openWebsiteAllowApi",
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
{
|
{
|
||||||
"name":"openWebsite",
|
"name":"openWebsite",
|
||||||
"type":"string",
|
"type":"string",
|
||||||
"value":"shared_variables.html"
|
"value":"shared_variables.php"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name":"openWebsiteAllowApi",
|
"name":"openWebsiteAllowApi",
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
<script src="<?php echo $_SERVER["FRONT_URL"] ?>/iframe_api.js"></script>
|
||||||
<script>
|
<script>
|
||||||
var script = document.createElement('script');
|
|
||||||
// Don't do this at home kids! The "document.referrer" part is actually inserting a XSS security.
|
|
||||||
// We are OK in this precise case because the HTML page is hosted on the "maps" domain that contains only static files.
|
|
||||||
script.setAttribute('src', document.referrer + 'iframe_api.js');
|
|
||||||
document.head.appendChild(script);
|
|
||||||
window.addEventListener('load', () => {
|
window.addEventListener('load', () => {
|
||||||
console.log('On load');
|
console.log('On load');
|
||||||
WA.onInit().then(() => {
|
WA.onInit().then(() => {
|
@ -1,13 +1,7 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<script>
|
<script src="<?php echo $_SERVER["FRONT_URL"] ?>/iframe_api.js"></script>
|
||||||
var script = document.createElement('script');
|
|
||||||
// Don't do this at home kids! The "document.referrer" part is actually inserting a XSS security.
|
|
||||||
// We are OK in this precise case because the HTML page is hosted on the "maps" domain that contains only static files.
|
|
||||||
script.setAttribute('src', document.referrer + 'iframe_api.js');
|
|
||||||
document.head.appendChild(script);
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<button id="sendchat">Send chat message</button>
|
<button id="sendchat">Send chat message</button>
|
@ -43,7 +43,7 @@
|
|||||||
{
|
{
|
||||||
"name":"openWebsite",
|
"name":"openWebsite",
|
||||||
"type":"string",
|
"type":"string",
|
||||||
"value":"iframe.html"
|
"value":"iframe.php"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name":"openWebsiteAllowApi",
|
"name":"openWebsiteAllowApi",
|
||||||
|
@ -4,8 +4,9 @@ const fs = require('fs')
|
|||||||
import { Selector } from 'testcafe';
|
import { Selector } from 'testcafe';
|
||||||
import {userAlice} from "./utils/roles";
|
import {userAlice} from "./utils/roles";
|
||||||
|
|
||||||
|
// Note: we are also testing that we can connect if the URL contains a random query string
|
||||||
fixture `Variables`
|
fixture `Variables`
|
||||||
.page `http://play.workadventure.localhost/_/global/maps.workadventure.localhost/tests/Variables/Cache/variables_tmp.json`;
|
.page `http://play.workadventure.localhost/_/global/maps.workadventure.localhost/tests/Variables/Cache/variables_tmp.json?somerandomparam=1`;
|
||||||
|
|
||||||
test("Test that variables cache in the back don't prevent setting a variable in case the map changes", async (t: TestController) => {
|
test("Test that variables cache in the back don't prevent setting a variable in case the map changes", async (t: TestController) => {
|
||||||
// Let's start by visiting a map that DOES not have the variable.
|
// Let's start by visiting a map that DOES not have the variable.
|
||||||
|
Loading…
Reference in New Issue
Block a user