Skip to content
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

[Feat] Offer option to upload logs to a pastebin #3873

Merged
merged 3 commits into from
Sep 8, 2024
Merged

Conversation

CommandMC
Copy link
Collaborator

@CommandMC CommandMC commented Jul 22, 2024

When displaying a game log, a new button to directly upload the log file to a pastebin service is now presented. This button will upload the log file to https://0x0.st and copy the resulting sharable URL into the user's clipboard.

To alleviate privacy concerns, logs are (1) only kept valid for 24 hours and (2) can be deleted from within Heroic:
In the "Settings" -> "Logs" tab specifically, a new button to view uploaded logs was added. It lists all logs which are still valid, the user can then open the sharable URL again or request file deletion

Behind the scenes, two new Zustand states have been added:

  • useGlobalState, which is my attempt at slowly migrating the current Global State to Zustand. It holds global information (specifically, whether the log file upload dialog or the upload list dialog are open)
  • useUploadedLogFiles, holding data on uploaded log files. The Backend pushes updates to this using two new Frontend messages

Closes #3863


Use the following Checklist if you have changed something on the Backend or Frontend:

  • Tested the feature and it's working on a current and clean install.
  • Tested the main App features and they are still working on a current and clean install. (Login, Install, Play, Uninstall, Move games, etc.)
  • Created / Updated Tests (If necessary)
  • Created / Updated documentation (If necessary)

@CommandMC CommandMC added the pr:ready-for-review Feature-complete, ready for the grind! :P label Jul 22, 2024
@CommandMC CommandMC self-assigned this Jul 22, 2024
src/backend/logger/uploader.ts Outdated Show resolved Hide resolved

const formData = new FormData()
formData.set('file', fileBlob, filename)
formData.set('expires', '24')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

24hs sounds too short for me, I can imagine some users sharing a log during a weekend and nobody sees it and expires

it should be easy to re-upload though, so maybe this is not really a problem

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly it is rather uncommon for support requests to go unnoticed for 24 hours (and if that does happen, as you said, reuploading the file isn't hard to do)

We can easily change this if this does end up being a problem, I'd like to take the safer (in terms of server bandwidth used) route here first

Copy link
Collaborator

@arielj arielj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me, I tested with some logs and works fine

I left 2 minor style comments, not blockers though

Copy link
Collaborator

@arielj arielj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh wait, now I'm getting an error when I try to delete a log file

(11:37:11) ERROR:   [LogUploader]:      Failed to send data to 0x0.st: TypeError: fetch failed
    at Object.fetch (node:internal/deps/undici/undici:12293:11)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at AS (/home/ariel/dev/oss/HeroicGamesLauncher/src/backend/logger/uploader.ts:114:20)
    at WebContents.<anonymous> (node:electron/js2c/browser_init:2:79404) {
  cause: AggregateError: 
      at internalConnectMultiple (node:net:1114:18)
      at internalConnectMultiple (node:net:1177:5)
      at Timeout.internalConnectMultipleTimeout (node:net:1687:3)
      at listOnTimeout (node:internal/timers:575:11)
      at processTimers (node:internal/timers:514:7) {
    code: 'ETIMEDOUT',
    [errors]: [ [Error], [Error] ]
  }
}

also sometimes when I try to upload a log file (same timeout error, but it's weird, I can access those urls fine)

(11:39:35) ERROR:   [LogUploader]:      Failed to send data to 0x0.st: TypeError: fetch failed
    at Object.fetch (node:internal/deps/undici/undici:12293:11)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at $S (/home/ariel/dev/oss/HeroicGamesLauncher/src/backend/logger/uploader.ts:72:20)
    at WebContents.<anonymous> (node:electron/js2c/browser_init:2:79404) {
  cause: AggregateError: 
      at internalConnectMultiple (node:net:1114:18)
      at internalConnectMultiple (node:net:1177:5)
      at Timeout.internalConnectMultipleTimeout (node:net:1687:3)
      at listOnTimeout (node:internal/timers:575:11)
      at processTimers (node:internal/timers:514:7) {
    code: 'ETIMEDOUT',
    [errors]: [ [Error], [Error] ]
  }
}

Could it be some kind of rate limiter for uploading/deleting? cause opening the log links works fine, but fails to upload/delete after using those things for a bit

@CommandMC
Copy link
Collaborator Author

I can't reproduce these errors. Are you still getting them? Looks like your connection to the site is failing, which wouldn't be "our fault" anyways

@arielj
Copy link
Collaborator

arielj commented Aug 23, 2024

I can't reproduced the error today either. No idea what happened there (I thought it was maybe some rate limiter from that site, but I clicked upload and delete many times now and no problems)

When displaying a game log, a new button to directly upload the log file to a
pastebin service is now presented. This button will upload the log file to
`https://0x0.st` and copy the resulting sharable URL into the user's clipboard.
To alleviate privacy concerns, logs are (1) only kept valid for 24 hours and
(2) can be deleted from within Heroic:
In the "Settings" -> "Logs" tab specifically, a new button to view uploaded logs
was added. It lists all logs which are still valid, the user can then open the
sharable URL again or request file deletion

Behind the scenes, two new Zustand states have been added:
- `useGlobalState`, which is my attempt at slowly migrating the current Global
  State to Zustand. It holds global information (specifically, whether the
  log file upload dialog or the upload list dialog are open)
- `useUploadedLogFiles`, holding data on uploaded log files. The Backend pushes
  updates to this using two new Frontend messages
@arielj arielj merged commit 294f9a0 into main Sep 8, 2024
9 checks passed
@arielj arielj deleted the feat/upload-logs branch September 8, 2024 16:08
@Heroic-Games-Launcher Heroic-Games-Launcher locked and limited conversation to collaborators Sep 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr:ready-for-review Feature-complete, ready for the grind! :P
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Offer an option to directly upload logs
2 participants