+
    ‚°ñj›P  ã                   óÌ   € ^ RI t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	H
t
 ^ RIHt ^ RIHt ^ RIt^RIHt ^ RIHt Rt ! R R	]4      tR
 R lt ! R R4      tR# )é    N)Úweb)Úparse)Úargs)ÚAppSettings)Ú	TypedDictÚdefaultc                   ó,   a € ] tR t^t o V 3R ltRtV tR# )ÚFileInfoc                óJ   <€ V ^8„  d   Qh/ S[ ;R&   S[;R&   S[;R&   S[;R&   # )é   ÚpathÚsizeÚmodifiedÚcreated)ÚstrÚint)ÚformatÚ__classdict__s   "€Ú4C:\Ai_Coding\apps\studio\ComfyUI\app\user_manager.pyÚ__annotate__ÚFileInfo.__annotate__   s1   ø‡ ‚ Ù
�Iñ á
�Iñ ñ �Mñ ñ �Lò	 ó    © N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__©r   s   @r   r
   r
      s   ø‡ ‡ „ r   r
   c                ó<   € V ^8„  d   QhR\         R\         R\        /# )r   r   Úrelative_toÚreturn)r   r
   )r   s   "r   r   r      s!   € ÷ ñ œð ¬#ð ´(ñ r   c                 óz  € R \         P                  P                  W4      P                  \         P                  R4      R\         P                  P                  V 4      R\        \         P                  P                  V 4      R,          4      R\        \         P                  P                  V 4      R,          4      /# )r   Ú/r   r   iè  r   )	Úosr   ÚrelpathÚreplaceÚsepÚgetsizer   ÚgetmtimeÚgetctime)r   r#   s   &&r   Úget_file_infor.      s}   € à”—‘—‘ Ó2×:Ñ:¼2¿6¹6À3ÓGØ”—‘—‘ Ó%Ø”CœŸ™×(Ñ(¨Ó.°Õ5Ó6Ø”3”r—w‘w×'Ñ'¨Ó-°Õ4Ó5ð	ð r   c                   óH   a € ] tR t^$t o R tR tR tR	R ltR tR t	Rt
V tR# )
ÚUserManagerc                óº  € \         P                  ! 4       p\        V 4      V n        \        P
                  P                  V4      '       g[   \        P                  ! VR R7       \        P                  '       g-   \        P                  ! R4       \        P                  ! R4       \        P                  '       d„   \        P
                  P                  V P                  4       4      '       dH   \        V P                  4       4      ;_uu_ 4       p\        P                   ! V4      V n        RRR4       R# / V n        R# RR/V n        R#   + '       g   i     R# ; i)T©Úexist_okzd****** User settings have been changed to be stored on the server instead of browser storage. ******zg****** For multi-user setups add the --multi-user CLI argument to enable multiple user profiles. ******Nr   )Úfolder_pathsÚget_user_directoryr   Úsettingsr'   r   ÚexistsÚmakedirsr   Ú
multi_userÚloggingÚwarningÚisfileÚget_users_fileÚopenÚjsonÚloadÚusers)ÚselfÚuser_directoryÚfs   &  r   Ú__init__ÚUserManager.__init__%   sß   € Ü%×8Ò8Ó:ˆä# DÓ)ˆŒÜ�w‰w�~‰~˜n×-Ò-Ü�KŠK˜°Õ6Ü—?—?�?Ü—’ð  !Gô  HÜ—’ð  !Jô  Kä�?�?ˆ?Ü�w‰w�~‰~˜d×1Ñ1Ó3×4Ò4Ü˜$×-Ñ-Ó/×0Ô0°AÜ!%§¢¨1£�D”J÷ 1Ñ0ð  �–
à# YÐ/ˆDŽJ÷ 1×0Ð0ús   ÄE	Å	E	c                óh   € \         P                  P                  \        P                  ! 4       R 4      # )z
users.json)r'   r   Újoinr4   r5   )rB   s   &r   r=   ÚUserManager.get_users_file8   s    € Ü�w‰w�|‰|œL×;Ò;Ó=¸|ÓLÐLr   c                ó0  € R p\         P                  '       d\   RVP                  9   dK   VP                  R,          pVP                  \        P
                  4      '       d   \        RV,           4      hW P                  9  d   \        RV,           4      hV# )r   z
