feat(panel): add sponsor slots fed from sponsors.sanaei.dev

Monthly sponsor placements need to change without cutting a panel
release. Panels now read 3X/sponsors.json from the MHSanaei/sponsors
repo (GitHub Pages on sponsors.sanaei.dev) and show active sponsors in
four slots: an overview banner, a rotating sidebar card (max three), the
login page and a new Sponsors page that also lists open placements.

An entry shows only while enable is not false and until is in the
future; links must be https and logos are png/webp/jpg by name only.
The list is cached for an hour and the last good copy survives upstream
failures; logos are proxied through /sponsors/logo/:name with failures
cached, so CSP stays 'self' and admin browsers never reach a third
party. Admins can hide a slot for 24h. Under XUI_DEBUG the panel reads
a sibling ../sponsors/3X checkout so edits can be previewed before push.
This commit is contained in:
MHSanaei
2026-09-26 03:31:51 +02:00
parent 89e200ead4
commit fd7b3559bc
47 changed files with 2323 additions and 10 deletions
+4
View File
@@ -247,6 +247,10 @@
padding: 8px 8px 12px;
}
.sider-sponsor {
margin-bottom: 6px;
}
.sidebar-pin {
display: inline-flex;
align-items: center;
+13
View File
@@ -11,6 +11,7 @@ import {
CloudServerOutlined,
ClusterOutlined,
CodeOutlined,
CrownOutlined,
DashboardOutlined,
DatabaseOutlined,
DiscordOutlined,
@@ -43,6 +44,7 @@ import { formatPanelVersion } from '@/lib/panel-version';
import { pauseAnimationsUntilLeave, useTheme } from '@/hooks/useTheme';
import { useAllSettings } from '@/api/queries/useAllSettings';
import { useCommandPalette } from '@/components/command-palette/useCommandPalette';
import SponsorSlot from '@/components/sponsor/SponsorSlot';
import './AppSidebar.css';
const DONATE_URL = 'https://donate.sanaei.dev/';
@@ -68,6 +70,7 @@ type IconName =
| 'cluster'
| 'hosts'
| 'logout'
| 'sponsors'
| 'apidocs'
| 'outbound'
| 'routing';
@@ -82,6 +85,7 @@ const iconByName: Record<IconName, ComponentType> = {
cluster: ClusterOutlined,
hosts: GlobalOutlined,
logout: LogoutOutlined,
sponsors: CrownOutlined,
apidocs: ApiOutlined,
outbound: ExportOutlined,
routing: SwapOutlined,
@@ -232,6 +236,7 @@ export default function AppSidebar() {
{ key: '/settings', icon: 'setting', title: t('menu.settings') },
{ key: '/xray', icon: 'tool', title: t('menu.xray') },
{ key: '/api-docs', icon: 'apidocs', title: t('menu.apiDocs') },
{ key: '/sponsors', icon: 'sponsors', title: t('menu.sponsors') },
{ key: LOGOUT_KEY, icon: 'logout', title: t('logout') },
],
[t],
@@ -447,6 +452,13 @@ export default function AppSidebar() {
onClick={onMenuClick}
/>
<div className="sider-footer">
<SponsorSlot
slot="sidebar"
variant="compact"
iconOnly={railCollapsed}
rotate
className="sider-sponsor"
/>
<VersionBadge version={panelVersion} collapsed={railCollapsed} />
</div>
</Layout.Sider>
@@ -532,6 +544,7 @@ export default function AppSidebar() {
}}
/>
<div className="drawer-footer">
<SponsorSlot slot="sidebar" variant="compact" rotate className="sider-sponsor" />
<VersionBadge version={panelVersion} />
</div>
</Drawer>