o
    i                     @   st   U d Z ddlmZ ddlmZmZ dZeed< dZ	eed< dZ
ejd	ejd
eejgeej f dejfddZdS )z+Cache control middleware for ComfyUI server    )web)Callable	Awaitablei  ONE_HOURiQ ONE_DAY)	z.jpgz.jpegz.pngz.ppmz.bmpz.pgmz.tifz.tiffz.webprequesthandlerreturnc                    s   || I dH }| j ddd }|do|d}| j ds)| j ds)|r2|jd	d
 |S | j  ts<|S |jdkrM|jd	dt	  |S |jdv r^|jd	dt
  |S |jdv rj|jd	d |S )zcCache control middleware that sets appropriate cache headers based on file type and response statusN/   indexz.jsonz.jsz.csszCache-Controlzno-storei  zpublic, max-age=)	                     i-  i4  )i.  i/  i3  zno-cache)pathrsplit
startswithendswithheaders
setdefaultlowerIMG_EXTENSIONSstatusr   r   )r   r   responsepath_filenameis_entry_point r!   9/mnt/c/Users/fbmor/ComfyUI/middleware/cache_middleware.pycache_control   s(   
	

r#   N)__doc__aiohttpr   typingr   r   r   int__annotations__r   r   
middlewareRequestResponser#   r!   r!   r!   r"   <module>   s    