+
    Ki-  c                   s    R t ^ RIt^ RIt^ RIHt ^ RIt^ RIHt ^ RIH	t	H
t
Ht ^ RIHtHt ^ RIHt ^ RIHtHt  ! R R	]4      t ! R
 R]]4      tR# )zSteam Family serviceN)gettext)settings)SERVICE_LOGINAuthTokenExpiredErrorOnlineService)	SteamGameSteamService)logger)get_active_steamid64get_steam_libraryc                   s<   a  ] tR t^t o RtRtRt]R 4       tRt	V t
R# )SteamFamilyGamesteamfamilyZsteamc                sJ    V P                  V4      pV P                  Vn        V# )z7Return a Steam Family game instance from an AppManifest)Znew_from_steam_gameservice)Zclsgame   &&@/usr/lib/python3.14/site-packages/lutris/services/steamfamily.pynew_from_steamfamily_gameZ)SteamFamilyGame.new_from_steamfamily_game   s$     &&t,{{     N)__name__
__module____qualname____firstlineno__r   Zinstaller_slugZrunnerZclassmethodr   __static_attributes____classdictcell__)__classdict__s   @r   r
   r
      s&     GNF r   r
   c                   s  a a ] tR t^t oRtRt]! R4      t]! R4      tRt	Rt
RtRt]t]P                   t]P&                  P)                  ]P*                  R4      t]P&                  P)                  ]P*                  R	4      t]P&                  P)                  ]P*                  R
4      tRtR.tRtRtRtRtV 3R ltR t R t!R t"R t#R t$R t%R t&R t'Rt(Vt)V ;t*# )SteamFamilyServicez&Service class for Steam Family sharingr   zSteam Familyz1Use for displaying every game in the Steam familyi  iR  Tz.steam.authz.steam.tokenzsteam-library.jsonz2https://store.steampowered.com/login/?redir=/aboutz$https://store.steampowered.com/aboutz?https://store.steampowered.com/pointssummary/ajaxgetasyncconfigzJhttps://api.steampowered.com/IFamilyGroupsService/GetSharedLibraryApps/v1/zKhttps://api.steampowered.com/IFamilyGroupsService/GetFamilyGroupForUser/v1/zrMozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.38 Safari/537.36c                s   < \         SV `  4        \        P                  ! 4       V n        V P                  V P                  P
                  R &   V P                  4       V n        R# )z
User-AgentN)Zsuper__init__requestssession
user_agentZheadersload_access_tokenaccess_token)self	__class__s   &r   r   ZSteamFamilyService.__init__8   sG    '')-1__\* 224r   c                sd    V P                  4       ;'       d    \        V P                  4       4      # )N)Zis_authenticatedZboolr   )r!   s   &r   is_connectedZSteamFamilyService.is_connected>   s'    $$&II40F0F0H+IIr   c           	     s<   V P                  4       pV'       g   \        R4      h\        V P                  RRR7      ;_uu_ 4       pVP	                  \
        P                  ! V^R7      4       RRR4       V P                  4       V n        R#   + '       g   i     L'; i)z;Fetch the access token from the store, save to disk and setzFailed to get access tokenZwutf-8Zencoding)ZindentN)	get_access_tokenZRuntimeErroropen
token_pathZwritejsonZdumpsr   r    )r!   
token_data
token_file   &  r   fetch_access_tokenZ%SteamFamilyService.fetch_access_tokenA   sl    **,
;<<$//399ZTZZ
1=> : 224 :9s   (BB	c                sN   \         P                  P                  V P                  4      '       g   R# \	        V P                  RR7      ;_uu_ 4       p\
        P                  ! V4      pVP                  R4      P                  RR4      uuRRR4       #   + '       g   i     R# ; i)zLoad the access token from diskZ r$   r%   ZdataZwebapi_tokenN)ospathZexistsr(   r'   r)   loadget)r!   r+   r*   r,   r   r   Z$SteamFamilyService.load_access_tokenJ   se    ww~~doo..$//G44
:.J>>&)--nbA 5444s   7BB$	c                s    \         P                  ! R4       V P                  P                  V P                  V P                  4       R7      pVP                  4        VP                  4       pV# )z2Request an access token from steam and return dumpzRequesting access token)Zcookies)r   debugr   r1   access_token_urlZload_cookiesraise_for_statusr)   )r!   responser*   r,   r   r&   Z#SteamFamilyService.get_access_tokenR   s\    ./<<##!!%%' $ 
 	!!#]]_
