Replace the nodeSchedule.Range object with a literal array for the
hour parameter in the event watch schedule. This makes the scheduled
hours (7 to 22) more explicit and easier to read at a glance, while
maintaining the exact same execution logic.
The scheduled job for watching events was previously set to run until
hour 23. This changes the `nodeSchedule.Range` end hour from 23 to 22
to ensure the job stops execution correctly before the end of the day.
This is a bug fix to align the actual execution window with the intended
operating hours.
No breaking changes.
Introduce a bottom drawer in the notification permission control
component to provide a step-by-step guide for users (specifically
on iOS/Safari) to enable push notifications when the browser does
not support direct requests.
Key changes:
- Added a 'Drawer' component with 'placement="bottom"' to display
instructions for adding the site to the home screen.
- Updated the permission control panel to use the same bottom
placement for consistency.
- Refactored the notification control to toggle the drawer state
upon interaction.
This improves the user experience by explicitly showing how to
enable features that are restricted in PWA-like environments.
Introduce Redis caching logic to `getClubInfo` and `getMatchDetail` methods in `KaiqiuService` to improve performance and reduce network requests.
- Added optional `force` parameter to bypass cache when needed.
- Implemented cache fallback for connection timeouts.
- Updated cache expiration times (e.g., 24h for club info, 5m for match details).
- Propagated the `force` parameter from `EventSubscribeService` to ensure data freshness.
Update the `info` array generation logic to concatenate the `see` and `nums` values into a single string separated by a space, instead of keeping them as separate array elements.
This change standardizes the format of the information display for match events.
- Extract 'nums' (号码) and 'see' (查看次数) from event page content.
- Include extracted data in the `IEventInfo` structure for display.
- Implement Redis caching for event details (key: `my-kaiqiuwang:event-info:${eventId}`).
- Cache strategy: Store result for 60 seconds, or refresh if cached data shows timeout errors or force flag is set.
- Reduces redundant external requests and improves response reliability.
Added volume mappings for /etc/localtime and /etc/timezone to ensure
the container uses the host's time and timezone settings.
This prevents time discrepancies in logs and scheduled tasks without
requiring manual timezone configuration inside the image.
- Introduce Redis caching for event lists to reduce redundant fetches and handle timeouts gracefully. Added a `force` query parameter to bypass cache when needed.
- Added a check in `EventWatchSchedule` to skip processing if player list is empty, preventing errors from rate-limited or failed requests.
- Updated the `listClubEvents` signature to accept the new `force` parameter and modified API endpoints to propagate this flag.
- Import and extend 'dayjs' with 'utc' and 'timezone' plugins.
- Update logging in 'watchEvents' and 'start' methods to explicitly format
dates in 'Asia/Tokyo' timezone instead of default system time.
- This ensures consistent timestamp representation across different deployment
environments regardless of the local server timezone.
- Import 'dayjs' to format timestamps for better readability.
- Store the scheduled job instance in a private field to access next execution time.
- Update the 'start' method to log the job name and the precise next run time.
- Update 'watchEvents' method with a debug log for the next invocation.
This improves observability by showing exactly when the scheduled task is expected to run next, rather than just the schedule definition.
Replace the string '7-23' with new nodeSchedule.Range(7, 23) for the hour configuration.
This change aligns the schedule definition with the explicit Range object type,
potentially improving type safety or ensuring compatibility with the underlying node-schedule library behavior.
The event watch schedule was previously running every 5 minutes all day.
Added 'hour: 7-23' configuration to restrict the task execution to
business hours, preventing unnecessary load during off-peak times.
- Update useFirebaseNotificationProcessor to handle notification clicks by opening the URL from data.url.
- Implement notificationclick event handler in sw.ts to redirect users when a notification is clicked.
- Simplify the registration success notification in index.tsx by removing the unnecessary JSON body argument.
- Ensure seamless navigation when users interact with push notifications by passing the URL through the notification payload.
- Introduce PermissionControlPanel in UserCenter for managing notification permissions.
- Update Service Worker (sw.ts) to handle background push notifications via Firebase Cloud Messaging.
- Implement EventSubscribeService logic to fetch active events, filter expired ones, and clean up subscriptions.
- Refactor KaiqiuService and parsing utilities to include eventId in event details.
- Remove deprecated ScheduleService and inline sendNotification logic.
- Update utility functions to support new types and notification checks.
- Add VAPI public key configuration and update Firebase exports.
Refactor the application to implement native browser push notifications and remove unnecessary Redis caching for performance optimization.
Key changes:
- Introduce a dedicated server topic 'SERVER_PUSH' to handle push notification messages via WebSocket.
- Implement a Service Worker (sw.ts) to capture push events and display system-level notifications, replacing the previous Ant Design toast usage for server messages.
- Add a "Notification Permission" button in the User Center to allow users to request push notification rights.
- Remove Redis caching logic from KaiqiuService (event lists, match details, and member details) to ensure real-time data accuracy, as the cache was causing latency in updates.
- Clean up WebSocket service subscription logic to focus on user-specific events.
This shift from UI-only notifications to system push notifications improves visibility for critical server events (like match updates) even when the user is not on the active tab. Additionally, removing the cache simplifies the codebase and ensures the latest match data is always fetched.
Previously, the refresh button was hidden whenever the cached uidScore size
was greater than 0, or when the cached data was empty. This logic prevented
the button from appearing even after a data request successfully returned
data in uidScoreRequest.
The updated logic now checks both the cached uidScore and the request data.
If either contains data, the button is shown, ensuring users can refresh
scores regardless of the caching state.
- Add `.catch(() => null)` in `ClubSummary.tsx` to gracefully handle failed API requests and prevent UI crashes.
- Return `null` from `ClubSummary` when the club data is `null` to skip rendering during errors.
- Extract `getMatchInfo` logic into a new static method `getMatchDetail` within `KaiqiuService` for better separation of concerns.
- Update `getClubLocation` and `getEventInfo` to accept an optional `force` parameter, allowing cache bypass when network errors (like '连接超时') occur.
- Remove the old `getMatchInfo` utility function from `server.ts` and update the `/api/match` route to use `KaiqiuService.getMatchDetail`.
- Refactor `WebSocketService` and `common.ts` to use a unified topic system instead of custom prefixes.
- Replace manual topic string concatenation with `getEventSubKey` and defined `WsServerSendTopics` types.
- Update client-side components (`EventCard`, `GroupingPrediction`) to support real-time event subscriptions and notifications.
- Move `useAuthSocket` and `WebScoketContext` initialization into `AppBarLayout` to ensure WebSocket state is available globally.
- Add error handling to WebSocket message processing in the Bun server.
- Implement a manual "Refresh Current Scores" button for `GroupingPrediction` to fetch fresh `nowScore` data.
- Update `HydrateFallback` UI to display a loading message instead of a refresh button during long load times.
- Add Service Worker (`sw.js`) build route to the Bun server configuration.
- Added `UserLocation` model to `prisma/schema.prisma` to store user location data including coordinates (point geometry), name, avatar, and bindings to Logto and Kaiqiu users.
- Created new API endpoints under `/api/account/location` to handle location operations:
- `POST`: Create a new location record for a user.
- `GET`: Retrieve nearby locations based on latitude and longitude.
- `PUT`: Update an existing location record, including coordinate updates via spatial index.
- `DELETE`: Remove a specific location record.
- Integrated the custom spatial operations from `xprisma` DAO to support geospatial queries and updates.
- Updated dependencies to include `@mui/icons-material` (and its peer dependencies like `prop-types` and `react-transition-group` which are implicitly required by the new icon components).
- Implemented `verifyLogtoToken` logic to secure the new endpoints and associate locations with authenticated users.
No breaking changes in API contracts; new endpoints are additive.
- Update HydrateFallback to show a refresh button after 10 seconds of loading
- Improve UserCenter avatar by using username/name as fallback when image is missing
- Add /dev route pointing to HydrateFallback component
This commit introduces a new `ChangeBackground` component into the User Center page.
The component is now rendered before the main content to dynamically update the
background based on the user's picture URL.
- Added import for `ChangeBackground` component.
- Integrated `ChangeBackground` with the user's picture URL (falling back to empty string if unavailable).
- No breaking changes or migration required.
Refactor the Dockerfile to separate dependency installation and type
generation from the runtime environment.
Changes:
- Moved `bun prisma generate` to the build phase to ensure type definitions
are created during image build rather than at runtime.
- Updated the ENTRYPOINT to run `bun prisma migrate deploy` before starting
the application. This ensures database migrations are applied automatically
upon container startup, supporting production deployments with incremental
schema changes.
- Added missing newline at the end of the file for compliance.
This change ensures that the application handles schema updates safely in
production without requiring a separate migration step outside the container.
- Modified `BindKaiqiuAccount` to wrap the UID text in a clickable `Flex` component.
- Added an `ExportOutlined` icon to indicate the actionable link.
- Implemented navigation to `/profile/{uid}` when the UID section is clicked, utilizing the `useNavigate` hook.
- Imported the new icon and navigation hook to support this interaction.
- Add `UserBind` model to Prisma schema for linking Logto and Kaiqiu user IDs.
- Implement `/api/account/bind` endpoint (GET/PUT) to handle Kaiqiu account binding and retrieval.
- Refactor `KaiqiuService` to include a `login` method that performs browser automation-like login on kaiqiuwang.cc using `cheerio` and `fetch`.
- Update `UserCenter` page to include a new `BindKaiqiuAccount` component.
- Restructure `WebSocketService`:
- Change from a simple global connection map to a per-user client tracking system (`#userClients`).
- Update topic naming conventions (e.g., `ONLINE_MEMBER_CHANGE` -> `MEMBER_CHANGE`).
- Add client-side broadcast capabilities for user-specific events like `MY_CLIENT_ONLINE`.
- Add support for dynamic subscription handling (SUB/UNSUB) via WebSocket messages.
- Update `verifyLogtoToken` to accept either `Headers` or a raw token string for flexibility in WebSocket auth.
- Minor fixes: typo corrections in `WSTopic` enum and commented out debug logs.
BREAKING CHANGE: WebSocket payload structure has changed.
The `ws.data` property now contains a `WsPaylaod` object with a `user` field (previously it was a JSON string of the JWT payload).
The `WSTopic` names have been updated (e.g., `ONLINE_MEMBER_CHANGE` is now `MEMBER_CHANGE`), requiring updates to any client code subscribing to these topics.
Introduces WebSocket connectivity for live data updates and a new subscription model for events.
Key changes:
- Integrated WebSocketService to handle open, message, and close events via the /ws endpoint.
- Added EventSubscribeService APIs to manage user subscriptions to specific events (matchId) via REST endpoints (`/api/subscribe-event` and `/api/subscribe-event/:matchId`).
- Implemented custom message protocol (JSON format) for WebSocket communication with defined topics (ONLINE_MEMBER_CHANGE, etc.).
- Updated database schema to include the `EventSubs` model for storing subscriptions.
- Refactored Dockerfile to use `bun prisma db push` for database migrations on startup.
- UI Updates:
- Replaced the Rate component in FavButton with Star icons for better UX.
- Adjusted layout of FavButton to be absolute positioned.
- Added debounce to ClubSummary data fetching.
- Removed unused `isMobile` import from ClubSummary.
- Utilities: Added helper functions `toCustomMessage` and `fromCustomMessage` for parsing WebSocket messages.
- Remove `getGitHash` function from `src/utils/server.ts` as it relied on `.git` directory presence which is not available in production builds.
- Remove the `/api/app-version` endpoint from `src/index.tsx` since fetching version via API is no longer needed.
- Update `src/hooks/useAppVersion.ts` to derive the version directly from the `src` attribute of a script tag in the HTML head.
- This change improves performance by avoiding an extra API request and ensures version accuracy across all deployment environments without requiring Git metadata.
- Removed unused imports from Ant Design (`message as AntdMessage`, `StarFilled`, `ShopTwoTone`, `DeleteOutlined`, `UploadOutlined`) and `@ant-design/icons`.
- Removed unused `type IdTokenClaims` import from `@logto/react`.
- Updated the logic in the empty list state: the "Log in to view cloud collection" button now only displays when the user is NOT authenticated (`!isAuthenticated`). Previously, it showed even when logged in, which was misleading.
This cleans up the codebase and improves the user experience on the Favorite Players page.
- Add `getGitHash` utility to extract the git commit hash from the `.git/HEAD` file.
- Expose a new `/api/app-version` endpoint on the server to return the current version.
- Implement a `useAppVersion` hook to fetch the version asynchronously.
- Display the app version (e.g., `app version: a1b2c3d`) in the User Center UI for both authenticated and unauthenticated users.
- This helps in tracking which version of the application is currently running in production.
The AppBar container was previously positioned exactly at the bottom of the viewport, causing a potential 1px gap or overflow issue on certain screens.
- Changed `bottom` from `0` to `-1px` to pull the bar slightly up.
- Adjusted `left` to `-2px` and `width` to `calc(100vw + 4px)` to compensate for the negative left offset and ensure the bar spans the full visible area without horizontal scroll.
This ensures the fixed bar aligns perfectly with the viewport edges in all scenarios.
- Move `initResultMap` and `buildMatchGroupTable` outside the component to reduce closure dependencies.
- Update `ClubEventList` to remove obsolete page key storage logic.
- Add `MATCH_RESULT_MAP_KEY` constant to `utils/constants.ts`.
- Refactor `useMemo` and `useCallback` hooks to rely on the extracted functions.
- Ensure consistent dependency arrays in callbacks for reliable re-renders.
- Changed the `url` property in the serve configuration from a commented-out placeholder to an active template string.
- The new URL format `https://tt.ksr.la/event/${e.matchId}` replaces the previous implementation where the URL was disabled.
- This ensures that event links are correctly generated and clickable within the calendar view, improving user navigation to event details.
- Modify the DELETE /api/fav endpoint to include the player uid in the response JSON.
- Refactor FavPlayersPage to remove explicit dependency on `aud` for API calls, relying solely on `useAuthHeaders`.
- Add a dedicated "un-fav" button to player cards to allow users to unfollow individual players.
- Implement logic to distinguish between local un-fav (for unauthenticated users) and server-side un-fav (for authenticated users).
- Improve UI layout using `styled-components` and updated Ant Design components (`Typography.Title`).
- Add a link to sign in and view cloud favorites when the local list is empty.
- Add 'admin' scope to Logto configuration in frontend.tsx.
- Externalize Logto appId to common.ts utils for better configuration management.
- Remove `isAuthExpired` check in UserCenter.tsx and always show the "Re-login" button.
- Moved header logic (background, avatar, title, notice button) from ClubEventsPage into a new ClubSummary component.
- Updated ClubEventsPage to use ClubSummary instead of managing layout and state directly.
- Fixed `onClick` handler in ClubSummary to correctly spread the `info.geo` object when passing to `openWebMapRaw`.
- Removed unused imports and state from ClubEventsPage.
- Centralized Logto domain and API base URLs in `common.ts` to avoid duplication.
- Replaced deprecated `Modal.useModal` with `App.useApp().modal` for consistent Ant Design usage.
- Refactored `useAutoLogin` hook to handle token expiration checks and trigger re-authentication.
- Updated `UserCenter` and `FavPlayersPage` to use the new `autoSignIn` flow.
- Removed the `useAuthHeaders` hook as logic was consolidated into `useAutoLogin`.
- Added `AUTH_CALLBACK_URL` and `USER_CENTER_URL` constants for cleaner routing.
- In `useAuthHeaders`, import `useAutoLogin` and trigger login if `getAccessToken` returns a falsy value. This handles edge cases where the token is expired or missing during an API call.
- In `useAutoLogin`, set the default redirect URL to `window.location.pathname` to ensure users return to the page they were on before logging in.
- Update database schema to rename `UserFav` to `LogtoUserFav` with clearer field names (`logto_uid`, `kaiqiu_uid`).
- Bump `jose` dependency to v6.2.1 for improved JWT verification.
- Configure `@logto/react` to request the correct resource token for API access.
- Implement token verification on the server side using `jose` and `jwtVerify`.
- Update API routes (`/api/fav`) to extract the user ID from the verified JWT `sub` claim instead of the URL `aud` parameter.
- Refactor frontend components (`FavButton`, `FavePlayersPage`) to use `useAuthHeaders` for fetching auth headers instead of manual token claims extraction.
- Clean up unused migration and DAO functions related to the old `aud`-based logic.
Added link to ./logo.jpg as an apple-touch-icon in index.html to
ensure proper icon display when users add the site to their home
screen on iOS devices.
- Added `isRunningStandalone` utility in `src/utils/front.ts` to detect if the app is running as a standalone PWA or in a native container (iOS Safari, Android Chrome, etc.).
- Updated `AppBar.tsx` to conditionally apply bottom padding only when running in standalone mode, ensuring better layout alignment within custom containers.
- Modified `title` generation to remove the club name prefix if it exists.
- Updated `calName` to display only the club name instead of adding "的比赛" suffix.
- This prevents redundant information in the calendar event titles.
- Update `openMapDirection` to `openWebMapRaw` in `utils/front.ts` to open
maps in a new browser tab (`_blank`) using raw WGS-84 coordinates.
- Adjust URL schemes for Google, AMap, Baidu, Tencent, and Apple Maps to
support direct web navigation with `coordinate` parameters.
- Update `ClubSummary.tsx` to use `openWebMapRaw` and change the map button
label from "Navigation" to "View Location" with a new icon.
- Add `padding-bottom` to `AppBar.tsx` in `AppBarLayout.tsx` to accommodate
the increased bottom padding required by the updated AppBar styling.
- Remove the "Home" FloatButton from `ProfilePage.tsx` and update `routes.tsx`
to remove the unused `ActionButtonLayout` import.
- Update navigation handlers in `AppBar.tsx` to use `replace: true` for smoother
state management without creating new browser history entries.
- Added a "Navigation" button in ClubSummary that opens a Dropdown menu.
- Supported multiple map types: Google, Apple, AMap, Tencent, and Baidu.
- Mobile-only features (AMap, Tencent, Baidu) are disabled on desktop devices.
- Added `geo` property to `ClubDetail` type to support location data.
- Implemented `openMapDirection` utility to launch specific map apps based on the selected type.
- Conditionally render the "View Announcement" button only if an article exists.
- Updated BaseLayout export name from `Layout` to `BaseLayout` for consistency.
- Update `src/index.tsx` to use a unified `ics.convertTimestampToArray` helper
instead of manually parsing formatted strings. This ensures consistent timestamp
handling across different environments.
- Remove the custom `HydrateFallback` and `Layout` components from `src/routes.tsx`.
- Import the existing `HydrateFallback` and `Layout` implementations from their
respective component files (`./components/HydrateFallback` and `./components/Layout/BaseLayout`) to reduce code duplication and improve maintainability.
- Deleted the custom `useRunOnce` hook as its functionality is no longer needed.
- Refactored `EventCard` to determine `type` (countup/countdown) dynamically based on the event state and current time.
- Updated `EventCard` to pass `type` and `format` separately to the `Statistic.Timer` component, removing the need for string formatting logic inside the component.
- Modified `ClubEventList` to add a 300ms delay on page initialization, ensuring the component is fully mounted before triggering the initial fetch logic.
- Refactor ClubEventList to support persistent page state in sessionStorage and dynamic toggle for finished events.
- Move pagination logic to useRunOnce hook for initialization, ensuring correct state restoration.
- Update ClubSearchTable to support "My Favorites" tab, using useRef to cache search results for different club types.
- Enhance EventCard with precise time formatting (HH:mm:ss) and dynamic countdown logic using dayjs timezone.
- Persist club selection in GameSelector using local storage and integrate ClubSummary component.
- Fix geo data handling in KaiqiuService, ensuring coordinates are correctly passed to iCalendar generator.
- Remove unused imports and simplify component structure across affected files.
- Only include 'geo' object in the event attributes if valid latitude/longitude exists.
- Conditionally add 'location' field only when it is present on the event.
- Removed the 'noGeo' flag logic for conditional spreading, simplifying the map operation.
- Ensures clean event data without empty geo/location properties in the generated calendar file.
- Refactor ClubEventList to subscribe to all club events instead of just the current page, removing pagination from the ICS URL.
- Enhance ICS generation for club subscriptions:
- Fetch all non-finished events across pages.
- Include geographic location (lat/lon) in the event metadata.
- Add 2-hour alarms (display and audio) to all subscribed events.
- Improve EventCard status display with logic for 'Finished', 'In Progress', and countdown formats.
- Update KaiqiuService to parse match status (isProcessing, isFinished) and location name accurately.
- Integrate dayjs timezone (Asia/Tokyo) and UTC plugins across index.tsx, services, and types.
- Update IEventInfo interface to include isProcessing and location fields.
- Add 'Club' vs 'Points Club' filter in `ClubSearchTable` using Radio buttons.
- Update `searchClub` request to accept and pass `clubType` parameter to the backend API.
- Refactor logic in `ClubEventList` to determine "Show All" button visibility based on whether all items are finished or not finished, rather than just a fixed count.
- Add custom CSS (styled-components) to limit the height of the game selector drawer for better UX.
- Update backend service `KaiqiuService` to handle the new query parameters for filtering clubs by type.