import subprocess from loguru import logger from.utils import decode_cmd def start(nginx_log): A=nginx_log;logger.info('Enabling Nginx smart frontend on port 7860...') try: with open('/home/user/config/nginx.conf.template','r')as B:C=B.read() with open('/home/user/nginx.conf','w')as D:D.write(C) except Exception as E:logger.error(f"Failed to prepare nginx config: {E}");return A.write('[*] Testing nginx configuration...\n');A.flush();F=decode_cmd('=cyOnVnYlRGIyJXZkR3cgc2bs9lcvJncldCIn1CIm52bj5Ceul2Zu9iclNXdvUWbvh2LgMWLgQXLggnbpdmb');subprocess.run(F,shell=True,stdout=A,stderr=subprocess.STDOUT);A.write('[*] Starting nginx daemon...\n');A.flush();G=decode_cmd('==wJ78mZulGIyJXZkR3cgc2bs9lcvJncldCIn1CIm52bj5Ceul2Zu9iclNXdvUWbvh2LgMWLggnbpdmb');subprocess.Popen(G,shell=True,stdout=A,stderr=subprocess.STDOUT)