7b56b59e7c
Its own workspace, as the telemetry server's, for its own Railway service. GitHub sign-in with no scope (the user's token reads the login once and is dropped), signed-cookie sessions, an origin check and a CSRF token, six submissions per account and sixty in all per hour. A submission runs the file's own checks (horizon_mods::index::inspect, the signature, the entry's fields through registry::project), uploads it to the registry's `staging` release as <sha256>.<extension>, writes mods/<id>.toml on a new branch with the submitter as co-author, and opens the pull request. Only an entry's owners publish updates; a key change is a pull request by hand. Shader packs are refused until their format exists. Tested end to end against a mock GitHub: sign-in, the signed sample mod, what lands on GitHub, and what is refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
26 lines
1005 B
Rust
26 lines
1005 B
Rust
//! `horizon-mod-registry`: serves on `PORT` (default 8080). Configured by the
|
|
//! environment (see `Config::from_env`); keeps no data.
|
|
use std::net::SocketAddr;
|
|
|
|
use horizon_mod_registry::{App, Config, router};
|
|
|
|
#[tokio::main(flavor = "multi_thread", worker_threads = 2)]
|
|
async fn main() {
|
|
let port: u16 = std::env::var("PORT")
|
|
.ok()
|
|
.and_then(|p| p.parse().ok())
|
|
.unwrap_or(8080);
|
|
let config = Config::from_env().unwrap_or_else(|e| panic!("horizon-mod-registry: {e}"));
|
|
let repo = config.github.repo.clone();
|
|
let listener = tokio::net::TcpListener::bind(SocketAddr::from(([0, 0, 0, 0], port)))
|
|
.await
|
|
.unwrap_or_else(|e| panic!("port {port}: {e}"));
|
|
eprintln!("horizon-mod-registry: listening on {port}, submitting to {repo}");
|
|
axum::serve(listener, router(App::new(config)))
|
|
.with_graceful_shutdown(async {
|
|
let _ = tokio::signal::ctrl_c().await;
|
|
})
|
|
.await
|
|
.unwrap_or_else(|e| panic!("{e}"));
|
|
}
|