mirror of
https://github.com/zimplexing/OrionTV.git
synced 2026-02-16 05:04:42 +08:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6db0c5d888 | ||
|
|
cfb3982611 |
@@ -7,11 +7,11 @@ export const UPDATE_CONFIG = {
|
|||||||
|
|
||||||
// GitHub相关URL
|
// GitHub相关URL
|
||||||
GITHUB_RAW_URL:
|
GITHUB_RAW_URL:
|
||||||
"https://gh-proxy.com/https://raw.githubusercontent.com/orion-lib/OrionTV/refs/heads/master/package.json",
|
"https://ghfast.top/https://raw.githubusercontent.com/orion-lib/OrionTV/refs/heads/master/package.json",
|
||||||
|
|
||||||
// 获取平台特定的下载URL
|
// 获取平台特定的下载URL
|
||||||
getDownloadUrl(version: string): string {
|
getDownloadUrl(version: string): string {
|
||||||
return `https://gh-proxy.com/https://github.com/orion-lib/OrionTV/releases/download/v${version}/orionTV.${version}.apk`;
|
return `https://ghfast.top/https://github.com/orion-lib/OrionTV/releases/download/v${version}/orionTV.${version}.apk`;
|
||||||
},
|
},
|
||||||
|
|
||||||
// 是否显示更新日志
|
// 是否显示更新日志
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"name": "OrionTV",
|
"name": "OrionTV",
|
||||||
"private": true,
|
"private": true,
|
||||||
"main": "expo-router/entry",
|
"main": "expo-router/entry",
|
||||||
"version": "1.3.3",
|
"version": "1.3.5",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "EXPO_TV=1 EXPO_USE_METRO_WORKSPACE_ROOT=1 expo start",
|
"start": "EXPO_TV=1 EXPO_USE_METRO_WORKSPACE_ROOT=1 expo start",
|
||||||
"android": "EXPO_TV=1 EXPO_USE_METRO_WORKSPACE_ROOT=1 expo run:android",
|
"android": "EXPO_TV=1 EXPO_USE_METRO_WORKSPACE_ROOT=1 expo run:android",
|
||||||
|
|||||||
@@ -208,9 +208,43 @@ export class API {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getResources(signal?: AbortSignal): Promise<ApiSite[]> {
|
async getResources(signal?: AbortSignal): Promise<ApiSite[]> {
|
||||||
const url = `/api/search/resources`;
|
const url = `/api/admin/config`;
|
||||||
const response = await this._fetch(url, { signal });
|
const response = await this._fetch(url, { signal });
|
||||||
return response.json();
|
const config = await response.json();
|
||||||
|
|
||||||
|
// 添加安全检查
|
||||||
|
if (!config || !config.Config.SourceConfig) {
|
||||||
|
console.warn('API response missing SourceConfig:', config);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 确保 SourceConfig 是数组
|
||||||
|
if (!Array.isArray(config.Config.SourceConfig)) {
|
||||||
|
console.warn('SourceConfig is not an array:', config.Config.SourceConfig);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 过滤并验证每个站点配置,同时进行去重
|
||||||
|
const seenKeys = new Set<string>();
|
||||||
|
const uniqueSites: ApiSite[] = [];
|
||||||
|
|
||||||
|
config.Config.SourceConfig
|
||||||
|
.filter((site: any) => site && !site.disabled)
|
||||||
|
.forEach((site: any) => {
|
||||||
|
const key = site.key || '';
|
||||||
|
// 基于 key 字段去重
|
||||||
|
if (key && !seenKeys.has(key)) {
|
||||||
|
seenKeys.add(key);
|
||||||
|
uniqueSites.push({
|
||||||
|
key: key,
|
||||||
|
api: site.api || '',
|
||||||
|
name: site.name || '',
|
||||||
|
detail: site.detail
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return uniqueSites;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getVideoDetail(source: string, id: string): Promise<VideoDetail> {
|
async getVideoDetail(source: string, id: string): Promise<VideoDetail> {
|
||||||
|
|||||||
Reference in New Issue
Block a user