File: //opt/cloudlinux/venv/lib64/python3.11/site-packages/xray/__pycache__/user_agent.cpython-311.pyc
�
���g� �
�N � d Z ddlZddlZddlZddlZddlmZmZ ddlm Z ddl
mZmZ ddl
mZmZ ddlmZ ddlmZ dd lmZmZmZmZmZ dd
lmZmZmZ ddlm Z ej! d� � Z"d
e e#e#f fd�Z$de#d
e%fd�Z&de#d
e#fd�Z'de(de%ded
e e#e#f fd�Z)dd�Z*dd�Z+dS )z@
This module contains X-Ray User Manager service implementation
� N)�Thread�current_thread)�Tuple)�
get_runner�Runner)�user_agent_sock�user_agent_log)� XRayError)�gettext)�unpack_request�
pack_response�
extract_creds�check_for_root�error_response)�
create_socket�read_sys_id�configure_logging)�get_locale_from_envars�
user_agent�returnc �f � t d� � } t | � � � � � dfS )zN
General format of message in case of errors during manager execution
z[X-Ray User Plugin failed to execute your request. Please, contact your server administrator� )�_r �encode)�_errs �F/opt/cloudlinux/venv/lib64/python3.11/site-packages/xray/user_agent.py�general_exec_errorr # s1 � �
�
j�k�k�D��$���&�&�(�(�#�-�-r �orig_msgc �R � t j dd| � � � � � S )zL
Cut data field from the original message, because it could be huge
z(?<="data": {).+(?=}, "result")z...)�re�sub�decode)r s r �log_truncater# + s# � � �6�3�U�H�O�O�<M�<M�N�N�Nr c �4 � d� }t j d|| � � S )zA
Extend warning 'Task is duplicated by URL' for end user
c �J � d}| � d� � }|dk r||z S |S )zM
Add more text for duplicate warning, leave others unchanged
s� . In case if you do not see running task for the same URL in your list of tasks below, contact your server administrator and ask him to check whether the requested URL is in the tasks list of X-Ray Admin Plugin or is scheduled for continuous tracing.r s Task is duplicated by URL)�group)�m�
additional�warns r �genz#duplicate_warning_cast.<locals>.gen7 s7 � �V�
� �w�w�q�z�z���/�/�/��*�$�$��r s (?<="warning": ").+(?="}))r r! )r r* s r �duplicate_warning_castr+ 2 s( � �
� � � �6�.��X�>�>�>r �command�user�runnerc � ��
��� �j dk r1 t � � | d<