Files
TermiNexus b078f8e9fe feat(订阅式软件提供): 产品定制页远端入口 + 我的订阅 + GVSDServiceServer
订阅组新增 RemoteEntry/RemoteModule(0053 迁移);新增 Provider/Page/Save(提供者用 ApiKey+密钥换取令牌后声明定制页)与 MySubscriptions(按当前用户查已订阅产品,含定制页入口)接口;清单新增「我的订阅」菜单与 subscriber 虚拟职务;新增提供者子服务器 GVSDServiceServer(仿 ATestCServer:MSYNC 桥接 + 托管 Venom 定制页远端组件 + 用订阅凭据声明定制页)。
2026-10-05 17:00:05 +08:00

45 lines
2.1 KiB
PowerShell

# GVSDServiceServer 启动脚本(提供者子服务器)
# HTTP 端口 25090
#
# 用法:
# .\start.ps1 # 仅起服务(不注册 MSYNC)
# .\start.ps1 -MsyncSecret <服务密钥> # 同时注册/认证到主服务器 MSYNC
# .\start.ps1 -ApiKey <产品ApiKey> -Secret <密钥> # 注入订阅凭据(声明定制页用)
#
# 说明:ApiKey/Secret 明文只在 GERP「软件管理 → API 与密钥」激活/重置时展示一次,
# 本脚本通过环境变量注入,不落盘、不提交。
param(
[string]$MsyncSecret = '',
[string]$ApiKey = '',
[string]$Secret = '',
[string]$MasterUrl = 'https://gerp.gvsds.com',
[switch]$DeclarePage = $false
)
$ErrorActionPreference = "Stop"
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
Set-Location $ScriptDir
Write-Host "============================" -ForegroundColor Cyan
Write-Host " GVSDServiceServer 启动" -ForegroundColor Cyan
Write-Host " HTTP : http://127.0.0.1:25090" -ForegroundColor Green
Write-Host " MSYNC → $MasterUrl" -ForegroundColor Yellow
Write-Host "============================" -ForegroundColor Cyan
$env:PYTHONPATH = "$ScriptDir;$ScriptDir\..\gvsdsdk"
$env:MSYNC_MASTER_URL = $MasterUrl
$env:SUBSCRIPTION_MASTER_URL = $MasterUrl
if ($MsyncSecret) { $env:MSYNC_SERVICE_SECRET = $MsyncSecret }
if ($ApiKey) { $env:SUBSCRIPTION_API_KEY = $ApiKey }
if ($Secret) { $env:SUBSCRIPTION_SECRET = $Secret }
if (-not $env:DJANGO_SECRET_KEY) { $env:DJANGO_SECRET_KEY = 'gvsd-service-server-local-dev-key' }
if ($DeclarePage) {
Write-Host "[*] 声明 Venom 定制页..." -ForegroundColor Magenta
python -c "import os,django;os.environ.setdefault('DJANGO_SETTINGS_MODULE','GVSDServiceServer.settings');django.setup();import json,urllib.request;req=urllib.request.Request('http://127.0.0.1:25090/api/sub/declare-page/',data=json.dumps({}).encode(),headers={'Content-Type':'application/json'},method='POST');print(urllib.request.urlopen(req,timeout=30).read().decode())"
}
Write-Host "[*] 启动 Django 开发服务器..." -ForegroundColor Magenta
python manage.py runserver 0.0.0.0:25090