comfy-userzUnknown user: )r   r9   ÚheadersÚ
startswithr4   ÚSYSTEM_USER_PREFIXÚKeyErrorrA   )rB   ÚrequestÚusers   && r   Úget_request_user_idÚUserManager.get_request_user_id;   so   € ØˆÜ�?�?ˆ?˜|¨w¯©Ô>Ø—?‘? <Õ0ˆDà�‰œ|×>Ñ>×?Ò?ÜÐ/°$Õ6Ó7Ð7à—z‘zÔ!ÜÐ+¨dÕ2Ó3Ð3àˆr   c                óî  € VR 8X  d   \         P                  ! 4       pM\        RV,           4      hV P                  V4      p\         P                  ! V4      pVf   R# Tp\
        P                  P                  WW34      V8w  d   R# Ve�   RV9   d   \        P                  ! V4      p\
        P                  P                  \
        P                  P                  Wr4      4      p\
        P                  P                  Wx34      V8w  d   R# \
        P                  P                  V4      ^ ,          p	V'       d>   \
        P                  P                  V	4      '       g   \
        P                  ! V	RR7       V# )ÚuserdatazUnknown filepath type:NÚ%Tr2   )r4   r5   rN   rQ   Úget_public_user_directoryr'   r   Ú
commonpathr   ÚunquoteÚabspathrH   Úsplitr7   r8   )
rB   rO   ÚfileÚtypeÚ
create_dirÚroot_dirrP   Ú	user_rootr   Úparents
   &&&&&     r   Úget_request_user_filepathÚ%UserManager.get_request_user_filepathH   s  € Ø�:ÔÜ#×6Ò6Ó8‰HäÐ3°dÕ:Ó;Ð;à×'Ñ'¨Ó0ˆÜ ×:Ò:¸4Ó@ˆ	ØÒÙØˆô �7‰7×Ñ˜xÐ3Ó4¸Ô@ÙàÒà�dŒ{Ü—}’} TÓ*�ô —7‘7—?‘?¤2§7¡7§<¡<°	Ó#@ÓAˆDÜ�w‰w×!Ñ! 9Ð"3Ó4¸	ÔAÙä—‘—‘˜tÓ$ QÕ'ˆçœbŸg™gŸn™n¨V×4Ò4Ü�KŠK˜¨Õ.àˆr   c                óp  € VP                  4       pV'       g   \        R 4      hVP                  \        P                  4      '       d   \        R4      h\
        P                  ! RRV4      pVP                  \        P                  4      '       d   \        R4      hVR,           \        \        P                  ! 4       4      ,           pWP                  V&   \        V P                  4       R4      ;_uu_ 4       p\        P                  ! V P                  V4       RRR4       V#   + '       g   i     T# ; i)zusername not providedzSystem User prefix not allowedz[^a-zA-Z0-9-_]+Ú-Ú_ÚwN)ÚstripÚ
ValueErrorrL   r4   rM   ÚreÚsubr   ÚuuidÚuuid4rA   r>   r=   r?   Údump)rB   ÚnameÚuser_idrD   s   &&  r   Úadd_userÚUserManager.add_useri   sÞ   € Ø�z‰z‹|ˆßÜÐ4Ó5Ð5Ø�?‰?œ<×:Ñ:×;Ò;ÜÐ=Ó>Ð>Ü—&’&Ð*¨C°Ó6ˆØ×Ñœl×=Ñ=×>Ò>ÜÐ=Ó>Ð>Ø˜C•-¤#¤d§j¢j£lÓ"3Õ3ˆà"�
‰
�7Ñä�$×%Ñ%Ó'¨×-Ô-°Ü�IŠI�d—j‘j !Ô$÷ .ð ˆ÷ .Ö-ð ˆús   Ã8"D$Ä$D5	c                óö  a a
€ S P                   P                  V4       VP                  R 4      V 3R l4       pVP                  R 4      V 3R l4       pVP                  R4      V 3R l4       pVP                  R4      V 3R l4       pRV 3R llo
VP                  R4      V
V 3R	 l4       pVP                  R4      V
V 3R
 l4       pVP	                  R4      V
