mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-06-16 13:34:04 +08:00
fafc122d82
Zhipu's `data.limits[]` returns 1 entry for legacy plans (subscribed before 2026-02-12) and 2 entries for current plans. Previously every TOKENS_LIMIT entry was hardcoded as `five_hour`, so the weekly bucket was rendered with the 5-hour i18n label. Sort TOKENS_LIMIT entries by nextResetTime ascending and assign `five_hour` to index 0, `weekly_limit` to index 1. Legacy plans naturally degrade to a single five_hour tier. Also harden the parser: case-insensitive type match (defends against upstream casing changes), reuse TIER_FIVE_HOUR/TIER_WEEKLY_LIMIT constants, and add 8 unit tests covering both plan shapes plus defensive edge cases.
fafc122d82
·
2026-04-30 22:38:34 +08:00
History