r   c                s~    \         P                  ! R4       V P                  4        \        P                  ! V 4       R# )zOnce the user logs in in a browser window, they're redirected to a
an arbitrary page (about), then we redirect to a page containing the
store access token which we can use to fetch family gameszLogin to Steam store successfulN)r   r2   r-   r   Zfire)r!   Zcontentr   r   login_callbackZ!SteamFamilyService.login_callback]   s+     	67!4 r   c                s6   V P                   P                  V P                  RV P                  4       R\	        4       /R7      pVP                  4        VP                  4       pVR,          pVR,          '       g
   VR,          # \        P                  ! R4       R# )	zGet the user's family group idr    steamidZparamsr5   Zis_not_member_of_any_groupfamily_groupidz(User is not a member of any family groupN)	r   r1   
family_urlr   r   r4   r)   r   error)r!   r5   resDatarecordss   &   r   get_family_groupidZ%SteamFamilyService.get_family_groupide   s    <<##OO^T5K5K5MyZnZp$q $ 
 	!!#--/*%344+,,?@r   c           
     s8   \        4       pV'       g   \        P                  ! R 4       . # V P                  P	                  V P
                  RV P                  4       RV P                  4       R\        4       /R7      pVP                  4        VP                  4       pVR,          R,          pV P                  '       dS   \        V4      pV Uu0 uF  qfR,          kK  	  ppTP                  V Uu. uF  qfR,          V9  g   K  VNK  	  up4       V# u upi u upi )z(Unable to find SteamID from Steam configr    r9   r7   r8   r5   Zappsappid)r   r   r;   r   r1   library_urlr   r>   r4   r)   include_own_gamesr	   Zextend)r!   r7   r5   r<   r=   Z	own_gamesr   Zidss   &       r   get_libraryZSteamFamilyService.get_libraryr   s    &(LLCDI<<## 6 6 8 $"9"9";/1 $ 
 	!!#--/*%f-!!!)'2I-45WT==WC5NNYSYTw-s:RDDYST 6Ss   D/DDc                s    V P                  4       pT FH  pTR,          T P                  9   d   K  T P                  P                  T4      pTP                  4        KJ  	  T P                  4        T#   \         di   p\        P                  ! R4        T P	                  4        T P                  4       p Rp?L   \        P                  ! R4       \        R4      Th; iRp?ii ; i)zLoad the list of gamesz3Access Token expired, will attempt to get a new onez Failed to get a new access tokenzAccess Token expiredNr?   )rB   Z	Exceptionr   Zwarningr-   r   Zexcluded_appids
game_classr   ZsaveZmatch_games)r!   ZlibraryZexZ
steam_gamer   s   &    r   r0   ZSteamFamilyService.load   s    		L&&(G "J'"d&:&::??<<ZHDIIK	 "
 	  	LNNPQL'')**,LAB+,BCK	Ls)   A2 2C%=C  B99$CC  C%)r    r   )+r   r   r   r   __doc__Zid_ZnameZdescriptionZlogin_window_widthZlogin_window_heightZonlineZrequires_login_pager
   rC   r   ZSTEAM_FAMILY_INCLUDE_OWNrA   r.   r/   ZjoinZ	CACHE_DIRZcookies_pathr(   Z
cache_pathZ	login_urlZredirect_urisr3   r@   r:   r   r   r#   r-   r   r&   r6   r>   rB   r0   r   r   Z__classcell__)r"   r   s   @@r   r   r      s     0	B^DGHKF J 9977<< 2 2MBLh00.AJh002FGJDI;<MX^K^J	, 5J5B	!, r   r   )rD   r)   r.   r    rE   r   Zlutrisr   Zlutris.services.baser   r   r   Zlutris.services.steamr   r   Zlutris.util.logr   Zlutris.util.steam.configr   r	   r
   r   r   r   r   <module>rF      sB      	     T T 9 " L
i 
}} }r   