Skip to content

Commit

Permalink
feat: 优化复制安装命令提示
Browse files Browse the repository at this point in the history
  • Loading branch information
naiba committed Nov 30, 2024
1 parent 63bb672 commit 7463bbe
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions src/components/install-commands.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@ export const InstallCommandsMenu = forwardRef<HTMLButtonElement, ButtonProps>((p
if (!copy) {
try {
setCopy(true);
if (settings)
await copyToClipboard(generateCommand(type, settings) || '');

} catch (e) {
if (!settings) throw new Error("Settings is not found.");
await copyToClipboard(generateCommand(type, settings) || '');
} catch (e: Error | any) {
console.error(e);
toast(t("Error"), {
description: t("Results.UnExpectedError"),
description: e.message,
})
} finally {
setTimeout(() => {
Expand Down Expand Up @@ -64,7 +63,7 @@ export const InstallCommandsMenu = forwardRef<HTMLButtonElement, ButtonProps>((p

const generateCommand = (type: number, { agent_secret_key, install_host, listen_port, tls }: ModelConfig) => {
if (!install_host)
throw new Error("You have not specify the installed host.");
throw new Error("You have not specify the installed host.")

const env = `NZ_SERVER=${install_host}:${listen_port} NZ_TLS=${tls || false} NZ_CLIENT_SECRET=${agent_secret_key}`;

Expand Down
2 changes: 1 addition & 1 deletion src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"DDNS": "Dynamic DNS",
"NATT": "NAT Traversal",
"Group": "Group",
"Profile": "personal information",
"Profile": "Profile",
"Settings": "System settings",
"Logout": "Log out",
"NavigateTo": "Navigate to",
Expand Down

0 comments on commit 7463bbe

Please sign in to comment.