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

Anonymous uploads + track upload IPs #167

Merged
merged 9 commits into from
Mar 25, 2022
Merged

Anonymous uploads + track upload IPs #167

merged 9 commits into from
Mar 25, 2022

Conversation

ro-tex
Copy link
Contributor

@ro-tex ro-tex commented Mar 23, 2022

PULL REQUEST

Overview

Track anonymous uploads and downloads.
Track the IP of any uploader.

Note:
Don't worry about the anonymous download tracking - we are going to stop tracking downloads, anyway. I just wanted to keep them in sync for the sake of my own mental model. That also helped root out a bug.

Example for Visual Changes

Checklist

Review and complete the checklist to ensure that the PR is complete before assigned to an approver.

  • All new methods or updated methods have clear docstrings
  • Testing added or updated for new methods
  • Verify if any changes impact the WebPortal Health Checks
  • Approriate documentation updated
  • Changelog file created

Issues Closed

@ro-tex ro-tex self-assigned this Mar 23, 2022
Fix a bug in downloads, where an unrelated recent download would be updated instead of a new one being created.
@ro-tex ro-tex marked this pull request as ready for review March 23, 2022 13:32
# Conflicts:
#	test/database/user_test.go
Copy link
Contributor

@ChrisSchinnerl ChrisSchinnerl left a comment

Choose a reason for hiding this comment

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

Looking pretty good. Only a few minor comments.

test/utils.go Outdated Show resolved Hide resolved
test/tester.go Show resolved Hide resolved
database/upload.go Outdated Show resolved Hide resolved
api/handlers.go Show resolved Hide resolved
api/handlers.go Show resolved Hide resolved
api/handlers.go Outdated Show resolved Hide resolved
api/handlers.go Outdated Show resolved Hide resolved
api/handlers.go Show resolved Hide resolved
database/upload.go Outdated Show resolved Hide resolved
test/database/download_test.go Outdated Show resolved Hide resolved
test/database/download_test.go Outdated Show resolved Hide resolved
test/database/download_test.go Outdated Show resolved Hide resolved
test/database/upload_test.go Outdated Show resolved Hide resolved
@peterjan
Copy link

what was the bug by the way? 🙂

@ro-tex
Copy link
Contributor Author

ro-tex commented Mar 24, 2022

what was the bug by the way? 🙂

DownloadRecent didn't have a user parameter. It was getting the most recent download of the given skylink (within the permitted time range), regardless of which user owned it. This results in some users' downloads being counted towards other users'. While the total downloaded amount stays the same, this brings down the total number of downloads.

database/upload.go Outdated Show resolved Hide resolved
Co-authored-by: Peter-Jan Brone <peter-jan@settlemint.com>
api/handlers.go Show resolved Hide resolved
@ro-tex ro-tex merged commit c3cbf77 into main Mar 25, 2022
@ro-tex ro-tex deleted the ivo/anonymous_uploads branch March 25, 2022 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants