Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
3cdb4cbd67 | |||
7cfa02ecbd
|
|||
31e4580c91
|
|||
5dac79b54a
|
|||
13fea4748e | |||
84f51bd2f3
|
|||
9eec2a2671
|
6
Cargo.lock
generated
6
Cargo.lock
generated
@@ -410,7 +410,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "artix-gitea"
|
name = "artix-gitea"
|
||||||
version = "0.1.2"
|
version = "0.1.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"awc",
|
"awc",
|
||||||
@@ -420,7 +420,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "artix-pkglib"
|
name = "artix-pkglib"
|
||||||
version = "0.1.2"
|
version = "0.1.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"alpm",
|
"alpm",
|
||||||
"alpm-utils",
|
"alpm-utils",
|
||||||
@@ -430,7 +430,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "artixweb_packages"
|
name = "artixweb_packages"
|
||||||
version = "0.1.2"
|
version = "0.1.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-files",
|
"actix-files",
|
||||||
"actix-identity",
|
"actix-identity",
|
||||||
|
@@ -8,7 +8,7 @@ homepage = "https://packages.artixlinux.org"
|
|||||||
keywords = ["artix", "packages", "gitea"]
|
keywords = ["artix", "packages", "gitea"]
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
version = "0.1.2"
|
version = "0.1.4"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "artix_gitea"
|
name = "artix_gitea"
|
||||||
|
@@ -8,7 +8,7 @@ homepage = "https://packages.artixlinux.org"
|
|||||||
keywords = ["artix", "packages"]
|
keywords = ["artix", "packages"]
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
version = "0.1.2"
|
version = "0.1.4"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "artix_pkglib"
|
name = "artix_pkglib"
|
||||||
|
@@ -7,7 +7,7 @@ repository = "gitea.artixlinux.org/artix/artixweb_packages"
|
|||||||
keywords = ["artix", "packages"]
|
keywords = ["artix", "packages"]
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
version = "0.1.2"
|
version = "0.1.4"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "artixweb_packages"
|
name = "artixweb_packages"
|
||||||
@@ -15,8 +15,8 @@ test = false
|
|||||||
bench = false
|
bench = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
artix-gitea = { path = "../artix-gitea", version = "=0.1.2" }
|
artix-gitea = { path = "../artix-gitea", version = "=0.1.4" }
|
||||||
artix-pkglib = { path = "../artix-pkglib", version = "=0.1.2" }
|
artix-pkglib = { path = "../artix-pkglib", version = "=0.1.4" }
|
||||||
|
|
||||||
actix-files = "0.6.0"
|
actix-files = "0.6.0"
|
||||||
actix-identity = "0.4"
|
actix-identity = "0.4"
|
||||||
|
@@ -110,6 +110,7 @@ pub(crate) struct ResponseDetail {
|
|||||||
pub required_by: Vec<String>,
|
pub required_by: Vec<String>,
|
||||||
pub contents: Vec<String>,
|
pub contents: Vec<String>,
|
||||||
pub maintainers: Vec<String>,
|
pub maintainers: Vec<String>,
|
||||||
|
pub packaged_by: String,
|
||||||
pub flagged: bool,
|
pub flagged: bool,
|
||||||
pub flagged_on: i64,
|
pub flagged_on: i64,
|
||||||
pub flagged_by: Vec<String>,
|
pub flagged_by: Vec<String>,
|
||||||
@@ -457,7 +458,7 @@ pub(crate) async fn get_packages_details_inner(
|
|||||||
.iter()
|
.iter()
|
||||||
.map(std::string::ToString::to_string)
|
.map(std::string::ToString::to_string)
|
||||||
.collect(),
|
.collect(),
|
||||||
gitea_url: String::new(),
|
gitea_url: format!("{}/packages/{}", SETTINGS.gitea_url, pkg.name().to_string()),
|
||||||
dependencies: get_depends_from_package(
|
dependencies: get_depends_from_package(
|
||||||
&handle,
|
&handle,
|
||||||
pkg.arch().unwrap_or("any"),
|
pkg.arch().unwrap_or("any"),
|
||||||
@@ -506,6 +507,7 @@ pub(crate) async fn get_packages_details_inner(
|
|||||||
pkg.replaces(),
|
pkg.replaces(),
|
||||||
&DependencyKind::Misc,
|
&DependencyKind::Misc,
|
||||||
),
|
),
|
||||||
|
packaged_by: format_packager(pkg.packager().unwrap_or("").to_string()),
|
||||||
flagged: false,
|
flagged: false,
|
||||||
flagged_on: 0,
|
flagged_on: 0,
|
||||||
flagged_by: Vec::new(),
|
flagged_by: Vec::new(),
|
||||||
@@ -517,7 +519,6 @@ pub(crate) async fn get_packages_details_inner(
|
|||||||
web::block(move || get_package_metadata(&pkg_name_version, &pool)).await
|
web::block(move || get_package_metadata(&pkg_name_version, &pool)).await
|
||||||
{
|
{
|
||||||
result.last_updated = metadata.last_update.timestamp();
|
result.last_updated = metadata.last_update.timestamp();
|
||||||
result.gitea_url = metadata.gitea_url;
|
|
||||||
result.flagged = metadata.flagged;
|
result.flagged = metadata.flagged;
|
||||||
if let Some(flagged_on) = metadata.flag_on {
|
if let Some(flagged_on) = metadata.flag_on {
|
||||||
result.flagged_on = flagged_on.timestamp_millis();
|
result.flagged_on = flagged_on.timestamp_millis();
|
||||||
@@ -566,6 +567,14 @@ pub(crate) async fn get_packages_details_inner(
|
|||||||
Err(ArtixWebPackageError::NotFound)
|
Err(ArtixWebPackageError::NotFound)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// removes email address from the packager string
|
||||||
|
fn format_packager(mut input: String) -> String {
|
||||||
|
if let Some(pos) = input.find('<') {
|
||||||
|
input.truncate(pos - 1);
|
||||||
|
}
|
||||||
|
input
|
||||||
|
}
|
||||||
|
|
||||||
// adds package metadata into the local postgres database
|
// adds package metadata into the local postgres database
|
||||||
fn add_package_metadata(metadata: &PackageMeta, pool: &web::Data<Pool>) {
|
fn add_package_metadata(metadata: &PackageMeta, pool: &web::Data<Pool>) {
|
||||||
use crate::schema::packages::dsl::packages;
|
use crate::schema::packages::dsl::packages;
|
||||||
|
@@ -72,6 +72,8 @@
|
|||||||
<section role="value">{{ pkg.installed_size|human_readable }} MB</section>
|
<section role="value">{{ pkg.installed_size|human_readable }} MB</section>
|
||||||
<section role="key">Build Date:</section>
|
<section role="key">Build Date:</section>
|
||||||
<section role="value">{{ pkg.build_date|show_date }}</section>
|
<section role="value">{{ pkg.build_date|show_date }}</section>
|
||||||
|
<section role="key">Packaged By:</section>
|
||||||
|
<section role="value">{{ pkg.packaged_by }}</section>
|
||||||
{% if pkg.flagged && !pkg.flagged_by.is_empty() %}
|
{% if pkg.flagged && !pkg.flagged_by.is_empty() %}
|
||||||
<section role="key">Flagged By:</section>
|
<section role="key">Flagged By:</section>
|
||||||
<section role="value">{{ pkg.flagged_by|join(", ") }}</section>
|
<section role="value">{{ pkg.flagged_by|join(", ") }}</section>
|
||||||
|
Reference in New Issue
Block a user