jantman / gw2copilot

A Python-based GuildWars2 helper tool
GNU Affero General Public License v3.0
4 stars 1 forks source link

Simpler bug reporting #34

Open jantman opened 7 years ago

jantman commented 7 years ago

related to #29

Need a simpler bug reporting button. Ideally this should provide the user with a popup that gives them a simple way to download/capture both the log output from the program (~/.gw2copilot/logs/gw2copilot.log) as well as the status page content and the browser console logs, and prompts them to create a screenshot. It should really just be a "here's a link to GitHub, or you can email me. Paste this, and include a screenshot.

It seems like in terms of console logging, capturing console.log isn't sane. We'll need to replace console.log with another function that both logs to console, and logs to browser storage or something (and clear it on page load). Options for that:

jantman commented 7 years ago

There are some tools aimed at anonymous GitHub issue reporting, but none of them seem to work the way I'd like.

So maybe the right/nice way to do this is:

  1. Have a "Report a Bug" button in the top nav bar, that opens a popup dialog with a WYSIWYG Markdown editor text box (see SimpleMDE, ckeditor with the markdown plugin editor.md). Pre-populate that box with the content of our GitHub "new issue" template, minus the file attachment suggestions.
  2. Add a field that attaches the browser JS console/debug log and the Python logging log (which we'll need to get from the API), and includes links to display the files if the user wants to see them first.
  3. Include a field for the user's name and email address (optional), if they're not a GitHub user.
  4. Include hidden field for gw2copilot version.
  5. This form POSTs to a Lambda function that includes a GitHub API key of mine, and creates an issue on the repo. Let's assume, for now, users won't abuse it... but bake in some sort of dead-simple input validation (maybe the gw2copilot version and some sort of stupid hash of the timestamp or something) to prevent random POSTs.
  6. If the POST succeeds, the popup is replaced with one linking to the issue on GitHub for users to follow or update/add to.
  7. If the POST fails, show a warning message where the submit button was. It should open a link like https://github.com/jantman/gw2copilot/issues/new?title=foo&body=bar that opens in a new window, and instruct the user to paste the body and attachments and open the issue.

Optional, but preferred feature: use GitHub JS client library (gh3.js, github.js, octokat.js)... if the user has a GitHub account, open the issue with their account. If not, use my Lambda func to open it anonymously.

jantman commented 7 years ago

So it looks like the GitHub stuff is going to be more complicated... auth to GitHub requires a client_secret for the app that needs to actually remain secret, so it can't be embedded anywhere in the public source. So I guess the only option is some sort of server (let's assume a Lambda func), that:

  1. If the user has a GitHub account, performs the OAuth handshake stuff.
  2. If the user doesn't, creates the issue on behalf of the user and returns the URL/ID.

So on my end, I'll need to do tooling (likely based on webhook2lambda2sqs) to Terraform an API Gateway that just passes specified methods (GET, POST, etc.) to a lambda function and returns the result. Ideally something really generic.

jantman commented 7 years ago

Ok, screw it. Forget the automatic GitHub integration. Just provide instructions (including screenshot), a link to create an issue, a text area with the debug information and logs, and a link to a Lambda function that posts it if the user doesn't have a GitHub account.