From fe868a601a9645291738a35533653d2ea4c2373b Mon Sep 17 00:00:00 2001 From: Kieran Date: Wed, 25 Jan 2023 11:49:56 +0000 Subject: [PATCH] chore: extract api host to const --- src/Const.ts | 6 +++++- src/Pages/DonatePage.tsx | 3 ++- src/Pages/NewUserPage.tsx | 4 ++-- src/Pages/Verification.tsx | 3 ++- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Const.ts b/src/Const.ts index bcea7a8b..3a1d20d3 100644 --- a/src/Const.ts +++ b/src/Const.ts @@ -1,5 +1,10 @@ import { RelaySettings } from "Nostr/Connection"; +/** + * Add-on api for snort features + */ +export const ApiHost = "https://api.snort.social"; + /** * Websocket re-connect timeout */ @@ -93,5 +98,4 @@ export const TidalRegex = /tidal\.com\/(?:browse\/)?(\w+)\/([a-z0-9-]+)/i; /** * SoundCloud regex */ - export const SoundCloudRegex = /soundcloud\.com\/(?!live)([a-zA-Z0-9]+)\/([a-zA-Z0-9-]+)/ diff --git a/src/Pages/DonatePage.tsx b/src/Pages/DonatePage.tsx index f422ede8..b5be933c 100644 --- a/src/Pages/DonatePage.tsx +++ b/src/Pages/DonatePage.tsx @@ -1,3 +1,4 @@ +import { ApiHost } from "Const"; import ProfilePreview from "Element/ProfilePreview"; import ZapButton from "Element/ZapButton"; import { HexKey } from "Nostr"; @@ -24,7 +25,7 @@ const DonatePage = () => { const [splits, setSplits] = useState([]); async function loadSplits() { - let rsp = await fetch("https://api.snort.social/api/v1/revenue/splits"); + let rsp = await fetch(`${ApiHost}/api/v1/revenue/splits`); if(rsp.ok) { setSplits(await rsp.json()); } diff --git a/src/Pages/NewUserPage.tsx b/src/Pages/NewUserPage.tsx index 369fc78b..b3792b57 100644 --- a/src/Pages/NewUserPage.tsx +++ b/src/Pages/NewUserPage.tsx @@ -1,4 +1,4 @@ -import { RecommendedFollows } from "Const"; +import { ApiHost, RecommendedFollows } from "Const"; import AsyncButton from "Element/AsyncButton"; import FollowListBase from "Element/FollowListBase"; import ProfilePreview from "Element/ProfilePreview"; @@ -8,7 +8,7 @@ import { useSelector } from "react-redux"; import { RootState } from "State/Store"; import { bech32ToHex } from "Util"; -const TwitterFollowsApi = "https://api.snort.social/api/v1/twitter/follows-for-nostr"; +const TwitterFollowsApi = `${ApiHost}/api/v1/twitter/follows-for-nostr`; export default function NewUserPage() { const [twitterUsername, setTwitterUsername] = useState(""); diff --git a/src/Pages/Verification.tsx b/src/Pages/Verification.tsx index 56204541..683c9025 100644 --- a/src/Pages/Verification.tsx +++ b/src/Pages/Verification.tsx @@ -1,3 +1,4 @@ +import { ApiHost } from "Const"; import Nip5Service from "Element/Nip5Service"; import './Verification.css' @@ -6,7 +7,7 @@ export default function VerificationPage() { const services = [ { name: "Snort", - service: "https://api.snort.social/api/v1/n5sp", + service: `${ApiHost}/api/v1/n5sp`, link: "https://snort.social/", supportLink: "https://snort.social/help", about: <>Our very own NIP-05 verification service, help support the development of this site and get a shiny special badge on our site!