mirror of
https://github.com/KuekHaoYang/KVideo.git
synced 2026-08-20 03:03:43 +08:00
fix(cloudflare): remove node-only site icon route
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
'use client';
|
||||
|
||||
import { createContext, useContext } from 'react';
|
||||
|
||||
const SiteIconContext = createContext('/icon.png');
|
||||
|
||||
export function SiteIconProvider({
|
||||
children,
|
||||
iconSrc,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
iconSrc: string;
|
||||
}) {
|
||||
return <SiteIconContext.Provider value={iconSrc}>{children}</SiteIconContext.Provider>;
|
||||
}
|
||||
|
||||
export function useSiteIcon() {
|
||||
return useContext(SiteIconContext);
|
||||
}
|
||||
@@ -4,8 +4,9 @@ import { useState } from 'react';
|
||||
import Link from 'next/link';
|
||||
import Image from 'next/image';
|
||||
import { ThemeSwitcher } from '@/components/ThemeSwitcher';
|
||||
import { useSiteIcon } from '@/components/SiteIconProvider';
|
||||
import { Icons } from '@/components/ui/Icon';
|
||||
import { siteConfig, SITE_ICON_PATH } from '@/lib/config/site-config';
|
||||
import { siteConfig } from '@/lib/config/site-config';
|
||||
import { getSession, clearSession, hasPermission, type AuthSession } from '@/lib/store/auth-store';
|
||||
import { useRuntimeFeatures } from '@/components/RuntimeFeaturesProvider';
|
||||
import { LogOut } from 'lucide-react';
|
||||
@@ -20,6 +21,7 @@ export function Navbar({ onReset, isPremiumMode = false }: NavbarProps) {
|
||||
const favoritesHref = isPremiumMode ? '/premium/favorites' : '/favorites';
|
||||
const [session] = useState<AuthSession | null>(() => getSession());
|
||||
const { iptvEnabled } = useRuntimeFeatures();
|
||||
const siteIconSrc = useSiteIcon();
|
||||
|
||||
const handleLogout = () => {
|
||||
clearSession();
|
||||
@@ -45,7 +47,7 @@ export function Navbar({ onReset, isPremiumMode = false }: NavbarProps) {
|
||||
>
|
||||
<div className="w-8 h-8 sm:w-10 sm:h-10 relative flex items-center justify-center flex-shrink-0">
|
||||
<Image
|
||||
src={SITE_ICON_PATH}
|
||||
src={siteIconSrc}
|
||||
alt={siteConfig.name}
|
||||
width={40}
|
||||
height={40}
|
||||
|
||||
@@ -3,11 +3,13 @@ import Link from 'next/link';
|
||||
import Image from 'next/image';
|
||||
import { Button } from '@/components/ui/Button';
|
||||
import { ThemeSwitcher } from '@/components/ThemeSwitcher';
|
||||
import { useSiteIcon } from '@/components/SiteIconProvider';
|
||||
import { Icons } from '@/components/ui/Icon';
|
||||
import { siteConfig, SITE_ICON_PATH } from '@/lib/config/site-config';
|
||||
import { siteConfig } from '@/lib/config/site-config';
|
||||
|
||||
export function PlayerNavbar({ isPremium }: { isPremium?: boolean }) {
|
||||
const router = useRouter();
|
||||
const siteIconSrc = useSiteIcon();
|
||||
|
||||
return (
|
||||
<nav className="sticky top-0 z-50 pt-4 pb-2 px-4" style={{ transform: 'translateZ(0)' }}>
|
||||
@@ -20,7 +22,7 @@ export function PlayerNavbar({ isPremium }: { isPremium?: boolean }) {
|
||||
title={isPremium ? "返回高级主页" : "返回首页"}
|
||||
>
|
||||
<Image
|
||||
src={SITE_ICON_PATH}
|
||||
src={siteIconSrc}
|
||||
alt={siteConfig.name}
|
||||
width={40}
|
||||
height={40}
|
||||
|
||||
Reference in New Issue
Block a user