diff --git a/config/vite.config.js b/config/vite.config.js index 6e9ebbde..f9ca0651 100644 --- a/config/vite.config.js +++ b/config/vite.config.js @@ -3,6 +3,7 @@ import vue from "@vitejs/plugin-vue"; import { defineConfig } from "vite"; import visualizer from "rollup-plugin-visualizer"; import viteCompression from "vite-plugin-compression"; +import commonjs from "vite-plugin-commonjs"; const postCssScss = require("postcss-scss"); const postcssRTLCSS = require("postcss-rtlcss"); @@ -18,6 +19,7 @@ export default defineConfig({ "FRONTEND_VERSION": JSON.stringify(process.env.npm_package_version), }, plugins: [ + commonjs(), vue(), legacy({ targets: [ "since 2015" ], @@ -42,6 +44,9 @@ export default defineConfig({ } }, build: { + commonjsOptions: { + include: [ /.js$/ ], + }, rollupOptions: { output: { manualChunks(id, { getModuleInfo, getModuleIds }) { diff --git a/package-lock.json b/package-lock.json index ad26942e..6b9b937b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -116,6 +116,7 @@ "typescript": "~4.4.4", "v-pagination-3": "~0.1.7", "vite": "~4.4.1", + "vite-plugin-commonjs": "^0.8.0", "vite-plugin-compression": "^0.5.1", "vue": "~3.3.4", "vue-chartjs": "~5.2.0", @@ -8751,6 +8752,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/es-module-lexer": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.3.0.tgz", + "integrity": "sha512-vZK7T0N2CBmBOixhmjdqx2gWVbFZ4DXZ/NyRMZVlJXPa7CyFS+/a4QQsDGDQy9ZfEzxFuNEsMLeQJnKP2p5/JA==", + "dev": true + }, "node_modules/es-set-tostringtag": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz", @@ -18020,6 +18027,18 @@ } } }, + "node_modules/vite-plugin-commonjs": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/vite-plugin-commonjs/-/vite-plugin-commonjs-0.8.1.tgz", + "integrity": "sha512-hL2wwqgSiLBcrmCH7z+H468Z9uyBnKXX5OAwoYmWd/i03PBGCqkOBR3rjeojyWOoGmWgDVB7lj6Xn5pVw3Fwyg==", + "dev": true, + "dependencies": { + "acorn": "^8.8.2", + "fast-glob": "^3.2.12", + "magic-string": "^0.30.1", + "vite-plugin-dynamic-import": "^1.5.0" + } + }, "node_modules/vite-plugin-compression": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/vite-plugin-compression/-/vite-plugin-compression-0.5.1.tgz", @@ -18118,6 +18137,18 @@ "node": ">=8" } }, + "node_modules/vite-plugin-dynamic-import": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/vite-plugin-dynamic-import/-/vite-plugin-dynamic-import-1.5.0.tgz", + "integrity": "sha512-Qp85c+AVJmLa8MLni74U4BDiWpUeFNx7NJqbGZyR2XJOU7mgW0cb7nwlAMucFyM4arEd92Nfxp4j44xPi6Fu7g==", + "dev": true, + "dependencies": { + "acorn": "^8.8.2", + "es-module-lexer": "^1.2.1", + "fast-glob": "^3.2.12", + "magic-string": "^0.30.1" + } + }, "node_modules/vue": { "version": "3.3.4", "resolved": "https://registry.npmjs.org/vue/-/vue-3.3.4.tgz", diff --git a/package.json b/package.json index fadd0f0d..891cebd3 100644 --- a/package.json +++ b/package.json @@ -175,6 +175,7 @@ "typescript": "~4.4.4", "v-pagination-3": "~0.1.7", "vite": "~4.4.1", + "vite-plugin-commonjs": "^0.8.0", "vite-plugin-compression": "^0.5.1", "vue": "~3.3.4", "vue-chartjs": "~5.2.0", diff --git a/server/config.js b/server/config.js index 43a40f67..77f9e74b 100644 --- a/server/config.js +++ b/server/config.js @@ -1,4 +1,5 @@ -const args = require("args-parser")(process.argv); +// Interop with browser +const args = (typeof process !== "undefined") ? require("args-parser")(process.argv) : {}; const demoMode = args["demo"] || false; const badgeConstants = { diff --git a/server/routers/api-router.js b/server/routers/api-router.js index 8b5d36f2..f51f046d 100644 --- a/server/routers/api-router.js +++ b/server/routers/api-router.js @@ -442,7 +442,7 @@ router.get("/api/badge/:id/cert-exp", cache("5 minutes"), async (request, respon if (!tlsInfo.valid) { // return a "Bad Cert" badge in naColor (grey), when cert is not valid badgeValues.message = "Bad Cert"; - badgeValues.color = badgeConstants.downColor; + badgeValues.color = downColor; } else { const daysRemaining = parseInt(overrideValue ?? tlsInfo.certInfo.daysRemaining); diff --git a/src/components/BadgeGeneratorDialog.vue b/src/components/BadgeGeneratorDialog.vue index 9e073e39..aa6fa6e8 100644 --- a/src/components/BadgeGeneratorDialog.vue +++ b/src/components/BadgeGeneratorDialog.vue @@ -22,78 +22,78 @@
- - + +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
@@ -109,12 +109,16 @@
- + +
+ +
+
- - + +
@@ -131,6 +135,7 @@