metabolist / metatext

A free, open-source iOS Mastodon client.
https://metabolist.org/metatext
GNU General Public License v3.0
727 stars 102 forks source link

Manually entering a username floods server with requests #218

Open mverrey opened 2 years ago

mverrey commented 2 years ago

Describe the bug When you type the "@" after a username in the search field, a search request is generated for each letter of the hostname, generating an error for each letter, and eventually causing you to be temporarily blocked from your server with "too many requests".

To Reproduce Steps to reproduce the behavior:

  1. Go to the "Explore" pane
  2. Begin entering user name (ex. @sirmarksalot@teh.entar.net)
  3. Type "@sirmarksalot@"
  4. Type "t"
  5. Dismiss "Remote data could not be fetched" notification
  6. Type "e"
  7. Dismiss "Remote data could not be fetched" notification
  8. Type "h"
  9. Dismiss "Remote data could not be fetched" notification
  10. Type "."
  11. Dismiss "Remote data could not be fetched" notification
  12. Type "e"
  13. Dismiss "Remote data could not be fetched" notification
  14. Type "n"
  15. Dismiss "Remote data could not be fetched" notification
  16. Type "t"
  17. Dismiss "Remote data could not be fetched" notification
  18. Type "a"
  19. Dismiss "Remote data could not be fetched" notification
  20. Type "r"
  21. Observe "Too Many Requests" notification. You have been blocked.

Expected behavior Client should not aggressively request incomplete host names. Add (or increase) a debounce time on the text input to accommodate slower text entry on phones. Alternatively, add a separate flow specific to user lookup with a manual "search" button.

(please complete the following information):

Additional context Manually entering addresses is required when migrating from other platforms. The default Twitter app does not allow you to copy text, for example. When trying to predict a good debounce time, keep in mind that certain text inputs take longer than others. The "." key is not on the key layout that Metatext presents by default, so the user has to click "123" and "ABC" before and after entering it. You could potentially work around this by finding a key layout that has both a "@" and a "."