-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathinstalled apps.html
More file actions
31 lines (26 loc) · 863 Bytes
/
installed apps.html
File metadata and controls
31 lines (26 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<iframe
id="bjhosFrame"
src="https://bjh-os.alwaysdata.net/Apps-Market/installed_apps.php"
style="width:100%; height:100vh; border:none;">
</iframe>
<script>
// Save session coming from iframe
window.addEventListener("message", (event) => {
if (event.data?.type === "LOGIN_SUCCESS") {
localStorage.setItem("BJHOS_SESSION", event.data.session);
}
if (event.data?.type === "LOGOUT") {
localStorage.removeItem("BJHOS_SESSION");
}
});
// Send session to iframe on load
document.getElementById("bjhosFrame").addEventListener("load", () => {
const savedSession = localStorage.getItem("BJHOS_SESSION");
if (savedSession) {
event.target.contentWindow.postMessage({
type: "RESTORE_SESSION",
session: savedSession
}, "*");
}
});
</script>