3R l4       pVP                  R4      V
V 3R l4       p	R# )z/usersc              “   ó  <"  € \         P                  '       d%   \        P                  ! R RRSP                  /4      # SP                  V RRR7      p\        P                  ! R RR\        P                  P                  V4      /4      # 5i)ÚstorageÚserverrA   NF©r]   Úmigrated)	r   r9   r   Újson_responserA   ra   r'   r   r7   )rO   Úuser_dirrB   s   & €r   Ú	get_usersÚ)UserManager.add_routes.<locals>.get_users~   st   øé € ä��ˆÜ×(Ò(¨)°X¸wÈÏ
É
Ð)SÓTÐTà×9Ñ9¸'À4ÐTYÐ9ÓZ�Ü×(Ò(Ø˜xØ¤§¡§¡¨xÓ 8ð*ó ð ùs   ƒBB	c              “   óŠ  <"  € V P                  4       G R j  x€L
 pVR,          pVSP                  P                  4       9   d   \        P                  ! RR/RR7      #  SP                  V4      p\        P                  ! T4      #  Ln  \         d.   p\        P                  ! R\        T4      /RR7      u R p?# R p?ii ; i5i)NÚusernameÚerrorzDuplicate username.é�  ©Ústatus)r?   rA   Úvaluesr   rx   rp   rh   r   )rO   Úbodyr}   ro   ÚerB   s   &    €r   Ú
post_usersÚ*UserManager.add_routes.<locals>.post_users‰   s¨   øé € à Ÿ™›×'ˆDØ˜JÕ'ˆHØ˜4Ÿ:™:×,Ñ,Ó.Ô.Ü×(Ò(¨'Ð3HÐ)IÐRUÔVÐVðHØŸ-™-¨Ó1�ô ×$Ò$ WÓ-Ð-ñ (øô ô HÜ×(Ò(¨'´3°q³6Ð):À3ÔGÕGûðHüs@   ƒC—B˜ACÁB Á0CÂC Â"B;Â5C Â6CÂ;C Ã Cz	/userdatac              “  óš  <aaa	"  € V P                   P                  P                  RR4      pV'       g   \        P                  ! RRR7      # S
P                  W4      oS'       g   \        P                  ! RRR7      # \        P                  P                  S4      '       g   \        P                  ! RR	R7      # V P                   P                  P                  R
R4      P                  4       R8H  pV P                   P                  P                  RR4      P                  4       R8H  oV P                   P                  P                  RR4      P                  4       R8H  o	V'       d7   \        P                  P                  \        P                  ! S4      RR4      pM4\        P                  P                  \        P                  ! S4      R4      pR VVV	3R llp\        P                  ! W2R7       Uu. uF2  p\        P                  P                  V4      '       g   K*  V! V4      NK4  	  pp\        P                  ! V4      # u upi 5i)aÎ  
List user data files in a specified directory.

This endpoint allows listing files in a user's data directory, with options for recursion,
full file information, and path splitting.

Query Parameters:
- dir (required): The directory to list files from.
- recurse (optional): If "true", recursively list files in subdirectories.
- full_info (optional): If "true", return detailed file information (path, size, modified time).
- split (optional): If "true", split file paths into components (only applies when full_info is false).

Returns:
- 400: If 'dir' parameter is missing.
- 403: If the requested path is not allowed.
- 404: If the requested directory does not exist.
- 200: JSON response with the list of files or file information.

The response format depends on the query parameters:
- Default: List of relative file paths.
- full_info=true: List of dictionaries with file details.
- split=true (and full_info=false): List of lists, each containing path components.
ÚdirÚ r   zDirectory not provided©r�   Útexté“  zInvalid directoryé”  zDirectory not foundÚrecurseÚtrueÚ	full_inforZ   z**Ú*c                ór   € V ^8„  d   QhR\         R\        \         ,          \        \         ,          ,          /# )r   Ú	full_pathr$   )r   r
   Úlist)r   s   "r   r   ÚBUserManager.add_routes.<locals>.listuserdata.<locals>.__annotate__Ä   s'   € ÷  ñ  ¬Sð  ´XÄµ^ÄdÌ3ÅiÕ5Oñ  r   c                 óî   <€ S'       d   \        V S4      # \        P                  P                  V S4      P	                  \        P
                  R 4      pS'       d   V.VP                  R 4      ,           # V# )r&   )r.   r'   r   r(   r)   r*   rZ   )r“   Úrel_pathr�   r   Ú
