| 123456789101112131415161718192021 |
- # -*- coding: utf-8 -*-
- r"""统一入口与路由表接口(**组件接入点:Nginx**)。
- 现在:Python 网关 `scripts/guanlan_gateway.py`(前缀改写 + data-abs 豁免 + 静态件)。
- 目标:Nginx 承担反代与静态托管,网关退化为**路由表**(本接口即路由表的读写面)。
- P0 只立契约,无实现(默认仍是 Python 网关)。
- """
- from __future__ import annotations
- from abc import ABC, abstractmethod
- class Gateway(ABC):
- @abstractmethod
- def routes(self) -> list[dict]:
- """→ [{prefix, upstream_port, name}](现由 gateway 的 ROUTES 提供)。"""
- @abstractmethod
- def rewrite(self, html: bytes, *, component: str) -> bytes:
- """组件前缀改写(`data-abs="1"` 链接豁免的规则保持)。"""
|