feat: introduce Vue Bootstrap interface and scoped router network status
This commit is contained in:
@@ -34,6 +34,7 @@ import genealogy
|
||||
import geography
|
||||
import households
|
||||
import inventory
|
||||
import network_status
|
||||
import heritage
|
||||
import appearance
|
||||
import cloud_images
|
||||
@@ -84,6 +85,7 @@ ACCOUNTS = identity.Accounts(sys.modules[__name__])
|
||||
FAMILY = genealogy.Family(sys.modules[__name__])
|
||||
HOUSEHOLDS = households.Households(sys.modules[__name__])
|
||||
INVENTORY = inventory.Inventory(sys.modules[__name__])
|
||||
NETWORK = network_status.NetworkStatus(sys.modules[__name__])
|
||||
HERITAGE = heritage.Heritage(sys.modules[__name__])
|
||||
APPEARANCE = appearance.Appearance(sys.modules[__name__])
|
||||
BACKUPS = backups.Backups(sys.modules[__name__])
|
||||
@@ -922,6 +924,8 @@ class Handler(BaseHTTPRequestHandler):
|
||||
self.require_auth()
|
||||
if path == '/api/state':
|
||||
self.answer(ACCOUNTS.state(self.user, status()))
|
||||
elif path == '/api/devices/network':
|
||||
self.require_manager(); self.answer(NETWORK.read(self.user, query))
|
||||
elif path == '/api/baidu/config':
|
||||
self.require_admin(); self.answer(BAIDU.public_config())
|
||||
elif path == '/api/baidu/status':
|
||||
@@ -1054,7 +1058,7 @@ class Handler(BaseHTTPRequestHandler):
|
||||
else:
|
||||
raise Problem('接口不存在', 404)
|
||||
else:
|
||||
files = {'/': 'index.html', '/app.js': 'app.js', '/live-player.js': 'live-player.js', '/style.css': 'style.css',
|
||||
files = {'/': 'ui/index.html', '/vue-bridge.js':'vue-bridge.js', '/app.js': 'app.js', '/live-player.js': 'live-player.js', '/style.css': 'style.css',
|
||||
'/family.js': 'family.js', '/kinship.js': 'kinship.js', '/households.js': 'households.js',
|
||||
'/device-model.js': 'device-model.js', '/devices.js': 'devices.js',
|
||||
'/steward.js': 'steward.js', '/heritage.js': 'heritage.js', '/personalization.js': 'personalization.js',
|
||||
@@ -1069,7 +1073,9 @@ class Handler(BaseHTTPRequestHandler):
|
||||
'/monitor.js': 'monitor.js', '/calendar.js': 'calendar.js', '/date-fields.js': 'date-fields.js',
|
||||
'/zhao-icon.png': 'zhao-icon.png',
|
||||
'/vendor/hls.min.js': 'vendor/hls.min.js'}
|
||||
if path not in files:
|
||||
if re.fullmatch(r'/ui/assets/[A-Za-z0-9_-]+\.(?:js|css)', path):
|
||||
files[path] = path[1:]
|
||||
if path not in files or not (ROOT / 'web' / files[path]).is_file():
|
||||
raise Problem('页面不存在', 404)
|
||||
file = ROOT / 'web' / files[path]
|
||||
raw = file.read_bytes()
|
||||
|
||||
Reference in New Issue
Block a user