Fix dashboard rendering

This commit is contained in:
jude
2025-11-05 18:52:36 +00:00
parent 901cf575c4
commit a4ec39e4a2
6 changed files with 55 additions and 11 deletions

4
.gitignore vendored
View File

@@ -3,8 +3,8 @@ target
/venv
.cargo
.idea
web/static/index.html
web/static/assets
static/index.html
static/assets
# Logs
logs
*.log

View File

@@ -17,13 +17,7 @@ COPY ./conf ./conf
COPY ./extract_derive ./extract_derive
COPY ./migrations ./migrations
COPY ./recordable_derive ./recordable_derive
COPY ./reminder-dashboard/public ./reminder-dashboard/public
COPY ./reminder-dashboard/src ./reminder-dashboard/src
COPY ./reminder-dashboard/index.html ./reminder-dashboard/
COPY ./reminder-dashboard/package.json ./reminder-dashboard/
COPY ./reminder-dashboard/package-lock.json ./reminder-dashboard/
COPY ./reminder-dashboard/tsconfig.json ./reminder-dashboard/
COPY ./reminder-dashboard/vite.config.ts ./reminder-dashboard/
COPY ./reminder-dashboard ./reminder-dashboard
COPY ./src ./src
COPY ./static ./static
COPY ./templates ./templates
@@ -32,6 +26,10 @@ COPY ./Cargo.lock ./
COPY ./Cargo.toml ./
COPY ./dp.py ./
# Build dashboard assets explicitly to ensure dist exists
RUN npm ci --prefix reminder-dashboard && npm run build --prefix reminder-dashboard
# Build and install the Rust binary
RUN cargo install --path .
EXPOSE 18920

View File

@@ -10,4 +10,17 @@ fn main() {
.current_dir(Path::new("reminder-dashboard"))
.spawn()
.expect("Failed to build NPM");
Command::new("cp")
.arg("reminder-dashboard/dist/index.html")
.arg("static/index.html")
.spawn()
.expect("Failed to copy index.html");
Command::new("cp")
.arg("-r")
.arg("reminder-dashboard/dist/static/assets")
.arg("static/")
.spawn()
.expect("Failed to copy assets");
}

View File

@@ -126,6 +126,7 @@ pub async fn initialize(
let static_path =
if Path::new("static").exists() { "static" } else { "/lib/reminder-rs/static" };
info!("Using static path: {}", static_path);
rocket::build()
.attach(MetricProducer)

View File

@@ -1 +0,0 @@
/home/jude/reminder-bot/reminder-dashboard/dist/static/assets

View File

@@ -1 +0,0 @@
/home/jude/reminder-bot/reminder-dashboard/dist/index.html

34
static/index.html Normal file
View File

@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html lang="EN">
<head>
<meta name="description" content="The most powerful Discord Reminders Bot">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="UTF-8">
<meta name="yandex-verification" content="bb77b8681eb64a90"/>
<meta name="google-site-verification" content="7h7UVTeEe0AOzHiH3cFtsqMULYGN-zCZdMT_YCkW1Ho"/>
<!-- <meta http-equiv="Content-Security-Policy" content="default-src 'self'; img-src *; font-src fonts.gstatic.com 'self'"> -->
<!-- favicon -->
<link rel="apple-touch-icon" sizes="180x180"
href="/static/favicon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32"
href="/static/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16"
href="/static/favicon/favicon-16x16.png">
<link rel="manifest" href="/static/site.webmanifest">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">
<title>Reminder Bot | Dashboard</title>
<!-- styles -->
<link rel="stylesheet" href="/static/css/fa.css">
<link rel="stylesheet" href="/static/css/font.css">
<link rel="stylesheet" href="/static/css/style.css">
<script type="module" crossorigin src="/static/assets/index-B8f0viPI.js"></script>
<link rel="stylesheet" crossorigin href="/static/assets/index-BZ8NJuKt.css">
</head>
<body>
<div id="app"></div>
</body>
</html>