split_paths   & €€€r   Úprocess_full_pathÚGUserManager.add_routes.<locals>.listuserdata.<locals>.process_full_pathÄ   sV   ø€ ßÜ(¨°DÓ9Ð9äŸ7™7Ÿ?™?¨9°dÓ;×CÑCÄBÇFÁFÈCÓP�ßØ$˜:¨¯©°sÓ(;Õ;Ð;à�r   )Ú	recursive)Úrel_urlÚqueryÚgetr   ÚResponsera   r'   r   r7   ÚlowerrH   ÚglobÚescaper<   rx   )rO   Ú	directoryrŽ   Úpatternr™   r“   Úresultsr�   r   r˜   rB   s   &      @@@€r   ÚlistuserdataÚ,UserManager.add_routes.<locals>.listuserdata–   s§  ûé € ð2  Ÿ™×-Ñ-×1Ñ1°%¸Ó<ˆIßÜ—|’|¨3Ð5MÔNÐNà×1Ñ1°'ÓEˆDßÜ—|’|¨3Ð5HÔIÐIä—7‘7—>‘> $×'Ò'Ü—|’|¨3Ð5JÔKÐKà—o‘o×+Ñ+×/Ñ/°	¸2Ó>×DÑDÓFÈ&ÑPˆGØŸ™×-Ñ-×1Ñ1°+¸rÓB×HÑHÓJÈfÑTˆIØ Ÿ™×.Ñ.×2Ñ2°7¸BÓ?×EÑEÓGÈ6ÑQˆJ÷ ÜŸ'™'Ÿ,™,¤t§{¢{°4Ó'8¸$ÀÓD‘äŸ'™'Ÿ,™,¤t§{¢{°4Ó'8¸#Ó>�÷ ò  ô "&§¢¨7Õ!Fóá!F�IÜ—7‘7—>‘> )×,ô -Ñ! )Ö,Ù!Fð ð ô ×$Ò$ WÓ-Ð-ùòùs&   †BIÂ#CIÅ(BIÇ6'IÈ"IÈ.Iz/v2/userdatac           
   “  ó„  <"  € V P                   P                  P                  RR4      p \        P                  ! V4      p SP                  T RR	R
7      pT'       d   SP                  YR	R
7      pMTp T'       g   \        P                  ! RRR7      # \        P                  P                  T4      '       g5   YC8X  d   \        P                  ! . 4      # \        P                  ! RRR7      # \        P                  P!                  T4      '       g   \        P                  ! RRR7      # . p \        P"                  ! TRR7       EF6  w  rgpT Fv  p	\        P                  P%                  Yi4      p
\        P                  P'                  Y£4      P)                  \        P*                  R4      pTP-                  RT	RTRR/4       Kx  	  T F­  p\        P                  P%                  Yl4      p\        P                  P'                  YÓ4      P)                  \        P*                  R4      pRTRTRR/p \        P.                  ! T4      pTP0                  TR&   TP2                  TR&   TP-                  T4       K¯  	  EK9  	  TP9                  R  R!7       \        P                  ! T4      #   \
         d?   p\        P                  ! RT RT 24       \        P                  ! RRR7      u Rp?# Rp?ii ; i  \         d<   p\        P                  ! RT 24       \        P                  ! RRR7      u Rp?# Rp?ii ; i  \4         d(   p\        P                  ! RT RT 24        Rp?ELRp?ii ; i  \4         d?   p\        P6                  ! RT RT 24       \        P                  ! RRR7      u Rp?# Rp?ii ; i5i)"a   
List files and directories in a user's data directory.

This endpoint provides a structured listing of contents within a specified
subdirectory of the user's data storage.

Query Parameters:
- path (optional): The relative path within the user's data directory
                   to list. Defaults to the root ('').

Returns:
- 400: If the requested path is invalid, outside the user's data directory, or is not a directory.
- 404: If the requested path does not exist.
- 403: If the user is invalid.
- 500: If there is an error reading the directory contents.
- 200: JSON response containing a list of file and directory objects.
       Each object includes:
       - name: The name of the file or directory.
       - type: 'file' or 'directory'.
       - path: The relative path from the user's data root.
       - size (for files): The size in bytes.
       - modified (for files): The last modified timestamp (Unix epoch).
r   r‰   z!Failed to decode path parameter: z	, Error: r   z$Invalid characters in path parameterrŠ   NFrv   zAccess denied for user: rŒ   z!Invalid user specified in requestzInvalid path requestedr�   zRequested path not foundz!Requested path is not a directoryT)Útopdownr&   rn   r\   r£   r[   r   r   zCould not stat file z: zError listing directory iô  z Error reading directory contentsc                 óH   € V R ,          R8g  V R,          P                  4       3# )r\   r£   rn   )r    )Úxs   &r   Ú<lambda>ÚBUserManager.add_routes.<locals>.list_userdata_v2.<locals>.<lambda><  s   € ¨¨&­	°[Ñ(@À!ÀFÅ)Ç/Á/ÓBSÑ'Tr   )Úkey)rœ   r�   rž   r   rX   Ú	Exceptionr:   r;   r   rŸ   ra   rN   r'   r   r7   rx   ÚisdirÚwalkrH   r(   r)   r*   ÚappendÚstatÚst_sizeÚst_mtimeÚOSErrorr~   Úsort)rO   Úrequested_rel_pathr„   Úbase_user_pathÚtarget_abs_pathr¥   ÚrootÚdirsÚfilesÚdir_nameÚdir_pathr—   Ú	file_nameÚ	file_pathÚ
entry_infoÚstatsÚ
stat_errorrB   s   &                €r   Úlist_userdata_v2Ú0UserManager.add_routes.<locals>.list_userdata_v2Ö   s(  øé € ð2 ")§¡×!6Ñ!6×!:Ñ!:¸6À2Ó!FÐð]Ü%*§]¢]Ð3EÓ%FÐ"ð[Ø"&×"@Ñ"@ÀÈ$Ð[`Ð"@Ó"a�ç&Ø'+×'EÑ'EÀgÐnsÐ'EÓ't‘_à'5‘_÷ #äŸš¨CÐ6NÔOÐOô —7‘7—>‘> /×2Ò2à"Ô4ä×-Ò-¨bÓ1Ð1ô  ŸLšL°Ð:TÔUÐUä—7‘7—=‘= ×1Ò1ÜŸš¨CÐ6YÔZÐZàˆGðYÜ)+¯ª°È$×)OÐ)OÑ%�D ã$(˜Ü#%§7¡7§<¡<°Ó#?˜Ü#%§7¡7§?¡?°8Ó#L×#TÑ#TÔUW×U[ÑU[Ð]`Ó#a˜ØŸ™Ø" HØ" HØ" Kð(ö ñ %)ó &+˜	Ü$&§G¡G§L¡L°Ó$A˜	Ü#%§7¡7§?¡?°9Ó#M×#UÑ#UÔVX×V\ÑV\Ð^aÓ#b˜à" IØ" HØ" Fð&˜
ð
!Ü$&§G¢G¨IÓ$6˜EØ16·±˜J vÑ.Ø5:·^±^˜J zÑ2ð  Ÿ™ zÖ2ô &+ñ *PðB �L‰LÑTˆLÔUä×$Ò$ WÓ-Ð-øôU ô ]Ü—’Ð"CÐDVÐCWÐW`ÐabÐ`cÐ dÔeÜ—|’|¨3Ð5[Ô\Õ\ûð]ûô ô [ä—’Ð#;¸A¸3Ð!?Ô@ÜŸš¨CÐ6YÔZÕZûð[ûôb  'ô !Ü#ŸOšOÐ.BÀ9À+ÈRÐPZÈ|Ð,\Ô]Ý ûð!ûô ô YÜ—’Ð 8¸Ð8IÈÈAÈ3ÐOÔPÜ—|’|¨3Ð5WÔXÕXûðYüsÞ   ƒ'O «J* ÁK6 ÁK6 Á1O Á2K6 Á4O Á=<O Â:AO ÄO Ä.DM4 È34L?É'M4 Ê)O Ê*K3Ê53K.Ë(K3Ë)O Ë.K3Ë3O Ë6L<Ì0L7Ì1L<Ì2O Ì7L<Ì<O Ì?M1Í
M,Í&M4 Í,M1Í1M4 Í4N=Í?3N8Î2N=Î3O Î8N=Î=O c                 óf  <€ V P                   P                  VR 4      pV'       g   \        P                  ! RR7      # SP	                  W4      pV'       g   \        P                  ! RR7      # V'       d=   \
        P                  P                  V4      '       g   \        P                  ! RR7      # V# )Nr   r€   rŒ   r�   )Ú
