DumbWhoIs icon indicating copy to clipboard operation
DumbWhoIs copied to clipboard

feat: show query in URL and default to light theme

Open erbanku opened this issue 6 months ago • 1 comments

Summary

This PR updates the search flow so the user query is reflected directly in the browser URL, making result pages shareable and easier to reuse.

For example:

https://dumb-whois.vercel.app/google.com

Opens the result for:

google.com

This also makes the app easier to use as a browser custom search engine shortcut:

https://dumb-whois.vercel.app/%s
image

Users can search directly from the browser address bar without needing to remember the website URL or open the site first and type the query manually.

Changes

  • Show search query in the URL using history.pushState
  • Support direct result URLs like /$query
  • Read query from URL path on page load
  • Keep fallback support for ?lookup= query parameter
  • Add popstate handling for browser back/forward navigation
  • Change default theme from dark to light

High-level PR Summary

This PR implements URL-based query routing to make WHOIS lookup results shareable by reflecting the search query directly in the browser URL (e.g., /google.com). The changes include updating the search flow to use history.pushState, reading queries from the URL path on page load, supporting browser back/forward navigation via popstate events, maintaining backward compatibility with the ?lookup= query parameter, and changing the default theme from dark to light. Additionally, PWA manifest files are added to the assets directory and formatting improvements are applied throughout the codebase.

⏱️ Estimated Review Time: 30-90 minutes

💡 Review Order Suggestion
Order File Path
1 public/index.html
2 public/index.js
3 server.js
4 public/assets/manifest.json
5 public/assets/asset-manifest.json
6 .gitignore

Need help? Join our Discord

Summary by CodeRabbit

Release Notes

  • New Features

    • Added Progressive Web App support for installing the app on your device.
    • Lookup queries now integrate with browser history—navigate back and forward through your searches.
    • Improved data parsing for WHOIS and ASN lookups.
  • Bug Fixes

    • Default theme changed to light mode.
    • Enhanced dark mode toggle and persistence.

Review Change Stack

erbanku avatar May 13 '26 06:05 erbanku

[!WARNING]

Rate limit exceeded

@erbanku has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 34 minutes and 58 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ca0cffb8-ab49-4d2d-b40e-af315440e4ac

📥 Commits

Reviewing files that changed from the base of the PR and between af95c4c1011deec9241b81a0e559c0c92e53e84d and 964bddc9afe10438cd0b344d3b9c95d1e31e04d9.

📒 Files selected for processing (6)
  • .gitignore
  • public/assets/manifest.json
  • public/index.js
  • public/service-worker.js
  • scripts/pwa-manifest-generator.js
  • vercel.json

Walkthrough

The PR modernizes the lookup flow by introducing static PWA manifests, refactoring the client-side lookup logic to support browser history via history.pushState, and enhancing server-side data parsing with DNS resolution and parallel ASN data fetching for BGPView-compatible responses.

Changes

Frontend and Backend Lookup Modernization

Layer / File(s) Summary
PWA Manifest Files and Build Artifact Configuration
public/assets/manifest.json, public/assets/asset-manifest.json, .gitignore
New static web app manifest and asset list replace server-side generation; .gitignore excludes VS Code settings and Vercel config instead of generated manifests.
HTML Theme Initialization and Manifest Reference
public/index.html
Static manifest linked at /assets/manifest.json; theme defaults to light; flicker-prevention script uses only localStorage without OS preference fallback.
Frontend Bootstrap and DOM Rendering Refactors
public/index.js
Initialization moves into DOMContentLoaded; DOM rendering for IPv4/IPv6 buttons, status tags, events, nameservers, registrar info, and ASN fields refactored to multiline template strings with map(...).join() patterns.
Client-Side Lookup with URL History and State Management
public/index.js
performLookup accepts optional pushState parameter for history.pushState updates; lookup initializes from URL path or ?lookup= query param; popstate handler re-runs lookup on back/forward; event wiring updated.
Server Setup, DNS Resolution, and WHOIS IP Extraction
server.js
Server exports app and runs HTTP listener only when main module; WHOIS parsing performs DNS IPv4/IPv6 lookups and regex-based IP extraction from filtered WHOIS text.
WHOIS Parsing for .eu and Non-.eu Domains
server.js
.eu domain parsing extracts section headers and indented key/value pairs; non-.eu parsing extracts registrar, dates, status, nameservers via key matching; both return consistent shape.
IP Lookup Service Source Tagging
server.js
IP lookup services (ipapi.co, ip-api.com, ipwho.is) include standardized source field for service identification.
ASN Data Fetching with Parallel Requests
server.js
fetchASNData fetches RIPEstat WHOIS, AS overview, and optional PeeringDB in parallel via Promise.all; PeeringDB failure caught gracefully.
ASN Response Formatting and BGPView Compatibility
server.js
ASN response includes abuse_contacts (fallback from emailContacts), owner_address, rir_allocation.date_allocated, traffic_ratio, and date_updated; IP input normalized by removing brackets/CIDR before lookup.
Unified /api/lookup Endpoint and Error Handling
server.js
Single /api/lookup/:query endpoint handles WHOIS (with .eu server selection), IP (with service fallback), and ASN (with AS prefix stripping); returns 400 for invalid types; distinguishes HTTP error codes; conditional server startup and CommonJS export added.

🎯 4 (Complex) | ⏱️ ~75 minutes


Look, okay, let me break this down for you slowly—
Static files now, no more server generation, wholly,
The client learns history, states move left-right, lowly,
DNS whispers to the backend, ASN responds nicely,
One endpoint rules them all—pretty simply. 📚✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.77% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the two main changes: adding URL-based query display via history.pushState and changing the default theme from dark to light.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests

[!TIP]

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar May 13 '26 06:05 coderabbitai[bot]