Skip to content

Commit

Permalink
Static Wrapped Examples (#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
avgupta456 authored Nov 28, 2023
1 parent cf9dff5 commit d33dcda
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
9 changes: 1 addition & 8 deletions backend/src/aggregation/layer2/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions backend/src/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 5 additions & 2 deletions backend/src/data/mongo/user_months/get.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/Wrapped/Wrapped.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const WrappedScreen = () => {
<div className="w-full h-auto flex flex-row flex-wrap -mb-4">
{!downloadLoading && (
<Link to="/">
<LeftArrowIcon className="hidden md:absolute ml-2 mt-2 h-8 w-8 text-gray-500 hover:text-gray-800" />
<LeftArrowIcon className="hidden md:block absolute ml-2 mt-2 h-8 w-8 text-gray-500 hover:text-gray-800" />
</Link>
)}
<p className="text-xl font-semibold text-center w-full">
Expand Down

1 comment on commit d33dcda

@vercel
Copy link

@vercel vercel bot commented on d33dcda Nov 28, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.