match_inforž   r   rŸ   ra   r'   r   r7   )rO   Úcheck_existsÚparamr[   r   rB   s   &&&  €r   Úget_user_data_pathÚ2UserManager.add_routes.<locals>.get_user_data_path@  sx   ø€ Ø×%Ñ%×)Ñ)¨%°Ó6ˆDßÜ—|’|¨3Ô/Ð/à×1Ñ1°'Ó@ˆDßÜ—|’|¨3Ô/Ð/ç¤B§G¡G§N¡N°4×$8Ò$8Ü—|’|¨3Ô/Ð/àˆKr   z/userdata/{file}c           	   “   óÜ  <"  € S! V R R7      p\        V\        4      '       g   V# \        P                  ! V4      ^ ,          ;'       g    RpSP	                  V RRR7      pV\
        P                  P                  \
        P                  P                  VR4      4      8H  pV'       d   RpRpM \        P                  ! V4      '       d   RpR	p\        P                  ! VR
VRRRV/R7      # 5i)T©rÉ   zapplication/octet-streamNFrv   zuser.cssztext/cssÚinlineÚ
attachmentzContent-TypezX-Content-Type-OptionsÚnosniffzContent-Disposition)rK   )Ú
isinstancer   Ú	mimetypesÚ
guess_typera   r'   r   rY   rH   r4   Úis_dangerous_content_typer   ÚFileResponse)rO   r   Úcontent_typer_   Úis_user_cssÚdispositionrË   rB   s   &     €€r   ÚgetuserdataÚ+UserManager.add_routes.<locals>.getuserdataN  sÓ   øé € á% g¸DÔAˆDÜ˜d¤C×(Ò(Ø�ô %×/Ò/°Ó5°aÕ8×VÐVÐ<VˆLà×6Ñ6°wÀÐQVÐ6ÓWˆIØ¤"§'¡'§/¡/´"·'±'·,±,¸yÈ*Ó2UÓ"VÑVˆKçØ)�Ø&‘ä×9Ò9¸,×GÒGØ#=�LØ*�ä×#Ò# DØ Ø(¨)Ø% {ð3ô ð ùs   ƒAC,Á
AC,Â) C,Ã
"C,c              “  ó`  <"  € S! V 4      p\        V\        4      '       g   V# V P                  P                  RR4      R8g  pV P                  P                  RR4      P	                  4       R8H  pV'       g>   \
        P                  P                  V4      '       d   \        P                  ! RRR7      #  V P                  4       G Rj  x€L
 p\
        P                  P                  V4      p\        P                  ! VR	7      w  rg \
        P                  ! VR
