git-gemini-forge 0.2.0

A simple Gemini server that serves a read-only view of public repositories from a Git forge.
use crate::config;
use crate::network;
// use crate::network::*;
// use crate::network::responses::*;
// use url::Url;
use windmark::response::Response;

/// Answers with Gemtext that consists of an overview of a repository.
pub fn handler(_cfg: &config::Config, username: &str, repo_name: &str) -> Result<Response, network::error::Error> {
	// TODO: Describe the given repo

	// let platform_url: &Url = &cfg.forge_url;
	// let api_url: Url = platform_url.join("api/v1/").unwrap(); // assumes this string works
	// println!("Forgejo API URL is {}", api_url.as_str());

	// // List repos
	// let repos_url: Url = api_url.join(format!("users/{username}/repos").as_str()).unwrap(); // assumes this string works
	// println!("Getting repos from {}...", repos_url.as_str());
	// let mut repos: Vec<Repo> = get(repos_url)?;

	// // Sort repos by date
	// repos.sort_by(|a: &Repo, b: &Repo| {
	// 	return b.updated_at.cmp(&a.updated_at);
	// });

	// // Transform repos into Gemtext internal page links
	// let repo_links: Vec<String> = repos.iter()
	// 	.map(super::templates::repo_link)
	// 	.collect();

	// // Format repos into a Gemtext list
	// let gemtext_list: String = repo_links.iter()
	// 	.map(|n: &String| format!("{n}\n"))
	// 	.collect::<Vec<String>>()
	// 	.concat();

	let gemtext: String = format!("## {username}/{repo_name}\n=> /{username} {username}\n\nTODO: Some info here");
	return Ok(Response::success(gemtext));
}