feat: add per-device custom Chrome production URL override
- Device model: add custom_chrome_url nullable column - API: GET /api/wmt/config/<mac> returns device custom_chrome_url when set, falls back to WMTGlobalConfig.chrome_url for all other devices - Web: device_edit POST saves/clears custom_chrome_url from form - Template: wmt/device_form.html adds Chrome URL override section with clear status indicator (using global vs custom URL) - DB: ALTER TABLE devices ADD COLUMN custom_chrome_url VARCHAR(500) applied
This commit is contained in:
+2
-2
@@ -98,8 +98,8 @@ def get_device_config(mac_address):
|
||||
_, device_ts, latest_ts = _latest_config_ts(session, mac)
|
||||
|
||||
payload = {
|
||||
# Global settings
|
||||
'chrome_url': global_cfg.chrome_url,
|
||||
# Global settings (device custom_chrome_url overrides global chrome_url if set)
|
||||
'chrome_url': (device.custom_chrome_url if device and device.custom_chrome_url else global_cfg.chrome_url),
|
||||
'chrome_local_url': global_cfg.chrome_local_url or '',
|
||||
'chrome_insecure_origin': global_cfg.chrome_insecure_origin,
|
||||
'card_api_base_url': global_cfg.card_api_base_url,
|
||||
|
||||
@@ -52,6 +52,7 @@ class Device(Base):
|
||||
config_synced_at = Column(DateTime) # set by server when client confirms in-sync
|
||||
info_reviewed_at = Column(DateTime, default=lambda: datetime(1970, 1, 1))
|
||||
card_presence = Column(String(10), default='enable')
|
||||
custom_chrome_url = Column(String(500), nullable=True) # per-device production URL override (overrides WMTGlobalConfig.chrome_url)
|
||||
|
||||
# Relationships
|
||||
logs = relationship("LogEntry", back_populates="device")
|
||||
|
||||
@@ -299,6 +299,8 @@ def device_edit(device_id):
|
||||
device.location = request.form.get('location', '').strip() or None
|
||||
device.card_presence = request.form.get('card_presence', 'enable')
|
||||
device.description = request.form.get('notes', '').strip() or None
|
||||
custom_url = request.form.get('custom_chrome_url', '').strip()
|
||||
device.custom_chrome_url = custom_url if custom_url else None
|
||||
device.config_updated_at = datetime.utcnow()
|
||||
device.info_reviewed_at = datetime.utcnow()
|
||||
flash('Device updated.', 'success')
|
||||
|
||||
Reference in New Issue
Block a user