mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-10-16 10:55:00 +03:00
feat(panel): let a sponsor slot start at a scheduled time
sponsors.json only had an end date, so a booked placement had to be added to the file on the day it started. An optional `from` now hides a sponsor (and its logo) until that instant; entries without it show immediately as before.
This commit is contained in:
@@ -1107,6 +1107,7 @@ export const EXAMPLES: Record<string, unknown> = {
|
||||
},
|
||||
"Sponsor": {
|
||||
"enable": true,
|
||||
"from": "2026-10-01T00:00:00Z",
|
||||
"id": "acme-2026-10",
|
||||
"link": "https://acme.example/?utm_source=3x-ui",
|
||||
"logo": "/sponsors/logo/acme.png",
|
||||
@@ -1123,6 +1124,7 @@ export const EXAMPLES: Record<string, unknown> = {
|
||||
"sponsors": [
|
||||
{
|
||||
"enable": true,
|
||||
"from": "2026-10-01T00:00:00Z",
|
||||
"id": "acme-2026-10",
|
||||
"link": "https://acme.example/?utm_source=3x-ui",
|
||||
"logo": "/sponsors/logo/acme.png",
|
||||
|
||||
@@ -4476,6 +4476,12 @@ export const SCHEMAS: Record<string, unknown> = {
|
||||
"nullable": true,
|
||||
"type": "boolean"
|
||||
},
|
||||
"from": {
|
||||
"example": "2026-10-01T00:00:00Z",
|
||||
"format": "date-time",
|
||||
"nullable": true,
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"example": "acme-2026-10",
|
||||
"type": "string"
|
||||
|
||||
@@ -1028,6 +1028,7 @@ export interface Setting {
|
||||
|
||||
export interface Sponsor {
|
||||
enable?: boolean | null;
|
||||
from?: string | null;
|
||||
id: string;
|
||||
link: string;
|
||||
logo?: string;
|
||||
|
||||
@@ -1091,6 +1091,7 @@ export type Setting = z.infer<typeof SettingSchema>;
|
||||
|
||||
export const SponsorSchema = z.object({
|
||||
enable: z.boolean().nullable().optional(),
|
||||
from: z.string().nullable().optional(),
|
||||
id: z.string(),
|
||||
link: z.string(),
|
||||
logo: z.string().optional(),
|
||||
|
||||
@@ -240,7 +240,7 @@ export const sections: readonly Section[] = [
|
||||
method: 'GET',
|
||||
path: '/sponsors',
|
||||
summary:
|
||||
'Public. Active paid sponsor placements read from the project sponsors.json (cached for 1h); expired entries are dropped. Logos are proxied by the panel at /sponsors/logo/{name}. Used by the login page and panel sponsor slots.',
|
||||
'Public. Active paid sponsor placements read from the project sponsors.json (cached for 1h); entries outside their from/until window are dropped. Logos are proxied by the panel at /sponsors/logo/{name}. Used by the login page and panel sponsor slots.',
|
||||
responseSchema: 'SponsorList',
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user