mirror of
https://github.com/hanzoai/bootnode.git
synced 2026-09-30 20:46:32 +00:00
fix(brand): remove hardcoded Bootnode leaks (terms, navbar, ai-chat, region-data, wallets sdk sample) + zoo IAM → zoolabs.id
- web/lib/brand.ts: zoo iam.url + iam.domain → zoolabs.id (zoo.id is NXDOMAIN)
- web/components/navbar.tsx: brand-aware `npm i {sdk}` snippet
- web/components/ai-chat.tsx: brand-namespaced localStorage keys
- web/components/lux/region-data.ts: brand-namespaced localStorage keys
- web/app/products/wallets/page.tsx: brand-aware SDK class + package in sample
- web/app/terms/page.tsx: BOOTNODE → {brand.name.toUpperCase()} in legal text
- web/lib/sdk-package.ts: shared brand→pkg/client map (single source of truth)
This commit is contained in:
@@ -21,10 +21,12 @@ import {
|
||||
Zap,
|
||||
} from "lucide-react"
|
||||
import { getBrand } from "@/lib/brand"
|
||||
import { getSdkPackage } from "@/lib/sdk-package"
|
||||
import { docsConfig } from "@/lib/docs-config"
|
||||
|
||||
export default function WalletsProductPage() {
|
||||
const brand = getBrand()
|
||||
const { pkg: sdkPackage, client: sdkClient } = getSdkPackage()
|
||||
|
||||
return (
|
||||
<div className="flex min-h-screen flex-col">
|
||||
@@ -171,9 +173,9 @@ export default function WalletsProductPage() {
|
||||
<div className="flex flex-col gap-4">
|
||||
<CodeBlock
|
||||
title="TypeScript"
|
||||
code={`import { BootnodeClient } from "@bootnode/sdk";
|
||||
code={`import { ${sdkClient} } from "${sdkPackage}";
|
||||
|
||||
const client = new BootnodeClient({
|
||||
const client = new ${sdkClient}({
|
||||
apiKey: "${docsConfig.apiKeyPrefix}YOUR_API_KEY",
|
||||
chain: "base",
|
||||
});
|
||||
|
||||
@@ -226,14 +226,14 @@ export default function TermsPage() {
|
||||
<div>
|
||||
<h2 className="text-xl font-semibold text-foreground">10. Limitation of Liability</h2>
|
||||
<p className="mt-3">
|
||||
TO THE MAXIMUM EXTENT PERMITTED BY LAW, BOOTNODE SHALL NOT BE LIABLE FOR
|
||||
TO THE MAXIMUM EXTENT PERMITTED BY LAW, {brand.name.toUpperCase()} SHALL NOT BE LIABLE FOR
|
||||
ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES,
|
||||
INCLUDING BUT NOT LIMITED TO LOSS OF PROFITS, DATA, OR BUSINESS
|
||||
OPPORTUNITIES, ARISING FROM OR RELATED TO YOUR USE OF THE SERVICE.
|
||||
</p>
|
||||
<p className="mt-3">
|
||||
OUR TOTAL AGGREGATE LIABILITY FOR ALL CLAIMS ARISING FROM OR RELATED TO
|
||||
THE SERVICE SHALL NOT EXCEED THE AMOUNT YOU PAID TO BOOTNODE IN THE TWELVE
|
||||
THE SERVICE SHALL NOT EXCEED THE AMOUNT YOU PAID TO {brand.name.toUpperCase()} IN THE TWELVE
|
||||
(12) MONTHS PRECEDING THE CLAIM.
|
||||
</p>
|
||||
<p className="mt-3">
|
||||
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
RotateCw,
|
||||
} from "lucide-react"
|
||||
import { useBrand } from "@/components/brand-logo"
|
||||
import { getBrandKey_ } from "@/lib/brand"
|
||||
|
||||
interface ChatMessage {
|
||||
role: "user" | "assistant"
|
||||
@@ -80,15 +81,17 @@ export function AiChat({
|
||||
content: m.content,
|
||||
}))
|
||||
|
||||
const tokenKey = `${getBrandKey_()}_token`
|
||||
const apiKeyKey = `${getBrandKey_()}_api_key`
|
||||
const res = await fetch("/api/v1/chat/completions", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...(typeof localStorage !== "undefined" && localStorage.getItem("bootnode_token")
|
||||
? { Authorization: `Bearer ${localStorage.getItem("bootnode_token")}` }
|
||||
...(typeof localStorage !== "undefined" && localStorage.getItem(tokenKey)
|
||||
? { Authorization: `Bearer ${localStorage.getItem(tokenKey)}` }
|
||||
: {}),
|
||||
...(typeof localStorage !== "undefined" && localStorage.getItem("bootnode_api_key")
|
||||
? { "X-API-Key": localStorage.getItem("bootnode_api_key")! }
|
||||
...(typeof localStorage !== "undefined" && localStorage.getItem(apiKeyKey)
|
||||
? { "X-API-Key": localStorage.getItem(apiKeyKey)! }
|
||||
: {}),
|
||||
},
|
||||
body: JSON.stringify({
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// DOKS (DigitalOcean Kubernetes Service) region coordinates and types
|
||||
// Used by fleet-map.tsx to position validator nodes on the world map
|
||||
|
||||
import { getBrandKey_ } from "@/lib/brand"
|
||||
|
||||
export interface DOKSRegion {
|
||||
name: string
|
||||
lat: number
|
||||
@@ -64,8 +66,9 @@ export function fleetStatusToNodeStatus(s: LuxFleet["status"]): NodeStatus {
|
||||
/** Auth headers for API calls -- matches existing pattern in infrastructure/page.tsx */
|
||||
export function getAuthHeaders(): Record<string, string> {
|
||||
if (typeof window === "undefined") return {}
|
||||
const token = localStorage.getItem("bootnode_token")
|
||||
const apiKey = localStorage.getItem("bootnode_api_key")
|
||||
const brand = getBrandKey_()
|
||||
const token = localStorage.getItem(`${brand}_token`)
|
||||
const apiKey = localStorage.getItem(`${brand}_api_key`)
|
||||
if (token) return { Authorization: `Bearer ${token}` }
|
||||
if (apiKey) return { "X-API-Key": apiKey }
|
||||
return {}
|
||||
|
||||
@@ -39,6 +39,7 @@ import { BrandLogo } from "@/components/brand-logo"
|
||||
import { CommandMenu } from "@/components/command-menu"
|
||||
import { NavMenu } from "@/components/nav-menu"
|
||||
import { getBrand } from "@/lib/brand"
|
||||
import { getSdkPackage } from "@/lib/sdk-package"
|
||||
|
||||
// Reusable icon link for mega-menu items
|
||||
function IconLink({
|
||||
@@ -74,6 +75,7 @@ function IconLink({
|
||||
// Products mega-menu content
|
||||
function ProductsContent({ closeMenu }: { closeMenu: () => void }) {
|
||||
const brand = getBrand()
|
||||
const { pkg: sdkPackage } = getSdkPackage()
|
||||
return (
|
||||
<div className="w-full">
|
||||
{/* Featured hero cards */}
|
||||
@@ -214,7 +216,7 @@ function ProductsContent({ closeMenu }: { closeMenu: () => void }) {
|
||||
<div className="mt-4 pt-4 border-t border-border flex items-center justify-between">
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="rounded-md px-2.5 py-1 font-mono text-[10px] bg-secondary text-foreground">
|
||||
npm i @bootnode/sdk
|
||||
{`npm i ${sdkPackage}`}
|
||||
</div>
|
||||
<span className="text-[10px] text-muted-foreground">
|
||||
Install {brand.name} SDK
|
||||
|
||||
+2
-2
@@ -238,9 +238,9 @@ const brands: Record<string, BrandConfig> = {
|
||||
github: "https://github.com/zoolabs",
|
||||
},
|
||||
iam: {
|
||||
url: "https://id.zoo.network",
|
||||
url: "https://zoolabs.id",
|
||||
clientId: "zoo-app-client-id",
|
||||
domain: "id.zoo.network",
|
||||
domain: "zoolabs.id",
|
||||
},
|
||||
footerLinks: [
|
||||
{ name: "Zoo Labs", href: "https://zoo.ngo", external: true },
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
// Brand-aware SDK package + client class names.
|
||||
// Used by docs samples and install snippets.
|
||||
|
||||
import { getBrandKey_ } from "@/lib/brand"
|
||||
|
||||
const PACKAGES: Record<string, { pkg: string; client: string }> = {
|
||||
bootnode: { pkg: "@bootnode/sdk", client: "BootnodeClient" },
|
||||
hanzo: { pkg: "@hanzo/web3-sdk", client: "HanzoClient" },
|
||||
lux: { pkg: "@luxfi/cloud-sdk", client: "LuxClient" },
|
||||
zoo: { pkg: "@zooai/cloud-sdk", client: "ZooClient" },
|
||||
pars: { pkg: "@parsnetwork/sdk", client: "ParsClient" },
|
||||
}
|
||||
|
||||
export function getSdkPackage(): { pkg: string; client: string } {
|
||||
return PACKAGES[getBrandKey_()] ?? PACKAGES.bootnode
|
||||
}
|
||||
Reference in New Issue
Block a user