Browse Source

Prevented i18n package from escaping text (#704)

* fix: prevented i18n package from escaping text

* Update packages/web/vite.config.ts

Co-authored-by: Copilot <[email protected]>

* fix: stupid copilot

---------

Co-authored-by: Copilot <[email protected]>
pull/707/head
Dan Ditomaso 12 months ago
committed by GitHub
parent
commit
5efa1d1795
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 12
      packages/web/index.html
  2. 2
      packages/web/public/i18n/locales/en/dialog.json
  3. 1
      packages/web/src/components/Dialog/LocationResponseDialog.tsx
  4. 1
      packages/web/src/components/Dialog/NodeDetailsDialog/NodeDetailsDialog.tsx
  5. 3
      packages/web/src/components/Dialog/PKIBackupDialog.tsx
  6. 3
      packages/web/src/components/Dialog/RefreshKeysDialog/RefreshKeysDialog.tsx
  7. 7
      packages/web/src/core/dto/NodeNumToNodeInfoDTO.ts
  8. 1
      packages/web/src/pages/Messages.tsx
  9. 4
      packages/web/vite.config.ts

12
packages/web/index.html

@ -8,16 +8,18 @@
<link rel="manifest" href="site.webmanifest" /> <link rel="manifest" href="site.webmanifest" />
<link rel="mask-icon" href="logo_black.svg" color="#67ea94" /> <link rel="mask-icon" href="logo_black.svg" color="#67ea94" />
<link rel="stylesheet" href="https://rsms.me/inter/inter.css" /> <link
rel="stylesheet"
href="https://rsms.me/inter/inter.css"
crossorigin="anonymous"
/>
<link <link
rel="stylesheet" rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@xz/fonts@1/serve/cascadia-code.min.css" href="https://cdn.jsdelivr.net/npm/@xz/fonts@1/serve/cascadia-code.min.css"
crossorigin="anonymous"
/> />
<meta name="theme-color" content="#67ea94" /> <meta name="theme-color" content="#67ea94" />
<meta <meta name="viewport" content="width=device-width, initial-scale=1" />
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=0"
/>
<meta name="description" content="Meshtastic Web Client" /> <meta name="description" content="Meshtastic Web Client" />
<title>Meshtastic Web</title> <title>Meshtastic Web</title>
</head> </head>

2
packages/web/public/i18n/locales/en/dialog.json

@ -178,6 +178,6 @@
"managedMode": { "managedMode": {
"confirmUnderstanding": "Yes, I know what I'm doing", "confirmUnderstanding": "Yes, I know what I'm doing",
"title": "Are you sure?", "title": "Are you sure?",
"description": "Enabling Managed Mode blocks client applications (including the web client) from writing configurations to a radio. Once enabled, radio configurations can <bold>only</bold> be changed through Remote Admin messages. This setting is not required for remote node administration." "description": "Enabling Managed Mode blocks client applications (including the web client) from writing configurations to a radio. Once enabled, radio configurations can only be changed through Remote Admin messages. This setting is not required for remote node administration."
} }
} }

1
packages/web/src/components/Dialog/LocationResponseDialog.tsx

