[PR #17] [MERGED] Append the entered command to the URL #35

Closed
opened 2026-02-27 23:20:09 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/spatie/dnsrecords.io/pull/17
Author: @cwhite92
Created: 10/28/2017
Status: Merged
Merged: 10/29/2017
Merged by: @freekmurze

Base: feature-append-urlHead: feat/command-in-url


📝 Commits (1)

  • 173494a Append the entered command to the URL, and allow users to browse directly to a command

📊 Changes

8 files changed (+27 additions, -26 deletions)

View changed files

📝 app/Http/Controllers/HomeController.php (+2 -7)
📝 app/Services/Commands/Commands/Clear.php (+1 -1)
📝 app/Services/Commands/Commands/DnsLookup.php (+2 -4)
📝 app/Services/Commands/Commands/Ip.php (+2 -2)
📝 app/Services/Commands/Commands/Manual.php (+2 -2)
📝 resources/assets/js/app.js (+9 -1)
📝 resources/views/home/index.blade.php (+8 -8)
📝 routes/web.php (+1 -1)

📄 Description

This PR introduces support for the command being in the URL. It fixes #15.

There were two options to fix this, the easiest being to just use a query string parameter like https://dnsrecords.io?c=website.com, but that's kind of ugly IMO. The other option was to have it as a route parameter like https://dnsrecords.io/website.com, which looks a lot better, so I ran with that. Open to discuss this though.

Notes:

  • Added some JavaScript to intercept the form being submitted and dynamically change the form action.
  • Changed routes to match on GETs and POSTs, since it's now possible to browse directly to https://dnsrecords.io/command as well as submit the command through the homepage form.
  • Removes controller validation for the command. Since the command is now in the URL, it must always be present (otherwise it'll 404 anyway), making the required validation unnecessary.
  • Changed the various commands to return redirect()s and response()es, since returning back() will lead to undesired results when you're already onhttps://dnsrecords.io/website.com for example.
  • Changed from using the session to flash the output to using regular view data. I noticed an issue when flashing where if I browsed to https://dnsrecords.io/website.com, and then went back to https://dnsrecords.io, I'd get command output printed out.
  • Had to change the help command from ? to help, since https://dnsrecords.io/? obviously won't work :( I updated the help hint to match.

Also I was going to fix the tests... before I realized you don't have any. :) Maybe that'll be a future PR. ;)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/spatie/dnsrecords.io/pull/17 **Author:** [@cwhite92](https://github.com/cwhite92) **Created:** 10/28/2017 **Status:** ✅ Merged **Merged:** 10/29/2017 **Merged by:** [@freekmurze](https://github.com/freekmurze) **Base:** `feature-append-url` ← **Head:** `feat/command-in-url` --- ### 📝 Commits (1) - [`173494a`](https://github.com/spatie/dnsrecords.io/commit/173494a72861d3fd932a92670d6f07adfd5db480) Append the entered command to the URL, and allow users to browse directly to a command ### 📊 Changes **8 files changed** (+27 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `app/Http/Controllers/HomeController.php` (+2 -7) 📝 `app/Services/Commands/Commands/Clear.php` (+1 -1) 📝 `app/Services/Commands/Commands/DnsLookup.php` (+2 -4) 📝 `app/Services/Commands/Commands/Ip.php` (+2 -2) 📝 `app/Services/Commands/Commands/Manual.php` (+2 -2) 📝 `resources/assets/js/app.js` (+9 -1) 📝 `resources/views/home/index.blade.php` (+8 -8) 📝 `routes/web.php` (+1 -1) </details> ### 📄 Description This PR introduces support for the command being in the URL. It fixes #15. There were two options to fix this, the easiest being to just use a query string parameter like `https://dnsrecords.io?c=website.com`, but that's kind of ugly IMO. The other option was to have it as a route parameter like `https://dnsrecords.io/website.com`, which looks a lot better, so I ran with that. Open to discuss this though. Notes: * Added some JavaScript to intercept the form being submitted and dynamically change the form action. * Changed routes to match on GETs and POSTs, since it's now possible to browse directly to `https://dnsrecords.io/command` as well as submit the command through the homepage form. * Removes controller validation for the command. Since the command is now in the URL, it must always be present (otherwise it'll 404 anyway), making the `required` validation unnecessary. * Changed the various commands to return `redirect()`s and `response()`es, since returning `back()` will lead to undesired results when you're already on`https://dnsrecords.io/website.com` for example. * Changed from using the session to flash the output to using regular view data. I noticed an issue when flashing where if I browsed to `https://dnsrecords.io/website.com`, and then went back to `https://dnsrecords.io`, I'd get command output printed out. * Had to change the help command from `?` to `help`, since `https://dnsrecords.io/?` obviously won't work :( I updated the help hint to match. Also I was going to fix the tests... before I realized you don't have any. :) Maybe that'll be a future PR. ;) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 23:20:09 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/dnsrecords.io#35
No description provided.