Commit Graph

66 Commits

Author SHA1 Message Date
959265484c feat: Add durable object for Anilist requests (#2)
This commit introduces a durable object to handle Anilist GraphQL requests, with the goal of preventing request duplication.

The durable object is designed to cache responses from the Anilist API, with a TTL based on the `nextAiringEpisode` field in the response.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2025-11-14 13:07:36 +08:00
8175d73df1 refactor: ♻️emoves Env parameter
Removes the `Env` parameter from several functions to simplify their signatures and rely on the global `env` for configuration.

This change reduces the number of arguments passed around, making the code cleaner and easier to maintain.
2025-08-10 19:22:14 -04:00
d680c97bc6 Removes console logs from title matching
Cleans up the code by removing console log statements used for debugging during the title matching process. This improves code readability and avoids unnecessary logging in the production environment.
2025-04-23 10:21:26 -04:00
b8ae211956 feat(aniwatch): Improves title matching logic
- Enhances title matching accuracy when fetching Aniwatch IDs.
- Prioritizes user-preferred titles and falls back to English titles.
- Ensures only one fetch call is made per title if both english and userPreferred title are same.
- Adds a score threshold to filter low-quality matches.
- Fixes a bug where the episode list was not being returned.
2025-04-23 09:49:06 -04:00
d6a27e1fa4 fix: treat title as "unreleased" if title is too far away to schedule 2024-11-14 07:42:55 -05:00
da7c843e72 fix: task for anilist-updates not encoding body in base 64 2024-10-29 07:47:54 -04:00
9fafa5b45d feat: improve title searching algorithm for aniwatch 2024-10-28 05:08:23 -04:00
592cc08853 feat: create routes to load popular titles 2024-10-27 13:59:49 -04:00
2dcf8630ab fix: improve error logging
Cloudflare doesn't log causes, only the messages so splitting the logs in to 2
2024-10-27 08:49:31 -04:00
34958cfa69 chore: log which title is being selected when loading aniwatch 2024-10-27 08:41:16 -04:00
f8889eb550 fix: make sure to check body with hashed queue task name 2024-10-23 09:00:39 -04:00
1869771716 fix: if failed to validate body, trigger hashed task name flow 2024-10-22 08:20:03 +02:00
42c041a4e0 fix: hash task name when failing to queue new task
this should help with gcp cloud task deduplication causing 409 errors
2024-10-21 18:42:29 +08:00
7f8fd882aa fix: throws "failed to queue" error when task already exists 2024-10-16 08:17:59 +08:00
37cf7bd738 fix: cloud tasks not being queued and failing silently 2024-10-14 08:28:22 +08:00
91dd250823 feat: create route to be able to mark episode as watched 2024-10-10 12:52:22 +02:00
8a20b72bcb fix: update queue name for anilist updates 2024-10-06 18:41:09 -04:00
5f978205c4 remove taskId from optional args of queueTask 2024-10-06 08:48:43 -04:00
d13bc2a64e refactor: update script
* runs promises serially instead of running them all at once
* directly calls /new-episode route for latest episode
2024-10-06 08:48:10 -04:00
271ea01b21 fix: test failures 2024-10-05 16:48:31 -04:00
5ea90bda55 feat: add more 429 checks 2024-10-05 15:52:38 -04:00
44ffa703b9 refactor: replace qstash with Google Cloud Tasks 2024-10-05 14:06:57 -04:00
85712ff0cf chore: update getCurrentDomain to return undefined when not allowing localhost 2024-10-05 11:54:35 -04:00
44d579ee6d refactor: create function to read admin SDK JSON 2024-10-05 11:21:20 -04:00
15c75eea5b refactor: move fcm to gcloud folder 2024-10-05 10:57:18 -04:00
e4ca45dbdc fix: retry loading user if 429 returned 2024-09-26 04:30:45 -04:00
bee8acaca8 feat: improve error handling for authentication flow 2024-09-26 03:51:17 -04:00
75eca0f6bd fix: maxRetries set to 3
since max limit is 3
2024-09-26 01:32:02 -04:00
15f680c4d0 feat: update retry algorithm for qstash
avoids dlq until it has to
2024-09-22 16:12:19 -04:00
3d0c76444e fix: flakiness in promiseTimeout test 2024-09-22 15:49:14 -04:00
1013d22024 fix: add error logging in fetchFromMultipleSources 2024-09-22 15:46:08 -04:00
ac53b65147 fix: avoid scheduling next episode notifications on localhost 2024-09-22 15:20:49 -04:00
ecbddbc574 fix: remove query params from getCurrentDomain 2024-09-22 15:20:22 -04:00
755ae4b94f feat: store unreleased titles where first episode time is unknown 2024-09-21 13:45:37 -04:00
c1bf12de4f feat: associate device id with username when logging in 2024-09-21 13:18:16 -04:00
209a0b477d test: comment out failing test 2024-09-20 00:09:26 -04:00
1ce79ed17a feat: delete message id when title no longer airing 2024-09-19 15:48:59 -04:00
6e28cc0ddb fix: episode being scheduled incorrectly 2024-09-13 09:13:28 -04:00
47b58c34d8 fix: url incorrect when verifying QStash header 2024-09-10 22:34:43 -04:00
56b2677eaf fix: readEnvVariable throws error when variable is string 2024-09-10 22:17:40 -04:00
25ed096b38 feat: create script to initialize "next episode" queue 2024-09-09 05:07:21 -05:00
336701a84b feat: schedule next airing episode
happens when new title is saved, or when new episode internal route is run successfully
2024-09-09 03:53:34 -05:00
090a7504aa refactor: create getCurrentDomain helper function 2024-09-08 14:36:36 -05:00
57fbdfaabe refactor: pass entire request object to verifyQstashHeader 2024-09-06 18:06:13 -05:00
690b5aa426 fix: verifyQstashHeader now returns false when SignatureError is thrown 2024-09-02 13:19:57 -04:00
9694c0ee0d fix: pass path of request to qstash 2024-09-02 13:07:01 -04:00
4fe22bccf3 feat: support sending "new title" alerts to devices 2024-09-02 13:02:05 -04:00
342e2c2bd8 fix: use string matching to map to correct title in Aniwatch 2024-08-26 21:55:11 -04:00
2becf1aa3b feat: support removing watch status when null
A user can choose to remove a show from being in their media list completely, by setting the watch status to null
2024-07-04 18:19:15 -04:00
3b1fe66261 refactor: created custom error for a token already exists 2024-06-16 08:47:07 -04:00