-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
151 lines (143 loc) · 4.67 KB
/
index.ts
File metadata and controls
151 lines (143 loc) · 4.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
import express from 'express';
import path from 'path';
import fs from 'fs';
const app = express();
const PORT = process.env.PORT || 3000;
app.use(express.static('public'));
// Mode selection page
app.get('/', (req, res) => {
res.send(`
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DNG to PNG Converter</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 800px;
margin: 0 auto;
padding: 20px;
background-color: #f5f5f5;
}
.container {
background: white;
padding: 30px;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
text-align: center;
}
h1 {
color: #333;
margin-bottom: 20px;
}
.mode-selection {
display: flex;
gap: 20px;
justify-content: center;
margin-top: 30px;
}
.mode-card {
background: #fff;
border: 2px solid #e0e0e0;
border-radius: 10px;
padding: 30px;
text-decoration: none;
color: #333;
transition: all 0.3s ease;
flex: 1;
max-width: 300px;
}
.mode-card:hover {
border-color: #007bff;
transform: translateY(-5px);
box-shadow: 0 5px 15px rgba(0,123,255,0.3);
}
.mode-icon {
font-size: 48px;
margin-bottom: 15px;
}
.mode-title {
font-size: 24px;
font-weight: bold;
margin-bottom: 10px;
color: #007bff;
}
.mode-description {
color: #666;
line-height: 1.5;
}
.features {
margin-top: 20px;
text-align: left;
}
.features ul {
list-style: none;
padding: 0;
}
.features li {
margin: 5px 0;
padding-left: 20px;
position: relative;
}
.features li:before {
content: "✓";
position: absolute;
left: 0;
color: #28a745;
font-weight: bold;
}
</style>
</head>
<body>
<div class="container">
<h1>🔄 DNG to PNG Converter</h1>
<p>Choose your preferred conversion mode:</p>
<div class="mode-selection">
<a href="/api-mode" class="mode-card">
<div class="mode-icon">🌐</div>
<div class="mode-title">API Mode</div>
<div class="mode-description">
Server-side conversion with high-quality processing
</div>
<div class="features">
<ul>
<li>Full dcraw + Sharp processing</li>
<li>High-quality PNG output</li>
<li>Large file support</li>
<li>Reliable conversion</li>
</ul>
</div>
</a>
<a href="/wasm-mode" class="mode-card">
<div class="mode-icon">⚡</div>
<div class="mode-title">WASM Mode</div>
<div class="mode-description">
Client-side conversion using WebAssembly
</div>
<div class="features">
<ul>
<li>Fast browser processing</li>
<li>No server upload needed</li>
<li>Privacy-focused</li>
<li>Offline capable</li>
</ul>
</div>
</a>
</div>
</div>
</body>
</html>
`);
});
// API Mode routes
app.use('/api-mode', require('./api-mode/server'));
// WASM Mode route
app.get('/wasm-mode', (req, res) => {
res.sendFile(path.join(__dirname, '../public/wasm-mode.html'));
});
app.listen(PORT, () => {
console.log(`🚀 DNG to PNG Converter running on http://localhost:${PORT}`);
console.log(`📋 Choose between API mode and WASM mode`);
});