mirror of
https://github.com/BioArchLinux/bioarchlinux-packages.git
synced 2025-03-10 06:24:00 +00:00
generate patch (#3)
* try to convert it to bioarchlinux * translate Chinese to English * change path based on own need * config * fix typo * fix the path * Update main.rs * change the location of repo * add index * feat: localized resource files * fix(deps): update rust crate actix-web to 4.1.0 * fix(deps): update rust crate anyhow to 1.0.58 * fix(deps): update rust crate sentry-actix to 0.27.0 * fix(deps): update rust crate sentry to 0.27.0 * chore(deps): update dependency rust to v1.62.0 * fix(deps): update rust crate serde to 1.0.138 * fix(deps): update rust crate cached to 0.35.0 * fix(deps): update rust crate cached to 0.36.0 * fix(deps): update rust crate openssl to 0.10.41 * fix(deps): update rust crate serde to 1.0.139 * fix(deps): update rust crate cached to 0.37.0 * chore(deps): update dependency rust to v1.62.1 * fix * fix --------- Co-authored-by: imlonghao <git@imlonghao.com> Co-authored-by: renovatebot <renovatebot@esd.cc>
This commit is contained in:
parent
3c7f07151a
commit
fff9faa4d5
5 changed files with 69 additions and 48 deletions
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "archlinuxcn-packages"
|
name = "bioarchlinux-packages"
|
||||||
version = "0.2.6"
|
version = "0.2.6"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
|
|
|
@ -3,15 +3,18 @@
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Archlinuxcn Currently Building Package</title>
|
<title>bioarchlinux Currently Building Package</title>
|
||||||
<link rel="stylesheet" href="https://build.archlinuxcn.org/~imlonghao/static/1.10.20-jquery.dataTables.min.css">
|
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.20/css/jquery.dataTables.min.css"
|
||||||
|
integrity="sha256-YY1izqyhIj4W3iyJOaGWOpXDSwrHWFL4Nfk+W0LyCHE=" crossorigin="anonymous">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<table id="l" class="stripe cell-border" style="text-align:center">
|
<table id="l" class="stripe cell-border" style="text-align:center">
|
||||||
</table>
|
</table>
|
||||||
<script src="https://build.archlinuxcn.org/~imlonghao/static/3.4.1-jquery.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"
|
||||||
<script src="https://build.archlinuxcn.org/~imlonghao/static/1.10.20-jquery.dataTables.min.js"></script>
|
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/datatables.net@1.10.20/js/jquery.dataTables.min.js"
|
||||||
|
integrity="sha256-LXQzPhL1IRyKkA7HpCOBi8I+OC8HqzHUYkjK8S+LKTs=" crossorigin="anonymous"></script>
|
||||||
<script>
|
<script>
|
||||||
const DATE_FORMATTER = new Intl.DateTimeFormat(undefined, {
|
const DATE_FORMATTER = new Intl.DateTimeFormat(undefined, {
|
||||||
timeStyle: "medium",
|
timeStyle: "medium",
|
||||||
|
@ -21,7 +24,7 @@
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$('#l').DataTable({
|
$('#l').DataTable({
|
||||||
"ajax": {
|
"ajax": {
|
||||||
url: "/imlonghao-api/current",
|
url: "/api/current",
|
||||||
dataSrc: ""
|
dataSrc: ""
|
||||||
},
|
},
|
||||||
"order": [[0, "desc"]],
|
"order": [[0, "desc"]],
|
||||||
|
@ -29,7 +32,7 @@
|
||||||
"columnDefs": [
|
"columnDefs": [
|
||||||
{
|
{
|
||||||
targets: 0,
|
targets: 0,
|
||||||
title: "更新时间",
|
title: "Update Time",
|
||||||
data: "updated_at",
|
data: "updated_at",
|
||||||
render: function (data, type, row, meta) {
|
render: function (data, type, row, meta) {
|
||||||
if (type == 'display') {
|
if (type == 'display') {
|
||||||
|
@ -41,22 +44,22 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
targets: 1,
|
targets: 1,
|
||||||
title: "包名",
|
title: "Package Name",
|
||||||
data: "pkgbase"
|
data: "pkgbase"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
targets: 2,
|
targets: 2,
|
||||||
title: "状态",
|
title: "Status",
|
||||||
data: "status"
|
data: "status"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
targets: 3,
|
targets: 3,
|
||||||
title: "上次打包时间",
|
title: "Last Packaging Time",
|
||||||
data: "elapsed"
|
data: "elapsed"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
targets: 4,
|
targets: 4,
|
||||||
title: "打包原因",
|
title: "Packaging Reason",
|
||||||
data: "reasons",
|
data: "reasons",
|
||||||
render: function (data, type, row, meta) {
|
render: function (data, type, row, meta) {
|
||||||
return JSON.parse(data)
|
return JSON.parse(data)
|
||||||
|
@ -68,4 +71,4 @@
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
15
html/index.html
Normal file
15
html/index.html
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<!-- saved from url=(0030)https://build.bioarchlinux.org/ -->
|
||||||
|
<html lang="en-US"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>BioArchLinux Packages Satsus</title>
|
||||||
|
</head><body data-new-gr-c-s-check-loaded="14.1062.0" data-gr-ext-installed="">
|
||||||
|
<h1>Welcome to BioArchLinux Packages Status Page!</h1>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://build.bioarchlinux.org/current.html">Building Packages logs</a></li>
|
||||||
|
<li><a href="https://build.bioarchlinux.org/logs.html">Built Packages logs</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- vim: set fdm=marker: -->
|
||||||
|
</body><grammarly-desktop-integration data-grammarly-shadow-root="true"></grammarly-desktop-integration></html>
|
|
@ -3,8 +3,9 @@
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Archlinuxcn Packages</title>
|
<title>bioarchlinux Packages</title>
|
||||||
<link rel="stylesheet" href="https://build.archlinuxcn.org/~imlonghao/static/1.10.20-jquery.dataTables.min.css">
|
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.20/css/jquery.dataTables.min.css"
|
||||||
|
integrity="sha256-YY1izqyhIj4W3iyJOaGWOpXDSwrHWFL4Nfk+W0LyCHE=" crossorigin="anonymous">
|
||||||
<style>
|
<style>
|
||||||
a {
|
a {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
@ -15,8 +16,10 @@
|
||||||
<body>
|
<body>
|
||||||
<table id="l" class="stripe cell-border" style="text-align:center">
|
<table id="l" class="stripe cell-border" style="text-align:center">
|
||||||
</table>
|
</table>
|
||||||
<script src="https://build.archlinuxcn.org/~imlonghao/static/3.4.1-jquery.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"
|
||||||
<script src="https://build.archlinuxcn.org/~imlonghao/static/1.10.20-jquery.dataTables.min.js"></script>
|
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/datatables.net@1.10.20/js/jquery.dataTables.min.js"
|
||||||
|
integrity="sha256-LXQzPhL1IRyKkA7HpCOBi8I+OC8HqzHUYkjK8S+LKTs=" crossorigin="anonymous"></script>
|
||||||
<script>
|
<script>
|
||||||
const DATE_FORMATTER = new Intl.DateTimeFormat(undefined, {
|
const DATE_FORMATTER = new Intl.DateTimeFormat(undefined, {
|
||||||
timeStyle: "medium",
|
timeStyle: "medium",
|
||||||
|
@ -24,7 +27,7 @@
|
||||||
hour12: false,
|
hour12: false,
|
||||||
});
|
});
|
||||||
$(window).on('hashchange', function () {
|
$(window).on('hashchange', function () {
|
||||||
url = window.location.hash.includes("#") ? "/imlonghao-api/pkg/" + window.location.hash.slice(1) : "/imlonghao-api/logs"
|
url = window.location.hash.includes("#") ? "/api/pkg/" + window.location.hash.slice(1) : "/api/logs"
|
||||||
$.get(url, function (newDataArray) {
|
$.get(url, function (newDataArray) {
|
||||||
let datatable = $('#l').DataTable()
|
let datatable = $('#l').DataTable()
|
||||||
datatable.clear()
|
datatable.clear()
|
||||||
|
@ -33,7 +36,7 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
url = window.location.hash.includes("#") ? "/imlonghao-api/pkg/" + window.location.hash.slice(1) : "/imlonghao-api/logs"
|
url = window.location.hash.includes("#") ? "/api/pkg/" + window.location.hash.slice(1) : "/api/logs"
|
||||||
$('#l').DataTable({
|
$('#l').DataTable({
|
||||||
"searchDelay": 100,
|
"searchDelay": 100,
|
||||||
"iDisplayLength": 100,
|
"iDisplayLength": 100,
|
||||||
|
@ -46,22 +49,22 @@
|
||||||
"columnDefs": [
|
"columnDefs": [
|
||||||
{
|
{
|
||||||
targets: 0,
|
targets: 0,
|
||||||
title: "包名",
|
title: "Package Name",
|
||||||
data: "pkgbase"
|
data: "pkgbase"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
targets: 1,
|
targets: 1,
|
||||||
title: "打包者",
|
title: "Maintainer",
|
||||||
data: "maintainer"
|
data: "maintainer"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
targets: 2,
|
targets: 2,
|
||||||
title: "版本号",
|
title: "Package Version",
|
||||||
data: "pkg_version"
|
data: "pkg_version"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
targets: 3,
|
targets: 3,
|
||||||
title: "状态",
|
title: "Status",
|
||||||
data: "result",
|
data: "result",
|
||||||
render: function (data, type, row, meta) {
|
render: function (data, type, row, meta) {
|
||||||
switch (data) {
|
switch (data) {
|
||||||
|
@ -74,17 +77,17 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
targets: 4,
|
targets: 4,
|
||||||
title: "持续时间(秒)",
|
title: "Last Time (s)",
|
||||||
data: "elapsed"
|
data: "elapsed"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
targets: 5,
|
targets: 5,
|
||||||
title: "CPU 使用率(%)",
|
title: "CPU Usage Percentage (%)",
|
||||||
data: "cpu"
|
data: "cpu"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
targets: 6,
|
targets: 6,
|
||||||
title: "内存使用(GiB)",
|
title: "RAM Usage (GiB)",
|
||||||
data: "memory",
|
data: "memory",
|
||||||
render: function (data, type, row, meta) {
|
render: function (data, type, row, meta) {
|
||||||
return data.toFixed(3)
|
return data.toFixed(3)
|
||||||
|
@ -92,7 +95,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
targets: 7,
|
targets: 7,
|
||||||
title: "打包时间",
|
title: "Last Packaging Time",
|
||||||
data: "ts",
|
data: "ts",
|
||||||
render: function (data, type, row, meta) {
|
render: function (data, type, row, meta) {
|
||||||
if (type == 'display') {
|
if (type == 'display') {
|
||||||
|
@ -107,23 +110,23 @@
|
||||||
title: "GitHub",
|
title: "GitHub",
|
||||||
data: "pkgbase",
|
data: "pkgbase",
|
||||||
render: function (data, type, row, meta) {
|
render: function (data, type, row, meta) {
|
||||||
return `<a href=https://github.com/archlinuxcn/repo/blob/master/archlinuxcn/${data}/ target=_blank rel=noopener>GitHub</a>`
|
return `<a href=https://github.com/BioArchLinux/Packages/blob/master/BioArchLinux/${data}/ target=_blank rel=noopener>GitHub</a>`
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
targets: 9,
|
targets: 9,
|
||||||
title: "日志",
|
title: "Log",
|
||||||
data: "ts",
|
data: "ts",
|
||||||
render: function (data, type, row, meta) {
|
render: function (data, type, row, meta) {
|
||||||
return `<a href=https://build.archlinuxcn.org/imlonghao-api/pkg/${row.pkgbase}/log/${Math.floor(data / 1000)} target=_blank rel=noopener>日志</a>`
|
return `<a href=https://build.bioarchlinux.org/api/pkg/${row.pkgbase}/log/${Math.floor(data / 1000)} target=_blank rel=noopener>Log</a>`
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
targets: 10,
|
targets: 10,
|
||||||
title: "更多",
|
title: "More",
|
||||||
data: "pkgbase",
|
data: "pkgbase",
|
||||||
render: function (data, type, row, meta) {
|
render: function (data, type, row, meta) {
|
||||||
return `<a href=#${data}>更多</a>`
|
return `<a href=#${data}>More</a>`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -132,4 +135,4 @@
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
32
src/main.rs
32
src/main.rs
|
@ -82,7 +82,7 @@ struct LogsResponse {
|
||||||
#[cached(time = 86400, result = true)]
|
#[cached(time = 86400, result = true)]
|
||||||
fn get_maintainer(pkg: String) -> Result<String> {
|
fn get_maintainer(pkg: String) -> Result<String> {
|
||||||
let contents = std::fs::read_to_string(format!(
|
let contents = std::fs::read_to_string(format!(
|
||||||
"/data/archgitrepo-webhook/archlinuxcn/{}/lilac.yaml",
|
"/usr/share/lilac/Packages/BioArchLinux/{}/lilac.yaml",
|
||||||
pkg
|
pkg
|
||||||
))?;
|
))?;
|
||||||
let docs = YamlLoader::load_from_str(&contents)?;
|
let docs = YamlLoader::load_from_str(&contents)?;
|
||||||
|
@ -97,7 +97,7 @@ fn get_maintainer(pkg: String) -> Result<String> {
|
||||||
Ok(maintainers.join(", "))
|
Ok(maintainers.join(", "))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/imlonghao-api/status")]
|
#[get("/api/status")]
|
||||||
async fn status(db: web::Data<deadpool_postgres::Pool>) -> impl Responder {
|
async fn status(db: web::Data<deadpool_postgres::Pool>) -> impl Responder {
|
||||||
let conn = db.get().await.unwrap();
|
let conn = db.get().await.unwrap();
|
||||||
let rows = conn
|
let rows = conn
|
||||||
|
@ -113,7 +113,7 @@ async fn status(db: web::Data<deadpool_postgres::Pool>) -> impl Responder {
|
||||||
HttpResponse::Ok().json(result)
|
HttpResponse::Ok().json(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/imlonghao-api/current")]
|
#[get("/api/current")]
|
||||||
async fn current(db: web::Data<deadpool_postgres::Pool>) -> impl Responder {
|
async fn current(db: web::Data<deadpool_postgres::Pool>) -> impl Responder {
|
||||||
let conn = db.get().await.unwrap();
|
let conn = db.get().await.unwrap();
|
||||||
let rows = conn
|
let rows = conn
|
||||||
|
@ -144,7 +144,7 @@ async fn current(db: web::Data<deadpool_postgres::Pool>) -> impl Responder {
|
||||||
HttpResponse::Ok().json(result)
|
HttpResponse::Ok().json(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/imlonghao-api/logs")]
|
#[get("/api/logs")]
|
||||||
async fn logs(db: web::Data<deadpool_postgres::Pool>) -> impl Responder {
|
async fn logs(db: web::Data<deadpool_postgres::Pool>) -> impl Responder {
|
||||||
let conn = db.get().await.unwrap();
|
let conn = db.get().await.unwrap();
|
||||||
let rows = conn
|
let rows = conn
|
||||||
|
@ -182,7 +182,7 @@ async fn logs(db: web::Data<deadpool_postgres::Pool>) -> impl Responder {
|
||||||
HttpResponse::Ok().json(results)
|
HttpResponse::Ok().json(results)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/imlonghao-api/pkg/{name}")]
|
#[get("/api/pkg/{name}")]
|
||||||
async fn get_pkg(
|
async fn get_pkg(
|
||||||
name: web::Path<String>,
|
name: web::Path<String>,
|
||||||
db: web::Data<deadpool_postgres::Pool>,
|
db: web::Data<deadpool_postgres::Pool>,
|
||||||
|
@ -220,7 +220,7 @@ async fn get_pkg(
|
||||||
HttpResponse::Ok().json(results)
|
HttpResponse::Ok().json(results)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/imlonghao-api/pkg/{name}/log/{ts}")]
|
#[get("/api/pkg/{name}/log/{ts}")]
|
||||||
async fn get_pkg_log(
|
async fn get_pkg_log(
|
||||||
path: web::Path<(String, i64)>,
|
path: web::Path<(String, i64)>,
|
||||||
db: web::Data<deadpool_postgres::Pool>,
|
db: web::Data<deadpool_postgres::Pool>,
|
||||||
|
@ -242,7 +242,7 @@ async fn get_pkg_log(
|
||||||
return HttpResponse::BadRequest().body("ts is too old");
|
return HttpResponse::BadRequest().body("ts is too old");
|
||||||
}
|
}
|
||||||
let logdir: String = rows[0].get("logdir");
|
let logdir: String = rows[0].get("logdir");
|
||||||
let filename = format!("/home/lilydjwg/.lilac/log/{}/{}.log", logdir, name);
|
let filename = format!("/home/bio/.lilac/log/{}/{}.log", logdir, name);
|
||||||
let contents = match std::fs::read_to_string(&filename) {
|
let contents = match std::fs::read_to_string(&filename) {
|
||||||
Ok(x) => x,
|
Ok(x) => x,
|
||||||
Err(_) => return HttpResponse::NotFound().body(format!("Log {} not exist", &filename)),
|
Err(_) => return HttpResponse::NotFound().body(format!("Log {} not exist", &filename)),
|
||||||
|
@ -256,18 +256,18 @@ async fn get_pkg_log(
|
||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> std::io::Result<()> {
|
async fn main() -> std::io::Result<()> {
|
||||||
let _guard = sentry::init((
|
//let _guard = sentry::init((
|
||||||
std::env::var("SENTRY").unwrap(),
|
// std::env::var("SENTRY").unwrap(),
|
||||||
sentry::ClientOptions {
|
// sentry::ClientOptions {
|
||||||
release: sentry::release_name!(),
|
// release: sentry::release_name!(),
|
||||||
..Default::default()
|
// ..Default::default()
|
||||||
},
|
// },
|
||||||
));
|
//));
|
||||||
std::env::set_var("RUST_BACKTRACE", "1");
|
std::env::set_var("RUST_BACKTRACE", "1");
|
||||||
|
|
||||||
let mut cfg = deadpool_postgres::Config::new();
|
let mut cfg = deadpool_postgres::Config::new();
|
||||||
cfg.user = Some("imlonghao".to_string());
|
cfg.user = Some("bio".to_string());
|
||||||
cfg.dbname = Some("lilydjwg".to_string());
|
cfg.dbname = Some("lilac".to_string());
|
||||||
cfg.host = Some("/run/postgresql".to_string());
|
cfg.host = Some("/run/postgresql".to_string());
|
||||||
cfg.manager = Some(deadpool_postgres::ManagerConfig {
|
cfg.manager = Some(deadpool_postgres::ManagerConfig {
|
||||||
recycling_method: deadpool_postgres::RecyclingMethod::Fast,
|
recycling_method: deadpool_postgres::RecyclingMethod::Fast,
|
||||||
|
|
Loading…
Add table
Reference in a new issue