loool
This commit is contained in:
commit
456161a02d
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/target
|
1635
Cargo.lock
generated
Normal file
1635
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
11
Cargo.toml
Normal file
11
Cargo.toml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
[package]
|
||||||
|
name = "auth-callback-watcher"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
rocket = "0.5.0"
|
||||||
|
log = "0.4.20"
|
||||||
|
env_logger = "0.11.1"
|
2
Rocket.toml
Normal file
2
Rocket.toml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[default]
|
||||||
|
port = 7887
|
28
src/main.rs
Normal file
28
src/main.rs
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#[macro_use]
|
||||||
|
extern crate rocket;
|
||||||
|
|
||||||
|
#[get("/authenticated/<_..>")]
|
||||||
|
fn authenticated(uri: &rocket::http::uri::Origin) -> &'static str {
|
||||||
|
log::error!("AUTHENTICATED: {uri:?}");
|
||||||
|
"authentication successful 🙂"
|
||||||
|
}
|
||||||
|
#[get("/deauthenticated/<_..>")]
|
||||||
|
fn deauthenticated(uri: &rocket::http::uri::Origin) -> &'static str {
|
||||||
|
log::error!("DEAUTHENTICATED: {uri:?}");
|
||||||
|
"deauthentication successful 🙂"
|
||||||
|
}
|
||||||
|
|
||||||
|
#[launch]
|
||||||
|
fn rocket() -> _ {
|
||||||
|
env_logger::builder()
|
||||||
|
.format_module_path(false)
|
||||||
|
.format_timestamp(
|
||||||
|
if std::env::var("LOG_TIMESTAMP").is_ok_and(|v| v == "false") {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
Some(env_logger::TimestampPrecision::Seconds)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.init();
|
||||||
|
rocket::build().mount("/", routes![authenticated, deauthenticated])
|
||||||
|
}
|
16
tesla-auth-callback-watcher.service
Normal file
16
tesla-auth-callback-watcher.service
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Tesla Auth Callback Watcher
|
||||||
|
After=network.target
|
||||||
|
StartLimitIntervalSec=0
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
Restart=always
|
||||||
|
RestartSec=10s
|
||||||
|
User=tesla
|
||||||
|
Environment="RUST_LOG=error,warn"
|
||||||
|
Environment="LOG_TIMESTAMP=false"
|
||||||
|
ExecStart=/usr/bin/auth-callback-watcher
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
Loading…
Reference in a new issue