comfyui / zrok.py
gmk123's picture
Upload 2 files
f4e737e verified
Raw
History Blame Contribute Delete
2.13 kB
from multiprocessing import Process ,Queue #line:1
import subprocess #line:2
import sys #line:3
import re #line:4
def hitozuma (O0O0O00OO0O0O00O0 ,OO0OO00O0OOO000OO ):#line:6
try :#line:7
OO000O0O000OOOOO0 =subprocess .run (['/home/studio-lab-user/.zrok/bin/zrok','enable',O0O0O00OO0O0O00O0 ],check =False ,stdout =subprocess .PIPE ,stderr =subprocess .STDOUT ,text =True )#line:9
O0O0OOOOO0000OO00 =subprocess .Popen (["/home/studio-lab-user/.zrok/bin/zrok","share","public","localhost:8188","--headless"],stdout =subprocess .PIPE ,stderr =subprocess .STDOUT ,text =True )#line:12
O000OO0O000OOOOOO =re .compile (r'https?://[^\s]*\.zrok\.io')#line:14
OOO0O0OOO000O0OOO =("◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼")#line:15
if OO000O0O000OOOOO0 .returncode ==0 :#line:17
OO0OO00O0OOO000OO .put (f"\n{OOO0O0OOO000O0OOO}\n[ZROK] environment enabled.\n")#line:18
else :#line:20
if "enabled environment"in OO000O0O000OOOOO0 .stdout :#line:21
OO0OO00O0OOO000OO .put (f"\n{OOO0O0OOO000O0OOO}\n[ZROK] environment already enabled.\n")#line:22
else :#line:23
OO0OO00O0OOO000OO .put (OO000O0O000OOOOO0 .stdout )#line:24
for O0O00O000O0O0O0O0 in O0O0OOOOO0000OO00 .stdout :#line:26
OO0O00O0000O0OOO0 =O000OO0O000OOOOOO .findall (O0O00O000O0O0O0O0 )#line:27
for O0O0O00O0OO0O000O in OO0O00O0000O0OOO0 :#line:28
OO0OO00O0OOO000OO .put (f"[ZROK] {O0O0O00O0OO0O000O}\n{OOO0O0OOO000O0OOO}\n\n")#line:29
O0O0OOOOO0000OO00 .wait ()#line:31
except :#line:33
pass #line:34
if __name__ =='__main__':#line:36
if len (sys .argv )!=2 :#line:37
sys .exit ("")#line:38
zrok_out =Queue ()#line:40
process =Process (target =hitozuma ,args =(sys .argv [1 ],zrok_out ))#line:42
process .start ()#line:43
while process .is_alive ()or not zrok_out .empty ():#line:45
while not zrok_out .empty ():#line:46
print (zrok_out .get (),end ='',flush =True )#line:47
process .join ()