fix: avoid scheduling next episode notifications on localhost
This commit is contained in:
@@ -17,6 +17,15 @@ export async function maybeScheduleNextAiringEpisode(
|
||||
req: HonoRequest,
|
||||
aniListId: number,
|
||||
) {
|
||||
const domain = getCurrentDomain(req);
|
||||
if (
|
||||
domain.includes("localhost") ||
|
||||
domain.includes("127.0.0.1") ||
|
||||
domain.includes("192.168.1")
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { nextAiring, status } = await getNextEpisodeTimeUntilAiring(aniListId);
|
||||
if (!nextAiring) {
|
||||
if (status === "NOT_YET_RELEASED") {
|
||||
@@ -31,7 +40,6 @@ export async function maybeScheduleNextAiringEpisode(
|
||||
const { timeUntilAiring, episode: nextEpisode } = nextAiring;
|
||||
const client = new Client({ token: env.QSTASH_TOKEN });
|
||||
|
||||
const domain = getCurrentDomain(req);
|
||||
const { messageId } = await client.publishJSON({
|
||||
url: `${domain}/internal/new-episode`,
|
||||
body: { aniListId, episodeNumber: nextEpisode },
|
||||
|
||||
Reference in New Issue
Block a user