11 Commits

Author SHA1 Message Date
zimplexing
4d15bec029 Add configuration file for API resources and update config path in index.ts 2025-07-04 17:27:57 +08:00
zimplexing
b811ff5ade Update version to 1.0.5, remove config.json, and modify .gitignore and vercel.json include paths 2025-07-04 17:15:34 +08:00
zimplexing
2e999f47bd 新增少儿分类&日志 2025-07-04 16:53:41 +08:00
zimplexing
b48ac069e8 Support http 2025-07-04 16:30:20 +08:00
zimplexing
ae138eb4ae Support http 2025-07-04 16:05:18 +08:00
zimplexing
24bccb9227 Merge branch 'master' of github.com:zimplexing/OrionTV 2025-07-02 15:57:46 +08:00
zimplexing
fa0f37d06b Update 2025-07-02 15:56:59 +08:00
Xin
a9b501a9ff Update README.md 2025-07-02 14:20:45 +08:00
zimplexing
011adc56fe Update 2025-07-02 13:57:04 +08:00
zimplexing
8f59322db0 Update 2025-07-02 13:56:22 +08:00
zimplexing
c69d87fec0 Update 2025-07-02 12:57:44 +08:00
16 changed files with 58 additions and 54 deletions

4
.gitignore vendored
View File

