chore: remove deprecated Discord widget and related configurations

This commit is contained in:
javayhu 2025-08-26 00:48:39 +08:00
parent 895e02bfdd
commit 4434f1900d
5 changed files with 0 additions and 139 deletions

View File

@ -86,7 +86,6 @@
"@types/canvas-confetti": "^1.9.0",
"@vercel/analytics": "^1.5.0",
"@vercel/speed-insights": "^1.2.0",
"@widgetbot/react-embed": "^1.9.0",
"ai": "^5.0.0",
"better-auth": "^1.1.19",
"canvas-confetti": "^1.9.3",

48
pnpm-lock.yaml generated
View File

@ -191,9 +191,6 @@ importers:
'@vercel/speed-insights':
specifier: ^1.2.0
version: 1.2.0(next@15.2.1(@babel/core@7.24.5)(@opentelemetry/api@1.9.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0)
'@widgetbot/react-embed':
specifier: ^1.9.0
version: 1.9.0(react@19.0.0)
ai:
specifier: ^5.0.0
version: 5.0.0(zod@4.0.17)
@ -3765,14 +3762,6 @@ packages:
vue-router:
optional: true
'@widgetbot/embed-api@1.2.17':
resolution: {integrity: sha512-qoiFLMak+mBG64pgKN5xFv3amPHcG2qcurPefAbof4DI/eip5OU59pbM+ak4d9d9OIkwA1QhoDzo9KWD/cOn0w==}
'@widgetbot/react-embed@1.9.0':
resolution: {integrity: sha512-+Qgqy7lwLy++lIiHmSsgxUjwcX80iFIHR0QJpKq4W82ePUmq4bTuxvUbxcE+VQH5IjNrWaydGNR8zROV5vUQsA==}
peerDependencies:
react: '>= 15'
accepts@1.3.8:
resolution: {integrity: sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==}
engines: {node: '>= 0.6'}
@ -4031,12 +4020,6 @@ packages:
crisp-sdk-web@1.0.25:
resolution: {integrity: sha512-CWTHFFeHRV0oqiXoPh/aIAKhFs6xcIM4NenGPnClAMCZUDQgQsF1OWmZWmnVNjJriXUmWRgDfeUxcxygS0dCRA==}
cross-domain-safe-weakmap@1.0.29:
resolution: {integrity: sha512-VLoUgf2SXnf3+na8NfeUFV59TRZkIJqCIATaMdbhccgtnTlSnHXkyTRwokngEGYdQXx8JbHT9GDYitgR2sdjuA==}
cross-domain-utils@2.0.38:
resolution: {integrity: sha512-zZfi3+2EIR9l4chrEiXI2xFleyacsJf8YMLR1eJ0Veb5FTMXeJ3DpxDjZkto2FhL/g717WSELqbptNSo85UJDw==}
cross-spawn@7.0.6:
resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==}
engines: {node: '>= 8'}
@ -5542,9 +5525,6 @@ packages:
resolution: {integrity: sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==}
engines: {node: '>=12'}
post-robot@8.0.32:
resolution: {integrity: sha512-PMOdDAt3pyuKUxZcTzdcXXFxLqkdeLpRlcCQl7QAJpI+e7J1YHH+PfC7KAbcL8hRVQ1LknQYGoirbA1/eO/a1g==}
postcss-selector-parser@7.1.0:
resolution: {integrity: sha512-8sLjZwK0R+JlxlYcTuVnyT2v+htpdrjDOKuMcOVdYjt52Lh8hWRYpxBPoKx/Zg+bcjc3wx6fmQevMmUztS/ccA==}
engines: {node: '>=4'}
@ -6334,9 +6314,6 @@ packages:
resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}
engines: {node: '>=10'}
zalgo-promise@1.0.48:
resolution: {integrity: sha512-LLHANmdm53+MucY9aOFIggzYtUdkSBFxUsy4glTTQYNyK6B3uCPWTbfiGvSrEvLojw0mSzyFJ1/RRLv+QMNdzQ==}
zod-to-json-schema@3.24.2:
resolution: {integrity: sha512-pNUqrcSxuuB3/+jBbU8qKUbTbDqYUaG1vf5cXFjbhGgoUuA1amO/y4Q8lzfOhHU8HNPK6VFJ18lBDKj3OHyDsg==}
peerDependencies:
@ -9483,15 +9460,6 @@ snapshots:
next: 15.2.1(@babel/core@7.24.5)(@opentelemetry/api@1.9.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)
react: 19.0.0
'@widgetbot/embed-api@1.2.17':
dependencies:
post-robot: 8.0.32
'@widgetbot/react-embed@1.9.0(react@19.0.0)':
dependencies:
'@widgetbot/embed-api': 1.2.17
react: 19.0.0
accepts@1.3.8:
dependencies:
mime-types: 2.1.35
@ -9756,14 +9724,6 @@ snapshots:
crisp-sdk-web@1.0.25: {}
cross-domain-safe-weakmap@1.0.29:
dependencies:
cross-domain-utils: 2.0.38
cross-domain-utils@2.0.38:
dependencies:
zalgo-promise: 1.0.48
cross-spawn@7.0.6:
dependencies:
path-key: 3.1.1
@ -11670,12 +11630,6 @@ snapshots:
picomatch@4.0.2: {}
post-robot@8.0.32:
dependencies:
cross-domain-safe-weakmap: 1.0.29
cross-domain-utils: 2.0.38
zalgo-promise: 1.0.48
postcss-selector-parser@7.1.0:
dependencies:
cssesc: 3.0.0
@ -12670,8 +12624,6 @@ snapshots:
yocto-queue@0.1.0: {}
zalgo-promise@1.0.48: {}
zod-to-json-schema@3.24.2(zod@3.25.64):
dependencies:
zod: 3.25.64

