From 29ce4a724bc7e3dbe637b5b0d5cd8d4859c53eb1 Mon Sep 17 00:00:00 2001 From: justuser Date: Tue, 18 Jun 2024 16:40:02 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B0=D0=B4=D1=80=D0=B5=D1=81=D0=B0?= =?UTF-8?q?=20=D0=BF=D1=80=D0=B8=20=D0=BE=D1=82=D0=BA=D1=80=D1=8B=D1=82?= =?UTF-8?q?=D0=B8=D0=B8=20=D1=81=D0=B0=D0=B9=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db.py | 2 +- interface.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/db.py b/db.py index 7c86df9..c039c32 100644 --- a/db.py +++ b/db.py @@ -2,7 +2,7 @@ import os import json if not os.path.exists('config.json'): - db = {} + db = {"our_port": 0000, "ports": [], "domain": "127.0.0.1"} js = json.dumps(db, indent=2) with open("config.json", "w") as outfile: outfile.write(js) diff --git a/interface.py b/interface.py index a180e92..1abb7c9 100644 --- a/interface.py +++ b/interface.py @@ -38,14 +38,16 @@ def update_servers(n): Input('interval-component', 'n_intervals'), Input('search', 'value')) def update_sites(n, s_val): + # Домен по умолчанию + domain = read()['domain'] # Если есть элемент в поиске if s_val: - return html.Div([ dcc.Link(children=i, href=f'http://0.0.0.0:8000/{s_val}', + return html.Div([ dcc.Link(children=i, href=f'http://{domain}:8000/{s_val}', target='_blank') ], className='sites_elem') res = [] for i in next(walk('cached/'), (None, None, []))[1]: - res.append(html.Div([ dcc.Link(children=i, href=f'http://0.0.0.0:8000/{i}', + res.append(html.Div([ dcc.Link(children=i, href=f'http://{domain}:8000/{i}', target='_blank') ], className='sites_elem')) return res