diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 1412d615..37a7eeee 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,5 +5,12 @@ "service": "devenv", "remoteUser": "ubuntu", - "workspaceFolder": "/workspace/zeppelin" + "workspaceFolder": "/workspace/zeppelin", + "customizations": { + "vscode": { + "extensions": [ + "Vue.volar" + ] + } + } } diff --git a/backend/package.json b/backend/package.json index 8fb9adbf..0be8c03f 100644 --- a/backend/package.json +++ b/backend/package.json @@ -42,7 +42,6 @@ "cross-env": "^7.0.3", "deep-diff": "^1.0.2", "discord.js": "^14.19.3", - "dotenv": "^4.0.0", "emoji-regex": "^8.0.0", "escape-string-regexp": "^1.0.5", "express": "^4.20.0", diff --git a/dashboard/.htmlnanorc.js b/dashboard/.htmlnanorc.js deleted file mode 100644 index 5dff0968..00000000 --- a/dashboard/.htmlnanorc.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - collapseWhitespace: false, -}; diff --git a/dashboard/src/index.html b/dashboard/index.html similarity index 80% rename from dashboard/src/index.html rename to dashboard/index.html index 7151c5b0..f7448266 100644 --- a/dashboard/src/index.html +++ b/dashboard/index.html @@ -14,7 +14,10 @@

Zeppelin

