Skip to content

Commit

Permalink
Use ext.alveus.gg for fetching ambassador data
Browse files Browse the repository at this point in the history
  • Loading branch information
MattIPv4 committed Jan 6, 2025
1 parent 1e64646 commit c9a2113
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .env.development.sample
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
REACT_APP_TEST_CHANNEL_NAMES=abdullahmorrison
REACT_APP_CHAT_COMMANDS_PRIVILEGED_USERS=abdullahmorrison
REACT_APP_WEBSITE_URL=http://localhost:3000
REACT_APP_API_BASE_URL=http://localhost:3000
2 changes: 1 addition & 1 deletion .env.sample
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
REACT_APP_CHAT_COMMANDS_PRIVILEGED_USERS=abdullahmorrison,mattipv4,pjeweb,alveusgg,spacevoyage
REACT_APP_DEFAULT_CHANNEL_NAMES=maya,alveussanctuary
REACT_APP_EXTRA_CHANNEL_NAMES=alveusgg
REACT_APP_WEBSITE_URL=https://www.alveussanctuary.org
REACT_APP_API_BASE_URL=https://ext.alveus.gg
5 changes: 3 additions & 2 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ All new versions start in local test where the base URI is `https://localhost:80

The "panel viewer path" should be `panel.html`, the "mobile viewer path" as `mobile.html`, and "video - fullscreen viewer path" as `video_overlay.html`.

Ensure that the allowlist for image domains is set to allow `https://www.alveussanctuary.org` for ambassador images, the allowlist for media domains is set to allow `https://fonts.googleapis.com/` for fonts, and that allowlist for URL fetching domains is set to include `wss://irc-ws.chat.twitch.tv:443`, `ws://irc-ws.chat.twitch.tv:80`, `irc://irc.chat.twitch.tv:6667`, `irc://irc.chat.twitch.tv:6697` to allow connecting to chat as well as `https://www.alveussanctuary.org` to allow fetching ambassador data.
Ensure that the allowlist for image domains is set to allow `https://www.alveussanctuary.org` for ambassador images, the allowlist for media domains is set to allow `https://fonts.googleapis.com/` for fonts, and that allowlist for URL fetching domains is set to include `wss://irc-ws.chat.twitch.tv:443`, `ws://irc-ws.chat.twitch.tv:80`, `irc://irc.chat.twitch.tv:6667`, `irc://irc.chat.twitch.tv:6697` to allow connecting to chat as well as `https://ext.alveus.gg` to allow fetching ambassador data.

## Hosted test

Expand Down Expand Up @@ -55,7 +55,8 @@ Allowlist explanations:
- `https://fonts.googleapis.com/` Google Fonts, for loading fonts in the extension
- `wss://irc-ws.chat.twitch.tv:443`, `ws://irc-ws.chat.twitch.tv:80`, `irc://irc.chat.twitch.tv:6667`, `irc://irc.chat.twitch.tv:6697` Twitch chat URLs, for the chatbot to connect to
- `https://www.alveussanctuary.org` Alveus Sanctuary website, for fetching ambassador data + images
- `https://www.alveussanctuary.org` Alveus Sanctuary website, for fetching ambassador images
- `https://ext.alveus.gg` Alveus Sanctuary website (cached API), for fetching ambassador data
Testing the Extension:
Expand Down
8 changes: 4 additions & 4 deletions src/hooks/useAmbassadors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ const apiSchema = z.object({

type Ambassador = z.infer<typeof apiAmbassadorSchema>;

const websiteUrl = process.env.REACT_APP_WEBSITE_URL?.replace(/\/+$/, "");
if (!websiteUrl)
throw new Error("REACT_APP_WEBSITE_URL environment variable is not set");
const apiBaseUrl = process.env.REACT_APP_API_BASE_URL?.replace(/\/+$/, "");
if (!apiBaseUrl)
throw new Error("REACT_APP_API_BASE_URL environment variable is not set");

const fetchAmbassadors = async (): Promise<Record<string, Ambassador>> => {
const response = await fetch(`${websiteUrl}/api/stream/ambassadors`);
const response = await fetch(`${apiBaseUrl}/api/stream/ambassadors`);
if (!response.ok)
throw new Error(
`Failed to fetch ambassadors: ${response.status} ${response.statusText} ${await response.text()}`,
Expand Down

0 comments on commit c9a2113

Please sign in to comment.