4      ;_uu_ 4       pVP                  V4       RRR4       \
        P                   ! Wq4       SP+                  T R4      p
T'       d   \-        Y4      pM\
        P                  P/                  Y4      p\        P0                  ! T4      #  Lç  + '       g   i     Lƒ; i   \
        P"                  ! T4       h ; i  \$         d?   p	\&        P(                  ! RT RT	 24       \        P                  ! RRR7      u Rp	?	# Rp	?	ii ; i5i)ak  
Upload or update a user data file.

This endpoint handles file uploads to a user's data directory, with options for
controlling overwrite behavior and response format.

Query Parameters:
- overwrite (optional): If "false", prevents overwriting existing files. Defaults to "true".
- full_info (optional): If "true", returns detailed file information (path, size, modified time).
                      If "false", returns only the relative file path.

Path Parameters:
- file: The target file path (URL encoded if necessary).

Returns:
- 400: If 'file' parameter is missing.
- 403: If the requested path is not allowed.
- 409: If overwrite=false and the file already exists.
- 200: JSON response with either:
      - Full file information (if full_info=true)
      - Relative file path (if full_info=false)

The request body should contain the raw file content to be written.
Ú	overwriter�   Úfalser�   é™  úFile already existsrŠ   N)rˆ   ÚwbzError saving file 'z': r   z@Invalid filename. Please avoid special characters like :\/*?"<>|)r�   Úreason)rÒ   r   r�   rž   r    r'   r   r7   r   rŸ   ÚreadÚdirnameÚtempfileÚmkstempÚfdopenÚwriter)   Úunlinkr¶   r:   r;   ra   r.   r(   rx   )rO   r   rÝ   r�   rƒ   r¾   ÚfdÚtmp_pathrD   r„   Ú	user_pathÚresprË   rB   s   &           €€r   Úpost_userdataÚ-UserManager.add_routes.<locals>.post_userdatal  s›  øé € ñ4 & gÓ.ˆDÜ˜d¤C×(Ò(Ø�àŸ™×)Ñ)¨+°vÓ>À'ÑIˆIØŸ™×)Ñ)¨+°wÓ?×EÑEÓGÈ6ÑQˆIç¤§¡§¡°×!5Ò!5Ü—|’|¨3Ð5JÔKÐKðØ$Ÿ\™\›^×+�äŸ7™7Ÿ?™?¨4Ó0�Ü'×/Ò/°HÔ=‘�ðÜŸš 2 t×,Ô,°ØŸ™ œ÷ -ä—J’J˜xÔ.ð ×6Ñ6°wÀÓEˆIßÜ$ TÓ5‘ä—w‘w—‘ tÓ7�ä×$Ò$ TÓ*Ð*ñ1 ,÷
 -×,ûðÜ—I’I˜hÔ'ØûÜô Ü—’Ð"5°d°V¸3¸q¸cÐ BÔCÜ—|’|ØØ_ôõ ûðüs…   ƒA4H.Á8$H.ÂH.Â6G" Ã	F1Ã
<G" ÄG Ä&F3Ä8G ÅH.Å0AH.Æ1G" Æ3G	Æ>G ÇGÇG" Ç"H+Ç-3H&È H+È!H.È&H+È+H.c              “   óª   <"  € S! V R R7      p\        V\        4      '       g   V# \        P                  ! V4       \        P
                  ! ^ÌR7      # 5i)TrÎ   r€   )rÒ   r   r'   Úremover   rŸ   )rO   r   rË   s   & €r   Údelete_userdataÚ/UserManager.add_routes.<locals>.delete_userdata«  s>   øé € á% g¸DÔAˆDÜ˜d¤C×(Ò(Ø�ä�IŠI�dŒOä—<’< sÔ+Ð+ùs   ƒAAz/userdata/{file}/move/{dest}c              “  óÔ  <"  € S! V RR7      p\        V\        4      '       g   V# S! V RRR7      p\        V\        4      '       g   V# V P                  P                  RR4      R8g  pV P                  P                  R	R4      P	                  4       R8H  pV'       g>   \
        P                  P                  V4      '       d   \        P                  ! R
RR7      # \        P                  ! RV RV R24       \        P                  ! W4       SP                  V R4      pV'       d   \        W%4      pM\
        P                  P!                  W%4      p\        P"                  ! V4      # 5i)a¶  
Move or rename a user data file.

This endpoint handles moving or renaming files within a user's data directory, with options for
controlling overwrite behavior and response format.

Path Parameters:
- file: The source file path (URL encoded if necessary)
- dest: The destination file path (URL encoded if necessary)

Query Parameters:
- overwrite (optional): If "false", prevents overwriting existing files. Defaults to "true".
- full_info (optional): If "true", returns detailed file information (path, size, modified time).
                      If "false", returns only the relative file path.

Returns:
- 400: If either 'file' or 'dest' parameter is missing
- 403: If either requested path is not allowed
- 404: If the source file does not exist
- 409: If overwrite=false and the destination file already exists
- 200: JSON response with either:
      - Full file information (if full_info=true)
      - Relative file path (if full_info=false)
TrÎ   FÚdest)rÉ   rÊ   rÝ   r�   rÞ   r�   rß   rà   rŠ   zmoving 'z' -> 'Ú'N)rÒ   r   r�   rž   r    r'   r   r7   r   rŸ   r:   ÚinfoÚshutilÚmovera   r.   r(   rx   )	rO   Úsourcerõ   rÝ   r�   rì   rí   rË   rB   s	   &      €€r   Úmove_userdataÚ-UserManager.add_routes.<locals>.move_userdataµ  s  øé € ñ4 (¨¸dÔCˆFÜ˜f¤c×*Ò*Ø�á% g¸EÈÔPˆDÜ˜d¤C×(Ò(Ø�àŸ™×)Ñ)¨+°vÓ>À'ÑIˆIØŸ™×)Ñ)¨+°wÓ?×EÑEÓGÈ6ÑQˆIç¤§¡§¡°×!5Ò!5Ü—|’|¨3Ð5JÔKÐKä�LŠL˜8 F 8¨6°$°°qÐ9Ô:Ü�KŠK˜Ô%à×6Ñ6°wÀÓEˆIßÜ$ TÓ5‘ä—w‘w—‘ tÓ7�ä×$Ò$ TÓ*Ð*ùs   ƒBE(Â$E(ÃB&E(N)Fr[   )r6   Ú
add_routesrž   ÚpostÚdelete)rB   Úroutesrz   r…   r¦   rÅ   rÚ   rî   rò   rû   rË   s   f&        @r   rý   ÚUserManager.add_routes{   s	  ù€ Ø�‰× Ñ  Ô(à	�‰�HÓ	ô	ó 
ð	ð 
�‰�XÓ	ô
	.ó 
ð
	.ð 
�‰�KÓ	 ô=	.ó 
!ð=	.ð~ 
�‰�NÓ	#ôg	.ó 
$ðg	.÷R	ð 
�‰Ð&Ó	'õ	ó 
(ð	ð: 
�‰Ð'Ó	(õ<	+ó 
)ð<	+ð| 
�‰Ð)Ó	*ô	,ó 
+ð	,ð 
�‰Ð3Ó	4õ0	+ó 
5ò0	+r   )r6   rA   N)rT   T)r   r   r   r   rE   r=   rQ   ra   rp   rý   r   r    r!   s   @r   r0   r0   $   s,   ø‡ € ò0ò&MòôòB÷$k+ð k+r   r0   )r?   r'   ri   rk   r¡   rø   r:   rå   rÓ   Úaiohttpr   Úurllibr   Úcomfy.cli_argsr   r4   Úapp_settingsr   Útypingr   Údefault_userr
   r.   r0   r   r   r   Ú<module>r     sT   ðÛ Û 	Û 	Û Û Û Û Û Û Ý Ý Ý Û Ý %Ý à€ôˆyô õ÷B+ó B+r   