Compare commits
2
Commits
No files matched your search
+9
-2
@@ -16,7 +16,13 @@ serde_json = "1.0.143"
|
||||
serde_with = { version = "3.14.0", features = ["json"] }
|
||||
strum = { version = "0.27.2", features = ["derive", "strum_macros"] }
|
||||
thiserror = "2.0.16"
|
||||
tokio = { version = "1.47.1", features = ["fs", "process", "rt-multi-thread", "io-util", "macros"] }
|
||||
tokio = { version = "1.47.1", features = [
|
||||
"fs",
|
||||
"process",
|
||||
"rt-multi-thread",
|
||||
"io-util",
|
||||
"macros",
|
||||
] }
|
||||
urlencoding = "2.1.3"
|
||||
|
||||
[profile.release]
|
||||
@@ -25,7 +31,8 @@ strip = true
|
||||
|
||||
[features]
|
||||
default = ["very-smart-parsing"]
|
||||
very-smart-parsing = [] # this is the a-bit-redundant parse thing that copilot made
|
||||
very-smart-parsing = [
|
||||
] # this is the a-bit-redundant parse thing that copilot made
|
||||
|
||||
[workspace]
|
||||
members = ["ipjs"]
|
||||
@@ -21,8 +21,19 @@
|
||||
|
||||
use super::AddrInfo;
|
||||
|
||||
pub async fn get(dev: Option<&str>) -> anyhow::Result<Vec<AddrInfo>> {
|
||||
let mut cmd = tokio::process::Command::new("ip");
|
||||
cmd.args(["-j", "address", "show"]);
|
||||
|
||||
if let Some(d) = dev {
|
||||
cmd.args(["dev", d]);
|
||||
}
|
||||
|
||||
pub async fn get() -> Vec<AddrInfo> {
|
||||
todo!()
|
||||
}
|
||||
let output = cmd.output().await?;
|
||||
|
||||
if !output.status.success() {
|
||||
anyhow::bail!(String::from_utf8_lossy(&output.stderr).into_owned());
|
||||
}
|
||||
|
||||
Ok(serde_json::from_slice(&output.stdout)?)
|
||||
}
|
||||
@@ -118,3 +118,8 @@ async fn ball_compare_backends() -> anyhow::Result<()> {
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn cidr_filter() {
|
||||
unimplemented!("never. i aint add what i dont need")
|
||||
}
|
||||
@@ -2,11 +2,14 @@
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
root = Path(__file__).parent.parent
|
||||
static = root / "static" # change "assets" to your folder
|
||||
out_rs = root / "src" / "assets.rs"
|
||||
static = root / "static"
|
||||
src = root / "src"
|
||||
out_rs = src / "assets.rs"
|
||||
|
||||
assert 'name = "wakey"' in (root / "Cargo.toml").read_text(
|
||||
encoding="utf-8"
|
||||
), "uhh how do i explain this"
|
||||
|
||||
def sanitize(name: str) -> str:
|
||||
# Valid Rust identifiers: letters, digits, underscores; no starting digit
|
||||
@@ -35,7 +38,7 @@ class RsAssetFile:
|
||||
const_name = sanitize(self.path.name).upper()
|
||||
return (
|
||||
f"pub const {const_name}: &str = "
|
||||
f'include_str!("{self.path.relative_to(out_rs.parent, walk_up=True).as_posix()}");'
|
||||
f'include_str!("{self.path.relative_to(src, walk_up=True).as_posix()}");'
|
||||
)
|
||||
# specify walk_up to have .. in yo path
|
||||
|
||||
@@ -62,4 +65,4 @@ rs_code = "// generated with ./scripts/map_static.py\n" + str(
|
||||
RsAssetModule(static, True)
|
||||
)
|
||||
out_rs.write_text(rs_code, encoding="utf-8")
|
||||
print(f"written to {out_rs}")
|
||||
print(f"written to {out_rs.relative_to(Path.cwd(), walk_up=True)}")
|
||||
Reference in new issue
Block a user