-
Couldn't load subscription status.
- Fork 2
Updated default url #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe default API URL in src/lib/store.ts was updated from https://api.wakatime.com/api/v1 to https://hackatime.hackclub.com/api/hackatime/v1. No other logic, signatures, or control flow changed. Other stores and the createStore setup remain the same. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/lib/store.ts (1)
29-32: Consider a one-time migration so existing users pick up the new defaultBecause the store uses a fallback only when no value exists, users who already have local:apiUrl set to the old default will keep it. If that’s undesired, add a simple migration that updates only untouched defaults (preserves custom user values).
Example (add near the export):
// Migrate users who never customized the API URL const OLD_WAKA_URL = "https://api.wakatime.com/api/v1"; const NEW_HACKATIME_URL = "https://hackatime.hackclub.com/api/hackatime/v1"; // Reuse storage to directly read/update the item without affecting other stores. const apiUrlItem = storage.defineItem<string>("local:apiUrl", { fallback: NEW_HACKATIME_URL }); apiUrlItem.getValue().then((current) => { if (current === OLD_WAKA_URL) { apiUrlItem.setValue(NEW_HACKATIME_URL); } });Optional: normalize user-inputted values (e.g., strip trailing slashes) if your endpoint construction is sensitive to them.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
src/lib/store.ts(1 hunks)
🔇 Additional comments (1)
src/lib/store.ts (1)
29-32: Updated default API base URL — LGTMThe new default aligns with the PR objective. No signature or control-flow impact.
| export const apiUrl = createStore( | ||
| "https://api.wakatime.com/api/v1", | ||
| "https://hackatime.hackclub.com/api/hackatime/v1", | ||
| "local:apiUrl" | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Ensure extension host permissions/CSP allow the new domain
If this runs in a browser extension or a constrained environment, verify:
- Host permissions include https://hackatime.hackclub.com/*
- connect-src in CSP includes the new origin
- Any references to the old domain are removed
Run this script to check for remaining references and required permissions:
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Searching for old/new API domains across the repo..."
rg -n -C2 'api\.wakatime\.com|hackatime\.hackclub\.com'
echo
echo "Checking manifest/config for host permissions and connect-src..."
# Common manifest/config files; adjust globs if your repo uses different paths
fd -t f -i 'manifest*.json' -x rg -n -C2 -i 'host_permissions|connect-src|hackatime\.hackclub\.com|api\.wakatime\.com' {}
fd -t f -i 'wxt.config.*' -x rg -n -C2 -i 'host_permissions|connect-src|hackatime\.hackclub\.com|api\.wakatime\.com' {}
fd -t f -i 'vite.config.*' -x rg -n -C2 -i 'connect-src|hackatime\.hackclub\.com|api\.wakatime\.com' {}
fd -t f -i 'package.json' -x rg -n -C2 -i 'hackatime\.hackclub\.com|api\.wakatime\.com' {}
echo
echo "Checking for potential double-appending of /api/v1 elsewhere..."
rg -n -C2 '/api/v1\b'
echo
echo "Scanning for uses of apiUrl to spot risky concatenations..."
rg -n -C2 '\bapiUrl\b'
rg -nP -C2 '\bget\s*\(\s*apiUrl\s*\)' --type ts --type svelteLength of output: 2262
Verify extension CSP includes the new API domain
-
Host permissions in manifest.json already use
<all_urls>, so https://hackatime.hackclub.com is permitted. -
No occurrences of the old
api.wakatime.comwere found anywhere. -
Add or update your content_security_policy in
manifest.jsonto include the new origin underconnect-src. For example:{ …, - "content_security_policy": "script-src 'self'; object-src 'self'" + "content_security_policy": "script-src 'self'; object-src 'self'; connect-src https://hackatime.hackclub.com" }
Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In src/lib/store.ts around lines 29 to 32 the API base URL was changed to
https://hackatime.hackclub.com/api/hackatime/v1; update your extension
manifest.json content_security_policy to allow that origin under connect-src.
Open manifest.json and add or append https://hackatime.hackclub.com (or its
origin https://hackatime.hackclub.com) to the connect-src directive so
fetch/XHR/websocket calls to the new API are permitted by the extension CSP;
ensure the CSP syntax matches your manifest version (MV2 vs MV3) and includes
any existing hosts.
Summary by cubic
Updated the default API URL to Hack Club’s Hackatime endpoint so requests use the correct backend by default. This replaces the old Wakatime endpoint.
Summary by CodeRabbit