mirror of
https://wget.la/https://github.com/432539/gpt
synced 2026-08-17 03:26:59 +08:00
只开源「GPT 账号注册机 / 管理」(account-manager):账号列表/导入导出、检测/批量检测、 拿 RT、协议/浏览器注册等注册机能力。批量直开 / 协议支付 / 提取链接 / 直卡直开 等其它功能 不含实现代码,仅通过 iframe 内嵌外链访问。真实机密均由 .gitignore 忽略,仅提供脱敏示例配置。
63 lines
2.3 KiB
Python
63 lines
2.3 KiB
Python
"""开源版 —— GPT 管理(account-manager)精简 Flask 应用。
|
|
|
|
本应用只真实运行「GPT管理」这一开源功能(account_manager 蓝图,页面 /account-manager/、
|
|
API 前缀 /api/plus 与 /api/probe)。其余功能(批量直开 / 协议支付 / 提取链接 / 直卡直开)
|
|
不放任何代码,改为在右侧内容区用 iframe 内嵌对应线上服务(见 /embed/<target>)。
|
|
|
|
本地预览默认端口 5090,避免和可能在跑的 5088 冲突。
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
|
|
try:
|
|
from dotenv import load_dotenv
|
|
load_dotenv()
|
|
except Exception:
|
|
pass
|
|
|
|
from flask import Flask, redirect, render_template, abort
|
|
|
|
app = Flask(__name__, template_folder="templates", static_folder="static")
|
|
|
|
# 注册子进程回读验证码用的内部地址默认指向本应用端口(仅注册功能相关)。
|
|
os.environ.setdefault("ACCOUNT_MGR_BASE", "http://127.0.0.1:5090")
|
|
|
|
# ---- 外链内嵌配置:菜单 key -> (标题, 目标 URL) ----
|
|
# 服务器不改动;这里只是让本地 shell 用 iframe 指向这些线上服务。
|
|
EMBEDS = {
|
|
"card-link": ("直卡直开", "https://card.153.ink/card-link/"),
|
|
"card-flow": ("批量直开(试用3天)", "https://reg.gpt2api.com/card-flow/?embed=1"),
|
|
"protocol": ("协议支付(试用3天)", "https://reg.gpt2api.com/protocol/?embed=1"),
|
|
"pay": ("提取链接(试用3天)", "https://reg.gpt2api.com/pay/?embed=1"),
|
|
}
|
|
|
|
GITHUB_URL = "https://github.com/432539/gpt"
|
|
|
|
|
|
@app.get("/")
|
|
def home():
|
|
return redirect("/account-manager/")
|
|
|
|
|
|
@app.get("/embed/<target>")
|
|
def embed(target: str):
|
|
item = EMBEDS.get(target)
|
|
if not item:
|
|
abort(404)
|
|
title, url = item
|
|
return render_template("embed.html", active=target, embed_title=title, embed_url=url)
|
|
|
|
|
|
# --- 注册「GPT管理」(account-manager) 蓝图(唯一开源的真实功能)---
|
|
try:
|
|
from account_manager import bp as account_manager_bp
|
|
app.register_blueprint(account_manager_bp)
|
|
app.logger.info("account_manager blueprint registered (/account-manager/, /api/plus*, /api/probe*)")
|
|
except Exception as exc: # 保持主应用可用,即便该蓝图导入失败
|
|
app.logger.warning("account_manager blueprint registration failed: %s", exc)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
app.run(host=os.getenv("HOST", "127.0.0.1"), port=int(os.getenv("PORT", "5090")), debug=False, threaded=True)
|