mirror of
https://github.com/truewhile/MeBox.git
synced 2026-10-01 12:06:38 +08:00
fix docker compose paths and subscription robustness
This commit is contained in:
@@ -6,6 +6,9 @@ import type { Site } from "../types";
|
||||
import { confirmAction } from "../components/confirmAction";
|
||||
|
||||
import {
|
||||
API_SITE_TIMEOUT_SECONDS,
|
||||
API_SITE_TYPES,
|
||||
DEFAULT_SITE_TIMEOUT_SECONDS,
|
||||
defaultSiteForm,
|
||||
siteFormToPayload,
|
||||
siteToForm,
|
||||
@@ -145,10 +148,15 @@ export function SitesPage() {
|
||||
};
|
||||
|
||||
const handleTypeChange = (type: string) => {
|
||||
const isAPISite = API_SITE_TYPES.has(type);
|
||||
setForm((current) => ({
|
||||
...current,
|
||||
type,
|
||||
auth_type: type === "mteam" || type === "yemapt" ? "api_key" : current.auth_type,
|
||||
auth_type: isAPISite ? "api_key" : current.auth_type,
|
||||
timeout:
|
||||
isAPISite && current.timeout === DEFAULT_SITE_TIMEOUT_SECONDS
|
||||
? API_SITE_TIMEOUT_SECONDS
|
||||
: current.timeout,
|
||||
}));
|
||||
};
|
||||
|
||||
|
||||
@@ -37,6 +37,10 @@ export const AUTH_TYPE_LABELS: Record<string, string> = {
|
||||
auth_header: "Auth Header",
|
||||
};
|
||||
|
||||
export const DEFAULT_SITE_TIMEOUT_SECONDS = 15;
|
||||
export const API_SITE_TIMEOUT_SECONDS = 45;
|
||||
export const API_SITE_TYPES = new Set(["mteam", "yemapt"]);
|
||||
|
||||
// ── 默认表单 ──
|
||||
export const defaultSiteForm = () => ({
|
||||
name: "",
|
||||
@@ -52,7 +56,7 @@ export const defaultSiteForm = () => ({
|
||||
// 高级设置
|
||||
user_agent: "",
|
||||
rss_url: "",
|
||||
timeout: 15,
|
||||
timeout: DEFAULT_SITE_TIMEOUT_SECONDS,
|
||||
priority: 50,
|
||||
use_proxy: false,
|
||||
rate_limit: false,
|
||||
@@ -76,7 +80,7 @@ export function siteToForm(site: Site): SiteForm {
|
||||
extra: site.extra || "",
|
||||
user_agent: site.user_agent || "",
|
||||
rss_url: site.rss_url || "",
|
||||
timeout: site.timeout ?? 15,
|
||||
timeout: site.timeout ?? DEFAULT_SITE_TIMEOUT_SECONDS,
|
||||
priority: site.priority ?? 50,
|
||||
use_proxy: site.use_proxy || false,
|
||||
rate_limit: site.rate_limit || false,
|
||||
@@ -99,7 +103,11 @@ export function siteFormToPayload(
|
||||
extra: form.extra || "",
|
||||
user_agent: form.user_agent || "",
|
||||
rss_url: form.rss_url || "",
|
||||
timeout: Number(form.timeout) || 15,
|
||||
timeout:
|
||||
Number(form.timeout) ||
|
||||
(API_SITE_TYPES.has(form.type)
|
||||
? API_SITE_TIMEOUT_SECONDS
|
||||
: DEFAULT_SITE_TIMEOUT_SECONDS),
|
||||
priority: Number(form.priority) || 50,
|
||||
use_proxy: !!form.use_proxy,
|
||||
rate_limit: !!form.rate_limit,
|
||||
|
||||
Reference in New Issue
Block a user