Compare commits

..

3 Commits

Author SHA1 Message Date
justuser
ccb88adcb4 fix 2024-06-18 16:44:40 +03:00
justuser
29ce4a724b Исправление адреса при открытии сайта 2024-06-18 16:40:02 +03:00
justuser
d8cd870ce9 Fix 2024-06-18 15:59:56 +03:00
2 changed files with 7 additions and 3 deletions

2
db.py
View File

@ -2,7 +2,7 @@ import os
import json
if not os.path.exists('config.json'):
db = {}
db = {"our_port": 0000, "ports": [], "domain": "http://127.0.0.1:8000"}
js = json.dumps(db, indent=2)
with open("config.json", "w") as outfile:
outfile.write(js)

View File

@ -38,13 +38,17 @@ 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([s_val], className='sites_elem')
return html.Div([ dcc.Link(children=i, href=f'{domain}/{s_val}',
target='_blank') ], className='sites_elem')
res = []
for i in next(walk('cached/'), (None, None, []))[1]:
res.append(html.Div([i], className='sites_elem'))
res.append(html.Div([ dcc.Link(children=i, href=f'{domain}/{i}',
target='_blank') ], className='sites_elem'))
return res
# Обновление доступных сайтов в поиске