feat:下载管理页面,集成分享功能

This commit is contained in:
Developer
2026-03-19 20:11:05 +08:00
parent 0fbfdadf6a
commit c0b7b8e974
8 changed files with 363 additions and 9 deletions

26
utils/lanServer.ts Normal file
View File

@@ -0,0 +1,26 @@
import StaticServer from '@dr.pogodin/react-native-static-server';
import * as FileSystem from 'expo-file-system/legacy';
import * as Network from 'expo-network';
const PORT = 18080;
let server: StaticServer | null = null;
export async function startLanServer(): Promise<string> {
if (server) await server.stop();
const root = FileSystem.documentDirectory!.replace('file://', '');
server = new StaticServer({ fileDir: root, port: PORT, nonLocal: true });
await server.start();
const ip = await Network.getIpAddressAsync();
return `http://${ip}:${PORT}`;
}
export async function stopLanServer(): Promise<void> {
if (server) {
await server.stop();
server = null;
}
}
export function buildVideoUrl(baseUrl: string, bvid: string, qn: number): string {
return `${baseUrl}/${bvid}_${qn}.mp4`;
}