From 985d1ef9cd822064e42fd0ef9d975ed75b4963c2 Mon Sep 17 00:00:00 2001 From: Boluwatife Popoola Date: Thu, 22 Aug 2024 15:15:28 +0100 Subject: [PATCH 1/2] add preview link cors regex --- base/settings.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/base/settings.py b/base/settings.py index a2ed79b..40978e4 100644 --- a/base/settings.py +++ b/base/settings.py @@ -173,6 +173,10 @@ "https://dev.local", ] +CORS_ALLOWED_ORIGIN_REGEXES = [ + "^https:\/\/potlock-next-[\w-]+-potlock\.vercel\.app\/?$" +] + # REDIS / CACHE CONFIGS REDIS_SCHEMA = ( From a3556fce185bf6269e37a73ff0357ae2f40abdc1 Mon Sep 17 00:00:00 2001 From: Boluwatife Popoola Date: Wed, 28 Aug 2024 17:56:53 +0100 Subject: [PATCH 2/2] fix testnet pot deployment, add cors allow --- base/settings.py | 32 +++++++++++++------ .../management/commands/populatedata.py | 2 +- indexer_app/utils.py | 4 +-- pots/utils.py | 2 +- 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/base/settings.py b/base/settings.py index 40978e4..36fecc4 100644 --- a/base/settings.py +++ b/base/settings.py @@ -163,15 +163,29 @@ WSGI_APPLICATION = "base.wsgi.application" -CORS_ALLOWED_ORIGINS = [ - "http://localhost:3000", - "https://alpha.potlock.io", - "https://alpha.potlock.org", - "https://alpha.potlock.xyz", - "https://alpha.potlock.app", # regex matching might not be advisable. - "http://dev.local", - "https://dev.local", -] + +if ENVIRONMENT == "testnet": + CORS_ALLOWED_ORIGINS = [ + "http://localhost:3000", + "https://test.potlock.org", + "https://test.potlock.xyz", + "https://test.potlock.io", + "https://test.potlock.app", + "https://testnet.potlock.org", + "https://testnet.potlock.xyz", + "https://testnet.potlock.app", + "https://testnet.potlock.io" + ] +else: + CORS_ALLOWED_ORIGINS = [ + "http://localhost:3000", + "https://alpha.potlock.io", + "https://alpha.potlock.org", + "https://alpha.potlock.xyz", + "https://alpha.potlock.app", # regex matching might not be advisable. + "http://dev.local", + "https://dev.local", + ] CORS_ALLOWED_ORIGIN_REGEXES = [ "^https:\/\/potlock-next-[\w-]+-potlock\.vercel\.app\/?$" diff --git a/indexer_app/management/commands/populatedata.py b/indexer_app/management/commands/populatedata.py index f10f646..e69422d 100644 --- a/indexer_app/management/commands/populatedata.py +++ b/indexer_app/management/commands/populatedata.py @@ -260,7 +260,7 @@ def handle(self, *args, **options): if config.get("chef"): chef, _ = Account.objects.get_or_create(defaults={"chain_id":1},id=config["chef"]) pot_defaults = { - "pot_factory_account": POTFACTORY_ID, + "pot_factory_id": POTFACTORY_ID, "owner_id": config["owner"], "chef_id": config["chef"], "name": config["pot_name"], diff --git a/indexer_app/utils.py b/indexer_app/utils.py index 8b9d4b6..ad5fd26 100644 --- a/indexer_app/utils.py +++ b/indexer_app/utils.py @@ -149,7 +149,7 @@ async def handle_new_pot( # Create Pot object logger.info(f"creating pot with owner {owner_id}....") pot_defaults = { - "pot_factory_account": predecessorId, + "pot_factory_id": predecessorId, "deployer": signer, "deployed_at": created_at, "source_metadata": data["source_metadata"], @@ -174,7 +174,7 @@ async def handle_new_pot( "registry_provider": data["registry_provider"], "min_matching_pool_donation_amount": data[ "min_matching_pool_donation_amount" - ], + ] or "0", "sybil_wrapper_provider": data["sybil_wrapper_provider"], "custom_sybil_checks": data.get("custom_sybil_checks"), "custom_min_threshold_score": data.get("custom_min_threshold_score"), diff --git a/pots/utils.py b/pots/utils.py index ef041d2..3591b6d 100644 --- a/pots/utils.py +++ b/pots/utils.py @@ -3,7 +3,7 @@ from django.conf import settings BASE_PATTERN = ( - r"potlock\.testnet" + r"v\d+\.potfactory\.potlock\.testnet" if settings.ENVIRONMENT == "testnet" else r"v\d+\.potfactory\.potlock\.near" )