From 1360e9e2872ad38d8d1d45f4508a8f58d3ae28f8 Mon Sep 17 00:00:00 2001 From: Kuoi Date: Wed, 11 May 2022 21:35:17 +0100 Subject: [PATCH] change path based on own need --- html/current.html | 2 +- html/logs.html | 6 +++--- src/main.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/html/current.html b/html/current.html index dc83542..51b03f3 100644 --- a/html/current.html +++ b/html/current.html @@ -24,7 +24,7 @@ $(document).ready(function () { $('#l').DataTable({ "ajax": { - url: "/imlonghao-api/current", + url: "/api/current", dataSrc: "" }, "order": [[0, "desc"]], diff --git a/html/logs.html b/html/logs.html index fa4ebc3..9f2d4c4 100644 --- a/html/logs.html +++ b/html/logs.html @@ -27,7 +27,7 @@ hour12: false, }); $(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) { let datatable = $('#l').DataTable() datatable.clear() @@ -36,7 +36,7 @@ }); }); $(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({ "searchDelay": 100, "iDisplayLength": 100, @@ -118,7 +118,7 @@ title: "Log", data: "ts", render: function (data, type, row, meta) { - return `Log` + return `Log` } }, { diff --git a/src/main.rs b/src/main.rs index ed4022e..5c989bb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -97,7 +97,7 @@ fn get_maintainer(pkg: String) -> Result { Ok(maintainers.join(", ")) } -#[get("/imlonghao-api/status")] +#[get("/api/status")] async fn status(db: web::Data) -> impl Responder { let conn = db.get().await.unwrap(); let rows = conn @@ -113,7 +113,7 @@ async fn status(db: web::Data) -> impl Responder { HttpResponse::Ok().json(result) } -#[get("/imlonghao-api/current")] +#[get("/api/current")] async fn current(db: web::Data) -> impl Responder { let conn = db.get().await.unwrap(); let rows = conn