Ë ¡QÓ�˜* )ãóä—ddlZddlZddlmZmZmZmZmZddlm Z ddl m Z m Z m Z mZmZmZmZmZmZmZmZmZmZmZmZmZddl mZmZmZmZmZd„Z dd „Z!dd „Z"Gd „d «Z#Gd „d«Z$d„Z%y)éNé)Ú ErrorResponseÚHTTP_BAD_REQUESTÚ cspvaluesÚ permhooksÚ statusmessageé)Úgetattr)ÚencodingÚerrorÚ extensionsÚ formatterÚhgÚhookÚ profilingÚpycompatÚ registrarÚrepoviewÚtemplatefiltersÚ templaterÚ templateutilÚuiÚutilÚwireprotoserver)ÚcommonÚrequestÚ webcommandsÚwebutilÚwsgicgicój—|jjdd«|dd«df}|t||«fS)Nóstyleówebspaper)ÚqsparamsÚgetÚ _stylemap)ÚreqÚconfigfnÚ templatepathÚstyless ú=usr/lib/python3.12/site-packages/mercurial/hgweb/hgweb_mod.pyÚgetstyler+2s>€à � ‰ ×ј 4Ó(Ù�˜Ó"Øð€Fð ”9˜V \Ó2Ð 2Ð2ócó€—|D]¬}|rV|tjtjfvs4tj|vs"tjrtj|vrŒ\t j j|d«d|zdf}|D]&}tj||«\}}|sŒ|||fccSŒ®td|z«‚)z´Return path to mapfile for a given style. Searches mapfile in the following locations: 1. templatepath/style/map 2. templatepath/map-style 3. templatepath/map smapsmap-sNo hgweb templates found in %r) rÚoscurdirÚospardirÚossepÚosaltsepÚosÚpathÚjoinrÚtry_open_templateÚ RuntimeError)r)r3ÚstyleÚ locationsÚlocationÚmapfileÚfps r*r%r%;s´€óˆñØœ×*Ñ*¬H×,=Ñ,=Ð>Ñ>Ü�~‰~ Ñ&Ü× Ò Ü×!Ñ! UÑ*à Ü—W‘W—\‘\ %¨Ó0°'¸E±/À6ÐJˆ ã!ˆHÜ#×5Ñ5°hÀÓE‰KˆG�RÚØ˜g rÐ)Ô)ñ"ðô" Ð8¸4Ñ?Ó @Ð@r,cór—|jd«r|dd}|rd|z|z}|}|jd«r|dd}g}|}dg|jd«z}t|«D];}|r|sn5|j ||dœ«t j j|«}Œ=tjt|««S)zÆReturn a 'URL breadcrumb' list A 'URL breadcrumb' is a list of URL-name pairs, corresponding to each of the path items on a URL. This can be used to create path navigation entries. ó/Néÿÿÿÿrr,)óurlóname) ÚendswithÚ startswithÚsplitÚreversedÚappendr2r3ÚdirnamerÚ mappinglist)ÚurlÚprefixÚrelpathÚ breadcrumbÚurlelÚ pathitemsÚpathels r*ÚmakebreadcrumbrOXs½€ð ‡|�|�DÔØ�#�2ˆhˆÙ Ø�V‰m˜cÑ!ˆØ€GØ×ј$ÔØ˜!˜"�+ˆà€JØ €EØ�˜Ÿ ™  dÓ+Ñ+€Iܘ9Ö%ˆÙ™UÙ Ø×Ñ 5°6Ñ:Ô;Ü—‘—‘ Ó&‰ð &ô × #Ñ #¤H¨ZÓ$8Ó 9Ð9r,có@—eZdZdZd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z y ) ÚrequestcontextzòHolds state/context for an individual request. Servers can be multi-threaded. Holding state on the WSGI application is prone to race conditions. Instances of this class exist to hold mutable and race-free state for requests. có®—||_|j|_||_||_|j}t j ||«rD|�B|dztjvr-|jj|jdz«|_|jdd«|_ |jdd«|_ |jdd«|_ |jdd«|_|jdd«|_|j#ddd ¬ «|_|j&|_t)|jj*«\|_|_y) Ns.hiddenr"s maxchangessstripessmaxshortchangessmaxfiless allow-pulls templatesF©Ú untrusted)ÚrepoÚreponamer&ÚresÚ filternamerÚhashiddenaccessrÚ filtertableÚfilteredÚ configintÚ maxchangesÚ stripecountÚmaxshortchangesÚmaxfilesÚ configboolÚ allowpullÚconfigr(Ú websubtablerrÚcspÚnonce)ÚselfÚapprUr&rWÚcurrent_filters r*Ú__init__zrequestcontext.__init__zs€ØˆŒ ØŸ ™ ˆŒ ؈ŒØˆŒðŸ™ˆä × "Ñ " 4¨Ô -ØÐ*Ø Ñ+¬x×/CÑ/CÑCàŸ ™ ×*Ñ*¨4¯?©?¸ZÑ+GÓHˆDŒIàŸ.™.¨°Ó?ˆŒØŸ>™>¨&°*Ó=ˆÔØ#Ÿ~™~¨fÐ6HÓIˆÔØŸ™ v¨{Ó;ˆŒ ØŸ™¨°Ó?ˆŒð !ŸK™K¨° ȘKÓNˆÔðŸ?™?ˆÔä(¨¯©¯©Ó6шŒ�$•*r,cór—|jdd«|jjj|i|¤ŽS©NrTT)Ú setdefaultrUrrc©rgÚargsÚkwargss r*rczrequestcontext.configŸs2€Ø×ј+ tÔ,Ø"ˆt�y‰y�|‰|×"Ñ" DÐ3¨FÑ3Ð3r,cór—|jdd«|jjj|i|¤ŽSrl)rmrUrrarns r*razrequestcontext.configbool£ó2€Ø×ј+ tÔ,Ø&ˆt�y‰y�|‰|×&Ñ&¨Ð7°Ñ7Ð7r,cór—|jdd«|jjj|i|¤ŽSrl)rmrUrr\rns r*r\zrequestcontext.configint§s2€Ø×ј+ tÔ,Ø%ˆt�y‰y�|‰|×%Ñ% tÐ6¨vÑ6Ð6r,cór—|jdd«|jjj|i|¤ŽSrl)rmrUrÚ configlistrns r*ruzrequestcontext.configlist«rrr,cóV—tj|jj|«S©N)rÚ archivelistrUr)rgÚnodeids r*rxzrequestcontext.archivelist¯s€Ü×"Ñ" 4§9¡9§<¡<°Ó8Ð8r,c ó2‡—‰jdd«}‰jdd«}‰jdd«xs|jjd«dz}|jd«s|dz }i}t |‰j‰j «\}\}}} ||dk(r||d<t j|d «} ‰jsL‰jdd d «xs2|jxs$|jxs‰jj‰_i} tj| «} | d t¬ «ˆfd„«} |jdz||||j‰jtj| t!|j«|‰j"dœ }tj$|«}|dd¬«ˆfd„«}t'j(‰jj*‰j«}t,j,j/|| | ||¬«S)Nr"ólogourlólogoimgó staticurlr=s/static/rr!ó?r@r,swebsub)ÚintypecóD•—tj|‰j«Srw)rÚwebsubrd)Útextrgs €r*Ú websubfilterz.requestcontext.templater..websubfilterÔsø€ä"×)Ñ)¨$°×0@Ñ0@ÓAÐ Ar,) r?r{r|r}surlbasesrepoóencodings sessionvarsspathdefr!snonceómotd©)Úrequiresc3ó6•K—‰jdd«–—y­w)Nr"r…)rc)ÚcontextÚmappingrgs €r*Úmotdz&requestcontext.templater..motdésøèø€à—+‘+˜f gÓ.Ó .ùsƒ)r;ÚfiltersÚdefaultsÚ resources)rcÚapppathÚrstriprAr+r(rÚ sessionvarsrVrUÚrootrÚtemplatefilterÚbytesÚadvertisedbaseurlr rOrfÚtemplatekeywordrÚtemplateresourcesrrÚ frommapfile)rgr&ÚlogourlÚlogoimgÚ staticurlÚvarsr)r7r:r;r‘rŒr“rƒr�r–r‹Útress` r*rzrequestcontext.templater²sø€ð—+‘+˜f jÓ1ˆØ—+‘+˜f jÓ1ˆà �K‰K˜  Ó -ò 6Ø�{‰{×!Ñ! $Ó'¨+Ñ5ð ð×!Ñ! $Ô'Ø ˜Ñ ˆIðˆÜ'/Ø �—‘˜d×/Ñ/ó( Ñ$ˆÑ$�˜ ð �F˜1‘IÒ Ø"ˆD�‰Nä×)Ñ)¨$°Ó5ˆ à�}Š}à— ‘ ˜F G¨SÓ1ò"Ø—<‘<ò"à—;‘;ò"ð—9‘9—>‘>ð ŒMðˆÜ"×1Ñ1°'Ó:ˆá ˜ ¬%Ô 0ó Bó 1ð Bð —K‘K $Ñ&ØØØ#Ø×-Ñ-Ø—]‘]Ü!×*Ñ*Ø'Ü& s§{¡{Ó3ØØ—j‘jñ  ˆô$×3Ñ3°HÓ=ˆá ˜¨2Ô .ó /ó /ð /ô×*Ñ*¨4¯9©9¯<©<¸¿¹ÓCˆÜ×"Ñ"×.Ñ.Ø ˜ G°hÈ$ð/ó ð r,c óü—|jjdk7rJtj|«}|jj |j j||««|jj«S)z=Helper function to send a response generated from a template.sHEAD) r&ÚmethodrÚ byteskwargsrWÚ setbodygenÚtmplÚgenerateÚ sendresponse)rgÚnamerps r*Ú sendtemplatezrequestcontext.sendtemplateòsX€à �8‰8�?‰?˜gÒ %Ü×)Ñ)¨&Ó1ˆFØ �H‰H× Ñ  § ¡ × 2Ñ 2°4¸Ó @Ô AØ�x‰x×$Ñ$Ó&Ð&r,N) Ú__name__Ú __module__Ú __qualname__Ú__doc__rjrcrar\rurxrr¦r†r,r*rQrQrs1„ñò"7òJ4ò8ò7ò8ò9ò> ó@'r,rQcó`—eZdZdZd d„Zd„Zejd„«Zd„Z d„Z d„Z d „Z d „Z y) Úhgweba*HTTP server for individual repositories. Instances of this class serve HTTP responses for a particular repository. Instances are typically used as WSGI applications. Some servers are multi-threaded. On these servers, there may be multiple active threads inside __call__. Ncó@—t|t«rr|r|j«}nHtjj «}t j|«t j|«tj||«}n|}|jjdddd«|jjdddd«|jjdddd«|jjdddd«|jjdd|jd«|jjdd|jd«|jjddd d«|jjddd d«|jjd d dd«|jjd d dd«tj|j|««g|_|j d |_t%j&d «||_y)Nsuisreport_untrustedsoffshgwebsnonttystruesforcecwdssignal-safe-locksfalsesprogresssdisablerT)Ú isinstancer”ÚcopyÚuimodrÚloadr ÚloadallÚ populateuirÚ repositoryÚ setconfigÚbaseuir’ÚcachedlocalrepoÚ _webifyrepoÚ_reposÚ _lastreporÚredirectrV)rgrUr¥r¶ÚuÚrs r*rjzhgweb.__init__s”€Ü �dœEÔ "ÙØ—K‘K“M‘ä—H‘H—M‘M“O�Ü×"Ñ" 1Ô%Ü×%Ñ% aÔ(Ü— ‘ ˜a Ó&‰AðˆAà �‰�‰�uÐ1°6¸8ÔDØ �‰×ј5Ð"5°v¸xÔHØ �‰�‰�u˜i¨°(Ô;Ø �‰×ј5 )¨W°hÔ?à �‰�‰�u˜k¨1¯6©6°8Ô<Ø �‰×ј5 +¨q¯v©v°xÔ@ð �‰�‰�uÐ1°8¸XÔFØ �‰×ј5Ð"5°xÀÔJð �‰�‰�{ J°¸ÔBØ �‰×ј;¨ °G¸XÔFÜ×)Ñ)¨$×*:Ñ*:¸1Ó*=Ó>Ð?ˆŒ ØŸ™ Q™ˆŒÜ � ‰ �dÔØˆ� r,cóP—t|«}tj|«|_|Srw)Ú getwebviewrÚ getwebsubsrd)rgrUs r*r¸zhgweb._webifyrepo)s$€Ü˜$ÓˆÜ"×-Ñ-¨dÓ3ˆÔ؈ r,c#ó°K—|jr.|jj«}|j«\}}n-|jj «}|j«\}}|r|j |«}||_|j |_ |–—|jj|«y#|jj|«wxYw­w)aObtain a repo unique to the caller. Internally we maintain a stack of cachedlocalrepo instances to be handed out. If one is available, we pop it and return it, ensuring it is up to date in the process. If one is not available, we clone the most recently used repo instance and return it. It is currently possible for the stack to grow without bounds if the server allows infinite threads. However, servers should have a thread limit, thus establishing our limit. N)r¹ÚpopÚfetchrºr¯r¸ÚmtimerE)rgÚcachedr½Úcreateds r*Ú _obtainrepozhgweb._obtainrepo.s¢èø€ð �;Š;Ø—[‘[—_‘_Ó&ˆFØŸ™›‰JˆA‰wà—^‘^×(Ñ(Ó*ˆFØŸ™›‰JˆAˆwÙ Ø× Ñ  Ó#ˆAàˆŒØ—\‘\ˆŒ ð 'ØŠGà �K‰K× Ñ ˜vÕ &øˆD�K‰K× Ñ ˜vÕ &üs‚BCÂB6ÂCÂ6CÃCcó¢—tjjdd«jd«s t d«‚t j |«y)z�Start a server from CGI environment. Modern servers should be using WSGI and should avoid this method, if possible. sGATEWAY_INTERFACEr,sCGI/1.sJThis function is only intended to be called while running as a CGI script.N)r Úenvironr$rBr6rÚlaunch)rgs r*Úrunz hgweb.runKsK€ô ×Ñ×#Ñ#Ð$8¸#Ó>×IÑIØ ô ôð9óð ô �‰�tÕr,có|—tj|«}tj||«}|j||«S)zSRun the WSGI application. This may be called by multiple threads. )Ú requestmodÚparserequestfromenvÚ wsgiresponseÚrun_wsgi)rgÚenvÚrespondr&rWs r*Ú__call__zhgweb.__call__Zs7€ô ×,Ñ,¨SÓ1ˆÜ×%Ñ% c¨7Ó3ˆà�}‰}˜S #Ó&Ð&r,c#ó4K—|j«5}|jjdd«}tj|j|¬«5|j |||«D]}|–—Œ ddd«ddd«y#1swYŒxYw#1swYyxYw­w)zÆInternal method to run the WSGI application. This is typically only called by Mercurial. External consumers should be using instances of this class as the WSGI application. s profilingsenabled)ÚenabledN)rÇrrarÚprofileÚ_runwsgi)rgr&rWrUrÖr½s r*rÐzhgweb.run_wsgidsxèø€ð × Ñ Ô  4Ø—g‘g×(Ñ(¨°zÓBˆGÜ×"Ñ" 4§7¡7°GÖ<ØŸ™ s¨C°Ö6�AØ“Gñ7÷=÷ Ð ç<Ð<ú÷ Ð üs4‚B“>B ÁBÁ/B Á7 BÂB ÂB  BÂBcóà —t||||«}|jdd«t_|j|jj _|jr|j|jd<tj||||j«}|r|j«S|j� |j}n0|jjd«djd«d}|j!dd«}d |j"v�r¿|�r¼|d�r¶|j%d«}|j'd «} | d k7r|d| |j"d <|| d zd}t)j*t,|«r||j"d <|dk(rdj/|«|j"d<nw|r5|dr0|j%d«j1dd«} | |j"d<|r>d|j"vr |j"d=|D]} |j"j3d| «Œ |jj5dd«} |dk(rd| vrd|j"d <|dk(r”|j"d} t6j8j;«D]G\}}|d}| j=|«sŒ| dt?|« |j"d<||j"d<ŒIn|j"j5d d«} |jA|«|_!|jBjEddtji«}|dk7r|j||d«|dk(r8|jBjEdi«|j"d <|j"d }|jGdd«r~|jHsrd|jJz}|jj5d«|k(r6d|_& |jd=|jQd«|j«S||jd <|t,jRvrd!|z}tUtV|«‚d"|_&||jd<tYt,|«|«S#tN$rYŒŽwxYw#tZj\tZj^f$r‡}tajb|«}t)j*|d#«r)te|tZjf«sd$|jhz}d%|_&|jd<|jkd&|¬'«cYd}~Sd}~wtZjltZjnf$rF}d(|_&|jd<|jkd&tajb|«¬'«cYd}~Sd}~wtZjp$r=}d)|_&|jd<|jkd&|jr¬'«cYd}~Sd}~wtT$r�}|jD]\}}||j|<Œtu|jvtajb|««|_&|jd<|jkd&tajb|«¬'«cYd}~Sd}~wwxYw)*Nr"r„sContent-Security-Policyó&ró;r=r scmdó-r>r!rsstaticsfiles%2Fsnodes User-Agentr,srevs mercurialsrawsarchivestypesmimetypesdefaultscachesW/"%d"s If-None-Matchs304 Not Modifieds Content-TypesETagsno such method: %ss200 Script output followsr¥srevision not found: %ss 404 Not Foundserror)r s500 Internal Server Errors 403 Forbidden)rsnðóÛ ÷õõ÷÷÷÷ó÷&õò3óAó::÷4E'ñE'÷P@$ñ@$óF(r,