🗑️ chore(custom channel): Remove custom channel support from upstream ratio sync

Remove all custom channel functionality from the upstream ratio sync feature to simplify the codebase and focus on database-stored channels only.

Changes:
- Remove custom channel UI components and related state management
- Remove custom channel testing and validation logic
- Simplify ChannelSelectorModal by removing custom channel input fields
- Update API payload to only include channel_ids, removing custom_channels
- Remove custom channel processing logic from backend controller
- Update import path for DEFAULT_ENDPOINT constant

Files modified:
- web/src/pages/Setting/Ratio/UpstreamRatioSync.js
- web/src/components/settings/ChannelSelectorModal.js
- controller/ratio_sync.go

This change streamlines the ratio synchronization workflow by focusing solely on pre-configured database channels, reducing complexity and potential maintenance overhead.
This commit is contained in:
Apple\Apple
2025-06-19 15:17:05 +08:00
parent 8748425aa2
commit 9db2886c18
5 changed files with 7 additions and 169 deletions
-20
View File
@@ -1,20 +0,0 @@
export const DEFAULT_ENDPOINT = '/api/ratio_config';
/**
* buildEndpointUrl: 拼接 baseUrl 与 endpoint,确保不会出现双斜杠或缺失斜杠问题。
* 使用 URL 构造函数保证协议/域名安全;若 baseUrl 非标准 URL,则退回字符串拼接。
* @param {string} baseUrl - 基础地址,例如 https://api.example.com
* @param {string} endpoint - 接口路径,例如 /api/ratio_config
* @returns {string}
*/
export const buildEndpointUrl = (baseUrl, endpoint) => {
if (!baseUrl) return endpoint;
try {
return new URL(endpoint, baseUrl).toString();
} catch (_) {
// fallback 处理不规范的 baseUrl
const cleanedBase = baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl;
const cleanedEndpoint = endpoint.startsWith('/') ? endpoint.slice(1) : endpoint;
return `${cleanedBase}/${cleanedEndpoint}`;
}
};