8 Commits

Author SHA1 Message Date
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
9 changed files with 41 additions and 29 deletions

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
npm install -g vercel
```
1. `docker pull zimpel1/tv-host`
2. **部署**
2. `docker run -d -p 3001:3001 zimpel1/tv-host`
进入 `backend` 目录并运行 `vercel` 命令:
本地部署后需要配置https才行不然会无法访问
```sh
cd backend
vercel
```
#### 使用 demo 地址
按照 Vercel CLI 的提示完成登录和部署过程。`vercel.json` 文件已配置好所有必要的构建和路由设置
在设置中可以使用 demo 地址: https://orion-tv.vercel.app 需要代理且不保证稳定和可用性
## 📜 主要脚本

View File

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

View File

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

View File

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

View File

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

View File

@@ -2,7 +2,7 @@
"name": "OrionTV",
"private": true,
"main": "expo-router/entry",
"version": "1.0.2",
"version": "1.0.4",
"scripts": {
"start": "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",
autoPlay: true,
playbackSpeed: 1.0,
apiBaseUrl: "http://127.0.0.1:3001",
apiBaseUrl: "",
};
try {
const data = await AsyncStorage.getItem(STORAGE_KEYS.SETTINGS);

View File

@@ -17,7 +17,7 @@
<data android:scheme="https"/>
</intent>
</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.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
<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>