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

Develop #622

Merged
merged 9 commits into from
Sep 14, 2024
Merged

Develop #622

merged 9 commits into from
Sep 14, 2024

Conversation

alimaktabi
Copy link
Collaborator

@alimaktabi alimaktabi commented Sep 13, 2024

Summary by Sourcery

Enhance CORS settings to support Turnstile headers for anti-bot services, fix token retrieval from headers, and update image URLs in tokenTap and prizetap apps through migration scripts.

New Features:

  • Add support for Turnstile response headers in CORS settings to integrate with Cloudflare and HCaptcha anti-bot services.

Bug Fixes:

  • Fix the retrieval of Turnstile tokens by accessing them from request headers instead of request data.

Enhancements:

  • Modify the constructor of the DidMintZoraNFT class to accept an optional 'obj' parameter.

Chores:

  • Add a migration script to update token image URLs in the tokenTap app by extracting the image ID from the URL.
  • Add a migration script to update raffle image URLs in the prizetap app by extracting the image ID from the URL.

Copy link
Contributor

sourcery-ai bot commented Sep 13, 2024

Reviewer's Guide by Sourcery

This pull request implements several changes to improve CORS handling, update Turnstile token retrieval, modify a constraint class initialization, and fix image URL prefixes in the database. The changes span across multiple files and include both code modifications and database migrations.

File-Level Changes

Change Details Files
Update CORS settings to allow Turnstile response headers
  • Add 'cf-turnstile-response' and 'hc-turnstile-response' to CORS_ALLOW_HEADERS
  • Include a comment explaining the purpose of the added headers
brightIDfaucet/settings.py
Modify Turnstile token retrieval method in captcha constraints
  • Change token retrieval from request_context.data to request_context.headers for Cloudflare Turnstile
  • Update token retrieval for HCaptcha Turnstile to use headers instead of data
core/constraints/captcha.py
Update DidMintZoraNFT constraint class initialization
  • Add 'obj' parameter to init method with default value None
  • Pass 'obj' parameter to super().init call
core/constraints/zora.py
Create migration to fix token image URL prefixes in TokenDistribution model
  • Implement fix_token_images_prefix function to update image and token_image fields
  • Remove 'https://imagedelivery.net' prefix from image URLs
  • Create a new migration file for the TokenDistribution model
tokenTap/migrations/0065_fix_token_image_prefix.py
Create migration to fix raffle image URL prefixes in Raffle model
  • Implement fix_raffle_images_prefix function to update image field
  • Remove 'https://imagedelivery.net' prefix from image URLs
  • Create a new migration file for the Raffle model
prizetap/migrations/0079_fix_raffle_image_urls.py

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @alimaktabi - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

@PooyaFekri PooyaFekri merged commit 097ce49 into main Sep 14, 2024
2 checks passed
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