Skip to content

Commit d5b28fa

Browse files
author
FileShot
committed
Fix missing archiver-utils dependency in v2.0.1
Add archiver-utils as explicit dependency to fix app launch error Bump version to 2.0.1 Add deploy-desktop-downloads.js script for easier deployment
1 parent 586f0b3 commit d5b28fa

3 files changed

Lines changed: 241 additions & 1 deletion

File tree

package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fileshot-desktop-v2",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "FileShot Desktop V2 — Next-Gen Encrypted File Sharing",
55
"main": "main.js",
66
"scripts": {
@@ -79,6 +79,7 @@
7979
"electron-updater": "^6.3.0",
8080
"form-data": "^4.0.0",
8181
"archiver": "^7.0.1",
82+
"archiver-utils": "^5.0.2",
8283
"extract-zip": "^2.0.1"
8384
},
8485
"devDependencies": {
Lines changed: 238 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
1+
/*
2+
Deploy desktop build artifacts to the public downloads directory.
3+
4+
This replaces the old ZKE upload approach. Files are served as direct downloads
5+
from /downloads/desktop/{windows,macos,linux}/ via the frontend static server.
6+
7+
Usage:
8+
node scripts/deploy-desktop-downloads.js
9+
node scripts/deploy-desktop-downloads.js --ci # use _ci_artifacts
10+
node scripts/deploy-desktop-downloads.js --dist # use dist/ (local build)
11+
node scripts/deploy-desktop-downloads.js --version 2.1.0 # override version
12+
13+
What it does:
14+
1. Finds build artifacts (exe, dmg, zip, AppImage, deb)
15+
2. Copies them to public_html/public_html/downloads/desktop/{platform}/
16+
3. Creates "latest" aliases (FileShot-Setup-latest.exe, etc.)
17+
4. Updates version.json with direct download paths
18+
5. Copies electron-updater YAML files (latest.yml, latest-mac.yml, latest-linux.yml)
19+
*/
20+
21+
'use strict';
22+
23+
const fs = require('fs');
24+
const path = require('path');
25+
26+
const PROJECT_ROOT = path.resolve(__dirname, '..');
27+
const FILESHOT_ROOT = path.resolve(PROJECT_ROOT, '..');
28+
const PUBLIC_DOWNLOADS = path.join(FILESHOT_ROOT, 'public_html', 'public_html', 'downloads', 'desktop');
29+
30+
const PLATFORM_DIRS = {
31+
windows: path.join(PUBLIC_DOWNLOADS, 'windows'),
32+
macos: path.join(PUBLIC_DOWNLOADS, 'macos'),
33+
linux: path.join(PUBLIC_DOWNLOADS, 'linux'),
34+
};
35+
36+
function parseArgs() {
37+
const args = process.argv.slice(2);
38+
const opts = { source: 'ci', version: null };
39+
40+
for (let i = 0; i < args.length; i++) {
41+
if (args[i] === '--ci') opts.source = 'ci';
42+
else if (args[i] === '--dist') opts.source = 'dist';
43+
else if (args[i] === '--version' && args[i + 1]) opts.version = args[++i];
44+
}
45+
46+
return opts;
47+
}
48+
49+
function getVersion(override) {
50+
if (override) return override;
51+
try {
52+
const pkg = JSON.parse(fs.readFileSync(path.join(PROJECT_ROOT, 'package.json'), 'utf8'));
53+
return pkg.version || '0.0.0';
54+
} catch {
55+
return '0.0.0';
56+
}
57+
}
58+
59+
function ensureDir(dir) {
60+
if (!fs.existsSync(dir)) {
61+
fs.mkdirSync(dir, { recursive: true });
62+
console.log(` Created: ${dir}`);
63+
}
64+
}
65+
66+
function copyFile(src, dest) {
67+
fs.copyFileSync(src, dest);
68+
const sizeMB = (fs.statSync(dest).size / (1024 * 1024)).toFixed(1);
69+
console.log(` ${path.basename(dest)} (${sizeMB} MB)`);
70+
}
71+
72+
function findArtifacts(source) {
73+
const artifacts = { windows: [], macos: [], linux: [] };
74+
75+
if (source === 'ci') {
76+
const ciDir = path.join(PROJECT_ROOT, '_ci_artifacts');
77+
if (!fs.existsSync(ciDir)) {
78+
throw new Error(`CI artifacts directory not found: ${ciDir}\nRun GitHub Actions build first, then download artifacts.`);
79+
}
80+
81+
const winDir = path.join(ciDir, 'dist-windows-latest');
82+
const macDir = path.join(ciDir, 'dist-macos-latest');
83+
const linuxDir = path.join(ciDir, 'dist-ubuntu-latest');
84+
85+
if (fs.existsSync(winDir)) {
86+
for (const f of fs.readdirSync(winDir)) {
87+
artifacts.windows.push(path.join(winDir, f));
88+
}
89+
}
90+
if (fs.existsSync(macDir)) {
91+
for (const f of fs.readdirSync(macDir)) {
92+
artifacts.macos.push(path.join(macDir, f));
93+
}
94+
}
95+
if (fs.existsSync(linuxDir)) {
96+
for (const f of fs.readdirSync(linuxDir)) {
97+
artifacts.linux.push(path.join(linuxDir, f));
98+
}
99+
}
100+
} else {
101+
const distDir = path.join(PROJECT_ROOT, 'dist');
102+
if (!fs.existsSync(distDir)) {
103+
throw new Error(`dist directory not found: ${distDir}\nRun 'npm run build' first.`);
104+
}
105+
106+
for (const f of fs.readdirSync(distDir)) {
107+
const full = path.join(distDir, f);
108+
if (!fs.statSync(full).isFile()) continue;
109+
const lower = f.toLowerCase();
110+
111+
if (lower.endsWith('.exe') || lower === 'latest.yml') {
112+
artifacts.windows.push(full);
113+
} else if (lower.endsWith('.dmg') || lower.endsWith('-mac.zip') || lower === 'latest-mac.yml' || (lower.endsWith('.blockmap') && lower.includes('mac'))) {
114+
artifacts.macos.push(full);
115+
} else if (lower.endsWith('.appimage') || lower.endsWith('.deb') || lower === 'latest-linux.yml') {
116+
artifacts.linux.push(full);
117+
}
118+
}
119+
}
120+
121+
return artifacts;
122+
}
123+
124+
function deployPlatform(platformName, files, destDir, version) {
125+
if (files.length === 0) {
126+
console.log(` [${platformName}] No artifacts found, skipping.`);
127+
return null;
128+
}
129+
130+
ensureDir(destDir);
131+
132+
const result = { downloadPath: null, artifactName: null };
133+
const extras = {};
134+
135+
for (const src of files) {
136+
const name = path.basename(src);
137+
const lower = name.toLowerCase();
138+
const dest = path.join(destDir, name);
139+
140+
// Skip debug/build metadata files
141+
if (lower === 'builder-debug.yml' || lower === 'builder-effective-config.yaml') continue;
142+
143+
copyFile(src, dest);
144+
145+
// Create "latest" aliases for the primary installers
146+
if (platformName === 'windows' && lower.endsWith('.exe') && lower.includes('setup')) {
147+
const latest = path.join(destDir, 'FileShot-Setup-latest.exe');
148+
copyFile(src, latest);
149+
result.downloadPath = `/downloads/desktop/windows/FileShot-Setup-latest.exe`;
150+
result.artifactName = name;
151+
}
152+
153+
if (platformName === 'macos') {
154+
if (lower.endsWith('-mac.zip')) {
155+
result.downloadPath = `/downloads/desktop/macos/${name}`;
156+
result.artifactName = name;
157+
}
158+
if (lower.endsWith('.dmg') && !lower.endsWith('.blockmap')) {
159+
const latest = path.join(destDir, 'FileShot-latest.dmg');
160+
copyFile(src, latest);
161+
extras.dmgZipPath = `/downloads/desktop/macos/FileShot-latest.dmg`;
162+
extras.dmgZipName = name;
163+
}
164+
}
165+
166+
if (platformName === 'linux') {
167+
if (lower.endsWith('.appimage')) {
168+
const latest = path.join(destDir, 'FileShot-latest.AppImage');
169+
copyFile(src, latest);
170+
result.downloadPath = `/downloads/desktop/linux/FileShot-latest.AppImage`;
171+
result.artifactName = name;
172+
}
173+
if (lower.endsWith('.deb')) {
174+
extras.debZipPath = `/downloads/desktop/linux/${name}`;
175+
extras.debZipName = name;
176+
}
177+
}
178+
}
179+
180+
return { ...result, ...extras };
181+
}
182+
183+
function writeVersionJson(version, platforms) {
184+
const versionJson = {
185+
version,
186+
updatedAt: new Date().toISOString().replace(/\.\d{3}Z$/, 'Z'),
187+
source: `deploy-script:v${version}`,
188+
};
189+
190+
if (platforms.windows) versionJson.windows = platforms.windows;
191+
if (platforms.macos) versionJson.macos = platforms.macos;
192+
if (platforms.linux) versionJson.linux = platforms.linux;
193+
194+
const dest = path.join(PUBLIC_DOWNLOADS, 'version.json');
195+
fs.writeFileSync(dest, JSON.stringify(versionJson, null, 2) + '\n', 'utf8');
196+
console.log(`\n version.json updated -> ${dest}`);
197+
return versionJson;
198+
}
199+
200+
function main() {
201+
const opts = parseArgs();
202+
const version = getVersion(opts.version);
203+
204+
console.log('=== FileShot Desktop Deploy ===');
205+
console.log(` Version: ${version}`);
206+
console.log(` Source: ${opts.source === 'ci' ? '_ci_artifacts/' : 'dist/'}`);
207+
console.log(` Target: ${PUBLIC_DOWNLOADS}`);
208+
console.log('');
209+
210+
const artifacts = findArtifacts(opts.source);
211+
212+
console.log('[Windows]');
213+
const win = deployPlatform('windows', artifacts.windows, PLATFORM_DIRS.windows, version);
214+
215+
console.log('\n[macOS]');
216+
const mac = deployPlatform('macos', artifacts.macos, PLATFORM_DIRS.macos, version);
217+
218+
console.log('\n[Linux]');
219+
const linux = deployPlatform('linux', artifacts.linux, PLATFORM_DIRS.linux, version);
220+
221+
const platforms = {};
222+
if (win && win.downloadPath) platforms.windows = win;
223+
if (mac && mac.downloadPath) platforms.macos = mac;
224+
if (linux && linux.downloadPath) platforms.linux = linux;
225+
226+
const vj = writeVersionJson(version, platforms);
227+
228+
console.log('\n=== Deploy Complete ===');
229+
console.log('');
230+
console.log('Download URLs:');
231+
if (vj.windows) console.log(` Windows: https://fileshot.io${vj.windows.downloadPath}`);
232+
if (vj.macos) console.log(` macOS: https://fileshot.io${vj.macos.downloadPath}`);
233+
if (vj.linux) console.log(` Linux: https://fileshot.io${vj.linux.downloadPath}`);
234+
console.log('');
235+
console.log('Desktop page: https://fileshot.io/desktop');
236+
}
237+
238+
main();

0 commit comments

Comments
 (0)