View File

@ -1,88 +0,0 @@
'use client';
import { DiscordIcon } from '@/components/icons/discord';
import { websiteConfig } from '@/config/website';
import { useMediaQuery } from '@/hooks/use-media-query';
import WidgetBot from '@widgetbot/react-embed';
import { useEffect, useRef, useState } from 'react';
/**
* Discord Widget, shows the channels and messages in the discord server
*
* @deprecated
* This feature is deprecated for Discord Widget can not be used anymore.
*
* https://docs.widgetbot.io/embed/react-embed/
*/
export default function DiscordWidget() {
if (!websiteConfig.features.enableDiscordWidget) {
return null;
}
const serverId = process.env.NEXT_PUBLIC_DISCORD_WIDGET_SERVER_ID as string;
const channelId = process.env.NEXT_PUBLIC_DISCORD_WIDGET_CHANNEL_ID as string;
if (!serverId || !channelId) {
return null;
}
const [open, setOpen] = useState(false);
const widgetRef = useRef<HTMLDivElement>(null);
const { device, width: windowWidth, height: windowHeight } = useMediaQuery();
let widgetWidth = 800;
let widgetHeight = 600;
if (device === 'mobile') {
widgetWidth = windowWidth ? Math.floor(windowWidth * 0.9) : 320;
widgetHeight = windowHeight ? Math.floor(windowHeight * 0.8) : 400;
} else if (device === 'tablet' || device === 'sm') {
widgetWidth = windowWidth ? Math.floor(windowWidth * 0.9) : 600;
widgetHeight = windowHeight ? Math.floor(windowHeight * 0.8) : 480;
}
useEffect(() => {
if (!open) return;
function handleClick(e: MouseEvent) {
if (widgetRef.current && !widgetRef.current.contains(e.target as Node)) {
setOpen(false);
}
}
document.addEventListener('mousedown', handleClick);
return () => document.removeEventListener('mousedown', handleClick);
}, [open]);
return (
<div>
{/* discord icon button, show in bottom right corner */}
{!open && (
<button
aria-label="Open Discord Widget"
className="fixed bottom-[84px] right-10 z-50 cursor-pointer flex items-center justify-center rounded-full bg-[#5865F2] shadow-lg
hover:scale-110 transition-transform duration-150"
style={{ width: 48, height: 48 }}
onClick={() => setOpen(true)}
type="button"
>
<DiscordIcon width={32} height={32} className="text-white" />
</button>
)}
{/* discord widget expand layer */}
{open && (
<div
ref={widgetRef}
className="fixed bottom-[84px] right-10 z-50 flex flex-col items-end"
style={{ width: widgetWidth, height: widgetHeight }}
>
<div className="rounded-lg overflow-hidden shadow-2xl border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-900">
<WidgetBot
server={serverId}
channel={channelId}
width={widgetWidth}
height={widgetHeight}
/>
</div>
</div>
)}
</div>
);
}

View File

@ -35,7 +35,6 @@ export const websiteConfig: WebsiteConfig = {
},
},
features: {
enableDiscordWidget: false,
enableUpgradeCard: true,
enableUpdateAvatar: true,
enableAffonsoAffiliate: false,

View File

@ -76,7 +76,6 @@ export interface SocialConfig {
* Website features
*/
export interface FeaturesConfig {
enableDiscordWidget?: boolean; // Whether to enable the discord widget, deprecated
enableCrispChat?: boolean; // Whether to enable the crisp chat
enableUpgradeCard?: boolean; // Whether to enable the upgrade card in the sidebar
enableUpdateAvatar?: boolean; // Whether to enable the update avatar in settings