数据迁移支持电子书和漫画
This commit is contained in:
@@ -142,6 +142,8 @@ const DataMigration = ({ onRefreshConfig }: DataMigrationProps) => {
|
||||
const [exportPassword, setExportPassword] = useState('');
|
||||
const [importPassword, setImportPassword] = useState('');
|
||||
const [selectedFile, setSelectedFile] = useState<File | null>(null);
|
||||
const [includeMangaExport, setIncludeMangaExport] = useState(true);
|
||||
const [includeBooksExport, setIncludeBooksExport] = useState(true);
|
||||
const [isExporting, setIsExporting] = useState(false);
|
||||
const [isImporting, setIsImporting] = useState(false);
|
||||
const [exportProgress, setExportProgress] = useState<{
|
||||
@@ -216,6 +218,8 @@ const DataMigration = ({ onRefreshConfig }: DataMigrationProps) => {
|
||||
},
|
||||
body: JSON.stringify({
|
||||
password: exportPassword,
|
||||
includeMangaData: includeMangaExport,
|
||||
includeBookData: includeBooksExport,
|
||||
}),
|
||||
});
|
||||
|
||||
@@ -336,6 +340,8 @@ const DataMigration = ({ onRefreshConfig }: DataMigrationProps) => {
|
||||
<p class="mt-2">导入的用户数量: ${result.importedUsers}</p>
|
||||
<p>备份时间: ${new Date(result.timestamp).toLocaleString('zh-CN')}</p>
|
||||
<p>服务器版本: ${result.serverVersion || '未知版本'}</p>
|
||||
<p>漫画数据: ${result.importedMangaData ? '已导入' : '未导入'}</p>
|
||||
<p>电子书数据: ${result.importedBookData ? '已导入' : '未导入'}</p>
|
||||
<p class="mt-3 text-orange-600">请刷新页面以查看最新数据。</p>
|
||||
</div>
|
||||
`,
|
||||
@@ -419,6 +425,30 @@ const DataMigration = ({ onRefreshConfig }: DataMigrationProps) => {
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="space-y-3 rounded-lg border border-gray-200 dark:border-gray-700 p-3">
|
||||
<p className="text-sm font-medium text-gray-700 dark:text-gray-300">附加数据</p>
|
||||
<label className="flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={includeMangaExport}
|
||||
onChange={(e) => setIncludeMangaExport(e.target.checked)}
|
||||
disabled={isExporting}
|
||||
className="h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500"
|
||||
/>
|
||||
漫画数据(书架 + 阅读记录)
|
||||
</label>
|
||||
<label className="flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={includeBooksExport}
|
||||
onChange={(e) => setIncludeBooksExport(e.target.checked)}
|
||||
disabled={isExporting}
|
||||
className="h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500"
|
||||
/>
|
||||
电子书数据(书架 + 阅读记录)
|
||||
</label>
|
||||
</div>
|
||||
|
||||
{/* 备份内容列表 */}
|
||||
<div className="text-xs text-gray-600 dark:text-gray-400 space-y-1">
|
||||
<p className="font-medium text-gray-700 dark:text-gray-300 mb-2">备份内容:</p>
|
||||
@@ -427,6 +457,8 @@ const DataMigration = ({ onRefreshConfig }: DataMigrationProps) => {
|
||||
<div>• 用户数据</div>
|
||||
<div>• 播放记录</div>
|
||||
<div>• 收藏夹</div>
|
||||
<div>• 搜索历史</div>
|
||||
<div>• 音乐数据</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -520,6 +552,7 @@ const DataMigration = ({ onRefreshConfig }: DataMigrationProps) => {
|
||||
disabled={isImporting}
|
||||
/>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
{/* 导入按钮 */}
|
||||
|
||||
Reference in New Issue
Block a user