Skip to content

Commit d2c9684

Browse files
committed
chore: keep user agents consistent
1 parent 9b6422f commit d2c9684

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

src/pages/api/anilist.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ export const GET: APIRoute = async ({ url }) => {
8383
headers: {
8484
'Content-Type': 'application/json',
8585
Accept: 'application/json',
86+
'User-Agent': 'sapphic.moe AniList API Proxy (Astro)',
8687
},
8788
body: JSON.stringify({
8889
query,

src/pages/api/lanyard.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ export const GET: APIRoute = async ({ url }) => {
6464
);
6565
}
6666

67-
const headers = new Headers({
68-
'User-Agent': 'sapphic.moe Lanyard API Proxy (Astro)',
69-
});
70-
7167
const API_URL = `${LANYARD_API_URL}/v1/users/${userId}`;
7268

7369
for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
7470
try {
75-
const apiRequest = await fetch(API_URL, { headers });
71+
const apiRequest = await fetch(API_URL, {
72+
headers: {
73+
'User-Agent': 'sapphic.moe Lanyard API Proxy (Astro)',
74+
},
75+
});
7676

7777
if (!apiRequest.ok) {
7878
const errorBody = await apiRequest.text();

src/pages/api/weather.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export const GET: APIRoute = async ({ url }) => {
6464
const apiUrl = `https://api.openweathermap.org/data/2.5/weather?${params.toString()}`;
6565

6666
const apiRequest = await fetch(apiUrl, {
67-
headers: { 'User-Agent': 'Sapphic.moe Weather API Proxy (Astro)' },
67+
headers: { 'User-Agent': 'sapphic.moe Weather API Proxy (Astro)' },
6868
});
6969

7070
if (!apiRequest.ok) {

src/utils/helpers/lastfm.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ export const validateAlbumCover = async (url: string | null): Promise<string | n
2323
const response = await fetch(url, {
2424
method: 'HEAD',
2525
signal: controller.signal,
26+
headers: {
27+
'User-Agent': 'sapphic.moe Last.fm API Proxy (Astro)',
28+
},
2629
});
2730
clearTimeout(timeoutId);
2831

0 commit comments

Comments
 (0)