MicroPython stuff

This commit is contained in:
2024-05-16 20:38:19 +03:00
parent a8e26be242
commit 60ba2c59e7
17 changed files with 478 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
{% args ram_free, ram_total %}
<!doctype html>
<html>
<head>
<title>S2F Terminal</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="/static/styles.css" rel="stylesheet">
</head>
<body>
<h1>by Alexander Popov</h1>
<p>Free RAM: {{ ram_free }} of {{ ram_total }}</p>
<div>
<a href="/?cmd=ftp">Поднять FTP сервер</a><br>
<a href="/?cmd=reboot">Перезапустить</a><br>
</div>
</body>
</html>

View File

@@ -0,0 +1,23 @@
# Autogenerated file
def render(ram_free, ram_total):
yield """<!doctype html>
<html>
<head>
<title>S2F Terminal</title>
<meta charset=\"utf-8\">
<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">
<link href=\"/static/styles.css\" rel=\"stylesheet\">
</head>
<body>
<h1>by Alexander Popov</h1>
<p>Free RAM: """
yield str(ram_free)
yield """ of """
yield str(ram_total)
yield """</p>
<div>
<a href=\"/?cmd=ftp\">Поднять FTP сервер</a><br>
<a href=\"/?cmd=reboot\">Перезапустить</a><br>
</div>
</body>
</html>"""

View File

@@ -0,0 +1,35 @@
<!doctype html>
<html>
<head>
<title>Microdot Upload Example</title>
<meta charset="UTF-8">
</head>
<body>
<h1>Microdot Upload Example</h1>
<form id="form">
<input type="file" id="file" name="file" />
<input type="submit" value="Upload" />
</form>
<script>
async function upload(ev) {
ev.preventDefault();
const file = document.getElementById('file').files[0];
if (!file) {
return;
}
await fetch('/upload', {
method: 'POST',
body: file,
headers: {
'Content-Type': 'application/octet-stream',
'Content-Disposition': `attachment; filename="${file.name}"`,
},
}).then(res => {
console.log('Upload accepted');
window.location.href = '/';
});
}
document.getElementById('form').addEventListener('submit', upload);
</script>
</body>
</html>