fixed68: 右上角四件套每一页常驻(TopRightButtons共用组件+独立页悬浮条+PageLayout去首页条件+版本号fixed68+停用cachebust运行时补丁)
This commit is contained in:
1 parent
980b559296
commit
8a91143e5c
32 files changed
+2593
-238
No files matched your search
@@ -0,0 +1,94 @@
|
||||
'use client';
|
||||
|
||||
import Link from 'next/link';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
type VodItem = {
|
||||
vod_id?: string | number;
|
||||
vod_name?: string;
|
||||
vod_pic?: string;
|
||||
vod_remarks?: string;
|
||||
vod_year?: string;
|
||||
vod_time?: string;
|
||||
};
|
||||
|
||||
export default function HkDramaRow() {
|
||||
const [items, setItems] = useState<VodItem[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
fetch('/api/tvbox/all?ac=videolist&t=902&pg=1&by=time')
|
||||
.then((r) => r.json())
|
||||
.then((j) => {
|
||||
const arr = (((j && j.list) as VodItem[]) || []).slice();
|
||||
arr.sort((a, b) => {
|
||||
const ya = parseInt(a.vod_year || '', 10) || 0;
|
||||
const yb = parseInt(b.vod_year || '', 10) || 0;
|
||||
if (yb !== ya) return yb - ya;
|
||||
return String(b.vod_time || '').localeCompare(
|
||||
String(a.vod_time || '')
|
||||
);
|
||||
});
|
||||
setItems(arr.slice(0, 5));
|
||||
})
|
||||
.catch(() => {});
|
||||
}, []);
|
||||
|
||||
if (!items.length) return null;
|
||||
|
||||
return (
|
||||
<section className='mb-8'>
|
||||
<div className='mb-4 flex items-center justify-between'>
|
||||
<h2 className='text-xl font-bold text-gray-800 dark:text-gray-200'>
|
||||
最新港剧
|
||||
</h2>
|
||||
<Link
|
||||
href='/filter?t=香港剧'
|
||||
className='flex items-center text-sm text-gray-500 hover:text-purple-700 dark:text-gray-400 dark:hover:text-purple-300 transition-colors'
|
||||
>
|
||||
查看更多
|
||||
</Link>
|
||||
</div>
|
||||
<div className='grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4 relative'>
|
||||
{items.map((v) => {
|
||||
const key = String(v.vod_id || '');
|
||||
const sep = key.indexOf(':');
|
||||
const ks = sep > 0 ? key.slice(0, sep) : '';
|
||||
const kid = sep > 0 ? key.slice(sep + 1) : key;
|
||||
const pic = v.vod_pic
|
||||
? '/api/image-proxy?url=' + encodeURIComponent(v.vod_pic)
|
||||
: '';
|
||||
return (
|
||||
<Link
|
||||
key={key}
|
||||
href={`/play?source=${encodeURIComponent(
|
||||
ks
|
||||
)}&id=${encodeURIComponent(kid)}&stitle=${encodeURIComponent(
|
||||
v.vod_name || ''
|
||||
)}&stype=tv`}
|
||||
className='group block'
|
||||
>
|
||||
<div className='relative aspect-[2/3] w-full overflow-hidden rounded-lg bg-gray-200 dark:bg-gray-800'>
|
||||
{pic ? (
|
||||
<img
|
||||
src={pic}
|
||||
alt={v.vod_name || ''}
|
||||
loading='lazy'
|
||||
className='absolute inset-0 w-full h-full object-cover group-hover:scale-105 transition-transform duration-300'
|
||||
/>
|
||||
) : null}
|
||||
{v.vod_remarks ? (
|
||||
<span className='absolute bottom-1 right-1 px-1.5 py-0.5 text-xs bg-black/65 text-white rounded'>
|
||||
{v.vod_remarks}
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
<div className='mt-2 text-sm font-medium text-gray-800 dark:text-gray-200 truncate'>
|
||||
{v.vod_name}
|
||||
</div>
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
'use client';
|
||||
|
||||
import { useEffect } from 'react';
|
||||
|
||||
export default function HubBell({ forceShow = false }: { forceShow?: boolean }) {
|
||||
useEffect(() => {
|
||||
const t = setTimeout(() => {
|
||||
fetch('/api/license-config', { cache: 'no-store' })
|
||||
.then((r) => r.json())
|
||||
.then((j) => {
|
||||
try {
|
||||
const a = j && j.data && j.data.announcement;
|
||||
if (!a) return;
|
||||
const seen = JSON.parse(
|
||||
localStorage.getItem('hub_seen') || '{}'
|
||||
);
|
||||
if (!seen['a' + a.id]) {
|
||||
const d = document.querySelector('.mv-bell-dot');
|
||||
if (d) (d as HTMLElement).style.display = 'block';
|
||||
}
|
||||
} catch {}
|
||||
})
|
||||
.catch(() => {});
|
||||
}, 1500);
|
||||
return () => clearTimeout(t);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<button
|
||||
onClick={() => {
|
||||
try {
|
||||
localStorage.removeItem('hasSeenAnnouncement');
|
||||
} catch {}
|
||||
if (location.pathname === '/') location.reload();
|
||||
else location.href = '/';
|
||||
}}
|
||||
title='公告通知'
|
||||
className={
|
||||
forceShow
|
||||
? 'relative flex items-center justify-center w-8 h-8 rounded-lg text-base text-gray-200 hover:text-white hover:bg-white/10 transition-colors duration-200'
|
||||
: 'relative hidden md:flex items-center justify-center w-8 h-8 rounded-lg text-base text-gray-500 hover:text-purple-600 hover:bg-purple-500/10 dark:text-gray-400 dark:hover:text-purple-400 transition-colors duration-200'
|
||||
}
|
||||
>
|
||||
<span className='leading-none'>🔔</span>
|
||||
<span
|
||||
className='mv-bell-dot absolute top-1.5 right-1.5 w-2 h-2 bg-red-500 rounded-full'
|
||||
style={{ display: 'none' }}
|
||||
/>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
'use client';
|
||||
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
interface LicenseData {
|
||||
version: string;
|
||||
latest: string;
|
||||
update_available: boolean;
|
||||
changelog: string;
|
||||
announcement: { id: number; title: string; content: string } | null;
|
||||
}
|
||||
|
||||
export default function HubNotice() {
|
||||
const [data, setData] = useState<LicenseData | null>(null);
|
||||
const [visible, setVisible] = useState(false);
|
||||
const [mode, setMode] = useState<'ann' | 'upd'>('ann');
|
||||
|
||||
useEffect(() => {
|
||||
const t = setTimeout(() => {
|
||||
fetch('/api/license-config', { cache: 'no-store' })
|
||||
.then((r) => r.json())
|
||||
.then((j) => {
|
||||
if (!j || j.code !== 200 || !j.data) return;
|
||||
const d = j.data as LicenseData;
|
||||
setData(d);
|
||||
let ann = null;
|
||||
try {
|
||||
const seen = JSON.parse(localStorage.getItem('hub_seen') || '{}');
|
||||
if (d.announcement && !seen['a' + d.announcement.id]) ann = d.announcement;
|
||||
} catch {}
|
||||
let upd = null;
|
||||
try {
|
||||
upd =
|
||||
d.update_available &&
|
||||
localStorage.getItem('hub_ver_dismiss') !== String(d.latest || '')
|
||||
? d
|
||||
: null;
|
||||
} catch {}
|
||||
if (!ann && !upd) return;
|
||||
setMode(ann ? 'ann' : 'upd');
|
||||
setVisible(true);
|
||||
})
|
||||
.catch(() => {});
|
||||
}, 1500);
|
||||
return () => clearTimeout(t);
|
||||
}, []);
|
||||
|
||||
if (!visible || !data) return null;
|
||||
|
||||
const title =
|
||||
mode === 'ann' && data.announcement
|
||||
? String(data.announcement.title || '📢 公告')
|
||||
: '发现新版本 v' + String(data.latest || '');
|
||||
const body =
|
||||
mode === 'ann' && data.announcement
|
||||
? String(data.announcement.content || '')
|
||||
: String(data.changelog || '').slice(0, 600);
|
||||
|
||||
const close = (dismissVer = false) => {
|
||||
try {
|
||||
if (mode === 'ann' && data.announcement) {
|
||||
const s = JSON.parse(localStorage.getItem('hub_seen') || '{}');
|
||||
s['a' + data.announcement.id] = 1;
|
||||
localStorage.setItem('hub_seen', JSON.stringify(s));
|
||||
}
|
||||
if (dismissVer && mode === 'upd') {
|
||||
localStorage.setItem('hub_ver_dismiss', String(data.latest || ''));
|
||||
}
|
||||
} catch {}
|
||||
setVisible(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
className='fixed inset-0 z-[9999] flex items-center justify-center bg-black/50 p-4'
|
||||
style={{ backdropFilter: 'blur(4px)' }}
|
||||
>
|
||||
<div className='bg-white dark:bg-gray-800 rounded-2xl shadow-2xl max-w-md w-full max-h-[80vh] flex flex-col overflow-hidden'>
|
||||
<div className='flex items-center justify-between px-6 pt-5 pb-3'>
|
||||
<h3 className='text-base font-bold text-gray-900 dark:text-gray-100 truncate mr-2'>
|
||||
{title}
|
||||
</h3>
|
||||
<button
|
||||
className='text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 text-lg leading-none flex-shrink-0'
|
||||
onClick={() => close(true)}
|
||||
>
|
||||
✕
|
||||
</button>
|
||||
</div>
|
||||
<div className='px-6 pb-2 overflow-y-auto text-sm text-gray-700 dark:text-gray-300 whitespace-pre-wrap'>
|
||||
{body}
|
||||
<div className='mt-3 text-xs text-gray-400 dark:text-gray-500'>
|
||||
当前版本 v{String(data.version || '')}
|
||||
</div>
|
||||
</div>
|
||||
<div className='px-6 py-4 bg-gray-50 dark:bg-gray-700/50 flex items-center justify-end gap-2'>
|
||||
<button
|
||||
className='px-3 py-1.5 rounded-lg text-xs font-medium text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-600'
|
||||
onClick={() => close(false)}
|
||||
>
|
||||
我知道了
|
||||
</button>
|
||||
<button
|
||||
className='px-3 py-1.5 rounded-lg text-xs font-medium text-purple-600 dark:text-purple-400 hover:bg-purple-500/10'
|
||||
onClick={() => close(true)}
|
||||
>
|
||||
不再提醒
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
'use client';
|
||||
|
||||
export default function Ipv6Button({ forceShow = false, compact = false, light = false }: { forceShow?: boolean; compact?: boolean; light?: boolean }) {
|
||||
const cls = forceShow
|
||||
? light
|
||||
? 'flex shrink-0 items-center gap-1 rounded-lg px-2 py-1.5 text-xs font-medium text-gray-700 hover:bg-purple-100/40 hover:text-purple-600 dark:text-gray-300 transition-colors duration-200'
|
||||
: 'flex shrink-0 items-center gap-1.5 rounded-lg px-2 py-1.5 text-xs font-medium text-gray-200 hover:bg-white/10 hover:text-white transition-colors duration-200'
|
||||
: 'hidden md:flex shrink-0 items-center gap-1.5 rounded-lg px-2.5 py-2 text-sm font-medium text-gray-700 hover:bg-purple-100/30 hover:text-purple-600 dark:text-gray-300 dark:hover:bg-purple-500/10 transition-colors duration-200';
|
||||
return (
|
||||
<button
|
||||
onClick={() => {
|
||||
location.href = '/ipv6';
|
||||
}}
|
||||
title='切换 IPv4 / IPv6 线路'
|
||||
className={cls}
|
||||
>
|
||||
🌐 {compact ? 'IPV4/IPV6' : 'IPV4/IPV6'}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import { Clover, Film, Home, Search, Tv } from 'lucide-react';
|
||||
import { Clover, Film, Filter, Home, Radio, Search, Tv } from 'lucide-react';
|
||||
import Link from 'next/link';
|
||||
import { usePathname } from 'next/navigation';
|
||||
|
||||
@@ -35,9 +35,20 @@ const MobileBottomNav = ({ activePath }: MobileBottomNavProps) => {
|
||||
label: '综艺',
|
||||
href: '/douban?type=show',
|
||||
},
|
||||
{
|
||||
icon: Filter,
|
||||
label: '筛选',
|
||||
href: '/filter',
|
||||
},
|
||||
{
|
||||
icon: Radio,
|
||||
label: '直播',
|
||||
href: '/live',
|
||||
},
|
||||
];
|
||||
|
||||
const isActive = (href: string) => {
|
||||
if (href === '/filter') return currentActive.startsWith('/filter');
|
||||
const typeMatch = href.match(/type=([^&]+)/)?.[1];
|
||||
|
||||
// 解码URL以进行正确的比较
|
||||
@@ -67,7 +78,7 @@ const MobileBottomNav = ({ activePath }: MobileBottomNavProps) => {
|
||||
{navItems.map((item) => {
|
||||
const active = isActive(item.href);
|
||||
return (
|
||||
<li key={item.href} className='flex-shrink-0 w-1/5'>
|
||||
<li key={item.href} className='flex-1 min-w-0'>
|
||||
<Link
|
||||
href={item.href}
|
||||
className={`flex flex-col items-center justify-center w-full h-14 gap-1 text-xs transition-all duration-200 relative ${
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
import { Clover, Film, Home, Search, Tv } from 'lucide-react';
|
||||
import { Clover, Film, Filter, Home, Play, Radio, Search, Tv } from 'lucide-react';
|
||||
import Link from 'next/link';
|
||||
import { usePathname, useRouter, useSearchParams } from 'next/navigation';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
|
||||
import { BackButton } from './BackButton';
|
||||
import HubNotice from '@/components/HubNotice';
|
||||
import MobileBottomNav from './MobileBottomNav';
|
||||
import MobileHeader from './MobileHeader';
|
||||
import { useSite } from './SiteProvider';
|
||||
import { ThemeToggle } from './ThemeToggle';
|
||||
import TopRightButtons from './TopRightButtons';
|
||||
import { UserMenu } from './UserMenu';
|
||||
|
||||
interface PageLayoutProps {
|
||||
@@ -69,6 +71,21 @@ const TopNavbar = ({ activePath = '/' }: { activePath?: string }) => {
|
||||
label: '综艺',
|
||||
href: '/douban?type=show',
|
||||
},
|
||||
{
|
||||
icon: Play,
|
||||
label: 'AI短剧',
|
||||
href: '/search?q=AI%E7%9F%AD%E5%89%A7',
|
||||
},
|
||||
{
|
||||
icon: Filter,
|
||||
label: '筛选',
|
||||
href: '/filter',
|
||||
},
|
||||
{
|
||||
icon: Radio,
|
||||
label: '直播',
|
||||
href: '/live',
|
||||
},
|
||||
];
|
||||
|
||||
// 桌面端:顶部固定导航(fixed)
|
||||
@@ -89,9 +106,9 @@ const TopNavbar = ({ activePath = '/' }: { activePath?: string }) => {
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
{/* 导航菜单 */}
|
||||
<div className='hidden md:block'>
|
||||
<div className='ml-10 flex items-baseline space-x-4'>
|
||||
{/* 导航菜单(可收缩横向滚动,避免挤出右侧按钮) */}
|
||||
<div className='hidden md:block min-w-0 flex-1 overflow-x-auto overflow-y-hidden'>
|
||||
<div className='ml-10 flex items-baseline space-x-4 whitespace-nowrap'>
|
||||
{menuItems.map((item) => {
|
||||
// 检查当前路径是否匹配这个菜单项
|
||||
const typeMatch = item.href.match(/type=([^&]+)/)?.[1];
|
||||
@@ -152,8 +169,9 @@ const TopNavbar = ({ activePath = '/' }: { activePath?: string }) => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 右侧按钮 - 调整为更靠右,增加间距实现对称效果 */}
|
||||
<div className='flex items-center gap-3 -mr-2'>
|
||||
{/* 右侧按钮 - 每一页都显示(历史要求),与独立页共用 TopRightButtons */}
|
||||
<div className='flex items-center gap-3 -mr-2 shrink-0'>
|
||||
<TopRightButtons />
|
||||
<ThemeToggle />
|
||||
<UserMenu />
|
||||
</div>
|
||||
@@ -225,6 +243,9 @@ const PageLayout = ({ children, activePath = '/' }: PageLayoutProps) => {
|
||||
<div className='md:hidden'>
|
||||
<MobileBottomNav activePath={activePath} />
|
||||
</div>
|
||||
|
||||
{/* 授权中心公告/更新弹窗 */}
|
||||
<HubNotice />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import { Clover, Film, Home, Menu, Search, Settings, Tv } from 'lucide-react';
|
||||
import { Clover, Film, Home, Menu, Play, Search, Settings, Tv } from 'lucide-react';
|
||||
import Link from 'next/link';
|
||||
import { usePathname, useRouter, useSearchParams } from 'next/navigation';
|
||||
import {
|
||||
@@ -138,6 +138,11 @@ const Sidebar = ({ onToggle, activePath = '/' }: SidebarProps) => {
|
||||
label: '综艺',
|
||||
href: '/douban?type=show',
|
||||
},
|
||||
{
|
||||
icon: Play,
|
||||
label: 'AI短剧',
|
||||
href: '/search?q=AI%E7%9F%AD%E5%89%A7',
|
||||
},
|
||||
{
|
||||
icon: Settings,
|
||||
label: 'TVBox配置',
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
'use client';
|
||||
|
||||
import HubBell from '@/components/HubBell';
|
||||
import Ipv6Button from '@/components/Ipv6Button';
|
||||
import TvboxButton from './TvboxButton';
|
||||
|
||||
interface TopRightButtonsProps {
|
||||
// float: 悬浮在页面右上角(给 /live 这类独立布局页用)
|
||||
// bar: 导航栏内嵌(给 PageLayout 用)
|
||||
variant?: 'bar' | 'float';
|
||||
}
|
||||
|
||||
// 右上角四件套:🔔 公告 / 📺 TVBOX接口 / 🌍 IPV4/IPV6 / ⭐ 开源地址
|
||||
// 每一页都要显示(历史要求),独立布局页(live/config/settings)与 PageLayout 共用此组件
|
||||
export default function TopRightButtons({ variant = 'bar' }: TopRightButtonsProps) {
|
||||
if (variant === 'float') {
|
||||
return (
|
||||
<div className='fixed top-2 right-2 z-50 flex items-center gap-1.5 rounded-xl bg-black/55 px-2 py-1.5 backdrop-blur-md border border-white/10'>
|
||||
<HubBell forceShow />
|
||||
<TvboxButton forceShow compact />
|
||||
<Ipv6Button forceShow compact />
|
||||
<a
|
||||
href='https://gitea.88531.cn/jinghui/katelyatv'
|
||||
target='_blank'
|
||||
rel='noopener'
|
||||
className='flex shrink-0 items-center rounded-lg px-2 py-1.5 text-xs font-medium text-gray-200 hover:bg-white/10 hover:text-white transition-colors duration-200'
|
||||
>
|
||||
⭐ 开源地址
|
||||
</a>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<span
|
||||
className='hidden lg:inline-flex shrink-0 items-center select-none rounded-lg px-2 py-1.5 text-xs font-bold tracking-wide text-purple-600 dark:text-purple-400 bg-purple-500/10 border border-purple-500/20'
|
||||
title='米视TV 当前版本'
|
||||
>
|
||||
v{process.env.NEXT_PUBLIC_SITE_VERSION || 'fixed67'}
|
||||
</span>
|
||||
<HubBell />
|
||||
<TvboxButton />
|
||||
<Ipv6Button />
|
||||
<a
|
||||
href='https://gitea.88531.cn/jinghui/katelyatv'
|
||||
target='_blank'
|
||||
rel='noopener'
|
||||
className='hidden md:flex shrink-0 items-center rounded-lg px-3 py-2 text-sm font-medium text-gray-700 hover:bg-purple-100/30 hover:text-purple-600 dark:text-gray-300 dark:hover:bg-purple-500/10 transition-colors duration-200'
|
||||
>
|
||||
⭐ 开源地址
|
||||
</a>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
'use client';
|
||||
|
||||
import { useState } from 'react';
|
||||
|
||||
export default function TvboxButton({ forceShow = false, compact = false }: { forceShow?: boolean; compact?: boolean }) {
|
||||
const [label, setLabel] = useState('📺 TVBOX接口');
|
||||
|
||||
const showModal = (title: string, body: string, link?: string) => {
|
||||
const ov = document.createElement('div');
|
||||
ov.className =
|
||||
'fixed inset-0 z-[9999] flex items-center justify-center bg-black/50 p-4';
|
||||
(ov.style as any).backdropFilter = 'blur(4px)';
|
||||
const card = document.createElement('div');
|
||||
card.className =
|
||||
'bg-white dark:bg-gray-800 rounded-2xl shadow-2xl max-w-md w-full max-h-[80vh] flex flex-col overflow-hidden';
|
||||
const head = document.createElement('div');
|
||||
head.className = 'flex items-center justify-between px-6 pt-5 pb-3';
|
||||
const h3 = document.createElement('h3');
|
||||
h3.className =
|
||||
'text-base font-bold text-gray-900 dark:text-gray-100 truncate mr-2';
|
||||
h3.textContent = title;
|
||||
const xb = document.createElement('button');
|
||||
xb.className =
|
||||
'text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 text-lg leading-none flex-shrink-0';
|
||||
xb.textContent = '✕';
|
||||
head.appendChild(h3);
|
||||
head.appendChild(xb);
|
||||
const bd = document.createElement('div');
|
||||
bd.className =
|
||||
'px-6 pb-4 overflow-y-auto text-sm text-gray-700 dark:text-gray-300 whitespace-pre-wrap';
|
||||
bd.textContent = body;
|
||||
card.appendChild(head);
|
||||
card.appendChild(bd);
|
||||
const foot = document.createElement('div');
|
||||
foot.className =
|
||||
'px-6 py-4 bg-gray-50 dark:bg-gray-700/50 flex items-center justify-end gap-2';
|
||||
const kb = document.createElement('button');
|
||||
kb.className =
|
||||
'px-3 py-1.5 rounded-lg text-xs font-medium text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-600';
|
||||
kb.textContent = '我知道了';
|
||||
foot.appendChild(kb);
|
||||
if (link) {
|
||||
const la = document.createElement('a');
|
||||
la.href = link;
|
||||
la.target = '_blank';
|
||||
la.rel = 'noopener';
|
||||
la.className =
|
||||
'px-3 py-1.5 rounded-lg text-xs font-medium text-purple-600 dark:text-purple-400 hover:bg-purple-500/10';
|
||||
la.textContent = '查看详情 →';
|
||||
foot.insertBefore(la, kb);
|
||||
}
|
||||
card.appendChild(foot);
|
||||
const close = () => {
|
||||
if (ov && ov.parentNode) ov.parentNode.removeChild(ov);
|
||||
};
|
||||
xb.onclick = close;
|
||||
kb.onclick = close;
|
||||
ov.onclick = (ev) => {
|
||||
if (ev.target === ov) close();
|
||||
};
|
||||
ov.appendChild(card);
|
||||
document.body.appendChild(ov);
|
||||
};
|
||||
|
||||
const onClick = (ev: React.MouseEvent<HTMLButtonElement>) => {
|
||||
const u = location.origin + '/api/tvbox';
|
||||
const bt = ev.currentTarget;
|
||||
const ok = () => {
|
||||
setLabel('✓ 已复制');
|
||||
setTimeout(() => setLabel('📺 TVBOX接口'), 1600);
|
||||
};
|
||||
const tip = '影视仓/TVBox「设置 → 配置地址」粘贴保存即可';
|
||||
try {
|
||||
if (navigator.clipboard && navigator.clipboard.writeText) {
|
||||
navigator.clipboard
|
||||
.writeText(u)
|
||||
.then(ok)
|
||||
.catch(() =>
|
||||
showModal('📺 TVBOX 接入', '配置地址: ' + u + ' —— ' + tip, u)
|
||||
);
|
||||
return;
|
||||
}
|
||||
} catch {}
|
||||
showModal('📺 TVBOX 接入', '配置地址: ' + u + ' —— ' + tip, u);
|
||||
};
|
||||
|
||||
return (
|
||||
<button
|
||||
onClick={onClick}
|
||||
title='TVBOX接口 · 点击复制配置地址'
|
||||
className={
|
||||
forceShow
|
||||
? 'flex shrink-0 items-center rounded-lg px-2 py-1.5 text-xs font-medium text-gray-200 hover:bg-white/10 hover:text-white transition-colors duration-200'
|
||||
: 'hidden md:flex shrink-0 items-center rounded-lg px-3 py-2 text-sm font-medium text-gray-700 hover:bg-purple-100/30 hover:text-purple-600 dark:text-gray-300 dark:hover:bg-purple-500/10 transition-colors duration-200'
|
||||
}
|
||||
>
|
||||
{compact && label === '📺 TVBOX接口' ? '📺 TVBOX' : label}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -418,7 +418,10 @@ export const UserMenu: React.FC = () => {
|
||||
{/* 版本信息 */}
|
||||
<button
|
||||
onClick={() =>
|
||||
window.open('https://github.com/katelya77/KatelyaTV', '_blank')
|
||||
window.open(
|
||||
'https://gitea.88531.cn/jinghui/katelyatv',
|
||||
'_blank'
|
||||
)
|
||||
}
|
||||
className='w-full px-3 py-2 text-center flex items-center justify-center text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors text-xs'
|
||||
>
|
||||
|
||||
Reference in new issue
Block a user