Migrate to Electron and implement native PDF export
Major changes: - Migrate from Tauri to Electron as primary desktop runtime - Implement native print dialog for PDF export via Electron webview - Add desktop runtime abstraction layer (supports both Electron and Tauri) - Implement task list rendering in preview mode - Add favorite notes sorting to display starred notes at top - Add attachment upload functionality with file picker - Improve sync reliability and Unicode filename support - Add category color sync across devices via WebDAV - Update documentation for Electron workflow Technical improvements: - Add Electron main process and preload bridge - Create desktop service layer for runtime-agnostic operations - Implement runtimeFetch for proxying network requests through Electron - Add PrintView component for native print rendering - Extract print/PDF utilities to shared module - Update build configuration for Electron integration
This commit is contained in:
168
README.md
168
README.md
@@ -1,85 +1,143 @@
|
||||

|
||||
|
||||
# Tauri + React + Typescript
|
||||
# Nextcloud Notes Desktop
|
||||
|
||||
# Nextcloud Notes - Cross-Platform Desktop App
|
||||
A desktop client for [Nextcloud Notes](https://apps.nextcloud.com/apps/notes) built with React, TypeScript, Vite, and Electron.
|
||||
|
||||
A modern, cross-platform desktop application for [Nextcloud Notes](https://apps.nextcloud.com/apps/notes) built with Tauri + React + TypeScript.
|
||||
This project started life as a Tauri app and has now been migrated to Electron for desktop runtime support, PDF export, and simpler cross-platform desktop behavior during development.
|
||||
|
||||
## Features
|
||||
## What It Does
|
||||
|
||||
- ✅ **Cross-platform**: macOS, Linux, Windows
|
||||
- ✅ **Lightweight**: ~600KB binary (vs 150MB+ Electron)
|
||||
- ✅ **Modern UI**: React + TailwindCSS
|
||||
- ✅ **Full sync**: Create, edit, delete, favorite notes
|
||||
- ✅ **Search & filter**: Find notes quickly, filter by favorites
|
||||
- ✅ **Auto-save**: Changes save automatically after 1.5s
|
||||
- ✅ **Secure**: Credentials stored in system keychain (localStorage for now)
|
||||
- ✅ **Background sync**: Auto-sync every 5 minutes
|
||||
- Sign in to a Nextcloud server with Notes enabled
|
||||
- Sync notes from WebDAV and favorite state from the Notes API
|
||||
- Create, edit, move, rename, and delete notes
|
||||
- Organize notes into categories, including nested categories
|
||||
- Mark notes as favorites
|
||||
- Cache notes locally for faster startup and offline viewing
|
||||
- Upload and render note attachments
|
||||
- Preview Markdown while editing
|
||||
- Export notes to PDF
|
||||
- Use a focus mode for distraction-free editing
|
||||
|
||||
## Prerequisites
|
||||
## Current Runtime
|
||||
|
||||
- **Rust**: Install from https://rustup.rs/
|
||||
- **Node.js**: v18+ recommended
|
||||
- **Nextcloud instance** with Notes app enabled
|
||||
- Primary desktop runtime: Electron
|
||||
- Frontend: React 19 + TypeScript + Vite
|
||||
- Styling: Tailwind CSS
|
||||
- Local cache: IndexedDB
|
||||
- Nextcloud integration:
|
||||
- WebDAV for note files, folders, attachments, and category color storage
|
||||
- Notes API for favorite metadata
|
||||
|
||||
Some Tauri-related code and dependencies are still present in the repository, mainly because parts of the app were built during the earlier Tauri phase. The Electron path is the actively used desktop runtime.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Node.js 18 or newer
|
||||
- npm
|
||||
- A Nextcloud instance with the Notes app enabled
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
Run the Electron app with the Vite dev server:
|
||||
|
||||
```bash
|
||||
# Install dependencies
|
||||
npm install
|
||||
npm run dev:desktop
|
||||
```
|
||||
|
||||
# Run in development mode
|
||||
npm run tauri dev
|
||||
Useful scripts:
|
||||
|
||||
# Build for production
|
||||
npm run tauri build
|
||||
```bash
|
||||
npm run dev:renderer # Vite frontend only
|
||||
npm run dev:electron # Electron only, expects renderer on port 1420
|
||||
npm run build # TypeScript + Vite production build
|
||||
npm run desktop # Run Electron against the built dist/
|
||||
npm run dist:dir # Build an unpacked Electron app in release/
|
||||
npm run dist:mac # Build macOS .dmg and .zip packages in release/
|
||||
```
|
||||
|
||||
## Production-Like Local Run
|
||||
|
||||
Build the frontend, then start Electron against the generated `dist/` files:
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
npm run desktop
|
||||
```
|
||||
|
||||
## First Launch
|
||||
|
||||
1. Enter your Nextcloud server URL (e.g., `https://cloud.example.com`)
|
||||
1. Enter your Nextcloud server URL, for example `https://cloud.example.com`
|
||||
2. Enter your username
|
||||
3. Enter your password or **App Password** (recommended)
|
||||
- Generate at: Settings → Security → Devices & Sessions in Nextcloud
|
||||
4. Click **Connect**
|
||||
3. Enter your password or, preferably, a Nextcloud app password
|
||||
4. Wait for the initial sync to finish
|
||||
|
||||
## Building for Distribution
|
||||
Using an app password is strongly recommended.
|
||||
|
||||
### macOS
|
||||
```bash
|
||||
npm run tauri build
|
||||
# Output: src-tauri/target/release/bundle/macos/
|
||||
## Notable Behavior
|
||||
|
||||
### Sync model
|
||||
|
||||
- Note files are synced through WebDAV
|
||||
- Favorite status is synced through the Nextcloud Notes API
|
||||
- Notes are cached locally and can still be viewed when offline
|
||||
- Background sync runs periodically while the app is open
|
||||
|
||||
### PDF export
|
||||
|
||||
- In Electron, the toolbar export action saves a PDF directly to disk
|
||||
- Embedded note images are resolved before export when possible
|
||||
|
||||
### Category colors
|
||||
|
||||
- Category color preferences are stored in `.category-colors.json` inside your Nextcloud Notes WebDAV folder
|
||||
|
||||
## Project Structure
|
||||
|
||||
```text
|
||||
electron/ Electron main process and preload bridge
|
||||
src/api/ Nextcloud API and WebDAV client logic
|
||||
src/components/ React UI
|
||||
src/db/ Local IndexedDB cache
|
||||
src/services/ Desktop runtime helpers and sync logic
|
||||
src/printExport.ts Shared print/PDF document generation
|
||||
```
|
||||
|
||||
### Linux
|
||||
```bash
|
||||
npm run tauri build
|
||||
# Output: src-tauri/target/release/bundle/appimage/ or .deb
|
||||
```
|
||||
## Security Notes
|
||||
|
||||
### Windows
|
||||
```bash
|
||||
npm run tauri build
|
||||
# Output: src-tauri/target/release/bundle/msi/
|
||||
```
|
||||
- Electron runs with `contextIsolation: true`
|
||||
- `nodeIntegration` is disabled in renderer windows
|
||||
- Network requests that need desktop privileges are routed through Electron IPC instead of renderer-side browser fetch
|
||||
|
||||
## Tech Stack
|
||||
Current limitation:
|
||||
|
||||
- **Tauri**: Rust-based native wrapper (~600KB)
|
||||
- **React 18**: UI framework
|
||||
- **TypeScript**: Type safety
|
||||
- **TailwindCSS**: Utility-first styling
|
||||
- **Vite**: Fast build tool
|
||||
- Login credentials are still persisted in `localStorage`
|
||||
|
||||
## Advantages over Native Swift App
|
||||
That is convenient for development, but it is not the right long-term storage mechanism for a production desktop app. A future improvement should move credentials into the OS keychain or another secure secret store.
|
||||
|
||||
- ✅ **Cross-platform**: One codebase for macOS, Linux, Windows
|
||||
- ✅ **No SwiftUI state issues**: React's state management is mature
|
||||
- ✅ **Smaller binary**: Tauri is much lighter than Electron
|
||||
- ✅ **Easier to maintain**: Web technologies vs platform-specific code
|
||||
- ✅ **No Xcode required**: Build on any platform
|
||||
## Packaging
|
||||
|
||||
## Recommended IDE Setup
|
||||
Electron packaging is set up with `electron-builder`.
|
||||
|
||||
- [VS Code](https://code.visualstudio.com/) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer)
|
||||
Current packaging commands:
|
||||
|
||||
- `npm run dist:dir` creates an unpacked app bundle in `release/`
|
||||
- `npm run dist:mac` creates macOS `.dmg` and `.zip` artifacts in `release/`
|
||||
|
||||
The current mac build is unsigned and not notarized, which is fine for local use and testing but not enough for friction-free public distribution through Gatekeeper.
|
||||
|
||||
Windows and Linux targets are also configured in `package.json`, but they have not been validated in this repository yet.
|
||||
|
||||
## Legacy Tauri Script
|
||||
|
||||
There is still a `npm run tauri` script in `package.json`, but the README and current workflow are centered on Electron.
|
||||
|
||||
## License
|
||||
|
||||
No license file is currently included in this repository.
|
||||
|
||||
Reference in New Issue
Block a user