@@ -20,4 +20,6 @@ web-build/
expo-env.d.ts expo-env.d.ts
# @end expo-cli # @end expo-cli
web/** web/**
.bmad-core
.kilocodemodes

View File

@@ -93,28 +93,23 @@ yarn android-tv
## 部署 ## 部署
### 后端部署 (Vercel) ### 后端部署
后端服务已配置为可以轻松部署到 [Vercel](https://vercel.com/)。 #### [Vercel](https://vercel.com/) 部署
1. **安装 Vercel CLI** [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fzimplexing%2FOrionTV&root-directory=backend)
如果您尚未安装,请全局安装 Vercel CLI #### Docker 部署
```sh 1. `docker pull zimpel1/tv-host`
npm install -g vercel
```
2. **部署** 2. `docker run -d -p 3001:3001 zimpel1/tv-host`
进入 `backend` 目录并运行 `vercel` 命令: 本地部署后需要配置https才行不然会无法访问
```sh #### 使用 demo 地址
cd backend
vercel
```
按照 Vercel CLI 的提示完成登录和部署过程。`vercel.json` 文件已配置好所有必要的构建和路由设置 在设置中可以使用 demo 地址: https://orion-tv.vercel.app 需要代理且不保证稳定和可用性
## 📜 主要脚本 ## 📜 主要脚本

View File

@@ -97,7 +97,7 @@ export default function DetailScreen() {
if (error) { if (error) {
return ( return (
<ThemedView style={styles.centered}> <ThemedView style={styles.centered}>
<ThemedText type="subtitle">Error: {error}</ThemedText> <ThemedText type="subtitle">{error}</ThemedText>
</ThemedView> </ThemedView>
); );
} }

View File

@@ -46,6 +46,7 @@ const initialCategories: Category[] = [
{ title: "热门剧集", type: "tv", tag: "热门" }, { title: "热门剧集", type: "tv", tag: "热门" },
{ title: "热门电影", type: "movie", tag: "热门" }, { title: "热门电影", type: "movie", tag: "热门" },
{ title: "豆瓣 Top250", type: "movie", tag: "top250" }, { title: "豆瓣 Top250", type: "movie", tag: "top250" },
{ title: "儿童", type: "movie", tag: "少儿" },
{ title: "美剧", type: "tv", tag: "美剧" }, { title: "美剧", type: "tv", tag: "美剧" },
{ title: "韩剧", type: "tv", tag: "韩剧" }, { title: "韩剧", type: "tv", tag: "韩剧" },
{ title: "日剧", type: "tv", tag: "日剧" }, { title: "日剧", type: "tv", tag: "日剧" },
@@ -148,7 +149,6 @@ export default function HomeScreen() {
setHasMore(true); setHasMore(true);
} }
} catch (err: any) { } catch (err: any) {
console.error("Failed to load data:", err);
if (err.message === "API_URL_NOT_SET") { if (err.message === "API_URL_NOT_SET") {
setError("请点击右上角设置按钮,配置您的 API 地址"); setError("请点击右上角设置按钮,配置您的 API 地址");
} else { } else {
@@ -297,7 +297,9 @@ export default function HomeScreen() {
</View> </View>
) : error ? ( ) : error ? (
<View style={styles.centerContainer}> <View style={styles.centerContainer}>
<ThemedText type="subtitle">{error}</ThemedText> <ThemedText type="subtitle" style={{ padding: 10 }}>
{error}
</ThemedText>
</View> </View>
) : ( ) : (
<FlatList <FlatList

View File

@@ -43,7 +43,11 @@ export default function SearchScreen() {
setError(null); setError(null);
try { try {
const response = await moonTVApi.searchVideos(keyword); const response = await moonTVApi.searchVideos(keyword);
setResults(response.results); if (response.results.length > 0) {
setResults(response.results);
} else {
setError("没有找到相关内容");
}
} catch (err) { } catch (err) {
setError("搜索失败,请稍后重试。"); setError("搜索失败,请稍后重试。");
console.error("Search failed:", err); console.error("Search failed:", err);

View File

@@ -1,12 +1,12 @@
{ {
"name": "mytv-backend", "name": "OrionTV-proxy",
"version": "1.0.0", "version": "1.0.1",
"description": "Backend service for MyTV application", "description": "Backend service for MyTV application",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
"start": "node dist/index.js", "start": "node dist/index.js",
"build": "tsc", "build": "tsc",
"dev": "ts-node-dev --respawn --transpile-only src/index.ts" "dev": "ts-node-dev --respawn --transpile-only src/index.docker.ts"
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",

View File

@@ -48,7 +48,7 @@ export const API_CONFIG = {
}; };
// Adjust path to read from project root, not from `backend/` // Adjust path to read from project root, not from `backend/`
const configPath = path.join(process.cwd(), "config.json"); const configPath = path.join(__dirname, "config.json");
let cachedConfig: Config; let cachedConfig: Config;
try { try {

View File

@@ -59,6 +59,15 @@ async function searchFromApi(
const data = await response.json(); const data = await response.json();
console.log(
"apiUrl",
apiSite.name,
"response status",
response.ok,
"response data",
data.list.length
);
if ( if (
!data || !data ||
!data.list || !data.list ||

View File

@@ -5,7 +5,7 @@
"src": "src/index.ts", "src": "src/index.ts",
"use": "@vercel/node", "use": "@vercel/node",
"config": { "config": {
"includeFiles": ["../config.json"] "includeFiles": ["./config.json"]
} }
} }
], ],

View File

@@ -1,4 +1,4 @@
import React, { useState, useEffect } from "react"; import React, { useState, useEffect, useRef } from "react";
import { import {
Modal, Modal,
View, View,
@@ -25,13 +25,19 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
onSave, onSave,
}) => { }) => {
const [apiUrl, setApiUrl] = useState(""); const [apiUrl, setApiUrl] = useState("");
const [isInputFocused, setIsInputFocused] = useState(false);
const colorScheme = useColorScheme(); const colorScheme = useColorScheme();
const inputRef = useRef<TextInput>(null);
useEffect(() => { useEffect(() => {
if (visible) { if (visible) {
SettingsManager.get().then((settings) => { SettingsManager.get().then((settings) => {
setApiUrl(settings.apiBaseUrl); setApiUrl(settings.apiBaseUrl);
}); });
const timer = setTimeout(() => {
inputRef.current?.focus();
}, 200);
return () => clearTimeout(timer);
} }
}, [visible]); }, [visible]);
@@ -72,6 +78,14 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
color: colorScheme === "dark" ? "white" : "black", color: colorScheme === "dark" ? "white" : "black",
borderColor: "transparent", borderColor: "transparent",
}, },
inputFocused: {
borderColor: "#007AFF",
shadowColor: "#007AFF",
shadowOffset: { width: 0, height: 0 },
shadowOpacity: 0.8,
shadowRadius: 10,
elevation: 5,
},
buttonContainer: { buttonContainer: {
flexDirection: "row", flexDirection: "row",
justifyContent: "space-around", justifyContent: "space-around",
@@ -115,13 +129,16 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
<ThemedView style={styles.modalContent}> <ThemedView style={styles.modalContent}>
<ThemedText style={styles.title}></ThemedText> <ThemedText style={styles.title}></ThemedText>
<TextInput <TextInput
style={styles.input} ref={inputRef}
style={[styles.input, isInputFocused && styles.inputFocused]}
value={apiUrl} value={apiUrl}
onChangeText={setApiUrl} onChangeText={setApiUrl}
placeholder="输入 API 地址" placeholder="输入 API 地址"
placeholderTextColor={colorScheme === "dark" ? "#888" : "#555"} placeholderTextColor={colorScheme === "dark" ? "#888" : "#555"}
autoCapitalize="none" autoCapitalize="none"
autoCorrect={false} autoCorrect={false}
onFocus={() => setIsInputFocused(true)}
onBlur={() => setIsInputFocused(false)}
/> />
<View style={styles.buttonContainer}> <View style={styles.buttonContainer}>
<Pressable <Pressable

View File

@@ -1,19 +0,0 @@
{
"cache_time": 3600,
"api_site": {
"ffzy": {
"key": "ffzy",
"name": "非凡资源",
"api": "http://cj.ffzy.co/api.php/provide/vod/from/ffm3u8/",
"detail": "http://www.ffzy.co"
},
"test-source": {
"key": "test-source",
"name": "示例源",
"api": "https://test-api.com/api.php"
}
},
"storage": {
"type": "localstorage"
}
}

View File

@@ -2,7 +2,7 @@
"name": "OrionTV", "name": "OrionTV",
"private": true, "private": true,
"main": "expo-router/entry", "main": "expo-router/entry",
"version": "1.0.2", "version": "1.0.5",
"scripts": { "scripts": {
"start": "EXPO_USE_METRO_WORKSPACE_ROOT=1 expo start", "start": "EXPO_USE_METRO_WORKSPACE_ROOT=1 expo start",
"start-tv": "EXPO_TV=1 EXPO_USE_METRO_WORKSPACE_ROOT=1 expo start", "start-tv": "EXPO_TV=1 EXPO_USE_METRO_WORKSPACE_ROOT=1 expo start",

View File

@@ -178,7 +178,7 @@ export class SettingsManager {
theme: "auto", theme: "auto",
autoPlay: true, autoPlay: true,
playbackSpeed: 1.0, playbackSpeed: 1.0,
apiBaseUrl: "http://127.0.0.1:3001", apiBaseUrl: "",
}; };
try { try {
const data = await AsyncStorage.getItem(STORAGE_KEYS.SETTINGS); const data = await AsyncStorage.getItem(STORAGE_KEYS.SETTINGS);

View File

@@ -17,7 +17,7 @@
<data android:scheme="https"/> <data android:scheme="https"/>
</intent> </intent>
</queries> </queries>
<application android:name=".MainApplication" android:usesCleartextTraffic="true" android:networkSecurityConfig="@xml/network_security_config" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:allowBackup="true" android:theme="@style/AppTheme" android:banner="@drawable/tv_banner"> <application android:name=".MainApplication" android:usesCleartextTraffic="true" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:allowBackup="true" android:theme="@style/AppTheme" android:banner="@drawable/tv_banner">
<meta-data android:name="expo.modules.updates.ENABLED" android:value="false"/> <meta-data android:name="expo.modules.updates.ENABLED" android:value="false"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/> <meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/> <meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">192.168.1.100</domain>
</domain-config>
</network-security-config>