Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d33dcda

Browse files
authored
Static Wrapped Examples (avgupta456#251)
1 parent cf9dff5 commit d33dcda

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

‎backend/src/aggregation/layer2/auth.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,10 @@
77
get_valid_db_user,
88
get_valid_github_user,
99
)
10-
from src.constants import OWNER, REPO
10+
from src.constants import OWNER, REPO, USER_WHITELIST
1111
from src.data.github.rest import RESTError
1212
from src.utils import alru_cache
1313

14-
USER_WHITELIST = [
15-
"torvalds",
16-
"yyx990803",
17-
"shadcn",
18-
"sindresorhus",
19-
]
20-
2114

2215
async def check_github_user_exists(user_id: str) -> bool:
2316
return await get_valid_github_user(user_id)

‎backend/src/constants.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@
5757
]
5858
TEST_SHA = "ad83e6340377904fa0295745b5314202b23d2f3f"
5959

60+
# WRAPPED
61+
62+
# example users, don't need to star the repo
63+
USER_WHITELIST = [
64+
"torvalds",
65+
"yyx990803",
66+
"shadcn",
67+
"sindresorhus",
68+
]
6069

6170
print("PROD", PROD)
6271
print("API_VERSION", API_VERSION)

‎backend/src/data/mongo/user_months/get.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from datetime import date, datetime
22
from typing import Any, Dict, List
33

4-
from src.constants import API_VERSION
4+
from src.constants import API_VERSION, USER_WHITELIST
55
from src.data.mongo.main import USER_MONTHS
66
from src.data.mongo.user_months.models import UserMonth
77
from src.models import UserPackage
@@ -28,7 +28,10 @@ async def get_user_months(
2828
months_data: List[UserMonth] = []
2929
for month in months:
3030
date_obj: datetime = month["month"]
31-
complete = not (date_obj.year == today.year and date_obj.month == today.month)
31+
complete = (
32+
not (date_obj.year == today.year and date_obj.month == today.month)
33+
or user_id in USER_WHITELIST
34+
)
3235
try:
3336
data = UserPackage.decompress(month["data"])
3437
months_data.append(

‎frontend/src/pages/Wrapped/Wrapped.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ const WrappedScreen = () => {
101101
<div className="w-full h-auto flex flex-row flex-wrap -mb-4">
102102
{!downloadLoading && (
103103
<Link to="/">
104-
<LeftArrowIcon className="hidden md:absolute ml-2 mt-2 h-8 w-8 text-gray-500 hover:text-gray-800" />
104+
<LeftArrowIcon className="hidden md:block absolute ml-2 mt-2 h-8 w-8 text-gray-500 hover:text-gray-800" />
105105
</Link>
106106
)}
107107
<p className="text-xl font-semibold text-center w-full">

0 commit comments

Comments
 (0)