@ -47,6 +47,7 @@ export const LocationResponseDialog = ({
<DialogHeader> <DialogHeader>
<DialogTitle> <DialogTitle>
{t("locationResponse.title", { {t("locationResponse.title", {
interpolation: { escapeValue: false },
identifier: `${longName} (${shortName})`, identifier: `${longName} (${shortName})`,
})} })}
</DialogTitle> </DialogTitle>

1
packages/web/src/components/Dialog/NodeDetailsDialog/NodeDetailsDialog.tsx

@ -169,6 +169,7 @@ export const NodeDetailsDialog = ({
<DialogHeader> <DialogHeader>
<DialogTitle> <DialogTitle>
{t("nodeDetails.title", { {t("nodeDetails.title", {
interpolation: { escapeValue: false },
identifier: `${node.user?.longName ?? t("unknown.shortName")} (${ identifier: `${node.user?.longName ?? t("unknown.shortName")} (${
node.user?.shortName ?? t("unknown.shortName") node.user?.shortName ?? t("unknown.shortName")
})`, })`,

3
packages/web/src/components/Dialog/PKIBackupDialog.tsx

@ -50,6 +50,7 @@ export const PkiBackupDialog = ({
<head> <head>
<title>${ <title>${
t("pkiBackup.header", { t("pkiBackup.header", {
interpolation: { escapeValue: false },
shortName: getMyNode()?.user?.shortName ?? t("unknown.shortName"), shortName: getMyNode()?.user?.shortName ?? t("unknown.shortName"),
longName: getMyNode()?.user?.longName ?? t("unknown.longName"), longName: getMyNode()?.user?.longName ?? t("unknown.longName"),
}) })
@ -63,6 +64,7 @@ export const PkiBackupDialog = ({
<body> <body>
<h1>${ <h1>${
t("pkiBackup.header", { t("pkiBackup.header", {
interpolation: { escapeValue: false },
shortName: getMyNode()?.user?.shortName ?? t("unknown.shortName"), shortName: getMyNode()?.user?.shortName ?? t("unknown.shortName"),
longName: getMyNode()?.user?.longName ?? t("unknown.longName"), longName: getMyNode()?.user?.longName ?? t("unknown.longName"),
}) })
@ -103,6 +105,7 @@ export const PkiBackupDialog = ({
const link = document.createElement("a"); const link = document.createElement("a");
link.href = url; link.href = url;
link.download = t("pkiBackup.fileName", { link.download = t("pkiBackup.fileName", {
interpolation: { escapeValue: false },
shortName: getMyNode()?.user?.shortName ?? t("unknown.shortName"), shortName: getMyNode()?.user?.shortName ?? t("unknown.shortName"),
longName: getMyNode()?.user?.longName ?? t("unknown.longName"), longName: getMyNode()?.user?.longName ?? t("unknown.longName"),
}); });

3
packages/web/src/components/Dialog/RefreshKeysDialog/RefreshKeysDialog.tsx

@ -10,7 +10,7 @@ import { LockKeyholeOpenIcon } from "lucide-react";
import { useRefreshKeysDialog } from "./useRefreshKeysDialog.ts"; import { useRefreshKeysDialog } from "./useRefreshKeysDialog.ts";
import { useDevice } from "@core/stores/deviceStore.ts"; import { useDevice } from "@core/stores/deviceStore.ts";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useMessageStore } from "../../../core/stores/messageStore/index.ts"; import { useMessageStore } from "@core/stores/messageStore/index.ts";
export interface RefreshKeysDialogProps { export interface RefreshKeysDialogProps {
open: boolean; open: boolean;
@ -35,6 +35,7 @@ export const RefreshKeysDialog = (
const text = { const text = {
title: t("refreshKeys.title", { title: t("refreshKeys.title", {
interpolation: { escapeValue: false },
identifier: nodeWithError?.user?.longName ?? "", identifier: nodeWithError?.user?.longName ?? "",
}), }),
description: `${t("refreshKeys.description.unableToSendDmPrefix")}${ description: `${t("refreshKeys.description.unableToSendDmPrefix")}${

7
packages/web/src/core/dto/NodeNumToNodeInfoDTO.ts

@ -8,14 +8,11 @@ class NodeInfoFactory {
const last4 = userIdHex.slice(-4); const last4 = userIdHex.slice(-4);
const longName = `Meshtastic ${last4}`; const longName = `Meshtastic ${last4}`;
const shortName = last4; const shortName = last4;
const hwModel = Protobuf.Mesh.HardwareModel.UNSET;
return create(Protobuf.Mesh.UserSchema, { return create(Protobuf.Mesh.UserSchema, {
id: userId, id: userId,
longName: longName, longName: longName.toString(),
shortName: shortName, shortName: shortName.toString(),
hwModel: hwModel,
isLicensed: false,
}); });
} }

1
packages/web/src/pages/Messages.tsx

@ -308,6 +308,7 @@ export const MessagesPage = () => {
<PageLayout <PageLayout
label={`${ label={`${
t("page.title", { t("page.title", {
interpolation: { escapeValue: false },
chatName: isBroadcast && currentChannel chatName: isBroadcast && currentChannel
? getChannelName(currentChannel) ? getChannelName(currentChannel)
: isDirect && otherNode : isDirect && otherNode

4
packages/web/vite.config.ts

@ -12,6 +12,9 @@ try {
hash = "DEV"; hash = "DEV";
} }
const CONTENT_SECURITY_POLICY =
"script-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net; 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({ export default defineConfig({
plugins: [ plugins: [
react(), react(),
@ -49,6 +52,7 @@ export default defineConfig({
server: { server: {
port: 3000, port: 3000,
headers: { headers: {
"content-security-policy": CONTENT_SECURITY_POLICY,
"Cross-Origin-Opener-Policy": "same-origin", "Cross-Origin-Opener-Policy": "same-origin",
"Cross-Origin-Embedder-Policy": "require-corp", "Cross-Origin-Embedder-Policy": "require-corp",
}, },

Loading…
Cancel
Save