Skip to content

Commit f365e3e

Browse files
committed
fixup desktop app
1 parent f75abb7 commit f365e3e

File tree

8 files changed

+2382
-156
lines changed

8 files changed

+2382
-156
lines changed

desktop/README.md

Lines changed: 57 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -1,152 +1,85 @@
1-
# PDF Converter Desktop App
1+
# Convert2Doc Desktop App
22

3-
A cross-platform desktop application that wraps the PDF Converter PWA in an Electron shell. This app provides a native desktop experience for Windows, macOS, and Linux users.
3+
This is the desktop application for Convert2Doc, which wraps the web application in an Electron shell.
44

5-
## Features
6-
7-
- Loads the PWA from the URL specified in the project's root .env file
8-
- Native desktop integration
9-
- Cross-platform support (Windows, macOS, Linux)
10-
- Custom application menu
11-
- External link handling
12-
- Offline capabilities (when the PWA supports it)
13-
14-
## Development Requirements
5+
## Development Setup
156

16-
- Node.js 16.x or later
17-
- npm or yarn
18-
- dotenv (for .env file parsing)
7+
### Prerequisites
198

20-
## Getting Started
9+
- Node.js (v14 or later)
10+
- npm or pnpm
2111

22-
1. Install dependencies:
23-
```
24-
cd desktop
25-
npm install
26-
```
27-
28-
2. Run the app in development mode:
29-
```
30-
npm start
31-
```
12+
### Running the App
3213

33-
## Building for Production
14+
#### Using the provided scripts
3415

35-
### All Platforms
16+
The easiest way to run the app is to use one of the provided scripts:
3617

37-
To build for all platforms (that your current OS supports):
18+
```bash
19+
# Using npm
20+
./run.sh
3821

22+
# Using pnpm
23+
./run-pnpm.sh
3924
```
40-
npm run build
41-
```
42-
43-
### Platform-Specific Builds
44-
45-
#### Windows
46-
47-
```
48-
npm run build:win
49-
```
50-
51-
This will generate:
52-
- NSIS installer (.exe)
53-
- Portable executable (.exe)
5425

55-
#### macOS
26+
These scripts will automatically install dependencies if needed and start the app.
5627

57-
```
58-
npm run build:mac
59-
```
28+
#### Manual setup
6029

61-
This will generate:
62-
- DMG installer (.dmg)
63-
- ZIP archive (.zip)
64-
65-
#### Linux
66-
67-
```
68-
npm run build:linux
69-
```
30+
1. Install dependencies:
31+
```bash
32+
# Using npm
33+
npm install
34+
35+
# Using pnpm
36+
pnpm install
37+
```
7038

71-
This will generate:
72-
- AppImage (.AppImage)
73-
- Debian package (.deb)
74-
- RPM package (.rpm)
39+
2. Start the app:
40+
```bash
41+
# Using npm
42+
npm start
43+
44+
# Using pnpm
45+
pnpm start
46+
```
7547

7648
## Configuration
7749

78-
The app reads the PWA URL from the `API_BASE_URL` variable in the project's root `.env` file. This allows you to easily switch between different environments (development, staging, production) by modifying a single configuration file.
79-
80-
### .env Configuration
50+
The app will connect to the Convert2Doc web application. The URL is determined in the following order:
8151

82-
In the project root's `.env` file:
52+
1. From the `API_BASE_URL` environment variable
53+
2. From the `API_BASE_URL` in the `.env` file in the project root
54+
3. Fallback to the hardcoded URL: `https://convert2doc.com`
8355

84-
```
85-
API_BASE_URL=https://profullstack.com/pdf
86-
```
87-
88-
### How It Works
89-
90-
The `config.js` file reads the API_BASE_URL from the .env file:
91-
92-
```javascript
93-
// In src/config.js
94-
function getApiBaseUrl() {
95-
try {
96-
// Try to find the .env file in the project root
97-
const rootPath = path.resolve(__dirname, '../../');
98-
const envPath = path.join(rootPath, '.env');
99-
100-
if (fs.existsSync(envPath)) {
101-
// Parse .env file
102-
const envConfig = dotenv.parse(fs.readFileSync(envPath));
103-
104-
// Return API_BASE_URL if found
105-
if (envConfig.API_BASE_URL) {
106-
return envConfig.API_BASE_URL;
107-
}
108-
}
109-
110-
// Check environment variables as fallback
111-
// ...
112-
113-
// Return default URL if not found
114-
return DEFAULT_API_BASE_URL;
115-
} catch (error) {
116-
// Handle errors
117-
}
118-
}
119-
```
120-
121-
And the main.js uses this configuration:
122-
123-
```javascript
124-
// In src/main.js
125-
const { getApiBaseUrl } = require('./config');
56+
## Features
12657

127-
// URL of the PWA - loaded from .env file
128-
const pwaUrl = getApiBaseUrl();
129-
```
58+
- Access Convert2Doc functionality in a desktop environment
59+
- Native menu with reload, developer tools, and zoom options
60+
- External links open in the default browser
13061

