feat: 服务管理支持 HTTP/HTTPS 协议选择
- Service 增加 scheme 字段,build_url 按协议拼接地址 - 表单新增协议下拉;启动时自动迁移已有 SQLite 库 - 更新部署说明中的 HTTPS 服务添加示例 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -39,6 +39,7 @@ class Service(db.Model):
|
||||
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
name = db.Column(db.String(120), nullable=False)
|
||||
scheme = db.Column(db.String(8), nullable=False, default="http")
|
||||
host = db.Column(db.String(255), nullable=False)
|
||||
port = db.Column(db.Integer, nullable=False)
|
||||
path = db.Column(db.String(512), nullable=False, default="/")
|
||||
@@ -51,4 +52,7 @@ class Service(db.Model):
|
||||
p = (self.path or "/").strip()
|
||||
if not p.startswith("/"):
|
||||
p = "/" + p
|
||||
return f"http://{self.host}:{self.port}{p}"
|
||||
proto = (self.scheme or "http").strip().lower()
|
||||
if proto not in ("http", "https"):
|
||||
proto = "http"
|
||||
return f"{proto}://{self.host}:{self.port}{p}"
|
||||
|
||||
Reference in New Issue
Block a user