Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
12 changes: 8 additions & 4 deletions packages/app/src-tauri/src/core/books/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,17 @@ pub async fn save_book(app_handle: AppHandle, data: BookUploadData) -> Result<Si

let epub_filename = format!("book.{}", data.format.to_lowercase());
let epub_path = book_dir.join(&epub_filename);
std::fs::rename(&data.temp_file_path, &epub_path)
.map_err(|e| format!("移动书籍文件失败: {}", e))?;
fs::copy(&data.temp_file_path, &epub_path)
.map_err(|e| format!("复制书籍文件失败: {}", e))?;
fs::remove_file(&data.temp_file_path)
.map_err(|e| format!("删除临时书籍文件失败: {}", e))?;

let cover_path = if let Some(cover_temp_path) = &data.cover_temp_file_path {
let cover_file = book_dir.join("cover.jpg");
std::fs::rename(cover_temp_path, &cover_file)
.map_err(|e| format!("移动封面文件失败: {}", e))?;
fs::copy(cover_temp_path, &cover_file)
.map_err(|e| format!("复制封面文件失败: {}", e))?;
fs::remove_file(cover_temp_path)
.map_err(|e| format!("删除临时封面文件失败: {}", e))?;
Some(format!("books/{}/cover.jpg", data.id))
} else {
None
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
"assetProtocol": {
"enable": true,
"scope": [
"**"
"$APPDATA/**"
]
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/app/src/components/reader-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function ReaderLayout() {
const resizeTimeoutRef = useRef<NodeJS.Timeout | null>(null);
const [showOverlay, setShowOverlay] = useState(false);

const isWindows = getOSPlatform() === "windows";
const isWindowsOrLinux = getOSPlatform() === "windows" || getOSPlatform() === "linux";

useEffect(() => {
const handleResize = () => {
Expand Down Expand Up @@ -93,7 +93,7 @@ export default function ReaderLayout() {
darkMode={isDarkMode}
className="h-7"
enableDragRegion={true}
marginLeft={isWindows ? 0 : 60}
marginLeft={isWindowsOrLinux ? 0 : 60}
pinnedLeft={
<div className="mx-2 flex items-center gap-2" onClick={navigateToHome}>
<HomeIcon className="size-5 text-neutral-700 hover:text-neutral-800 dark:text-neutral-400 dark:hover:text-neutral-200" />
Expand Down