-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Add ip-geo extension #25366
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?
Add ip-geo extension #25366
Conversation
- feat: 改进 README.md,增加详细描述、功能、用法和截图,并更新 package.json 中的类别和图标。 - feat: 引入“自动”语言选项,根据IP位置自动切换显示语言。 - feat: 为 IP Geo 命令添加多语言支持,包括语言偏好设置和 UI 文本国际化。 - feat: 改进 IP 地址列表项的显示,包括更简洁的来源标记和详细的副标题。 - refactor: 移除 `ipSource` 偏好设置,并优化 IP 地址获取逻辑以支持多源显示。 - feat: 增加偏好设置以选择 IP 源(ip-api.com 或 cip.cc) - feat: 实现 IP 地理位置查询功能,包括搜索、历史记录和详细显示,并更新扩展元数据。 - Initial commit
|
Congratulations on your new Raycast extension! 🚀 We're currently experiencing a high volume of incoming requests. As a result, the initial review may take up to 10-15 business days. Once the PR is approved and merged, the extension will be available on our Store. |
DescriptionThis extension allows users to query IP address geolocation data and view it on a map. It supports both automatic detection of the current public IP and manual searching for specific IP addresses. Features
AuthorRyan.L |
Greptile OverviewGreptile SummaryThis PR adds a new IP Geolocation extension that allows users to query IP address information and display locations on a map. The extension includes automatic current IP detection, search functionality, history tracking, and map visualization. Key Changes:
Issues Found:
The core functionality is well-implemented with proper error handling and state management, but the localization approach needs to be revised to align with Raycast guidelines. Confidence Score: 2/5
Important Files Changed
|
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.
13 files reviewed, 3 comments
| import { getPreferenceValues } from "@raycast/api"; | ||
|
|
||
| export const preferences = getPreferenceValues<Preferences>(); | ||
|
|
||
| export const availableLanguages = ["en", "zh"] as const; | ||
| export type Language = (typeof availableLanguages)[number]; | ||
|
|
||
| export const dictionary = { | ||
| en: { | ||
| searchPlaceholder: "Enter IP address (leave empty for current IP)", | ||
| searchResult: "Search Result", | ||
| yourIp: "Your IP Address", | ||
| unknownIp: "Unknown IP", | ||
| fetching: "Fetching IP information...", | ||
| history: "History", | ||
| error: "Error", | ||
| errorFetch: "Failed to fetch IP information.", | ||
| copyIp: "Copy IP", | ||
| copyJson: "Copy Full JSON", | ||
| removeFromHistory: "Remove from History", | ||
| clearHistory: "Clear All History", | ||
| failedSaveHistory: "Failed to save history", | ||
| viaIpip: "Via myip.ipip.net", | ||
| viaLocal: "Via Local Connection", | ||
| ipAddress: "IP Address", | ||
| city: "City", | ||
| region: "Region", | ||
| country: "Country", | ||
| isp: "ISP", | ||
| timezone: "Timezone", | ||
| latitude: "Latitude", | ||
| longitude: "Longitude", | ||
| }, | ||
| zh: { | ||
| searchPlaceholder: "输入 IP 地址 (留空查询当前 IP)", | ||
| searchResult: "搜索结果", | ||
| yourIp: "您的 IP 地址", | ||
| unknownIp: "未知 IP", | ||
| fetching: "正在获取 IP 信息...", | ||
| history: "历史记录", | ||
| error: "错误", | ||
| errorFetch: "获取 IP 信息失败。", | ||
| copyIp: "复制 IP", | ||
| copyJson: "复制完整 JSON", | ||
| removeFromHistory: "从历史记录移除", | ||
| clearHistory: "清空历史记录", | ||
| failedSaveHistory: "保存历史记录失败", | ||
| viaIpip: "通过 myip.ipip.net", | ||
| viaLocal: "通过本地连接", | ||
| ipAddress: "IP 地址", | ||
| city: "城市", | ||
| region: "地区", | ||
| country: "国家", | ||
| isp: "运营商", | ||
| timezone: "时区", | ||
| latitude: "纬度", | ||
| longitude: "经度", | ||
| }, | ||
| }; |
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.
Custom localization logic should not be implemented in Raycast extensions. Raycast only supports US English, and implementing custom language switching creates unnecessary complexity. If you need locale-dependent features (like unit systems), use the preferences API instead.
Consider removing this custom i18n system entirely and using only English strings, or use preferences for language selection if this is truly needed as a user preference rather than automatic locale detection.
Context Used: Rule from dashboard - What: Do not implement custom localization logic in Raycast extensions; use the preferences API for ... (source)
| { | ||
| "name": "language", | ||
| "type": "dropdown", | ||
| "required": false, | ||
| "title": "Language", | ||
| "description": "Select the display language.", | ||
| "default": "auto", | ||
| "data": [ | ||
| { | ||
| "title": "Auto", | ||
| "value": "auto" | ||
| }, | ||
| { | ||
| "title": "English", | ||
| "value": "en" | ||
| }, | ||
| { | ||
| "title": "简体中文", | ||
| "value": "zh" | ||
| } | ||
| ] | ||
| } |
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.
The language preference with auto-detection based on IP location violates Raycast's guidelines. Raycast only supports US English. If language selection is necessary as a user preference, it should be a manual choice, not auto-detected based on locale.
Context Used: Rule from dashboard - What: Do not implement custom localization logic in Raycast extensions; use the preferences API for ... (source)
extensions/ip-geo/README.md
Outdated
|  | ||
|  |
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.
Screenshots should be in a metadata/ folder, not in assets/. The assets/ folder should only contain files used by the extension itself (like the icon).
Move screenshot-1.png and screenshot-2.png to metadata/ and update the README references to point to metadata/screenshot-1.png and metadata/screenshot-2.png.
Context Used: Rule from dashboard - What: Extensions with view-type commands must include a metadata/ folder containing Raycast-styled... (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
Thanks for the review! I've addressed the feedback:
Ready for another look! |
Description
Screencast
Checklist
npm run buildand tested this distribution build in Raycastassetsfolder are used by the extension itselfREADMEare placed outside of themetadatafolder