mirror of
https://github.com/sergi0g/cup.git
synced 2025-11-16 17:13:46 -05:00
refactor: load web UI assets with a relative URL to allow for hosting under a different path.
Might fix #53.
This commit is contained in:
@@ -26,9 +26,9 @@
|
|||||||
content="#030712"
|
content="#030712"
|
||||||
>
|
>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<link rel="icon" type="image/svg+xml" href="favicon.svg">
|
<link rel="icon" type="image/svg+xml" href="./favicon.svg">
|
||||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
<link rel="icon" type="image/x-icon" href="./favicon.ico">
|
||||||
<link rel="apple-touch-icon" href="apple-touch-icon.png">
|
<link rel="apple-touch-icon" href="./apple-touch-icon.png">
|
||||||
<title>Cup</title>
|
<title>Cup</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { LoaderCircle } from "lucide-react";
|
|||||||
export default function Loading({ onLoad }: { onLoad: (data: Data) => void }) {
|
export default function Loading({ onLoad }: { onLoad: (data: Data) => void }) {
|
||||||
fetch(
|
fetch(
|
||||||
process.env.NODE_ENV === "production"
|
process.env.NODE_ENV === "production"
|
||||||
? "/api/v3/json"
|
? "./api/v3/json"
|
||||||
: `http://${window.location.hostname}:8000/api/v3/json`,
|
: `http://${window.location.hostname}:8000/api/v3/json`,
|
||||||
).then((response) =>
|
).then((response) =>
|
||||||
response.json().then((data) => {
|
response.json().then((data) => {
|
||||||
@@ -26,9 +26,9 @@ export default function Loading({ onLoad }: { onLoad: (data: Data) => void }) {
|
|||||||
<Logo />
|
<Logo />
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
className={`flex flex-col h-full items-center justify-center gap-1 text-${theme}-500 dark:text-${theme}-400`}
|
className={`flex h-full flex-col items-center justify-center gap-1 text-${theme}-500 dark:text-${theme}-400`}
|
||||||
>
|
>
|
||||||
<div className="flex gap-1 mb-8">
|
<div className="mb-8 flex gap-1">
|
||||||
Loading <LoaderCircle className="animate-spin" />
|
Loading <LoaderCircle className="animate-spin" />
|
||||||
</div>
|
</div>
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import react from "@vitejs/plugin-react-swc";
|
|||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [react()],
|
plugins: [react()],
|
||||||
|
base: "./",
|
||||||
build: {
|
build: {
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
// https://stackoverflow.com/q/69614671/vite-without-hash-in-filename#75344943
|
// https://stackoverflow.com/q/69614671/vite-without-hash-in-filename#75344943
|
||||||
|
|||||||
Reference in New Issue
Block a user