Skip to content

Commit 48794be

Browse files
committed
frontend: remove address
1 parent b9e9738 commit 48794be

5 files changed

Lines changed: 22 additions & 116 deletions

File tree

cmd/relay-server/frontend.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,6 @@ func (f *Frontend) injectOGMetadata(htmlContent, title, description string) stri
235235
"[%OG_TITLE%]", html.EscapeString(title),
236236
"[%OG_DESCRIPTION%]", html.EscapeString(description),
237237
"[%LANDING_PAGE_ENABLED%]", html.EscapeString(strconv.FormatBool(f.isLandingPageEnabled())),
238-
"[%SERVER_OWNER_ADDRESS%]", html.EscapeString(f.server.OwnerAddress()),
239238
"[%RELEASE_VERSION%]", html.EscapeString(types.ReleaseVersion),
240239
)
241240
return replacer.Replace(htmlContent)

frontend/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
<meta name="twitter:title" content="[%OG_TITLE%]" />
1515
<meta name="twitter:description" content="[%OG_DESCRIPTION%]" />
1616
<meta name="portal-landing-page-enabled" content="[%LANDING_PAGE_ENABLED%]" />
17-
<meta name="portal-server-owner-address" content="[%SERVER_OWNER_ADDRESS%]" />
1817
<meta name="portal-release-version" content="[%RELEASE_VERSION%]" />
1918
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
2019
<title>Portal - Local to web. Instant access.</title>

frontend/src/components/Header.tsx

