diff --git a/backend/src/aggregation/layer2/auth.py b/backend/src/aggregation/layer2/auth.py index addbca57..685580c8 100644 --- a/backend/src/aggregation/layer2/auth.py +++ b/backend/src/aggregation/layer2/auth.py @@ -7,17 +7,10 @@ get_valid_db_user, get_valid_github_user, ) -from src.constants import OWNER, REPO +from src.constants import OWNER, REPO, USER_WHITELIST from src.data.github.rest import RESTError from src.utils import alru_cache -USER_WHITELIST = [ - "torvalds", - "yyx990803", - "shadcn", - "sindresorhus", -] - async def check_github_user_exists(user_id: str) -> bool: return await get_valid_github_user(user_id) diff --git a/backend/src/constants.py b/backend/src/constants.py index 4d43f61f..3f8cf993 100644 --- a/backend/src/constants.py +++ b/backend/src/constants.py @@ -57,6 +57,15 @@ ] TEST_SHA = "ad83e6340377904fa0295745b5314202b23d2f3f" +# WRAPPED + +# example users, don't need to star the repo +USER_WHITELIST = [ + "torvalds", + "yyx990803", + "shadcn", + "sindresorhus", +] print("PROD", PROD) print("API_VERSION", API_VERSION) diff --git a/backend/src/data/mongo/user_months/get.py b/backend/src/data/mongo/user_months/get.py index d1f4fe96..22f09767 100644 --- a/backend/src/data/mongo/user_months/get.py +++ b/backend/src/data/mongo/user_months/get.py @@ -1,7 +1,7 @@ from datetime import date, datetime from typing import Any, Dict, List -from src.constants import API_VERSION +from src.constants import API_VERSION, USER_WHITELIST from src.data.mongo.main import USER_MONTHS from src.data.mongo.user_months.models import UserMonth from src.models import UserPackage @@ -28,7 +28,10 @@ async def get_user_months( months_data: List[UserMonth] = [] for month in months: date_obj: datetime = month["month"] - complete = not (date_obj.year == today.year and date_obj.month == today.month) + complete = ( + not (date_obj.year == today.year and date_obj.month == today.month) + or user_id in USER_WHITELIST + ) try: data = UserPackage.decompress(month["data"]) months_data.append( diff --git a/frontend/src/pages/Wrapped/Wrapped.js b/frontend/src/pages/Wrapped/Wrapped.js index 00b7c64f..86edcf5a 100644 --- a/frontend/src/pages/Wrapped/Wrapped.js +++ b/frontend/src/pages/Wrapped/Wrapped.js @@ -101,7 +101,7 @@ const WrappedScreen = () => {