131-
### Application Icons
62+
## Keyboard Shortcuts
13263

133-
Replace the placeholder icon files in the `assets` directory with your own icons:
134-
- `icon.png` (512x512 PNG for Linux)
135-
- `icon.ico` (Windows icon)
136-
- `icon.icns` (macOS icon)
64+
- Reload: `Ctrl+R` (Windows/Linux) or `Cmd+R` (macOS)
65+
- Developer Tools: `Ctrl+Shift+I` (Windows/Linux) or `Cmd+Alt+I` (macOS)
66+
- Zoom In: `Ctrl++` (Windows/Linux) or `Cmd++` (macOS)
67+
- Zoom Out: `Ctrl+-` (Windows/Linux) or `Cmd+-` (macOS)
68+
- Reset Zoom: `Ctrl+0` (Windows/Linux) or `Cmd+0` (macOS)
69+
- Fullscreen: `F11` (Windows/Linux) or `Ctrl+Cmd+F` (macOS)
13770

138-
## Project Structure
71+
## Building
13972

140-
- `src/main.js`: Main process script
141-
- `src/config.js`: Configuration module that reads from the .env file
142-
- `src/preload.js`: Preload script for secure renderer process
143-
- `assets/`: Application icons and resources
144-
- `package.json`: Project configuration and dependencies
73+
Building the app is currently experiencing issues. We recommend running the app in development mode using the provided scripts.
14574

146-
## Packaging and Distribution
75+
If you want to attempt building, you can try:
14776

148-
The app is configured to be packaged using electron-builder. The configuration in `package.json` specifies the build targets for each platform.
77+
```bash
78+
# Using npm
79+
npm run build
14980

150-
## License
81+
# Using pnpm
82+
pnpm build
83+
```
15184

152-
MIT
85+
Note that building may hang or fail due to missing icon files or other configuration issues.

desktop/package.json

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "pdf-converter-desktop",
2+
"name": "convert2doc-desktop",
33
"version": "1.0.0",
4-
"description": "PDF Converter Desktop App",
4+
"description": "Convert2Doc Desktop App",
55
"main": "src/main.js",
66
"scripts": {
77
"start": "electron .",
@@ -10,8 +10,9 @@
1010
"build:mac": "electron-builder --mac",
1111
"build:linux": "electron-builder --linux"
1212
},
13-
"author": "ProFullStack",
13+
"author": "ProFullStack <[email protected]>",
1414
"license": "MIT",
15+
"homepage": "https://convert2doc.com",
1516
"devDependencies": {
1617
"electron": "^25.0.0",
1718
"electron-builder": "^24.0.0"
@@ -20,8 +21,8 @@
2021
"dotenv": "^16.0.3"
2122
},
2223
"build": {
23-
"appId": "com.profullstack.pdfconverter",
24-
"productName": "PDF Converter",
24+
"appId": "com.convert2doc.app",
25+
"productName": "Convert2Doc",
2526
"directories": {
2627
"output": "dist"
2728
},
@@ -30,29 +31,10 @@
3031
"assets/**/*",
3132
"package.json"
3233
],
33-
"mac": {
34-
"category": "public.app-category.productivity",
35-
"target": [
36-
"dmg",
37-
"zip"
38-
],
39-
"icon": "assets/icon.icns"
40-
},
41-
"win": {
42-
"target": [
43-
"nsis",
44-
"portable"
45-
],
46-
"icon": "assets/icon.ico"
47-
},
4834
"linux": {
49-
"target": [
50-
"AppImage",
51-
"deb",
52-
"rpm"
53-
],
35+
"target": ["AppImage"],
5436
"category": "Office",
55-
"icon": "assets/icon.png"
37+
"maintainer": "ProFullStack <[email protected]>"
5638
}
5739
}
5840
}

0 commit comments

Comments
 (0)