Lines changed: 17 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { useEffect, useState } from "react";
2-
import { Check, Copy, LogOut } from "lucide-react";
1+
import { LogOut } from "lucide-react";
32
import { Button } from "@/components/ui/button";
43
import { ThemeToggleButton } from "@/components/ThemeToggleButton";
54
import {
@@ -14,72 +13,18 @@ interface HeaderProps {
1413
title?: string;
1514
isAdmin?: boolean;
1615
onLogout?: () => void;
16+
showQuickStartLink?: boolean;
1717
}
1818

1919
const repoURL = "https://github.com/gosuda/portal";
20-
const SERVER_OWNER_ADDRESS_META_NAME = "portal-server-owner-address";
21-
22-
function getServerOwnerAddress(doc?: Document): string {
23-
const targetDoc =
24-
doc ?? (typeof document !== "undefined" ? document : undefined);
25-
if (!targetDoc) {
26-
return "";
27-
}
28-
29-
return (
30-
targetDoc
31-
.querySelector<HTMLMetaElement>(
32-
`meta[name="${SERVER_OWNER_ADDRESS_META_NAME}"]`
33-
)
34-
?.content.trim() || ""
35-
);
36-
}
37-
38-
function formatOwnerAddress(address: string): string {
39-
const trimmed = address.trim();
40-
if (trimmed.length <= 14) {
41-
return trimmed;
42-
}
43-
44-
return `${trimmed.slice(0, 6)}...${trimmed.slice(-4)}`;
45-
}
4620

4721
export function Header({
4822
title = "PORTAL",
4923
isAdmin,
5024
onLogout,
25+
showQuickStartLink = true,
5126
}: HeaderProps) {
5227
const releaseVersion = getReleaseVersion();
53-
const serverOwnerAddress = getServerOwnerAddress();
54-
const [ownerAddressCopied, setOwnerAddressCopied] = useState(false);
55-
const displayOwnerAddress = formatOwnerAddress(serverOwnerAddress);
56-
57-
useEffect(() => {
58-
if (!ownerAddressCopied) {
59-
return;
60-
}
61-
62-
const timer = window.setTimeout(() => {
63-
setOwnerAddressCopied(false);
64-
}, 1800);
65-
66-
return () => {
67-
window.clearTimeout(timer);
68-
};
69-
}, [ownerAddressCopied]);
70-
71-
const handleCopyOwnerAddress = async () => {
72-
if (!serverOwnerAddress) {
73-
return;
74-
}
75-
76-
try {
77-
await navigator.clipboard.writeText(serverOwnerAddress);
78-
setOwnerAddressCopied(true);
79-
} catch (error) {
80-
console.error("Failed to copy owner address", error);
81-
}
82-
};
8328

8429
return (
8530
<header className="flex flex-wrap items-center justify-between gap-x-4 gap-y-3 py-2 lg:flex-nowrap">
@@ -115,12 +60,14 @@ export function Header({
11560
</div>
11661
{!isAdmin && (
11762
<nav className="hidden items-center gap-6 pl-2 text-base font-semibold text-text-muted xl:flex xl:pl-3">
118-
<a
119-
href="#quick-start"
120-
className="transition-colors hover:text-foreground"
121-
>
122-
Quick Start
123-
</a>
63+
{showQuickStartLink && (
64+
<a
65+
href="#quick-start"
66+
className="transition-colors hover:text-foreground"
67+
>
68+
Quick Start
69+
</a>
70+
)}
12471
<a
12572
href="#live-servers"
12673
className="transition-colors hover:text-foreground"
@@ -138,60 +85,20 @@ export function Header({
13885
</div>
13986

14087
<div className="flex shrink-0 flex-wrap items-center gap-2 sm:gap-3">
141-
{serverOwnerAddress && (
142-
<div
143-
title={serverOwnerAddress}
144-
className="inline-flex h-11 max-w-full items-center gap-2 rounded-full border border-sky-500/20 bg-background/85 pl-1.5 pr-1 shadow-[0_10px_28px_rgba(15,23,42,0.08)] backdrop-blur"
145-
>
146-
<div className="flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-linear-to-br from-sky-400 via-cyan-300 to-blue-500 shadow-[0_8px_20px_rgba(56,189,248,0.28)]">
147-
<svg
148-
xmlns="http://www.w3.org/2000/svg"
149-
width="16"
150-
height="16"
151-
viewBox="0 0 906.26 1457.543"
152-
className="h-4 w-4 text-slate-950"
153-
>
154-
<path
155-
fill="currentColor"
156-
d="M254.854 137.158c-34.46 84.407-88.363 149.39-110.934 245.675 90.926-187.569 308.397-483.654 554.729-348.685 135.487 74.216 194.878 270.78 206.058 467.566 21.924 385.996-190.977 853.604-467.585 943.057-174.879 56.543-307.375-86.447-364.527-198.115-176.498-344.82 2.041-910.077 182.259-1109.498zm198.13 7.918C202.61 280.257 4.622 968.542 207.322 1270.414c51.713 77.029 194.535 160.648 285.294 71.318-209.061 31.529-288.389-176.143-301.145-340.765 31.411 147.743 139.396 326.12 309.075 253.588 251.957-107.723 376.778-648.46 269.433-966.817 22.394 134.616 15.572 317.711-47.551 412.087 86.655-230.615 7.903-704.478-269.444-554.749z"
157-
/>
158-
</svg>
159-
</div>
160-
161-
<span className="max-w-[6.75rem] truncate font-mono text-[13px] font-semibold tracking-tight text-foreground sm:max-w-[8.5rem]">
162-
{displayOwnerAddress}
163-
</span>
164-
165-
<button
166-
type="button"
167-
onClick={() => {
168-
void handleCopyOwnerAddress();
169-
}}
170-
className="inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full border border-border/70 bg-background/90 text-text-muted transition-colors hover:text-foreground"
171-
aria-label="Copy owner address"
172-
>
173-
{ownerAddressCopied ? (
174-
<Check className="h-4 w-4 text-sky-500" />
175-
) : (
176-
<Copy className="h-4 w-4" />
177-
)}
178-
</button>
179-
</div>
180-
)}
18188
{!isAdmin && (
18289
<a
18390
href={repoURL}
18491
target="_blank"
18592
rel="noopener noreferrer"
186-
className="hidden h-11 w-11 items-center justify-center text-foreground transition-transform transition-colors hover:-translate-y-0.5 hover:text-primary xl:inline-flex"
93+
className="hidden h-12 w-12 items-center justify-center rounded-full border border-border/70 bg-background/90 text-foreground shadow-sm transition-all hover:-translate-y-0.5 hover:border-primary/40 hover:text-primary xl:inline-flex"
18794
aria-label="View source on GitHub"
18895
>
18996
<svg
190-
height="20"
191-
width="20"
97+
height="22"
98+
width="22"
19299
viewBox="0 0 24 24"
193100
fill="currentColor"
194-
className="opacity-80 transition-opacity hover:opacity-100"
101+
className="opacity-85 transition-opacity hover:opacity-100"
195102
>
196103
<path d="M12 1C5.923 1 1 5.923 1 12c0 4.867 3.149 8.979 7.521 10.436.55.096.756-.233.756-.522 0-.262-.013-1.128-.013-2.049-2.764.509-3.479-.674-3.699-1.292-.124-.317-.66-1.293-1.127-1.554-.385-.207-.936-.715-.014-.729.866-.014 1.485.797 1.691 1.128.99 1.663 2.571 1.196 3.204.907.096-.715.385-1.196.701-1.471-2.448-.275-5.005-1.224-5.005-5.432 0-1.196.426-2.186 1.128-2.956-.111-.275-.496-1.402.11-2.915 0 0 .921-.288 3.024 1.128a10.193 10.193 0 0 1 2.75-.371c.936 0 1.871.123 2.75.371 2.104-1.43 3.025-1.128 3.025-1.128.605 1.513.221 2.64.111 2.915.701.77 1.127 1.747 1.127 2.956 0 4.222-2.571 5.157-5.019 5.432.399.344.743 1.004.743 2.035 0 1.471-.014 2.654-.014 3.025 0 .289.206.632.756.522C19.851 20.979 23 16.854 23 12c0-6.077-4.922-11-11-11Z" />
197104
</svg>
@@ -208,10 +115,10 @@ export function Header({
208115
variant="outline"
209116
size="icon"
210117
onClick={onLogout}
211-
className="h-11 w-11 cursor-pointer rounded-full text-foreground hover:text-destructive"
118+
className="h-12 w-12 cursor-pointer rounded-full border-border/70 bg-background/90 text-foreground shadow-sm transition-all hover:-translate-y-0.5 hover:border-destructive/40 hover:bg-background hover:text-destructive"
212119
aria-label="Logout"
213120
>
214-
<LogOut className="h-5 w-5" />
121+
<LogOut className="h-[22px] w-[22px]" />
215122
</Button>
216123
</TooltipTrigger>
217124
<TooltipContent>

frontend/src/components/ServerListView.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,7 @@ export function ServerListView({
640640
title={title}
641641
isAdmin={isAdmin}
642642
onLogout={onLogout}
643+
showQuickStartLink={landingPageEnabled}
643644
/>
644645
</div>
645646
</div>

frontend/src/components/ThemeToggleButton.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@ export function ThemeToggleButton({ className }: ThemeToggleButtonProps) {
1414
return (
1515
<Button
1616
type="button"
17-
variant="ghost"
17+
variant="outline"
1818
size="icon"
1919
onClick={toggleTheme}
2020
className={clsx(
21-
"h-11 w-11 cursor-pointer rounded-full text-foreground shadow-none hover:bg-transparent hover:-translate-y-0.5 hover:text-primary",
21+
"h-12 w-12 cursor-pointer rounded-full border-border/70 bg-background/90 text-foreground shadow-sm transition-all hover:-translate-y-0.5 hover:border-primary/40 hover:bg-background hover:text-primary",
2222
className
2323
)}
2424
aria-label={`Switch to ${nextTheme} theme`}
2525
title={theme === "dark" ? "Light theme" : "Dark theme"}
2626
>
2727
{theme === "dark" ? (
28-
<Sun className="h-5 w-5" />
28+
<Sun className="h-[22px] w-[22px]" />
2929
) : (
30-
<Moon className="h-5 w-5" />
30+
<Moon className="h-[22px] w-[22px]" />
3131
)}
3232
</Button>
3333
);

0 commit comments

Comments
 (0)