Skip to content

Commit

Permalink
Implementation of LXD PWA with a dynamic start_url"
Browse files Browse the repository at this point in the history
Signed-off-by: Nkeiruka <[email protected]>
  • Loading branch information
Kxiru committed May 28, 2024
1 parent 130bb42 commit 56625c2
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 11 deletions.
71 changes: 60 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,68 @@
<!doctype html>

<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

<title>LXD UI</title>
<link rel="shortcut icon" href="/assets/img/favicon-32x32.png" type="image/x-icon">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

<script>const global = globalThis;</script>
</head>
<body>
<title>LXD UI</title>
<link rel="shortcut icon" href="/assets/img/favicon-32x32.png" type="image/x-icon">
<link rel="manifest" href="/manifest.json" id="manifest">

<div id="app"></div>
<script type="module" src="/src/index.tsx"></script>
<script>const global = globalThis;

</script>
</head>

<body>

<div id="app"></div>
<script type="module" src="/src/index.tsx"></script>

</body>

</body>
</html>

<script>

var screenshot = window.location.origin + "/assets/img/LXD-screenshot.png";

const manifestElement = document.getElementById("manifest");
const dynamicManifest = JSON.stringify({
"short_name": "LXD",
"name": "LXD-UI",
"icons": [
{
"src": window.location.origin + "/assets/img/canonical-lxd-512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"id": "LXDID",
"start_url": window.location.origin,
"background_color": "#E95420",
"display": "standalone",
"scope": "/",
"theme_color": "#E95420",
"shortcuts": [],
"description": "LXD provides a unified user experience for managing system containers and virtual machines.",
"screenshots": [
{
"src": screenshot,
"type": "image/png",
"sizes": "954x953",
"form_factor": "wide"
},
{
"src": screenshot,
"type": "image/png",
"sizes": "954x953"
}]
})

manifestElement?.setAttribute(
"href",
"data:application/json;charset=utf-8," + encodeURIComponent(dynamicManifest)
);
</script>
Binary file added public/assets/img/LXD-screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/img/canonical-lxd-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 56625c2

Please sign in to comment.