Adds a generic gating hook so a private overlay can restrict the IoT gateway proxy to paid plans without the OSS image carrying any plan logic. register_iot_gateway_gate() installs an async callback that returns None to allow or a detail dict to block; the OSS default (no overlay) allows everyone, and a failing gate fails OPEN so the gateway can never be taken down by a buggy overlay. gateway_proxy() calls the gate first. When blocked it content- negotiates the 402: browsers (Accept: text/html — the frontend opens the gateway via window.open) get a small styled upgrade page with a link to /pricing; programmatic fetch/XHR callers get the JSON detail. No behaviour change for the open-source image — the gate is a no-op there. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| config.py | ||
| hooks.py | ||