--- /dev/null
+import React from 'react';
+
+// V1 根站点提示页: 默认访问 https://words.acesimba.cloud/ 时显示,
+// 告知用户已切换到分组模式并引导到 /split/。开发者模式(?dev=1 或 localStorage.v1_dev=1)下不显示。
+export default function V1Notice() {
+ return (
+ <div
+ style={{
+ minHeight: '100vh',
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ padding: '24px',
+ textAlign: 'center',
+ background: '#fff',
+ color: '#333',
+ fontFamily: 'system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',
+ lineHeight: 1.9,
+ }}
+ >
+ <p style={{ maxWidth: '680px', fontSize: '18px', margin: 0 }}>
+ 您已经开始使用分组模式,请进入链接{' '}
+ <a
+ href="https://words.acesimba.cloud/split/"
+ target="_blank"
+ rel="noreferrer"
+ style={{ color: '#2563eb' }}
+ >
+ https://words.acesimba.cloud/split/
+ </a>
+ 。如需要打开,请在开发者模式中进行打开(请联系你最爱的妈妈)。
+ </p>
+ </div>
+ );
+}
import './index.css';
import App from './App';
import ErrorBoundary from './ErrorBoundary';
+import V1Notice from './V1Notice';
import { isLoggedIn } from './auth';
import reportWebVitals from './reportWebVitals';
+// V1 根站点网关: 默认显示"已切换到分组模式"提示页;
+// 开发者模式(?dev=1 或 localStorage.v1_dev=1)才加载原 V1 应用(进度/数据均保留在后端, 不受影响)。
+function isDevMode() {
+ try {
+ const params = new URLSearchParams(window.location.search);
+ if (params.get('dev') === '1') return true;
+ if (window.localStorage.getItem('v1_dev') === '1') return true;
+ } catch (e) {}
+ return false;
+}
+
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<ErrorBoundary>
- <App />
+ {isDevMode() ? <App /> : <V1Notice />}
</ErrorBoundary>
</React.StrictMode>
);
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
-// 注册 Service Worker (PWA 离线支持) — split 用相对路径, 确保在 /split 作用域下注册
+// 注册 Service Worker (PWA 离线支持)
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('sw.js').catch(err => console.error('SW registration failed:', err));
// SW 接管页面后, 再触发一次同步+预取, 确保预取请求被 SW 拦截并写入缓存
navigator.serviceWorker.ready.then(() => {
- if (isLoggedIn()) {
+ if (isDevMode() && isLoggedIn()) {
import('./sync').then(m => m.triggerAutoSync()).catch(() => {});
}
}).catch(() => {});