Compare commits
7
Commits
v0.1.4
..
f4b3511057
No files matched your search
File renamed without changes.
@@ -1,8 +1,5 @@
|
|||||||
you should use block code to refence code, like so:
|
you can use block code as so:
|
||||||
```rust
|
```rust
|
||||||
hello_world!(println);
|
hello_world!(println);
|
||||||
// indented lines
|
|
||||||
```
|
```
|
||||||
in the chat. Else it fucks up formatting.
|
in the chat.
|
||||||
|
|
||||||
We work towards clean, maintainable design. im not the best at this thing.
|
|
||||||
Generated
+1
-1
@@ -1179,7 +1179,7 @@ checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wakey"
|
name = "wakey"
|
||||||
version = "0.1.4"
|
version = "0.1.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"axum",
|
"axum",
|
||||||
"axum-extra",
|
"axum-extra",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "wakey"
|
name = "wakey"
|
||||||
version = "0.1.4"
|
version = "0.1.2"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
publish = ["gitea"]
|
publish = ["gitea"]
|
||||||
|
|
||||||
|
|||||||
@@ -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.
|
||||||
@@ -7,7 +7,7 @@ start() {
|
|||||||
RETRY_COUNT=0
|
RETRY_COUNT=0
|
||||||
|
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
sh -c '
|
nohup sh -c '
|
||||||
while [ "$RETRY_COUNT" -lt "$MAX_RETRIES" ]; do
|
while [ "$RETRY_COUNT" -lt "$MAX_RETRIES" ]; do
|
||||||
if /etc/ldlda_help/update_wakey.sh; then
|
if /etc/ldlda_help/update_wakey.sh; then
|
||||||
echo "[update_wakey] Success at $(date)" >>"$LOGFILE"
|
echo "[update_wakey] Success at $(date)" >>"$LOGFILE"
|
||||||
|
|||||||
+2
-8
@@ -1,9 +1,6 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
arpparse::NUDState,
|
arpparse::NUDState,
|
||||||
utils::{
|
utils::parse::{de_many, serialize_macs},
|
||||||
parse::{de_many, serialize_macs},
|
|
||||||
query::get_macs,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
use axum::{Json, http::StatusCode, response::IntoResponse};
|
use axum::{Json, http::StatusCode, response::IntoResponse};
|
||||||
use axum_extra::extract::Query;
|
use axum_extra::extract::Query;
|
||||||
@@ -96,11 +93,9 @@ pub async fn get_status_json(
|
|||||||
mac: mac.clone(),
|
mac: mac.clone(),
|
||||||
};
|
};
|
||||||
let mut tasks = Vec::new();
|
let mut tasks = Vec::new();
|
||||||
// can we jus collect the whole table instead of doing this.
|
|
||||||
for d in &dev_opts {
|
for d in &dev_opts {
|
||||||
for n in &nud_opts {
|
for n in &nud_opts {
|
||||||
tasks.push(get_macs(
|
tasks.push(crate::utils::query::get_macs(
|
||||||
// this i hate sm
|
|
||||||
name.as_deref(),
|
name.as_deref(),
|
||||||
ips_opt.as_deref(),
|
ips_opt.as_deref(),
|
||||||
d.as_deref(),
|
d.as_deref(),
|
||||||
@@ -115,7 +110,6 @@ pub async fn get_status_json(
|
|||||||
{
|
{
|
||||||
Ok(mut table) => {
|
Ok(mut table) => {
|
||||||
if !mac.is_empty() {
|
if !mac.is_empty() {
|
||||||
// mac here
|
|
||||||
let wanted: HashSet<MacAddr> = mac.into_iter().collect();
|
let wanted: HashSet<MacAddr> = mac.into_iter().collect();
|
||||||
table.retain(|row| row.mac.map(|m| wanted.contains(&m)).unwrap_or(false));
|
table.retain(|row| row.mac.map(|m| wanted.contains(&m)).unwrap_or(false));
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -89,7 +89,7 @@ pub async fn wake_multi_split(
|
|||||||
} else {
|
} else {
|
||||||
wake_one(
|
wake_one(
|
||||||
&sock,
|
&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
|
.await
|
||||||
.into()
|
.into()
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ pub fn get_dev() -> HashSet<String> {
|
|||||||
if e.file_type()
|
if e.file_type()
|
||||||
.map(|ft| {
|
.map(|ft| {
|
||||||
if ft.is_symlink() {
|
if ft.is_symlink() {
|
||||||
// true
|
|
||||||
fs::metadata(e.path()).map(|m| m.is_dir()).unwrap_or(false)
|
fs::metadata(e.path()).map(|m| m.is_dir()).unwrap_or(false)
|
||||||
} else {
|
} else {
|
||||||
ft.is_dir()
|
ft.is_dir()
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ pub async fn get_macs(
|
|||||||
state: Option<NUDState>,
|
state: Option<NUDState>,
|
||||||
) -> Result<Vec<IpNeighLine>> {
|
) -> Result<Vec<IpNeighLine>> {
|
||||||
let ip_list: Option<Vec<IpAddr>> =
|
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) {
|
let ip_list = match (ip_list, machine_name) {
|
||||||
(Some(list), _) => list,
|
(Some(list), _) => list,
|
||||||
(None, Some(name)) => get_ips(name).await?.collect(),
|
(None, Some(name)) => get_ips(name).await?.collect(),
|
||||||
@@ -136,9 +136,7 @@ pub async fn get_mac(
|
|||||||
Ok(rows)
|
Ok(rows)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* pub async fn _get_macs_good(
|
||||||
/// get macs where you just run ip neigh then rust handles the filtering (faster than get mac)
|
|
||||||
pub async fn get_macs_rust(
|
|
||||||
machine_names: Option<&str>,
|
machine_names: Option<&str>,
|
||||||
ips: Option<&[IpAddr]>,
|
ips: Option<&[IpAddr]>,
|
||||||
devs: Option<&[&str]>,
|
devs: Option<&[&str]>,
|
||||||
|
|||||||
Reference in new issue
Block a user