Skip to content

Commit 155b6fb

Browse files
author
FileShot
committed
v1.4.5 - Fix logo, icons, colors, explorer width, drag-drop to online
1 parent 72b447a commit 155b6fb

6 files changed

Lines changed: 122 additions & 10 deletions

File tree

main.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,18 @@ ipcMain.handle('open-external', async (_event, url) => {
10111011
}
10121012
});
10131013

1014+
// Handle files dragged onto the Online webview - trigger upload in the webview
1015+
ipcMain.handle('upload-files-to-online', async (_event, paths) => {
1016+
if (!mainWindow || !paths || !paths.length) return { success: false };
1017+
try {
1018+
// Send file paths to the renderer which will handle the webview interaction
1019+
mainWindow.webContents.send('trigger-online-upload', paths);
1020+
return { success: true };
1021+
} catch (e) {
1022+
return { success: false, error: e.message || String(e) };
1023+
}
1024+
});
1025+
10141026
ipcMain.handle('vault-list', async () => {
10151027
const items = getVaultItems();
10161028
return { items, totalBytes: vaultTotalBytes(items) };

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fileshot-desktop",
3-
"version": "1.4.4",
3+
"version": "1.4.5",
44
"description": "FileShot.io Desktop Application - Fast, Private File Sharing",
55
"main": "main.js",
66
"scripts": {

preload.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,16 @@ contextBridge.exposeInMainWorld('electronAPI', {
9191
ipcRenderer.on('start-upload', (event, filePaths) => callback(filePaths));
9292
},
9393

94+
// Upload files to online (triggers drop zone in webview)
95+
uploadFilesToOnline: (paths) => ipcRenderer.invoke('upload-files-to-online', paths),
96+
97+
// Receive trigger to upload files in the online webview
98+
onTriggerOnlineUpload: (callback) => {
99+
ipcRenderer.on('trigger-online-upload', (_event, paths) => {
100+
try { callback(paths); } catch (_) {}
101+
});
102+
},
103+
94104
// Platform info
95105
platform: process.platform,
96106
isDesktop: true

renderer/local/app.js

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,6 +1948,50 @@ function initOnlineTool() {
19481948
wv.addEventListener('did-navigate', () => setUrlLabel(wv.getURL()));
19491949
wv.addEventListener('did-navigate-in-page', () => setUrlLabel(wv.getURL()));
19501950

1951+
// Enable drag-drop onto webview for file uploads
1952+
const onlineFrame = wv.closest('.online-frame');
1953+
if (onlineFrame) {
1954+
onlineFrame.addEventListener('dragover', (e) => {
1955+
e.preventDefault();
1956+
e.stopPropagation();
1957+
e.dataTransfer.dropEffect = 'copy';
1958+
});
1959+
1960+
onlineFrame.addEventListener('drop', (e) => {
1961+
e.preventDefault();
1962+
e.stopPropagation();
1963+
1964+
// Handle in-app drag from explorer
1965+
const itemsJson = e.dataTransfer?.getData('application/x-fileshot-items');
1966+
if (itemsJson) {
1967+
let items;
1968+
try { items = JSON.parse(itemsJson); } catch (_) { items = null; }
1969+
const list = Array.isArray(items) ? items : [];
1970+
const paths = list.map(it => String(it?.path || '')).filter(Boolean);
1971+
if (paths.length) {
1972+
triggerWebviewFileUpload(wv, paths);
1973+
}
1974+
return;
1975+
}
1976+
1977+
// Handle OS-level file drop
1978+
const files = e.dataTransfer?.files;
1979+
if (files && files.length > 0) {
1980+
const paths = Array.from(files).map(f => f.path).filter(Boolean);
1981+
if (paths.length) {
1982+
triggerWebviewFileUpload(wv, paths);
1983+
}
1984+
}
1985+
});
1986+
}
1987+
1988+
// Handle online upload trigger from main process
1989+
window.electronAPI?.onTriggerOnlineUpload?.((paths) => {
1990+
if (paths && paths.length) {
1991+
triggerWebviewFileUpload(wv, paths);
1992+
}
1993+
});
1994+
19511995
const backBtn = DOM.onlineBackBtn();
19521996
const fwdBtn = DOM.onlineForwardBtn();
19531997
const reloadBtn = DOM.onlineReloadBtn();
@@ -2024,4 +2068,51 @@ function explorerRefresh() {
20242068
}
20252069
}
20262070

2071+
// ============================================================================
2072+
// WEBVIEW FILE UPLOAD TRIGGER
2073+
// ============================================================================
2074+
2075+
/**
2076+
* Trigger file upload in the online webview by injecting a script
2077+
* that simulates a file drop on the dropzone.
2078+
*/
2079+
function triggerWebviewFileUpload(wv, paths) {
2080+
if (!wv || !paths || !paths.length) return;
2081+
2082+
// We need to use executeJavaScript to trigger the file input in the webview
2083+
// The webview has a dropzone that accepts files
2084+
const script = `
2085+
(function() {
2086+
// Look for file input or dropzone
2087+
const dropzone = document.querySelector('.upload-dropzone, .dropzone, [class*="drop"]');
2088+
const fileInput = document.querySelector('input[type="file"]');
2089+
2090+
if (fileInput) {
2091+
// Click the file input to trigger native file dialog
2092+
// Note: We can't programmatically set files due to security
2093+
fileInput.click();
2094+
console.log('[FileShot Desktop] Triggered file input click for upload');
2095+
} else if (dropzone) {
2096+
// Visual indicator that drop was received
2097+
dropzone.style.outline = '3px solid #f97316';
2098+
setTimeout(() => { dropzone.style.outline = ''; }, 1500);
2099+
console.log('[FileShot Desktop] Files received - use Choose Files button');
2100+
}
2101+
2102+
// Show a notification
2103+
const msg = document.createElement('div');
2104+
msg.style.cssText = 'position:fixed;top:20px;left:50%;transform:translateX(-50%);background:#f97316;color:#fff;padding:12px 24px;border-radius:8px;z-index:99999;font-weight:600;box-shadow:0 4px 20px rgba(0,0,0,0.3);';
2105+
msg.textContent = 'Files received! Click "Choose Files" to select them.';
2106+
document.body.appendChild(msg);
2107+
setTimeout(() => msg.remove(), 3000);
2108+
})();
2109+
`;
2110+
2111+
try {
2112+
wv.executeJavaScript(script);
2113+
} catch (e) {
2114+
console.error('[FileShot Desktop] Failed to trigger webview upload:', e);
2115+
}
2116+
}
2117+
20272118
// Legacy hook removed: online is now embedded inside the local shell.

renderer/local/index.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@
4545
<div class="tools-menu" id="toolsMenu">
4646
<button class="nav-item tools-toggle" type="button" id="btnToolsToggle" aria-expanded="false">
4747
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
48-
<path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l2.1-2.1a2 2 0 0 0 0-2.8l-1.2-1.2a2 2 0 0 0-2.8 0l-2.1 2.1z"></path>
49-
<path d="M8 7H4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2v-4"></path>
48+
<path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"></path>
5049
</svg>
5150
<span>Tools</span>
5251
<svg class="chev" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
@@ -89,7 +88,7 @@
8988
<button class="nav-item" data-tool="settings">
9089
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
9190
<circle cx="12" cy="12" r="3"></circle>
92-
<path d="M12 1v6m0 6v6M4.22 4.22l4.24 4.24m3.08 3.08l4.24 4.24M1 12h6m6 0h6M4.22 19.78l4.24-4.24m3.08-3.08l4.24-4.24"></path>
91+
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path>
9392
</svg>
9493
<span>Settings</span>
9594
</button>

renderer/local/styles.css

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
:root {
22
color-scheme: dark;
3-
--bg: #0a0e13;
4-
--bg-secondary: #0f131a;
3+
--bg: #0a0a0a;
4+
--bg-secondary: #111111;
55
--panel: rgba(255,255,255,0.04);
66
--panel-hover: rgba(255,255,255,0.07);
77
--border: rgba(255,255,255,0.09);
8-
--text: #e8eef6;
9-
--text-secondary: rgba(232,238,246,0.68);
8+
--text: #f0f0f0;
9+
--text-secondary: rgba(240,240,240,0.68);
1010
--accent: #f97316;
1111
--accent-hover: #ea580c;
1212
--ok: #10b981;
1313
--sidebar-width: 220px;
1414
--sidebar-width-collapsed: 60px;
15-
--explorer-width: 280px;
15+
--explorer-width: 320px;
1616
}
1717

1818
* { box-sizing: border-box; }
@@ -30,7 +30,7 @@ body {
3030
.sidebar { width: var(--sidebar-width); background: var(--bg-secondary); border-right: 1px solid var(--border); display: flex; flex-direction: column; transition: width 0.3s ease; overflow: hidden; }
3131
.sidebar.collapsed { width: var(--sidebar-width-collapsed); }
3232
.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 12px; border-bottom: 1px solid var(--border); }
33-
.logo-img { height: 28px; width: auto; object-fit: contain; border-radius: 4px; }
33+
.logo-img { height: 22px; width: auto; object-fit: contain; border-radius: 3px; }
3434
.btn-collapse { background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: 8px; display: flex; border-radius: 8px; transition: background 0.2s; }
3535
.btn-collapse:hover { background: var(--panel-hover); }
3636
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 12px; overflow-y: auto; }

0 commit comments

Comments
 (0)