@@ -80,7 +80,7 @@ def get_redirect_url(
8080 app_links : dict ,
8181 share_slug : str ,
8282 request : Request ,
83- ) -> tuple [ str , OSID ] :
83+ ) -> str :
8484 """Get the redirect URL and store ID based on the device type."""
8585 user_agent = request .headers .get ("User-Agent" , "" )
8686 logger .info (f"User-Agent: { user_agent } " )
@@ -109,13 +109,13 @@ def get_redirect_url(
109109 detected_os = OSID .ERROR
110110
111111 logger .info (f"Redirect URL: { redirect_url = } { detected_os = } " )
112- return redirect_url , detected_os
112+ return redirect_url
113113
114114
115115async def process_share_link (
116116 share_slug : str ,
117117 request : Request ,
118- detected_os : OSID ,
118+ redirect_url : str ,
119119) -> None :
120120 """Process the share link in background."""
121121 client_host = get_client_ip (request )
@@ -129,9 +129,9 @@ async def process_share_link(
129129 logger .warning (f"No link associated with { share_slug } " )
130130 return
131131
132- if detected_os == OSID . ANDROID and link_data [ "google_store_id" ] :
132+ if "play.google.com/store/apps/details?id=" in redirect_url :
133133 app = link_data .get ("google_store_id" )
134- elif detected_os == OSID . IOS and link_data [ "apple_store_id" ] :
134+ elif "apps.apple.com/app/id" in redirect_url :
135135 app = link_data .get ("apple_store_id" )
136136 else :
137137 app = ""
@@ -231,7 +231,7 @@ async def shared_link(
231231 # TODO: Attempts to redirect ot the root of the share url with possibly no landing page
232232 return Redirect (path = "/" )
233233
234- redirect_url , detected_os = get_redirect_url (
234+ redirect_url = get_redirect_url (
235235 app_links ,
236236 share_slug ,
237237 request ,
@@ -243,7 +243,7 @@ async def shared_link(
243243 process_share_link ,
244244 share_slug ,
245245 request ,
246- detected_os ,
246+ redirect_url ,
247247 ),
248248 )
249249
0 commit comments