7 Commits
10 changed files with 74 additions and 26 deletions

No files matched your search

File renamed without changes.
+2 -5
View File
@@ -1,8 +1,5 @@
you should use block code to refence code, like so:
you can use block code as so:
```rust
hello_world!(println);
// indented lines
```
in the chat. Else it fucks up formatting.
We work towards clean, maintainable design. im not the best at this thing.
in the chat.
Generated
+1 -1
View File
@@ -1179,7 +1179,7 @@ checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65"
[[package]]
name = "wakey"
version = "0.1.4"
version = "0.1.2"
dependencies = [
"axum",
"axum-extra",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "wakey"
version = "0.1.4"
version = "0.1.2"
edition = "2024"
publish = ["gitea"]
+60
View File
@@ -0,0 +1,60 @@
# taking back my code AHHHH
this is going to be lengthy. ci is spotless but idk how it works cuz powershell. this is good but i cant afford VPN on the router; we will need to do some bullshit.
## overview
we need a:
- small ahh bin in the router.
- forwards a shell and some functions.
- may be shell calling fns maybe some unsafe c. i cant unsafe c.
- big ahh bin in the vps.
- connect to the small ahh bin thru the wide ass internet.
- forwards some APIs.
- static site
- now need no hosts; apis can be called anywhere anyway.
- do offer these in the big ahh bins tho lets not miss out some shit.
- automation
- gitea
- on the vps or the uh idk.
- ABSOLUTELY can auto build main:latest every day / other day.
- and releases.
- router
- a script to pull the tar. from actions artifacts or from releases. (lua or shell yo)
- a script for the bin and the init.d scripts for these two.
- vps
- a systemd service (ima use ai for ts ngl)
- an auto updater. maybe we overkill and dnf. maybe go easy and git clone + cargo install. maybe we pull from release or nightly. idk
i think idk
## router
### current
everything.
we have some functions that call ip neigh a bajillion times.
we have some other functions that read the same file/folder in /sys or sum shit.
we have a function that broadcast to a set ahh address.
we have some routes; and some data structures acting as schema for them ahh. we dont do posts with json but gets with query strings for some ahh reasons.
these are carryover from the early days.
also from the early days are the js.
static was 100% ai with 0 intervention.
we have a search bar of sort that hooks through a smart endpoint that searches for everything.
we have some bullshit. and two buttons to check and wake. that pings `/api/smart/{query}` and `/wake?name=query`. why.
we have the result of the wake and or status and the errors in the first text box.
the list of cliets with names connected to the router the second box.
thats cool.
### changes?
idk changes.
+5 -5
View File
@@ -2,12 +2,12 @@
START=66
start() {
LOGFILE=/var/log/update_wakey.log
MAX_RETRIES=10
RETRY_COUNT=0
LOGFILE=/var/log/update_wakey.log
MAX_RETRIES=10
RETRY_COUNT=0
# shellcheck disable=SC2016
sh -c '
# shellcheck disable=SC2016
nohup sh -c '
while [ "$RETRY_COUNT" -lt "$MAX_RETRIES" ]; do
if /etc/ldlda_help/update_wakey.sh; then
echo "[update_wakey] Success at $(date)" >>"$LOGFILE"
+2 -8
View File
@@ -1,9 +1,6 @@
use crate::{
arpparse::NUDState,
utils::{
parse::{de_many, serialize_macs},
query::get_macs,
},
utils::parse::{de_many, serialize_macs},
};
use axum::{Json, http::StatusCode, response::IntoResponse};
use axum_extra::extract::Query;
@@ -96,11 +93,9 @@ pub async fn get_status_json(
mac: mac.clone(),
};
let mut tasks = Vec::new();
// can we jus collect the whole table instead of doing this.
for d in &dev_opts {
for n in &nud_opts {
tasks.push(get_macs(
// this i hate sm
tasks.push(crate::utils::query::get_macs(
name.as_deref(),
ips_opt.as_deref(),
d.as_deref(),
@@ -115,7 +110,6 @@ pub async fn get_status_json(
{
Ok(mut table) => {
if !mac.is_empty() {
// mac here
let wanted: HashSet<MacAddr> = mac.into_iter().collect();
table.retain(|row| row.mac.map(|m| wanted.contains(&m)).unwrap_or(false));
}
+1 -1
View File
@@ -89,7 +89,7 @@ pub async fn wake_multi_split(
} else {
wake_one(
&sock,
c.try_into().expect("complete struct failed to try_into"), // type state pattern?
c.try_into().expect("complete struct failed to try_into"),
)
.await
.into()
-1
View File
@@ -7,7 +7,6 @@ pub fn get_dev() -> HashSet<String> {
if e.file_type()
.map(|ft| {
if ft.is_symlink() {
// true
fs::metadata(e.path()).map(|m| m.is_dir()).unwrap_or(false)
} else {
ft.is_dir()
+2 -4
View File
@@ -81,7 +81,7 @@ pub async fn get_macs(
state: Option<NUDState>,
) -> Result<Vec<IpNeighLine>> {
let ip_list: Option<Vec<IpAddr>> =
ips.map(|slice| slice.iter().map(|ip| ip.to_canonical()).collect());
ips.map(|slice| slice.iter().copied().map(|ip| ip.to_canonical()).collect());
let ip_list = match (ip_list, machine_name) {
(Some(list), _) => list,
(None, Some(name)) => get_ips(name).await?.collect(),
@@ -136,9 +136,7 @@ pub async fn get_mac(
Ok(rows)
}
/*
/// get macs where you just run ip neigh then rust handles the filtering (faster than get mac)
pub async fn get_macs_rust(
/* pub async fn _get_macs_good(
machine_names: Option<&str>,
ips: Option<&[IpAddr]>,
devs: Option<&[&str]>,