change path based on own need

This commit is contained in:
Kuoi 2022-05-11 21:35:17 +01:00
parent 7d1de4440d
commit 1360e9e287
3 changed files with 6 additions and 6 deletions

View file

@ -24,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"]],

View file

@ -27,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()
@ -36,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,
@ -118,7 +118,7 @@
title: "Log", title: "Log",
data: "ts", data: "ts",
render: function (data, type, row, meta) { render: function (data, type, row, meta) {
return `<a href=https://build.bioarchlinux.org/imlonghao-api/pkg/${row.pkgbase}/log/${Math.floor(data / 1000)} target=_blank rel=noopener>Log</a>` return `<a href=https://build.bioarchlinux.org/api/pkg/${row.pkgbase}/log/${Math.floor(data / 1000)} target=_blank rel=noopener>Log</a>`
} }
}, },
{ {

View file

@ -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