diff --git a/app/api/wmt.py b/app/api/wmt.py index 339c75a..ee60fdb 100644 --- a/app/api/wmt.py +++ b/app/api/wmt.py @@ -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, diff --git a/app/models/__init__.py b/app/models/__init__.py index 47ac946..f46fcd1 100644 --- a/app/models/__init__.py +++ b/app/models/__init__.py @@ -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") diff --git a/app/web/wmt.py b/app/web/wmt.py index 5312f72..08414c8 100644 --- a/app/web/wmt.py +++ b/app/web/wmt.py @@ -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') diff --git a/templates/wmt/device_form.html b/templates/wmt/device_form.html index e9514de..de5aa46 100644 --- a/templates/wmt/device_form.html +++ b/templates/wmt/device_form.html @@ -72,6 +72,34 @@ +
+ Leave blank to use the global default URL configured in + WMT Settings. + Fill in only if this device needs a different production page. +
+