* feat(conn): add connection screen and logic * fixes from code review * force https * code review fixes * add http for self testing * enable deviceStore persistance * added translations * disabled feature flag * i18n updates * chore: add new folders to biome config (#910) * chore(i18n): New Crowdin Translations by GitHub Action (#908) Co-authored-by: Crowdin Bot <support+bot@crowdin.com> * fix: use correct deprecated GPS coordinate format enum (#917) The Config_DisplayConfig_GpsCoordinateFormat export doesn't exist in the protobufs package. The correct export is Config_DisplayConfig_DeprecatedGpsCoordinateFormat, which matches what's used in the validation schema. Added TODO comment explaining that this field is deprecated since protobufs 2.7.4 and should be migrated to DeviceUIConfig.gps_format when DeviceUI settings are implemented. * style: fix line wrapping for GPS coordinate format enum (#918) - Split long enum reference across multiple lines to improve code readability - Maintains consistent code formatting standards without changing functionality * fix(core): ensure core package works in browser (#923) * fix(core): ensure core package works in browser * style(core): revert new line removal * fix: add @serialport/bindings-cpp to onlyBuiltDependencies (#914) * feat(ui): Add UI library (#900) * feat: scaffold UI library * Update packages/ui/src/components/theme-provider.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * add lock file * lint/formatting fixes --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * formatting/linting fixes * fixed some paring logic * fixed connection issue with serial --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Crowdin Bot <support+bot@crowdin.com> Co-authored-by: Kamil Dzieniszewski <kamil.dzieniszewski@gmail.com> Co-authored-by: Azarattum <43073346+Azarattum@users.noreply.github.com> Co-authored-by: Ben Allfree <ben@benallfree.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
93 lines
3.0 KiB
TypeScript
93 lines
3.0 KiB
TypeScript
import { execSync } from "node:child_process";
|
|
import path from "node:path";
|
|
import process from "node:process";
|
|
import tailwindcss from "@tailwindcss/vite";
|
|
import basicSsl from "@vitejs/plugin-basic-ssl";
|
|
import react from "@vitejs/plugin-react";
|
|
import { defineConfig, loadEnv } from "vite";
|
|
import { createHtmlPlugin } from "vite-plugin-html";
|
|
import { VitePWA } from "vite-plugin-pwa";
|
|
|
|
let hash = "";
|
|
let version = "v0.0.0";
|
|
try {
|
|
hash = execSync("git rev-parse --short HEAD", { encoding: "utf8" }).trim();
|
|
} catch (error) {
|
|
console.error("Error getting git hash:", error);
|
|
hash = "DEV";
|
|
}
|
|
|
|
try {
|
|
version = execSync("git describe --tags --abbrev=0", {
|
|
encoding: "utf8",
|
|
}).trim();
|
|
} catch (error) {
|
|
console.error("Error getting git version:", error);
|
|
}
|
|
|
|
const CONTENT_SECURITY_POLICY =
|
|
"script-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net https://cdn-cookieyes.com; style-src 'self' 'unsafe-inline' data: https://rsms.me https://cdn.jsdelivr.net; img-src 'self' data:; font-src 'self' data: https://rsms.me https://cdn.jsdelivr.net; worker-src 'self' blob:; object-src 'none'; base-uri 'self';";
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
const env = loadEnv(mode, process.cwd());
|
|
|
|
const isProd = mode === "production";
|
|
const isTest = env.VITE_IS_TEST;
|
|
const useHTTPS = env.VITE_USE_HTTPS === "true";
|
|
|
|
return {
|
|
plugins: [
|
|
react(),
|
|
tailwindcss(),
|
|
...(useHTTPS ? [basicSsl()] : []),
|
|
createHtmlPlugin({
|
|
inject: {
|
|
data: {
|
|
title: isTest ? "Meshtastic Web (TEST)" : "Meshtastic Web",
|
|
cookieYesScript:
|
|
isProd && env.VITE_COOKIEYES_CLIENT_ID
|
|
? // This is for GDPR/CCPA compliance
|
|
`<script async src="https://cdn-cookieyes.com/client_data/${env.VITE_COOKIEYES_CLIENT_ID}/script.js"></script>`
|
|
: "",
|
|
},
|
|
},
|
|
}),
|
|
VitePWA({
|
|
selfDestroying: true,
|
|
}),
|
|
],
|
|
optimizeDeps: {
|
|
include: ["react/jsx-runtime"],
|
|
},
|
|
define: {
|
|
"import.meta.env.VITE_COMMIT_HASH": JSON.stringify(hash),
|
|
"import.meta.env.VITE_VERSION": JSON.stringify(version),
|
|
},
|
|
build: {
|
|
emptyOutDir: true,
|
|
assetsDir: "./",
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
"@app": path.resolve(process.cwd(), "./src"),
|
|
"@pages": path.resolve(process.cwd(), "./src/pages"),
|
|
"@components": path.resolve(process.cwd(), "./src/components"),
|
|
"@core": path.resolve(process.cwd(), "./src/core"),
|
|
"@layouts": path.resolve(process.cwd(), "./src/layouts"),
|
|
},
|
|
},
|
|
server: {
|
|
port: 3000,
|
|
headers: {
|
|
"Content-Security-Policy": CONTENT_SECURITY_POLICY,
|
|
"Cross-Origin-Opener-Policy": "same-origin",
|
|
"Cross-Origin-Embedder-Policy": "credentialless",
|
|
"X-Content-Type-Options": "nosniff",
|
|
"Strict-Transport-Security":
|
|
"max-age=63072000; includeSubDomains; preload",
|
|
"Referrer-Policy": "strict-origin-when-cross-origin",
|
|
},
|
|
},
|
|
};
|
|
});
|