Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
3cdb4cbd67 | |||
7cfa02ecbd
|
|||
31e4580c91
|
|||
5dac79b54a
|
|||
13fea4748e | |||
84f51bd2f3
|
|||
9eec2a2671
|
|||
8e0d076e67 | |||
31d3cb5f27
|
|||
a1e748c0a9 | |||
4f2c810a2f
|
|||
3ce6daea15 | |||
16fd963c8d
|
|||
6d3cd0566e
|
|||
42fd6f186f |
@@ -73,7 +73,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
images: |
|
images: |
|
||||||
${{ env.ABSOLUTE_DH_IMAGE }}
|
${{ env.ABSOLUTE_DH_IMAGE }}
|
||||||
${{ env.ABSOLUTE_IMAGE }}
|
# ${{ env.ABSOLUTE_IMAGE }}
|
||||||
|
##unexpected status from PUT request: 413 Request Entity Too Large
|
||||||
tags: |
|
tags: |
|
||||||
type=raw,value=latest
|
type=raw,value=latest
|
||||||
type=semver,pattern={{version}}
|
type=semver,pattern={{version}}
|
||||||
|
6
Cargo.lock
generated
6
Cargo.lock
generated
@@ -410,7 +410,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "artix-gitea"
|
name = "artix-gitea"
|
||||||
version = "0.1.1"
|
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.1"
|
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.1"
|
version = "0.1.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-files",
|
"actix-files",
|
||||||
"actix-identity",
|
"actix-identity",
|
||||||
|
@@ -44,10 +44,14 @@ EXPOSE 1936/tcp
|
|||||||
|
|
||||||
RUN pacman -Sy --noconfirm postgresql-libs \
|
RUN pacman -Sy --noconfirm postgresql-libs \
|
||||||
&& set -x \
|
&& set -x \
|
||||||
&& echo -e "[lib32]\nInclude = /etc/pacman.d/mirrorlist" >> /etc/pacman.conf \
|
|
||||||
&& echo -e "[universe]\nServer = https://universe.artixlinux.org/\$arch" >> /etc/pacman.conf \
|
|
||||||
&& pacman -Syu --noconfirm \
|
&& pacman -Syu --noconfirm \
|
||||||
&& pacman -Scc --noconfirm
|
&& pacman -Scc --noconfirm \
|
||||||
|
&& printf "[lib32]\nInclude = /etc/pacman.d/mirrorlist\n" >> /etc/pacman.conf \
|
||||||
|
&& printf "[system-gremlins]\nInclude = /etc/pacman.d/mirrorlist\n" >> /etc/pacman.conf \
|
||||||
|
&& printf "[world-gremlins]\nInclude = /etc/pacman.d/mirrorlist\n" >> /etc/pacman.conf \
|
||||||
|
&& printf "[galaxy-gremlins]\nInclude = /etc/pacman.d/mirrorlist\n" >> /etc/pacman.conf \
|
||||||
|
&& printf "[lib32-gremlins]\nInclude = /etc/pacman.d/mirrorlist\n" >> /etc/pacman.conf \
|
||||||
|
&& pacman -Sy --noconfirm
|
||||||
|
|
||||||
WORKDIR /usr/share/artixweb_packages
|
WORKDIR /usr/share/artixweb_packages
|
||||||
COPY --from=0 /usr/share/artixweb_packages ./
|
COPY --from=0 /usr/share/artixweb_packages ./
|
||||||
|
@@ -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.1"
|
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.1"
|
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.1"
|
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.1" }
|
artix-gitea = { path = "../artix-gitea", version = "=0.1.4" }
|
||||||
artix-pkglib = { path = "../artix-pkglib", version = "=0.1.1" }
|
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"
|
||||||
|
@@ -73,7 +73,16 @@ fn generate_random_token() -> String {
|
|||||||
token
|
token
|
||||||
}
|
}
|
||||||
|
|
||||||
const DATABASESS: [&str; 5] = ["system", "world", "galaxy", "universe", "lib32"];
|
const DATABASESS: [&str; 8] = [
|
||||||
|
"system",
|
||||||
|
"world",
|
||||||
|
"galaxy",
|
||||||
|
"lib32",
|
||||||
|
"system-gremlins",
|
||||||
|
"world-gremlins",
|
||||||
|
"galaxy-gremlins",
|
||||||
|
"lib32-gremlins"
|
||||||
|
];
|
||||||
const MIN_PASSWORD_LENGTH: usize = 8;
|
const MIN_PASSWORD_LENGTH: usize = 8;
|
||||||
|
|
||||||
/// Syncs the configured databases
|
/// Syncs the configured databases
|
||||||
|
@@ -23,6 +23,7 @@ use super::packages::{get_packages_inner, Response};
|
|||||||
#[template(path = "base_index.html")]
|
#[template(path = "base_index.html")]
|
||||||
struct BaseTemplate {
|
struct BaseTemplate {
|
||||||
packages: Vec<Response>,
|
packages: Vec<Response>,
|
||||||
|
repos: Vec<String>,
|
||||||
limit: usize,
|
limit: usize,
|
||||||
query: String,
|
query: String,
|
||||||
user_email: String,
|
user_email: String,
|
||||||
@@ -33,6 +34,7 @@ struct BaseTemplate {
|
|||||||
#[template(path = "packages_nav.html")]
|
#[template(path = "packages_nav.html")]
|
||||||
struct PackagesNavigation {
|
struct PackagesNavigation {
|
||||||
packages: Vec<Response>,
|
packages: Vec<Response>,
|
||||||
|
repos: Vec<String>,
|
||||||
total: usize,
|
total: usize,
|
||||||
offset: usize,
|
offset: usize,
|
||||||
limit: usize,
|
limit: usize,
|
||||||
@@ -62,7 +64,16 @@ pub async fn index(
|
|||||||
String::new()
|
String::new()
|
||||||
};
|
};
|
||||||
|
|
||||||
let valid_repos = vec!["world", "galaxy", "system", "universe", "lib32"];
|
let valid_repos = vec![
|
||||||
|
"system",
|
||||||
|
"world",
|
||||||
|
"galaxy",
|
||||||
|
"lib32",
|
||||||
|
"system-gremlins",
|
||||||
|
"world-gremlins",
|
||||||
|
"galaxy-gremlins",
|
||||||
|
"lib32-gremlins"
|
||||||
|
];
|
||||||
for parameter in query.0 {
|
for parameter in query.0 {
|
||||||
let key: &str = ¶meter.0;
|
let key: &str = ¶meter.0;
|
||||||
match key {
|
match key {
|
||||||
@@ -110,38 +121,37 @@ pub async fn index(
|
|||||||
repos.join(":")
|
repos.join(":")
|
||||||
};
|
};
|
||||||
|
|
||||||
let s = if let Ok(result) =
|
let mut s = PackagesNavigation {
|
||||||
|
user_email,
|
||||||
|
packages: Vec::new(),
|
||||||
|
repos,
|
||||||
|
total: 0,
|
||||||
|
query: query_url.join("&"),
|
||||||
|
total_pages: 1,
|
||||||
|
generation_time: 0,
|
||||||
|
offset,
|
||||||
|
limit
|
||||||
|
};
|
||||||
|
if let Ok(result) =
|
||||||
get_packages_inner(&repos_criteria, limit, offset, search_criteria, Some(&pool)).await
|
get_packages_inner(&repos_criteria, limit, offset, search_criteria, Some(&pool)).await
|
||||||
{
|
{
|
||||||
PackagesNavigation {
|
s.packages = result.0;
|
||||||
user_email,
|
s.total = result.1;
|
||||||
packages: result.0,
|
s.total_pages = if limit > 0 {
|
||||||
total: result.1,
|
(result.1 as f64 / limit as f64).ceil() as usize
|
||||||
query: query_url.join("&"),
|
} else {
|
||||||
total_pages: if limit > 0 {
|
1
|
||||||
(result.1 as f64 / limit as f64).ceil() as usize
|
};
|
||||||
} else {
|
}
|
||||||
1
|
s.generation_time = start_time.elapsed().as_millis();
|
||||||
},
|
|
||||||
generation_time: start_time.elapsed().as_millis(),
|
|
||||||
offset,
|
|
||||||
limit,
|
|
||||||
}
|
|
||||||
.render()
|
|
||||||
.unwrap()
|
|
||||||
} else {
|
|
||||||
return Ok(HttpResponse::NotFound()
|
|
||||||
.content_type("text/html")
|
|
||||||
.body("<html><body>404 - Page Not Found!</body></html>"));
|
|
||||||
};
|
|
||||||
|
|
||||||
Ok(HttpResponse::Ok().content_type("text/html").body(s))
|
Ok(HttpResponse::Ok().content_type("text/html").body(s.render().unwrap()))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::unnecessary_wraps)]
|
#[allow(clippy::unnecessary_wraps)]
|
||||||
mod filters {
|
mod filters {
|
||||||
pub fn selected_repo(query: &str, repo: &str) -> ::askama::Result<bool> {
|
pub fn selected_repo(repos: &Vec<String>, repo: &str) -> ::askama::Result<bool> {
|
||||||
Ok(query.to_lowercase().contains(&repo.to_lowercase()))
|
Ok(repos.iter().any(|r| r == repo))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn details_url(pkg_name: &str) -> ::askama::Result<String> {
|
pub fn details_url(pkg_name: &str) -> ::askama::Result<String> {
|
||||||
|
@@ -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;
|
||||||
|
@@ -10,11 +10,14 @@
|
|||||||
<div>
|
<div>
|
||||||
<label for="repo_name" title="Repositories to include in the search">Repositories</label>
|
<label for="repo_name" title="Repositories to include in the search">Repositories</label>
|
||||||
<select id="repo_name" name="repo" multiple="">
|
<select id="repo_name" name="repo" multiple="">
|
||||||
<option value="World" {% if query|selected_repo("World") %} selected {% endif %}>World</option>
|
<option value="system" {% if repos|selected_repo("system") %} selected {% endif %}>System</option>
|
||||||
<option value="Galaxy" {% if query|selected_repo("Galaxy") %} selected {% endif %}>Galaxy</option>
|
<option value="world" {% if repos|selected_repo("world") %} selected {% endif %}>World</option>
|
||||||
<option value="System" {% if query|selected_repo("System") %} selected {% endif %}>System</option>
|
<option value="galaxy" {% if repos|selected_repo("galaxy") %} selected {% endif %}>Galaxy</option>
|
||||||
<option value="Universe" {% if query|selected_repo("Universe") %} selected {% endif %}>Universe</option>
|
<option value="lib32" {% if repos|selected_repo("lib32") %} selected {% endif %}>Lib32</option>
|
||||||
<option value="Lib32" {% if query|selected_repo("Lib32") %} selected {% endif %}>Lib32</option>
|
<option value="system-gremlins" {% if repos|selected_repo("system-gremlins") %} selected {% endif %}>System-Gremlins</option>
|
||||||
|
<option value="world-gremlins" {% if repos|selected_repo("world-gremlins") %} selected {% endif %}>World-Gremlins</option>
|
||||||
|
<option value="galaxy-gremlins" {% if repos|selected_repo("galaxy-gremlins") %} selected {% endif %}>Galaxy-Gremlins</option>
|
||||||
|
<option value="lib32-gremlins" {% if repos|selected_repo("lib32-gremlins") %} selected {% endif %}>Lib32-Gremlins</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
@@ -35,8 +35,8 @@
|
|||||||
<h2>{{ pkg.package_name }}-{{ pkg.version }} {% if pkg.flagged %}(<span class="flagged">flagged</span>){% endif %}</h2>
|
<h2>{{ pkg.package_name }}-{{ pkg.version }} {% if pkg.flagged %}(<span class="flagged">flagged</span>){% endif %}</h2>
|
||||||
<section role="action_panel" class="action_panel">
|
<section role="action_panel" class="action_panel">
|
||||||
<h4>Actions Panel</h4>
|
<h4>Actions Panel</h4>
|
||||||
<section role="action"><a href="{{ pkg.gitea_url }}" target="blank">View Package Sources</a></section>
|
<section role="action"><a href="{{ pkg.gitea_url }}">View Package Sources</a></section>
|
||||||
<section role="action"><a href="{{ pkg.gitea_url }}/graph" target="blank">View Package Changes</a></section>
|
<section role="action"><a href="{{ pkg.gitea_url }}/graph">View Package Changes</a></section>
|
||||||
{% if !pkg.flagged %}
|
{% if !pkg.flagged %}
|
||||||
<section role="action"><a href="/flag_package/{{ pkg.package_name }}/{{ pkg.version }}">Flag package out-of-date</a></section>
|
<section role="action"><a href="/flag_package/{{ pkg.package_name }}/{{ pkg.version }}">Flag package out-of-date</a></section>
|
||||||
{% else %}
|
{% else %}
|
||||||
@@ -65,13 +65,15 @@
|
|||||||
<section role="value">{{ pkg.replaces|provides_or_replaces }}</section>
|
<section role="value">{{ pkg.replaces|provides_or_replaces }}</section>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<section role="key">Upstream URL:</section>
|
<section role="key">Upstream URL:</section>
|
||||||
<section role="value"><a href="{{ pkg.upstream_url }}" target="_blank">{{ pkg.upstream_url }}</a></section>
|
<section role="value"><a href="{{ pkg.upstream_url }}">{{ pkg.upstream_url }}</a></section>
|
||||||
<section role="key">Size:</section>
|
<section role="key">Size:</section>
|
||||||
<section role="value">{{ pkg.size|human_readable }} MB</section>
|
<section role="value">{{ pkg.size|human_readable }} MB</section>
|
||||||
<section role="key">Installed Size:</section>
|
<section role="key">Installed Size:</section>
|
||||||
<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