fix: update process.env to import.meta
This commit is contained in:
@@ -5,9 +5,7 @@ import { Code } from "@components/UI/Typography/Code.tsx";
|
|||||||
import { useAppStore } from "@core/stores/appStore.ts";
|
import { useAppStore } from "@core/stores/appStore.ts";
|
||||||
import { useDeviceStore } from "@core/stores/deviceStore.ts";
|
import { useDeviceStore } from "@core/stores/deviceStore.ts";
|
||||||
import { HomeIcon, PlusIcon, SearchIcon } from "lucide-react";
|
import { HomeIcon, PlusIcon, SearchIcon } from "lucide-react";
|
||||||
|
import { Avatar } from "@components/UI/Avatar.tsx";
|
||||||
import { Avatar } from "./UI/Avatar.tsx";
|
|
||||||
import process from "node:process";
|
|
||||||
|
|
||||||
export const DeviceSelector = () => {
|
export const DeviceSelector = () => {
|
||||||
const { getDevices } = useDeviceStore();
|
const { getDevices } = useDeviceStore();
|
||||||
@@ -17,6 +15,7 @@ export const DeviceSelector = () => {
|
|||||||
setCommandPaletteOpen,
|
setCommandPaletteOpen,
|
||||||
setConnectDialogOpen,
|
setConnectDialogOpen,
|
||||||
} = useAppStore();
|
} = useAppStore();
|
||||||
|
console.log(import.meta.env.VITE_COMMIT_HASH);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<nav className="flex flex-col justify-between border-r-[0.5px] border-slate-300 pt-2 dark:border-slate-700">
|
<nav className="flex flex-col justify-between border-r-[0.5px] border-slate-300 pt-2 dark:border-slate-700">
|
||||||
@@ -71,7 +70,7 @@ export const DeviceSelector = () => {
|
|||||||
</button> */
|
</button> */
|
||||||
}
|
}
|
||||||
<Separator />
|
<Separator />
|
||||||
<Code>{process.env.COMMIT_HASH}</Code>
|
<Code>{import.meta.env.VITE_COMMIT_HASH}</Code>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -58,8 +58,7 @@ export const Security = () => {
|
|||||||
if (input.length % 4 !== 0) {
|
if (input.length % 4 !== 0) {
|
||||||
addError(
|
addError(
|
||||||
fieldName,
|
fieldName,
|
||||||
`${
|
`${fieldName === "privateKey" ? "Private" : "Admin"
|
||||||
fieldName === "privateKey" ? "Private" : "Admin"
|
|
||||||
} Key is required to be a 256 bit pre-shared key (PSK)`,
|
} Key is required to be a 256 bit pre-shared key (PSK)`,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
@@ -74,8 +73,7 @@ export const Security = () => {
|
|||||||
console.error(e);
|
console.error(e);
|
||||||
addError(
|
addError(
|
||||||
fieldName,
|
fieldName,
|
||||||
`Invalid ${
|
`Invalid ${fieldName === "privateKey" ? "Private" : "Admin"
|
||||||
fieldName === "privateKey" ? "Private" : "Admin"
|
|
||||||
} Key format`,
|
} Key format`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -85,8 +83,6 @@ export const Security = () => {
|
|||||||
if (hasErrors()) {
|
if (hasErrors()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log(toByteArray(state.adminKey));
|
|
||||||
|
|
||||||
setWorkingConfig(
|
setWorkingConfig(
|
||||||
create(Protobuf.Config.ConfigSchema, {
|
create(Protobuf.Config.ConfigSchema, {
|
||||||
payloadVariant: {
|
payloadVariant: {
|
||||||
@@ -248,7 +244,7 @@ export const Security = () => {
|
|||||||
? getErrorMessage("adminKey")
|
? getErrorMessage("adminKey")
|
||||||
: "",
|
: "",
|
||||||
inputChange: adminKeyInputChangeEvent,
|
inputChange: adminKeyInputChangeEvent,
|
||||||
selectChange: () => {},
|
selectChange: () => { },
|
||||||
bits: [{ text: "256 bit", value: "32", key: "bit256" }],
|
bits: [{ text: "256 bit", value: "32", key: "bit256" }],
|
||||||
devicePSKBitCount: state.privateKeyBitCount,
|
devicePSKBitCount: state.privateKeyBitCount,
|
||||||
hide: !state.adminKeyVisible,
|
hide: !state.adminKeyVisible,
|
||||||
|
|||||||
@@ -1,33 +1,32 @@
|
|||||||
import { cn } from "../../core/utils/cn.ts";
|
import { cn } from "@core/utils/cn.ts"
|
||||||
import React from "react";
|
|
||||||
|
|
||||||
export interface FooterProps extends React.HTMLAttributes<HTMLElement> {}
|
type FooterProps = {
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
|
||||||
const Footer = React.forwardRef<HTMLElement, FooterProps>(
|
const Footer = ({ className, ...props }: FooterProps) => {
|
||||||
({ className, ...props }) => {
|
return (
|
||||||
return (
|
<footer
|
||||||
<footer
|
className={cn("flex mt-auto justify-center p-2", className)}
|
||||||
className={cn("flex mt-auto justify-center p-2", className)}
|
{...props}
|
||||||
{...props}
|
>
|
||||||
>
|
<p>
|
||||||
<p>
|
<a
|
||||||
<a
|
href="https://vercel.com/?utm_source=meshtastic&utm_campaign=oss"
|
||||||
href="https://vercel.com/?utm_source=meshtastic&utm_campaign=oss"
|
className="hover:underline text-link"
|
||||||
className="hover:underline text-link"
|
>
|
||||||
>
|
Powered by ▲ Vercel
|
||||||
Powered by ▲ Vercel
|
</a>{" "}
|
||||||
</a>{" "}
|
| Meshtastic® is a registered trademark of Meshtastic LLC. |{" "}
|
||||||
| Meshtastic® is a registered trademark of Meshtastic LLC. |{" "}
|
<a
|
||||||
<a
|
href="https://meshtastic.org/docs/legal"
|
||||||
href="https://meshtastic.org/docs/legal"
|
className="hover:underline text-link"
|
||||||
className="hover:underline text-link"
|
>
|
||||||
>
|
Legal Information
|
||||||
Legal Information
|
</a>
|
||||||
</a>
|
</p>
|
||||||
</p>
|
</footer>
|
||||||
</footer>
|
);
|
||||||
);
|
}
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
export default Footer;
|
export default Footer;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export interface GeneratorProps extends React.BaseHTMLAttributes<HTMLElement> {
|
|||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Generator = React.forwardRef<HTMLInputElement, GeneratorProps>(
|
const Generator =
|
||||||
(
|
(
|
||||||
{
|
{
|
||||||
type,
|
type,
|
||||||
@@ -53,7 +53,7 @@ const Generator = React.forwardRef<HTMLInputElement, GeneratorProps>(
|
|||||||
action,
|
action,
|
||||||
disabled,
|
disabled,
|
||||||
...props
|
...props
|
||||||
},
|
}: GeneratorProps
|
||||||
) => {
|
) => {
|
||||||
const inputRef = React.useRef<HTMLInputElement>(null);
|
const inputRef = React.useRef<HTMLInputElement>(null);
|
||||||
|
|
||||||
@@ -115,8 +115,7 @@ const Generator = React.forwardRef<HTMLInputElement, GeneratorProps>(
|
|||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
);
|
|
||||||
Generator.displayName = "Button";
|
Generator.displayName = "Button";
|
||||||
|
|
||||||
export { Generator };
|
export { Generator };
|
||||||
|
|||||||
+29
-21
@@ -1,40 +1,48 @@
|
|||||||
import { defineConfig } from 'vitest/config'
|
import { defineConfig } from 'vite';
|
||||||
import react from '@vitejs/plugin-react';
|
import react from '@vitejs/plugin-react';
|
||||||
import { VitePWA } from 'vite-plugin-pwa';
|
import { VitePWA } from 'vite-plugin-pwa';
|
||||||
import { execSync } from 'node:child_process';
|
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
|
|
||||||
let hash = '';
|
let hash = '';
|
||||||
try {
|
try {
|
||||||
hash = execSync('git rev-parse --short HEAD').toString().trim();
|
const process = new Deno.Command('git', {
|
||||||
|
args: ['rev-parse', '--short', 'HEAD'],
|
||||||
|
stdout: 'piped'
|
||||||
|
});
|
||||||
|
const output = await process.output();
|
||||||
|
hash = new TextDecoder().decode(output.stdout).trim();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error('Error getting git hash:', error);
|
||||||
hash = 'DEV';
|
hash = 'DEV';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('Commit hash:', hash);
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [react(),
|
plugins: [
|
||||||
VitePWA({
|
react(),
|
||||||
registerType: 'autoUpdate',
|
VitePWA({
|
||||||
strategies: 'generateSW',
|
registerType: 'autoUpdate',
|
||||||
devOptions: {
|
strategies: 'generateSW',
|
||||||
enabled: true
|
devOptions: {
|
||||||
},
|
enabled: true
|
||||||
workbox: {
|
},
|
||||||
cleanupOutdatedCaches: true,
|
workbox: {
|
||||||
sourcemap: true
|
cleanupOutdatedCaches: true,
|
||||||
}
|
sourcemap: true
|
||||||
})
|
}
|
||||||
|
})
|
||||||
],
|
],
|
||||||
define: {
|
define: {
|
||||||
'process.env.COMMIT_HASH': JSON.stringify(hash),
|
'import.meta.env.VITE_COMMIT_HASH': JSON.stringify(hash),
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'@app': path.resolve(__dirname, './src'),
|
'@app': path.resolve(Deno.cwd(), './src'),
|
||||||
'@pages': path.resolve(__dirname, './src/pages'),
|
'@pages': path.resolve(Deno.cwd(), './src/pages'),
|
||||||
'@components': path.resolve(__dirname, './src/components'),
|
'@components': path.resolve(Deno.cwd(), './src/components'),
|
||||||
'@core': path.resolve(__dirname, './src/core'),
|
'@core': path.resolve(Deno.cwd(), './src/core'),
|
||||||
'@layouts': path.resolve(__dirname, './src/layouts'),
|
'@layouts': path.resolve(Deno.cwd(), './src/layouts'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
|
|||||||
Reference in New Issue
Block a user