feat: enhance PWA support with updated meta tags and icon paths
This commit is contained in:
parent
0dfd673ab3
commit
6e57c372cf
18
index.html
18
index.html
|
|
@ -3,16 +3,22 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover, user-scalable=no" />
|
||||
<title>Meatloaf Manipulator</title>
|
||||
<meta name="theme-color" content="#4d4d4d" />
|
||||
<link rel="manifest" href="/manifest.webmanifest" />
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="/icon-192.png" />
|
||||
<link rel="icon" type="image/png" sizes="512x512" href="/icon-512.png" />
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="/icon.192.png" />
|
||||
<link rel="icon" type="image/png" sizes="512x512" href="/icon.512.png" />
|
||||
<!-- PWA / add-to-home-screen -->
|
||||
<meta name="mobile-web-app-capable" content="yes" />
|
||||
<meta name="mobile-web-app-status-bar-style" content="black-translucent" />
|
||||
<link rel="apple-touch-icon" href="/icon-192.png" />
|
||||
<style>html, body { height: 100%; margin: 0; } #root { height: 100%; }</style>
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||
<meta name="apple-mobile-web-app-title" content="Meatloaf" />
|
||||
<link rel="apple-touch-icon" href="/icon.192.png" />
|
||||
<style>
|
||||
html, body { height: 100%; margin: 0; overscroll-behavior: none; }
|
||||
#root { height: 100%; }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
|
|
|||
|
|
@ -10,12 +10,14 @@
|
|||
{
|
||||
"src": "icon.192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
"type": "image/png",
|
||||
"purpose": "any maskable"
|
||||
},
|
||||
{
|
||||
"src": "icon.512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
"type": "image/png",
|
||||
"purpose": "any maskable"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
141
public/ws.html
141
public/ws.html
|
|
@ -1,141 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>ESP32 Web Server</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" href="data:,">
|
||||
<style>
|
||||
html {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.8rem;
|
||||
color: white;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.5rem;
|
||||
font-weight: bold;
|
||||
color: #07156d;
|
||||
}
|
||||
|
||||
.card {
|
||||
background-color: #F8F7F9;
|
||||
;
|
||||
box-shadow: 2px 2px 12px 1px rgba(140, 140, 140, .5);
|
||||
padding-top: 10px;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
.card input {
|
||||
width: 80%;
|
||||
height: 2em;
|
||||
font-size: 24px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.topnav {
|
||||
overflow: hidden;
|
||||
background-color: #4d4d4d;
|
||||
}
|
||||
.topnav img {
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 30px;
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.button {
|
||||
padding: 15px 50px;
|
||||
font-size: 24px;
|
||||
text-align: center;
|
||||
outline: none;
|
||||
color: #fff;
|
||||
background-color: #0ffa6d; //green
|
||||
border: #0ffa6d;
|
||||
border-radius: 5px;
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
.button:active {
|
||||
background-color: #fa0f0f;
|
||||
transform: translateY(2px);
|
||||
}
|
||||
|
||||
.state {
|
||||
font-size: 1.5rem;
|
||||
color: #120707;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
<title>Meatloaf WebSocket Test</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" href="data:,">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="topnav">
|
||||
<img src="assets/logo.svg" />
|
||||
<h1>WebSocket Test</h1>
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="card">
|
||||
<h2>COMMAND</h2>
|
||||
<input id="command" type="text"/>
|
||||
<p><button id="button" class="button">Execute</button></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var gateway = `ws://${window.location.hostname}/ws`;
|
||||
var websocket;
|
||||
window.addEventListener('load', onLoad);
|
||||
function initWebSocket() {
|
||||
console.log('Trying to open a WebSocket connection...');
|
||||
websocket = new WebSocket(gateway);
|
||||
websocket.onopen = onOpen;
|
||||
websocket.onclose = onClose;
|
||||
websocket.onmessage = onMessage; // <-- add this line
|
||||
}
|
||||
function onOpen(event) {
|
||||
console.log('Connection opened');
|
||||
}
|
||||
function onClose(event) {
|
||||
console.log('Connection closed');
|
||||
setTimeout(initWebSocket, 2000);
|
||||
}
|
||||
function onMessage(event) {
|
||||
var state;
|
||||
console.log(event.data);
|
||||
}
|
||||
function onLoad(event) {
|
||||
initWebSocket();
|
||||
initButton();
|
||||
}
|
||||
function initButton() {
|
||||
document.getElementById('button').addEventListener('click', execute);
|
||||
}
|
||||
function execute() {
|
||||
var command = document.getElementById('command').value;
|
||||
console.log(command);
|
||||
websocket.send(command);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -186,7 +186,7 @@ function AppPage({ title, onBack }: { title: string; onBack: () => void }) {
|
|||
return (
|
||||
<div className="size-full flex flex-col bg-neutral-50">
|
||||
<Toaster position="top-center" />
|
||||
<header className="bg-[#4d4d4d] px-0 py-0 flex-shrink-0">
|
||||
<header className="bg-[#4d4d4d] px-0 py-0 flex-shrink-0" style={{ paddingTop: 'env(safe-area-inset-top)' }}>
|
||||
<div className="flex items-stretch justify-between min-h-[56px]">
|
||||
<div className="flex items-center h-full">
|
||||
<img src={logoSvg} alt="Meatloaf" className="h-full max-h-[56px] w-auto object-contain" />
|
||||
|
|
@ -268,7 +268,7 @@ function AppPage({ title, onBack }: { title: string; onBack: () => void }) {
|
|||
{pages[currentPage]}
|
||||
</main>
|
||||
|
||||
<nav className="bg-[#4d4d4d] flex-shrink-0">
|
||||
<nav className="bg-[#4d4d4d] flex-shrink-0" style={{ paddingBottom: 'env(safe-area-inset-bottom)' }}>
|
||||
<div className="flex">
|
||||
<button
|
||||
onClick={() => setCurrentPage('status')}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user