api
Some checks failed
ci/woodpecker/push/pkgbuild/2 Pipeline is pending
ci/woodpecker/push/pkgbuild/1 Pipeline was successful
ci/woodpecker/push/container Pipeline failed

This commit is contained in:
JMARyA 2025-06-28 03:49:27 +02:00
parent 67033785ad
commit e6362f69a7
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
8 changed files with 79 additions and 13 deletions

View file

@ -6,10 +6,33 @@ use pacco::pkg::package::PackageMetaInfo;
use rocket::{State, get};
use pacco::pkg::{Repository, arch::Architecture};
use serde_json::json;
use crate::routes::ui::arch_card;
use pacco::config::Config;
/// Repository API Endpoint
#[get("/<repo>/<arch>/json")]
pub async fn repo_arch_json(
repo: &str,
ctx: RequestContext,
arch: &str,
config: &State<Config>,
) -> serde_json::Value {
let arch = Architecture::parse(arch).unwrap_or(Architecture::any);
let repo_name = repo;
let repo = Repository::new(repo_name).unwrap();
let packages = repo.list_pkg_arch(arch.clone());
json!({
"repo": repo_name,
"arch": arch.to_string(),
"packages": packages
})
}
/// Repository Overview UI
#[get("/<repo>?<arch>&<sort>")]
pub async fn repo_ui(
repo: &str,