Skip to content

Commit

Permalink
Last fixes for hack
Browse files Browse the repository at this point in the history
  • Loading branch information
abchatra committed Mar 6, 2025
1 parent 05a1973 commit d25b465
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 5 deletions.
42 changes: 39 additions & 3 deletions docfiles/script.html
Original file line number Diff line number Diff line change
Expand Up @@ -415,11 +415,47 @@ <h2 class="ui item header no-select">@title@</h2>
}

openLink = function(link) {
if (link == "/--kiosk")
{
//GEnerate a code to lauch a input text box which takes a kiosk id
const domain = pxt.BrowserUtils.isLocalHostDev() ? "http://arcade.makecode.com" : "";
const kioskId = prompt("Enter a Kiosk ID to launch the game:");
if (kioskId) {
//write a post api to save kiosk id and the share id both
//and then open the link
const postUrl = `${domain}/api/kiosk/updatecode`;
const data = {
shareId: "@id@",
kioskCode: kioskId
};
fetch(postUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
})
.then(data => {
console.log('Success:', data);
})
.catch((error) => {
console.error('Error:', error);
});
}
}
else {
const domain = pxt.BrowserUtils.isLocalHostDev() ? "https://makecode.microbit.org" : "";
const evalUrl = `${domain}${pxt.webConfig.relprefix}eval?project=@id@`;

const domain = pxt.BrowserUtils.isLocalHostDev() ? "https://makecode.microbit.org" : "";
const evalUrl = `${domain}${pxt.webConfig.relprefix}eval?project=@id@`;
window.open(evalUrl, "_blank");
}

window.open(evalUrl, "_blank");
}

</script>
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"typescript": "4.8.3"
},
"dependencies": {
"pxt-common-packages": "12.2.5",
"pxt-core": "11.3.26"
"pxt-common-packages": "12.2.6",
"pxt-core": "11.3.28"
},
"optionalDependencies": {
"pxt-arcade-sim": "microsoft/pxt-arcade-sim.git#v0.11.13"
Expand Down

0 comments on commit d25b465

Please sign in to comment.