[WIP] A simple wake-on-lan service

images... 🫩 (serve info.icon at /favicon.ico)

vielle.dev ede6e7c9 010994e4

verified
+41 -1
+1
.gitignore
··· 1 1 /target 2 2 /web/dist 3 3 /wol.toml 4 + /favicon.* 4 5 5 6 # Logs 6 7 /web/logs
+33
Cargo.lock
··· 375 375 ] 376 376 377 377 [[package]] 378 + name = "http-range-header" 379 + version = "0.4.2" 380 + source = "registry+https://github.com/rust-lang/crates.io-index" 381 + checksum = "9171a2ea8a68358193d15dd5d70c1c10a2afc3e7e4c5bc92bc9f025cebd7359c" 382 + 383 + [[package]] 378 384 name = "httparse" 379 385 version = "1.10.1" 380 386 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 676 682 version = "0.3.17" 677 683 source = "registry+https://github.com/rust-lang/crates.io-index" 678 684 checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" 685 + 686 + [[package]] 687 + name = "mime_guess" 688 + version = "2.0.5" 689 + source = "registry+https://github.com/rust-lang/crates.io-index" 690 + checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" 691 + dependencies = [ 692 + "mime", 693 + "unicase", 694 + ] 679 695 680 696 [[package]] 681 697 name = "mio" ··· 1436 1452 dependencies = [ 1437 1453 "bitflags", 1438 1454 "bytes", 1455 + "futures-core", 1439 1456 "futures-util", 1440 1457 "http", 1441 1458 "http-body", 1459 + "http-body-util", 1460 + "http-range-header", 1461 + "httpdate", 1442 1462 "iri-string", 1463 + "mime", 1464 + "mime_guess", 1465 + "percent-encoding", 1443 1466 "pin-project-lite", 1467 + "tokio", 1468 + "tokio-util", 1444 1469 "tower", 1445 1470 "tower-layer", 1446 1471 "tower-service", 1472 + "tracing", 1447 1473 ] 1448 1474 1449 1475 [[package]] ··· 1483 1509 version = "0.2.5" 1484 1510 source = "registry+https://github.com/rust-lang/crates.io-index" 1485 1511 checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" 1512 + 1513 + [[package]] 1514 + name = "unicase" 1515 + version = "2.9.0" 1516 + source = "registry+https://github.com/rust-lang/crates.io-index" 1517 + checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142" 1486 1518 1487 1519 [[package]] 1488 1520 name = "unicode-ident" ··· 1926 1958 "thiserror 2.0.18", 1927 1959 "tokio", 1928 1960 "toml", 1961 + "tower-http", 1929 1962 ] 1930 1963 1931 1964 [[package]]
+1
Cargo.toml
··· 12 12 serde_json = "1.0.149" 13 13 reqwest = "0.13.2" 14 14 ping = "0.7.1" 15 + tower-http = { version = "0.6.8", features = ["fs"] } 15 16 16 17 [build-dependencies] 17 18 serde = { version = "1.0.228", features = ["derive"] }
+2
src/server/mod.rs
··· 5 5 middleware::{self}, 6 6 routing::{get, post}, 7 7 }; 8 + use tower_http::services::ServeFile; 8 9 9 10 use crate::config::Config; 10 11 ··· 19 20 .route("/wake", post(wake::main)) 20 21 .route("/config", get(config::main)) 21 22 .route("/ping", get(ping::main)) 23 + .nest_service("/favicon.ico", ServeFile::new(&conf.info.icon)) 22 24 .with_state(Arc::new(conf)) 23 25 .merge(dist::main()) 24 26 .layer(middleware::from_fn(log::main))
+4 -1
web/src/App.svelte
··· 20 20 <ThemeProvider /> 21 21 <main> 22 22 <div></div> 23 - <h1>{config.info.title}</h1> 23 + <h1> 24 + {config.info.title} 25 + <img src="/favicon.ico" alt="" style:height="1ch" /> 26 + </h1> 24 27 <ul class="targets"> 25 28 {#each targets as [name, { mac, ip, url }]} 26 29 <li>