diff --git a/.gitignore b/.gitignore
index bbf1764..d6b994d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
node_modules/
dist/
.DS_Store
+.env
diff --git a/index.html b/index.html
index a4fbf30..8175bec 100644
--- a/index.html
+++ b/index.html
@@ -10,18 +10,18 @@
-
-
-
-
-
+
+
+
+
+
-
+
-
+
YMB · Short stories, big emotions
diff --git a/public/_headers b/public/_headers
new file mode 100644
index 0000000..dbfab2b
--- /dev/null
+++ b/public/_headers
@@ -0,0 +1,4 @@
+/assets/*
+ Cache-Control: public, max-age=31536000, immutable
+/index.html
+ Cache-Control: public, max-age=0, must-revalidate
diff --git a/public/_redirects b/public/_redirects
new file mode 100644
index 0000000..ad37e2c
--- /dev/null
+++ b/public/_redirects
@@ -0,0 +1 @@
+/* /index.html 200
diff --git a/public/robots.txt b/public/robots.txt
index f46718b..4106e8a 100644
--- a/public/robots.txt
+++ b/public/robots.txt
@@ -1,4 +1,5 @@
# Author: fruit.com.cn
+# __SITE_URL__ 由 vite.config.js 在构建时替换为 .env 的 VITE_SITE_URL
User-agent: *
Allow: /
-Sitemap: https://ymb.example.com/sitemap.xml
+Sitemap: __SITE_URL__/sitemap.xml
diff --git a/public/sitemap.xml b/public/sitemap.xml
index b4d4024..10898ec 100644
--- a/public/sitemap.xml
+++ b/public/sitemap.xml
@@ -1,8 +1,10 @@
+
- http://39.162.50.99:3007/daily1.0
- http://39.162.50.99:3007/aboutmonthly0.8
- http://39.162.50.99:3007/privacyyearly0.5
- http://39.162.50.99:3007/termsyearly0.5
+ __SITE_URL__/daily1.0
+ __SITE_URL__/aboutmonthly0.8
+ __SITE_URL__/contactmonthly0.6
+ __SITE_URL__/privacyyearly0.5
+ __SITE_URL__/termsyearly0.5
diff --git a/src/app/router.jsx b/src/app/router.jsx
index 14191e3..84330ad 100644
--- a/src/app/router.jsx
+++ b/src/app/router.jsx
@@ -10,6 +10,7 @@ const SearchPage = lazy(() => import('../features/search/SearchPage').then((modu
const HistoryPage = lazy(() => import('../features/history/HistoryPage').then((module) => ({ default: module.HistoryPage })));
const ListingPage = lazy(() => import('../features/listing/ListingPage').then((module) => ({ default: module.ListingPage })));
const AboutPage = lazy(() => import('../features/about/AboutPage').then((module) => ({ default: module.AboutPage })));
+const ContactPage = lazy(() => import('../features/about/ContactPage').then((module) => ({ default: module.ContactPage })));
const LegalPage = lazy(() => import('../features/legal/LegalPage').then((module) => ({ default: module.LegalPage })));
export function AppRouter() {
@@ -22,6 +23,7 @@ export function AppRouter() {
} />
} />
} />
+ } />
} />
} />
} />
diff --git a/src/features/about/ContactPage.jsx b/src/features/about/ContactPage.jsx
new file mode 100644
index 0000000..9a20469
--- /dev/null
+++ b/src/features/about/ContactPage.jsx
@@ -0,0 +1,70 @@
+// Author: fruit.com.cn
+import { useEffect } from 'react';
+import { useLocale } from '../../app/providers/AppProviders';
+import { COMPANY } from '../../shared/data/company';
+
+/** 联系我们:邓白氏审核会找联系页,必须出现法定名称、注册地址、电话、邮箱。 */
+const CONTACT_COPY = {
+ id: {
+ title: 'Hubungi Kami',
+ summary: 'Informasi kontak resmi perusahaan. Kami biasanya membalas dalam 1–2 hari kerja.',
+ companyTitle: 'Entitas Perusahaan',
+ contactTitle: 'Kontak',
+ emailLabel: 'Email',
+ phoneLabel: 'Telepon',
+ nibLabel: 'NIB',
+ addressLabel: 'Alamat Terdaftar',
+ },
+ en: {
+ title: 'Contact Us',
+ summary: 'Official company contact details. We usually reply within 1–2 business days.',
+ companyTitle: 'Company Entity',
+ contactTitle: 'Contact',
+ emailLabel: 'Email',
+ phoneLabel: 'Phone',
+ nibLabel: 'NIB',
+ addressLabel: 'Registered Address',
+ },
+ zh: {
+ title: '联系我们',
+ summary: '公司官方联系方式,通常在 1–2 个工作日内回复。',
+ companyTitle: '公司主体',
+ contactTitle: '联系方式',
+ emailLabel: '邮箱',
+ phoneLabel: '电话',
+ nibLabel: 'NIB 注册号',
+ addressLabel: '注册地址',
+ },
+};
+
+export function ContactPage() {
+ const { locale } = useLocale();
+ const copy = CONTACT_COPY[locale.code] || CONTACT_COPY.en;
+
+ useEffect(() => {
+ document.title = `${copy.title} · ${COMPANY.legalName}`;
+ }, [copy.title]);
+
+ return (
+
+
+ {COMPANY.legalName}
+ {copy.title}
+ {copy.summary}
+
+
+
+ {copy.companyTitle}
+ {COMPANY.legalName}
+ {copy.addressLabel}: {COMPANY.address}
+ {copy.nibLabel}: {COMPANY.nib}
+
+
+
+
+ );
+}
diff --git a/src/features/legal/legal.css b/src/features/legal/legal.css
index 37c699e..5b9caff 100644
--- a/src/features/legal/legal.css
+++ b/src/features/legal/legal.css
@@ -35,6 +35,10 @@
.legal-contact { margin-top: 22px; padding: 30px 44px; border-radius: 22px; background: #171a22; }
.legal-contact p { margin: 8px 0; overflow-wrap: anywhere; }
.legal-contact a { color: #a9ccff; }
+.site-footer-company { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; color: #8b93a1; line-height: 1.7; }
+.site-footer-company strong { color: #d7dbe2; font-size: 13px; }
+.site-footer-company a { color: #8b93a1; }
+.site-footer-company a:hover { color: #fff; text-decoration: underline; }
.site-footer-links { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin-top: 10px; }
.site-footer-links a { color: #a0a0a0; }
.site-footer-links a:hover { color: #fff; text-decoration: underline; }
diff --git a/src/i18n/index.js b/src/i18n/index.js
index 9c28540..7412579 100644
--- a/src/i18n/index.js
+++ b/src/i18n/index.js
@@ -1,7 +1,7 @@
// Author: fruit.com.cn
export const locales = {
- id: { code: 'id', htmlLang: 'id', title: 'YMB · Cerita pendek, emosi besar', description: 'Temukan drama pendek terbaik dan episode baru setiap hari.', search: 'Cari drama, aktor, atau genre', searchResults: 'Hasil pencarian untuk', noResults: 'Tidak ada hasil untuk', clearSearch: 'Hapus pencarian', create: 'Buat', notifications: 'Notifikasi', account: 'Akun', home: 'Beranda', shorts: 'Shorts', subscriptions: 'Langganan', library: 'Perpustakaan', history: 'Riwayat', clearHistory: 'Hapus semua', historyEmpty: 'Belum ada riwayat tontonan.', comments: 'Komentar', noComments: 'Belum ada komentar.', commentPlaceholder: 'Tambah komentar…', send: 'Kirim', share: 'Bagikan', save: 'Simpan', like: 'Suka', linkCopied: 'Tautan disalin', subscribe: 'Subscribe', subscribed: 'Subscribed', uploadVideo: 'Unggah video', uploadHint: 'Seret file video ke sini, atau klik untuk memilih', uploadHintSub: 'MP4, MOV atau WebM', uploadTitleLabel: 'Judul', uploadTitlePlaceholder: 'Beri judul untuk videomu', uploadCancel: 'Batal', uploadSubmit: 'Unggah', uploadSuccessTitle: 'Video dikirim untuk ditinjau', uploadSuccessText: 'Setelah disetujui, video akan tampil di channel-mu.', uploadDone: 'Selesai', close: 'Tutup', episodes: 'Episode', episodeSwipeHint: 'Geser atas/bawah untuk ganti episode', lockedEpisode: 'Masuk untuk membuka episode ini.', soundHint: 'Ketuk untuk suara', about: 'Tentang YMB', copyright: 'YMB · Your Mini Business. Hak cipta dilindungi.', you: 'Anda', playlists: 'Playlist', watchLater: 'Tonton nanti', likedVideos: 'Video yang disukai', myVideos: 'Video saya', explore: 'Jelajahi', music: 'Musik', movies: 'Film', live: 'Live', more: 'Lainnya', liked: 'Drama disukai', hero: 'Cerita pendek,', accent: 'emosi besar.', watch: 'Mulai menonton', picks: 'Drama pilihan minggu ini', shortTitle: 'Shorts', viewAll: 'Lihat semua →', videoCount: 'video', channels: 'Ikuti cerita favoritmu', genres: ['Semua', 'Romansa', 'Balas dendam', 'Keluarga', 'Rahasia', 'Kisah kedua'], follow: 'Ikuti', following: 'Mengikuti', empty: 'Belum ada drama yang cocok.', loading: 'Memuat dari server…', apiFallback: 'Server belum tersedia, menampilkan katalog demo sementara.', playbackUnavailable: 'Pilih episode untuk mulai menonton.', swipeHint: 'Geser ke atas untuk menemukan cerita berikutnya' },
- en: { code: 'en', htmlLang: 'en', title: 'YMB · Short stories, big emotions', description: 'Discover the best short dramas and new episodes every day.', search: 'Search dramas, actors, or genres', searchResults: 'Search results for', noResults: 'No results for', clearSearch: 'Clear search', create: 'Create', notifications: 'Notifications', account: 'Account', home: 'Home', shorts: 'Shorts', subscriptions: 'Subscriptions', library: 'Library', history: 'History', clearHistory: 'Clear all', historyEmpty: 'No watch history yet.', comments: 'Comments', noComments: 'No comments yet.', commentPlaceholder: 'Add a comment…', send: 'Send', share: 'Share', save: 'Save', like: 'Like', linkCopied: 'Link copied', subscribe: 'Subscribe', subscribed: 'Subscribed', uploadVideo: 'Upload video', uploadHint: 'Drag and drop a video file here, or click to browse', uploadHintSub: 'MP4, MOV or WebM', uploadTitleLabel: 'Title', uploadTitlePlaceholder: 'Give your video a title', uploadCancel: 'Cancel', uploadSubmit: 'Upload', uploadSuccessTitle: 'Video submitted for review', uploadSuccessText: 'Once approved, it will appear on your channel.', uploadDone: 'Done', close: 'Close', episodes: 'Episodes', episodeSwipeHint: 'Swipe up/down to change episodes', lockedEpisode: 'Login to unlock this episode.', soundHint: 'Tap for sound', about: 'About YMB', copyright: 'YMB · Your Mini Business. All rights reserved.', you: 'You', playlists: 'Playlists', watchLater: 'Watch later', likedVideos: 'Liked videos', myVideos: 'Your videos', explore: 'Explore', music: 'Music', movies: 'Movies', live: 'Live', more: 'Show more', liked: 'Liked dramas', hero: 'Short stories,', accent: 'big emotions.', watch: 'Watch now', picks: 'Drama picks this week', shortTitle: 'Shorts', viewAll: 'View all →', videoCount: 'videos', channels: 'Follow your favorite stories', genres: ['All', 'Romance', 'Revenge', 'Family', 'Secrets', 'Second chance'], follow: 'Follow', following: 'Following', empty: 'No dramas match your search.', loading: 'Loading from server…', apiFallback: 'Server unavailable, showing the demo catalog temporarily.', playbackUnavailable: 'Select an episode to start watching.', swipeHint: 'Swipe up to discover the next story' },
- zh: { code: 'zh', htmlLang: 'zh-CN', title: 'YMB · 短故事,大情绪', description: '发现精彩短剧,每天更新新剧集。', search: '搜索短剧、演员或题材', searchResults: '搜索结果', noResults: '没有找到相关结果', clearSearch: '清空搜索', create: '创建', notifications: '通知', account: '账号菜单', home: '首页', shorts: 'Shorts', subscriptions: '订阅', library: '媒体库', history: '观看记录', clearHistory: '清空记录', historyEmpty: '还没有观看记录。', comments: '评论', noComments: '还没有评论。', commentPlaceholder: '添加评论…', send: '发送', share: '分享', save: '收藏', like: '点赞', linkCopied: '链接已复制', subscribe: '订阅', subscribed: '已订阅', uploadVideo: '上传视频', uploadHint: '拖拽视频文件到此处,或点击选择', uploadHintSub: '支持 MP4 / MOV / WebM', uploadTitleLabel: '标题', uploadTitlePlaceholder: '为视频添加标题', uploadCancel: '取消', uploadSubmit: '上传', uploadSuccessTitle: '视频已提交审核', uploadSuccessText: '审核通过后会在你的频道中展示。', uploadDone: '完成', close: '关闭', episodes: '剧集', episodeSwipeHint: '上下滑动切换剧集', lockedEpisode: '登录后解锁本集。', soundHint: '点击开启声音', about: '关于 YMB', copyright: 'YMB · Your Mini Business. 版权所有。', you: '我', playlists: '播放列表', watchLater: '稍后观看', likedVideos: '赞过的视频', myVideos: '我的视频', explore: '探索', music: '音乐', movies: '电影', live: '直播', more: '展开', liked: '喜欢的短剧', hero: '短故事,', accent: '大情绪。', watch: '立即观看', picks: '本周精选短剧', shortTitle: 'Shorts', viewAll: '查看全部 →', videoCount: '个视频', channels: '关注你喜欢的故事', genres: ['全部', '爱情', '复仇', '家庭', '秘密', '重生'], follow: '关注', following: '已关注', empty: '没有找到匹配的短剧。', loading: '正在从服务端加载…', apiFallback: '服务端暂不可用,暂时展示演示目录。', playbackUnavailable: '请选择剧集开始播放。', swipeHint: '向上滑动发现下一个故事' }
+ id: { code: 'id', htmlLang: 'id', title: 'YMB · Cerita pendek, emosi besar', description: 'Temukan drama pendek terbaik dan episode baru setiap hari.', search: 'Cari drama, aktor, atau genre', searchResults: 'Hasil pencarian untuk', noResults: 'Tidak ada hasil untuk', clearSearch: 'Hapus pencarian', create: 'Buat', notifications: 'Notifikasi', account: 'Akun', home: 'Beranda', shorts: 'Shorts', subscriptions: 'Langganan', library: 'Perpustakaan', history: 'Riwayat', clearHistory: 'Hapus semua', historyEmpty: 'Belum ada riwayat tontonan.', comments: 'Komentar', noComments: 'Belum ada komentar.', commentPlaceholder: 'Tambah komentar…', send: 'Kirim', share: 'Bagikan', save: 'Simpan', like: 'Suka', linkCopied: 'Tautan disalin', subscribe: 'Subscribe', subscribed: 'Subscribed', uploadVideo: 'Unggah video', uploadHint: 'Seret file video ke sini, atau klik untuk memilih', uploadHintSub: 'MP4, MOV atau WebM', uploadTitleLabel: 'Judul', uploadTitlePlaceholder: 'Beri judul untuk videomu', uploadCancel: 'Batal', uploadSubmit: 'Unggah', uploadSuccessTitle: 'Video dikirim untuk ditinjau', uploadSuccessText: 'Setelah disetujui, video akan tampil di channel-mu.', uploadDone: 'Selesai', close: 'Tutup', episodes: 'Episode', episodeSwipeHint: 'Geser atas/bawah untuk ganti episode', lockedEpisode: 'Masuk untuk membuka episode ini.', soundHint: 'Ketuk untuk suara', about: 'Tentang YMB', copyright: 'Hak cipta dilindungi.', you: 'Anda', playlists: 'Playlist', watchLater: 'Tonton nanti', likedVideos: 'Video yang disukai', myVideos: 'Video saya', explore: 'Jelajahi', music: 'Musik', movies: 'Film', live: 'Live', more: 'Lainnya', liked: 'Drama disukai', hero: 'Cerita pendek,', accent: 'emosi besar.', watch: 'Mulai menonton', picks: 'Drama pilihan minggu ini', shortTitle: 'Shorts', viewAll: 'Lihat semua →', videoCount: 'video', channels: 'Ikuti cerita favoritmu', genres: ['Semua', 'Romansa', 'Balas dendam', 'Keluarga', 'Rahasia', 'Kisah kedua'], follow: 'Ikuti', following: 'Mengikuti', empty: 'Belum ada drama yang cocok.', loading: 'Memuat dari server…', apiFallback: 'Server belum tersedia, menampilkan katalog demo sementara.', playbackUnavailable: 'Pilih episode untuk mulai menonton.', swipeHint: 'Geser ke atas untuk menemukan cerita berikutnya' },
+ en: { code: 'en', htmlLang: 'en', title: 'YMB · Short stories, big emotions', description: 'Discover the best short dramas and new episodes every day.', search: 'Search dramas, actors, or genres', searchResults: 'Search results for', noResults: 'No results for', clearSearch: 'Clear search', create: 'Create', notifications: 'Notifications', account: 'Account', home: 'Home', shorts: 'Shorts', subscriptions: 'Subscriptions', library: 'Library', history: 'History', clearHistory: 'Clear all', historyEmpty: 'No watch history yet.', comments: 'Comments', noComments: 'No comments yet.', commentPlaceholder: 'Add a comment…', send: 'Send', share: 'Share', save: 'Save', like: 'Like', linkCopied: 'Link copied', subscribe: 'Subscribe', subscribed: 'Subscribed', uploadVideo: 'Upload video', uploadHint: 'Drag and drop a video file here, or click to browse', uploadHintSub: 'MP4, MOV or WebM', uploadTitleLabel: 'Title', uploadTitlePlaceholder: 'Give your video a title', uploadCancel: 'Cancel', uploadSubmit: 'Upload', uploadSuccessTitle: 'Video submitted for review', uploadSuccessText: 'Once approved, it will appear on your channel.', uploadDone: 'Done', close: 'Close', episodes: 'Episodes', episodeSwipeHint: 'Swipe up/down to change episodes', lockedEpisode: 'Login to unlock this episode.', soundHint: 'Tap for sound', about: 'About YMB', copyright: 'All rights reserved.', you: 'You', playlists: 'Playlists', watchLater: 'Watch later', likedVideos: 'Liked videos', myVideos: 'Your videos', explore: 'Explore', music: 'Music', movies: 'Movies', live: 'Live', more: 'Show more', liked: 'Liked dramas', hero: 'Short stories,', accent: 'big emotions.', watch: 'Watch now', picks: 'Drama picks this week', shortTitle: 'Shorts', viewAll: 'View all →', videoCount: 'videos', channels: 'Follow your favorite stories', genres: ['All', 'Romance', 'Revenge', 'Family', 'Secrets', 'Second chance'], follow: 'Follow', following: 'Following', empty: 'No dramas match your search.', loading: 'Loading from server…', apiFallback: 'Server unavailable, showing the demo catalog temporarily.', playbackUnavailable: 'Select an episode to start watching.', swipeHint: 'Swipe up to discover the next story' },
+ zh: { code: 'zh', htmlLang: 'zh-CN', title: 'YMB · 短故事,大情绪', description: '发现精彩短剧,每天更新新剧集。', search: '搜索短剧、演员或题材', searchResults: '搜索结果', noResults: '没有找到相关结果', clearSearch: '清空搜索', create: '创建', notifications: '通知', account: '账号菜单', home: '首页', shorts: 'Shorts', subscriptions: '订阅', library: '媒体库', history: '观看记录', clearHistory: '清空记录', historyEmpty: '还没有观看记录。', comments: '评论', noComments: '还没有评论。', commentPlaceholder: '添加评论…', send: '发送', share: '分享', save: '收藏', like: '点赞', linkCopied: '链接已复制', subscribe: '订阅', subscribed: '已订阅', uploadVideo: '上传视频', uploadHint: '拖拽视频文件到此处,或点击选择', uploadHintSub: '支持 MP4 / MOV / WebM', uploadTitleLabel: '标题', uploadTitlePlaceholder: '为视频添加标题', uploadCancel: '取消', uploadSubmit: '上传', uploadSuccessTitle: '视频已提交审核', uploadSuccessText: '审核通过后会在你的频道中展示。', uploadDone: '完成', close: '关闭', episodes: '剧集', episodeSwipeHint: '上下滑动切换剧集', lockedEpisode: '登录后解锁本集。', soundHint: '点击开启声音', about: '关于 YMB', copyright: '版权所有。', you: '我', playlists: '播放列表', watchLater: '稍后观看', likedVideos: '赞过的视频', myVideos: '我的视频', explore: '探索', music: '音乐', movies: '电影', live: '直播', more: '展开', liked: '喜欢的短剧', hero: '短故事,', accent: '大情绪。', watch: '立即观看', picks: '本周精选短剧', shortTitle: 'Shorts', viewAll: '查看全部 →', videoCount: '个视频', channels: '关注你喜欢的故事', genres: ['全部', '爱情', '复仇', '家庭', '秘密', '重生'], follow: '关注', following: '已关注', empty: '没有找到匹配的短剧。', loading: '正在从服务端加载…', apiFallback: '服务端暂不可用,暂时展示演示目录。', playbackUnavailable: '请选择剧集开始播放。', swipeHint: '向上滑动发现下一个故事' }
};
export function getLocale(code) { return locales[code] || locales.id; }
diff --git a/src/layouts/AppShell.jsx b/src/layouts/AppShell.jsx
index 17812d5..d63a662 100644
--- a/src/layouts/AppShell.jsx
+++ b/src/layouts/AppShell.jsx
@@ -2,6 +2,7 @@
import { Suspense, useState } from 'react';
import { Link, Outlet, useLocation } from 'react-router-dom';
import { useLocale, useUi } from '../app/providers/AppProviders';
+import { COMPANY } from '../shared/data/company';
import { Sidebar } from './components/Sidebar';
import { TopBar } from './components/TopBar';
import { UploadVideoDialog } from './components/UploadVideoDialog';
@@ -30,13 +31,25 @@ export function AppShell() {
{!immersive && (
)}
diff --git a/src/shared/data/company.js b/src/shared/data/company.js
index f14c76a..f251458 100644
--- a/src/shared/data/company.js
+++ b/src/shared/data/company.js
@@ -1,9 +1,13 @@
// Author: fruit.com.cn
+// 主体信息:与印尼公司注册文件、D-U-N-S 档案、Apple 开发者账号保持逐字一致。
+// 邮箱域名在 .env 的 VITE_CONTACT_EMAIL 中配置,买好域名后只改那一处。
export const COMPANY = {
legalName: 'PT YMB TECHNOLOGY INDONESIA',
address: 'Komplek Ruko Mega Grosir Cempaka Mas Blok C No. 6, Jakarta Pusat 10640, Indonesia',
phone: '+62 821 7000 5974',
phoneHref: '+6282170005974',
- email: 'ymbtechnologyindonesia@gmail.com',
+ email: import.meta.env.VITE_CONTACT_EMAIL || 'contact@ymbdrama.com',
nib: '1240000631056',
+ country: 'Indonesia',
+ established: '2024',
};
diff --git a/src/shared/lib/seo.js b/src/shared/lib/seo.js
index 010532f..0b43cb0 100644
--- a/src/shared/lib/seo.js
+++ b/src/shared/lib/seo.js
@@ -1,7 +1,9 @@
// Author: fruit.com.cn
+const SITE_URL = (import.meta.env.VITE_SITE_URL || 'https://www.ymbdrama.com').replace(/\/$/, '');
+
export function applySeo(locale, route = '') {
document.title = locale.title;
document.documentElement.lang = locale.htmlLang;
document.querySelector('meta[name="description"]')?.setAttribute('content', locale.description);
- document.querySelector('link[rel="canonical"]')?.setAttribute('href', `https://ymb.example.com${route || '/'}`);
+ document.querySelector('link[rel="canonical"]')?.setAttribute('href', `${SITE_URL}${route || '/'}`);
}
diff --git a/vite.config.js b/vite.config.js
index 0a94685..001f0d8 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -1,5 +1,28 @@
// Author: fruit.com.cn
-import { defineConfig } from 'vite';
+import { defineConfig, loadEnv } from 'vite';
import react from '@vitejs/plugin-react';
+import { readFileSync, writeFileSync } from 'node:fs';
+import { resolve } from 'node:path';
-export default defineConfig({ plugins: [react()], server: { proxy: { '/app': { target: 'http://127.0.0.1:8081', changeOrigin: true }, '/files': { target: 'http://127.0.0.1:8081', changeOrigin: true } } } });
+/** 把 public 里的 __SITE_URL__ 占位符替换成 .env 的 VITE_SITE_URL,域名只改一处。 */
+function siteUrlPlugin() {
+ return {
+ name: 'site-url-replace',
+ apply: 'build',
+ closeBundle() {
+ const env = loadEnv('production', process.cwd(), '');
+ const url = (env.VITE_SITE_URL || '').replace(/\/$/, '');
+ if (!url) return;
+ for (const file of ['sitemap.xml', 'robots.txt']) {
+ const path = resolve('dist', file);
+ try {
+ writeFileSync(path, readFileSync(path, 'utf8').replaceAll('__SITE_URL__', url));
+ } catch {
+ // 文件不存在时忽略
+ }
+ }
+ },
+ };
+}
+
+export default defineConfig({ plugins: [react(), siteUrlPlugin()], server: { proxy: { '/app': { target: 'http://127.0.0.1:8081', changeOrigin: true }, '/files': { target: 'http://127.0.0.1:8081', changeOrigin: true } } } });