diff options
author | Melody Horn <melody@boringcactus.com> | 2021-04-22 04:51:12 -0600 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2021-04-22 04:51:12 -0600 |
commit | 7c0daee1843e36c4c204c653a2ce010e4e0f98b2 (patch) | |
tree | 8acd77ed7b159508f4242eb6a34c6a3f7c360b4f | |
parent | 9e17467a434482a54e480aac9edb9473bd3cf323 (diff) | |
download | gityeet-7c0daee1843e36c4c204c653a2ce010e4e0f98b2.tar.gz gityeet-7c0daee1843e36c4c204c653a2ce010e4e0f98b2.zip |
expect that trailing slash
-rw-r--r-- | src/main.rs | 14 | ||||
-rw-r--r-- | templates/index.html | 4 |
2 files changed, 6 insertions, 12 deletions
diff --git a/src/main.rs b/src/main.rs index b248ae7..dd5fea0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,6 +17,8 @@ struct IndexTemplate<'a> { #[async_std::main] async fn main() -> Result<()> { + tide::log::start(); + let matches = clap::App::new("gityeet") .arg(clap::Arg::with_name("root") .help("sets the directory from which repositories will be found") @@ -37,9 +39,9 @@ async fn main() -> Result<()> { let mut app = tide::with_state(Arc::new(Mutex::new(state))); app.at("/").get(index); { - let mut repo = app.at("/*repo"); + let mut repo = app.at("/*repo/"); repo.get(about); - repo.at("/tree").get(|_| async { Ok("bruh tree") }); + repo.at("tree/").get(|_| async { Ok("bruh tree") }); } app.listen(("127.0.0.1", port)).await?; Ok(()) @@ -50,14 +52,6 @@ type Request = tide::Request<Arc<Mutex<State>>>; async fn index(req: Request) -> tide::Result { let state = req.state(); let state = state.lock_arc().await; - for repo in &state.data { - println!("path: {:?}", repo.path()); - let head = repo.head(); - if let Ok(head) = head { - println!("head name: {:?}", head.name()); - println!("head shorthand: {:?}", head.shorthand()); - } - } Ok(IndexTemplate { state: state.deref() }.into()) } diff --git a/templates/index.html b/templates/index.html index 302c11e..ecddb48 100644 --- a/templates/index.html +++ b/templates/index.html @@ -11,8 +11,8 @@ <h1>hi this is gityeet</h1> <ul> {% for repo in state.data %} - <li><a href="/{{ state.relative_path(repo.path()).display() }}">{{ state.relative_path(repo.path()).display() }}</a></li> + <li><a href="/{{ state.relative_path(repo.path()).display() }}/">{{ state.relative_path(repo.path()).display() }}</a></li> {% endfor %} </ul> </body> -</html>
\ No newline at end of file +</html> |