The Zeppelin website requires JavaScript to load. - +
+ + + diff --git a/dashboard/package.json b/dashboard/package.json index 41fc4926..832e1b3f 100644 --- a/dashboard/package.json +++ b/dashboard/package.json @@ -3,54 +3,37 @@ "version": "1.0.0", "description": "", "private": true, + "type": "module", "scripts": { - "build": "rimraf dist && cross-env NODE_ENV=production webpack --config webpack.config.js", - "build-debug": "rimraf dist && cross-env NODE_ENV=development webpack --config webpack.config.js", - "watch": "cross-env NODE_ENV=development webpack-dev-server" + "dev": "vite", + "build": "vite build", + "preview": "vite preview" }, "devDependencies": { - "@babel/core": "^7.22.5", - "@babel/preset-env": "^7.22.5", - "@babel/preset-typescript": "^7.22.5", - "babel-loader": "^9.1.2", + "@tailwindcss/vite": "^4.1.8", + "@vitejs/plugin-vue": "^5.2.4", + "@vue/tsconfig": "^0.7.0", "cross-env": "^7.0.3", - "css-loader": "^6.8.1", - "cssnano": "^4.1.10", - "dotenv": "^16.4.5", - "file-loader": "^6.2.0", - "html-loader": "^4.2.0", - "html-webpack-plugin": "^5.5.3", - "postcss-import": "^15.1.0", - "postcss-loader": "^7.3.3", - "postcss-nesting": "^11.3.0", - "postcss-preset-env": "^8.5.1", - "source-map-loader": "^4.0.1", - "tailwindcss": "^1.9.6", - "ts-loader": "^9.4.3", - "vue-loader": "^17.4.2", - "vue-style-loader": "^4.1.3", - "vue-template-compiler": "^2.7.14", - "webpack": "^5.94.0", - "webpack-cli": "^5.1.4", - "webpack-dev-server": "^4.15.1", - "webpack-merge": "^5.9.0" - }, - "dependencies": { - "@fastify/static": "^7.0.1", - "fastify": "^4.26.2", "highlight.js": "^11.8.0", "humanize-duration": "^3.27.0", "js-yaml": "^4.1.0", "marked": "^5.1.0", - "modern-css-reset": "^1.4.0", "moment": "^2.29.4", + "postcss-nesting": "^13.0.1", + "tailwindcss": "^4.1.8", + "vite": "npm:rolldown-vite@latest", "vue": "^3.5.13", "vue-material-design-icons": "^5.3.1", "vue-router": "^4.5.0", + "vue-tsc": "^2.2.10", "vue3-ace-editor": "^2.2.4", "vue3-highlightjs": "^1.0.5", "vuex": "^4.1.0" }, + "dependencies": { + "@fastify/static": "^7.0.1", + "fastify": "^4.26.2" + }, "browserslist": [ "last 2 Chrome versions" ] diff --git a/dashboard/postcss.config.js b/dashboard/postcss.config.js new file mode 100644 index 00000000..bc73bf51 --- /dev/null +++ b/dashboard/postcss.config.js @@ -0,0 +1,8 @@ +import nesting from "postcss-nesting"; + +/** @type {import('postcss-load-config').Config} */ +const config = { + plugins: [nesting] +} + +export default config; diff --git a/dashboard/public/env.js b/dashboard/public/env.js new file mode 100644 index 00000000..cf4a9404 --- /dev/null +++ b/dashboard/public/env.js @@ -0,0 +1,2 @@ +// Don't edit this directly, it uses env vars in prod via serve.js +window.API_URL = "/api"; diff --git a/dashboard/src/img/logo.png b/dashboard/public/img/logo.png similarity index 100% rename from dashboard/src/img/logo.png rename to dashboard/public/img/logo.png diff --git a/dashboard/src/img/squint.png b/dashboard/public/img/squint.png similarity index 100% rename from dashboard/src/img/squint.png rename to dashboard/public/img/squint.png diff --git a/dashboard/serve.js b/dashboard/serve.js index f63fc3ab..936b4fbc 100644 --- a/dashboard/serve.js +++ b/dashboard/serve.js @@ -1,9 +1,22 @@ -const fastify = require("fastify")({ logger: true }); -const fastifyStatic = require("@fastify/static"); -const path = require("path"); +import Fastify from "fastify"; +import fastifyStatic from "@fastify/static"; +import path from "node:path"; + +const fastify = Fastify({ + // We already get logs from nginx, so disable here + logger: false, +}); + +fastify.addHook("preHandler", (req, reply, done) => { + if (req.url === "/env.js") { + reply.header("Content-Type", "application/javascript; charset=utf8"); + reply.send(`window.API_URL = ${JSON.stringify(process.env.API_URL)};`); + } + done(); +}); fastify.register(fastifyStatic, { - root: path.join(__dirname, "dist"), + root: path.join(import.meta.dirname, "dist"), wildcard: false, }); diff --git a/dashboard/src/api.ts b/dashboard/src/api.ts index f6cfd5e5..92d62baf 100644 --- a/dashboard/src/api.ts +++ b/dashboard/src/api.ts @@ -1,5 +1,4 @@ import { RootStore } from "./store"; -const apiUrl = process.env.API_URL; type QueryParamObject = { [key: string]: string | null }; @@ -28,7 +27,7 @@ function buildQueryString(params: QueryParamObject) { } export function request(resource, fetchOpts: RequestInit = {}) { - return fetch(`${apiUrl}/${resource}`, fetchOpts).then(async (res) => { + return fetch(`${window.API_URL}/${resource}`, fetchOpts).then(async (res) => { if (!res.ok) { if (res.status === 401) { RootStore.dispatch("auth/expiredLogin"); @@ -74,7 +73,7 @@ type FormPostOpts = { export function formPost(resource: string, body: Record = {}, opts: FormPostOpts = {}) { body["X-Api-Key"] = RootStore.state.auth.apiKey; const form = document.createElement("form"); - form.action = `${apiUrl}/${resource}`; + form.action = `${window.API_URL}/${resource}`; form.method = "POST"; form.enctype = "multipart/form-data"; if (opts.target != null) { diff --git a/dashboard/src/auth.ts b/dashboard/src/auth.ts index 92fcd936..1bc0cc04 100644 --- a/dashboard/src/auth.ts +++ b/dashboard/src/auth.ts @@ -11,7 +11,7 @@ const isAuthenticated = async () => { export const authGuard: NavigationGuard = async (to, from, next) => { if (await isAuthenticated()) return next(); - window.location.href = `${process.env.API_URL}/auth/login`; + window.location.href = `${window.API_URL}/auth/login`; }; export const loginCallbackGuard: NavigationGuard = async (to, from, next) => { @@ -26,6 +26,6 @@ export const loginCallbackGuard: NavigationGuard = async (to, from, next) => { export const authRedirectGuard: NavigationGuard = async (to, form, next) => { if (await isAuthenticated()) return next("/dashboard"); - window.location.href = `${process.env.API_URL}/auth/login`; + window.location.href = `${window.API_URL}/auth/login`; return next(); }; diff --git a/dashboard/src/components/Expandable.vue b/dashboard/src/components/Expandable.vue index fb699924..88f6995a 100644 --- a/dashboard/src/components/Expandable.vue +++ b/dashboard/src/components/Expandable.vue @@ -20,7 +20,7 @@ diff --git a/dashboard/src/components/dashboard/GuildConfigEditor.vue b/dashboard/src/components/dashboard/GuildConfigEditor.vue index 312da749..f5b097a6 100644 --- a/dashboard/src/components/dashboard/GuildConfigEditor.vue +++ b/dashboard/src/components/dashboard/GuildConfigEditor.vue @@ -25,7 +25,7 @@ lang="yaml" theme="tomorrow_night" ref="aceEditor" - v-options="{ + :options="{ useSoftTabs: true, tabSize: 2 }" diff --git a/dashboard/src/components/dashboard/GuildInfo.vue b/dashboard/src/components/dashboard/GuildInfo.vue index 28694aec..14158ed9 100644 --- a/dashboard/src/components/dashboard/GuildInfo.vue +++ b/dashboard/src/components/dashboard/GuildInfo.vue @@ -2,7 +2,7 @@

Guild Info

- What are you doing here + What are you doing here

diff --git a/dashboard/src/components/dashboard/Layout.vue b/dashboard/src/components/dashboard/Layout.vue index 9a46852c..a7c433ff 100644 --- a/dashboard/src/components/dashboard/Layout.vue +++ b/dashboard/src/components/dashboard/Layout.vue @@ -4,7 +4,7 @@