mirror of
https://github.com/JetSprow/J-Board-Lite.git
synced 2026-05-01 01:14:10 +05:30
feat: separate subscription base url
This commit is contained in:
@@ -166,7 +166,7 @@ export function NodeActions({ node, siteUrl }: { node: NodeActionValue; siteUrl:
|
||||
|
||||
{!siteUrl && (
|
||||
<p className="rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs leading-5 text-amber-700 dark:text-amber-200">
|
||||
建议先到系统设置填写站点域名,否则从本地地址打开后台时命令会带本机地址。
|
||||
建议先到系统设置填写网站 URL,否则从本地地址打开后台时命令会带本机地址。
|
||||
</p>
|
||||
)}
|
||||
<p className="text-xs leading-5 text-muted-foreground">
|
||||
|
||||
@@ -25,6 +25,7 @@ export default async function AdminSettingsPage() {
|
||||
config={{
|
||||
siteName: config.siteName,
|
||||
siteUrl: config.siteUrl,
|
||||
subscriptionUrl: config.subscriptionUrl,
|
||||
supportContact: config.supportContact,
|
||||
maintenanceNotice: config.maintenanceNotice,
|
||||
siteNotice: config.siteNotice,
|
||||
|
||||
@@ -14,6 +14,7 @@ import { getErrorMessage } from "@/lib/errors";
|
||||
interface AppConfig {
|
||||
siteName: string;
|
||||
siteUrl: string | null;
|
||||
subscriptionUrl: string | null;
|
||||
supportContact: string | null;
|
||||
maintenanceNotice: string | null;
|
||||
siteNotice: string | null;
|
||||
@@ -130,9 +131,14 @@ export function SettingsForm({ config, coupons }: { config: AppConfig; coupons:
|
||||
<Input id="siteName" name="siteName" defaultValue={config.siteName} required />
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="siteUrl">站点域名 / URL</Label>
|
||||
<Input id="siteUrl" name="siteUrl" defaultValue={config.siteUrl ?? ""} placeholder="https://example.com" />
|
||||
<p className="text-xs leading-5 text-muted-foreground">用于订阅链接、支付回调和 Agent 一键安装命令,反代后建议填写公网域名。</p>
|
||||
<Label htmlFor="siteUrl">网站 URL</Label>
|
||||
<Input id="siteUrl" name="siteUrl" defaultValue={config.siteUrl ?? ""} placeholder="https://panel.example.com" />
|
||||
<p className="text-xs leading-5 text-muted-foreground">用于登录、邮件链接、支付回跳和 Agent 安装命令。请填写准备反代到面板的公网域名。</p>
|
||||
</div>
|
||||
<div className="space-y-2 md:col-span-2">
|
||||
<Label htmlFor="subscriptionUrl">订阅 URL</Label>
|
||||
<Input id="subscriptionUrl" name="subscriptionUrl" defaultValue={config.subscriptionUrl ?? ""} placeholder="https://sub.example.com" />
|
||||
<p className="text-xs leading-5 text-muted-foreground">只用于生成客户端订阅链接。可与网站 URL 相同,也可单独使用 sub 域名,便于 Cloudflare/WAF 和访问风控独立配置。</p>
|
||||
</div>
|
||||
<div className="space-y-2 md:col-span-2">
|
||||
<Label htmlFor="supportContact">客服联系方式</Label>
|
||||
|
||||
@@ -7,7 +7,7 @@ import { PageHeader, PageShell, SectionHeader } from "@/components/shared/page-s
|
||||
import { SubscriptionDetailCards } from "@/components/subscriptions/subscription-detail-cards";
|
||||
import { SubscriptionTimelineSection } from "@/components/subscriptions/subscription-timeline-section";
|
||||
import { TrafficLogs } from "./_components/traffic-logs";
|
||||
import { getSiteBaseUrl } from "@/services/site-url";
|
||||
import { getSubscriptionBaseUrl } from "@/services/site-url";
|
||||
import { ProxySubscriptionDetails } from "../_components/proxy-subscription-details";
|
||||
import { StreamingCredentialCard } from "../streaming-credential-card";
|
||||
import { getUserSubscriptionDetail } from "./subscription-detail-data";
|
||||
@@ -30,7 +30,7 @@ export default async function UserSubscriptionDetailPage({
|
||||
subscriptionId: id,
|
||||
userId: session!.user.id,
|
||||
}),
|
||||
getSiteBaseUrl({ headers: requestHeaders }),
|
||||
getSubscriptionBaseUrl({ headers: requestHeaders }),
|
||||
]);
|
||||
|
||||
if (!data) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { headers } from "next/headers";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import { getSiteBaseUrl } from "@/services/site-url";
|
||||
import { getSubscriptionBaseUrl as resolveSubscriptionBaseUrl } from "@/services/site-url";
|
||||
import {
|
||||
getPlanTrafficPoolState,
|
||||
type PlanTrafficPoolState,
|
||||
@@ -22,7 +22,7 @@ export async function getUserSubscriptions(userId: string): Promise<Subscription
|
||||
|
||||
export async function getSubscriptionBaseUrl() {
|
||||
const requestHeaders = await headers();
|
||||
return getSiteBaseUrl({ headers: requestHeaders });
|
||||
return resolveSubscriptionBaseUrl({ headers: requestHeaders });
|
||||
}
|
||||
|
||||
export async function getTrafficPoolMap(subscriptions: SubscriptionRecord[]) {
|
||||
|
||||
@@ -73,7 +73,7 @@ export async function POST(req: Request) {
|
||||
|
||||
const baseUrl = await getSiteBaseUrl({ headers: req.headers, requestUrl: req.url });
|
||||
if (!baseUrl) {
|
||||
return jsonError("请先在后台系统设置里配置站点域名", { status: 400 });
|
||||
return jsonError("请先在后台系统设置里配置网站 URL", { status: 400 });
|
||||
}
|
||||
const result = await adapter.createPayment({
|
||||
tradeNo,
|
||||
|
||||
Reference in New Issue
Block a user