mirror of
https://github.com/Vale54321/schafkop-neu.git
synced 2025-12-15 19:29:34 +01:00
delete back and frontend
add schafkopf os add build firmware action
This commit is contained in:
1
schafkopf-os/.gitignore
vendored
Normal file
1
schafkopf-os/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
target/
|
||||
7
schafkopf-os/Cargo.lock
generated
Normal file
7
schafkopf-os/Cargo.lock
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "schafkopf-os"
|
||||
version = "0.1.0"
|
||||
4
schafkopf-os/Cargo.toml
Normal file
4
schafkopf-os/Cargo.toml
Normal file
@@ -0,0 +1,4 @@
|
||||
[package]
|
||||
name = "schafkopf-os"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
27
schafkopf-os/README.md
Normal file
27
schafkopf-os/README.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# schafkopf-os — Test Frontend (Axum + Askama)
|
||||
|
||||
This crate serves a tiny test frontend using Axum + Askama and static assets.
|
||||
|
||||
## Run
|
||||
|
||||
```bash
|
||||
cargo run --manifest-path schafkopf-os/Cargo.toml
|
||||
```
|
||||
|
||||
Then open:
|
||||
|
||||
- http://127.0.0.1:3000 — server renders an Askama template
|
||||
- Click "Ping API" to call `GET /api/ping`
|
||||
|
||||
Or test the API directly:
|
||||
|
||||
```bash
|
||||
curl -s http://127.0.0.1:3000/api/ping | jq
|
||||
```
|
||||
|
||||
## Structure
|
||||
|
||||
- `src/main.rs` — Axum server with routes `/` and `/api/ping`, and static files at `/static`
|
||||
- `templates/index.html` — Askama template for the homepage
|
||||
- `static/styles.css` — Minimal styling
|
||||
- `static/app.js` — Browser script to call the ping API
|
||||
3
schafkopf-os/src/main.rs
Normal file
3
schafkopf-os/src/main.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
25
schafkopf-os/static/app.js
Normal file
25
schafkopf-os/static/app.js
Normal file
@@ -0,0 +1,25 @@
|
||||
const btn = document.getElementById('pingBtn');
|
||||
const versionBtn = document.getElementById('versionBtn');
|
||||
const out = document.getElementById('result');
|
||||
|
||||
btn?.addEventListener('click', async () => {
|
||||
out.textContent = 'Requesting /api/ping…';
|
||||
try {
|
||||
const res = await fetch('/api/ping');
|
||||
const json = await res.json();
|
||||
out.textContent = JSON.stringify(json, null, 2);
|
||||
} catch (err) {
|
||||
out.textContent = 'Error: ' + (err?.message || String(err));
|
||||
}
|
||||
});
|
||||
|
||||
versionBtn?.addEventListener('click', async () => {
|
||||
out.textContent = 'Requesting /api/version…';
|
||||
try {
|
||||
const res = await fetch('/api/version');
|
||||
const json = await res.json();
|
||||
out.textContent = JSON.stringify(json, null, 2);
|
||||
} catch (err) {
|
||||
out.textContent = 'Error: ' + (err?.message || String(err));
|
||||
}
|
||||
});
|
||||
28
schafkopf-os/static/styles.css
Normal file
28
schafkopf-os/static/styles.css
Normal file
@@ -0,0 +1,28 @@
|
||||
/* Minimal styles for the test frontend */
|
||||
:root {
|
||||
color-scheme: light dark;
|
||||
--bg: #0e1217;
|
||||
--fg: #e9eef5;
|
||||
--muted: #94a3b8;
|
||||
--accent: #4f46e5;
|
||||
--card: #111827;
|
||||
--border: #1f2937;
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
html, body { margin: 0; padding: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji"; }
|
||||
|
||||
body { background: var(--bg); color: var(--fg); }
|
||||
|
||||
.container { max-width: 800px; margin: 3rem auto; padding: 0 1rem; }
|
||||
|
||||
h1 { font-size: 1.8rem; margin: 0 0 1rem; }
|
||||
.lead { color: var(--muted); margin: 0 0 1rem; }
|
||||
.version { color: var(--muted); font-size: 0.9rem; margin: 0 0 1.5rem; }
|
||||
|
||||
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; }
|
||||
|
||||
button { background: var(--accent); color: white; border: none; padding: 0.6rem 1rem; border-radius: 8px; cursor: pointer; margin-right: 0.5rem; }
|
||||
button:hover { filter: brightness(1.1); }
|
||||
|
||||
pre { background: #0b0f14; border: 1px solid var(--border); padding: 0.75rem; border-radius: 8px; overflow: auto; }
|
||||
25
schafkopf-os/templates/index.html
Normal file
25
schafkopf-os/templates/index.html
Normal file
@@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>{{ title }}</title>
|
||||
<link rel="stylesheet" href="/static/styles.css" />
|
||||
</head>
|
||||
<body>
|
||||
<main class="container">
|
||||
<h1>{{ title }}</h1>
|
||||
<p class="lead">{{ message }}</p>
|
||||
<p class="version">Version: {{ version }}</p>
|
||||
|
||||
<section class="card">
|
||||
<h2>API Test</h2>
|
||||
<button id="pingBtn">Ping API</button>
|
||||
<button id="versionBtn">Get Version</button>
|
||||
<pre id="result">Waiting…</pre>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<script src="/static/app.js" type="module"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user