mirror of
https://github.com/mileswolfallen2/OmniEmu2.0.git
synced 2026-12-06 16:43:54 +00:00
feat: Add cloud sync functionality with Syncthing integration
- Implemented cloud sync for game saves, allowing users to sync saves between devices. - Added UI components for managing sync status and toggling sync for individual emulators. - Enhanced SaveManagerPage to display sync status and enable/disable sync for emulator save directories. - Introduced new types for Syncthing folders and updated relevant components to handle cloud sync data. - Updated SettingsPage to reflect new beta features related to cloud sync. - Added new styles for sync-related badges in styles.css. - Introduced decompilation support with a new decomps module, including installation and management of decomp projects. - Added support for various decompilation projects with GitHub integration for downloading and installing. - Updated release notes for version 0.3.0 to include new features and bug fixes.
This commit is contained in:
1 parent
cc14a72f9c
commit
dc5f7e06ae
16 files changed
+2066
-491
No files matched your search
@@ -1,8 +1,14 @@
|
||||
import React, { useEffect, useState, useCallback, useRef } from 'react';
|
||||
import type { SyncthingStatus } from '../../shared/types';
|
||||
import type { SyncthingStatus, SyncthingPendingDevice, SyncthingPendingFolder } from '../../shared/types';
|
||||
|
||||
type SetupStep = 'install' | 'start' | 'setup' | 'ready';
|
||||
|
||||
interface EmuDir {
|
||||
id: string;
|
||||
name: string;
|
||||
saves: string | null;
|
||||
}
|
||||
|
||||
export function CloudSyncPage() {
|
||||
const [status, setStatus] = useState<SyncthingStatus | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
@@ -14,41 +20,64 @@ export function CloudSyncPage() {
|
||||
const [remoteDeviceId, setRemoteDeviceId] = useState('');
|
||||
const [remoteDeviceName, setRemoteDeviceName] = useState('');
|
||||
const [addingDevice, setAddingDevice] = useState(false);
|
||||
const [folderLabel, setFolderLabel] = useState('');
|
||||
const [folderPath, setFolderPath] = useState('');
|
||||
const [showAddFolder, setShowAddFolder] = useState(false);
|
||||
const [copied, setCopied] = useState(false);
|
||||
const [cloudEnabled, setCloudEnabled] = useState(false);
|
||||
const uninstallRef = useRef<HTMLTextAreaElement>(null);
|
||||
const [forceReady, setForceReady] = useState(false);
|
||||
const [pendingDevices, setPendingDevices] = useState<SyncthingPendingDevice[]>([]);
|
||||
const [pendingFolders, setPendingFolders] = useState<SyncthingPendingFolder[]>([]);
|
||||
const [pendingFolderPaths, setPendingFolderPaths] = useState<Record<string, string>>({});
|
||||
const [emuDirs, setEmuDirs] = useState<EmuDir[]>([]);
|
||||
const [emuSynced, setEmuSynced] = useState<Record<string, boolean>>({});
|
||||
const [togglingSync, setTogglingSync] = useState('');
|
||||
const [acceptingDevice, setAcceptingDevice] = useState('');
|
||||
const [acceptingFolder, setAcceptingFolder] = useState('');
|
||||
const pollRef = useRef<ReturnType<typeof setInterval> | null>(null);
|
||||
const idRef = useRef<HTMLTextAreaElement>(null);
|
||||
|
||||
const DEFAULT_STATUS: SyncthingStatus = {
|
||||
installed: false, running: false, deviceId: '', apiAddress: '',
|
||||
apiKey: '', version: '', folders: [], remoteDevices: [],
|
||||
};
|
||||
|
||||
const loadStatus = useCallback(async () => {
|
||||
const loadData = useCallback(async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const s = await Promise.race([
|
||||
window.omni.cloud.status(),
|
||||
new Promise<null>((_, reject) => setTimeout(() => reject(new Error('timeout')), 8000)),
|
||||
const [s, cloudStatus, pendingDev, pendingFol, dirs] = await Promise.all([
|
||||
window.omni.settings.get(),
|
||||
window.omni.cloud.status().catch(() => null),
|
||||
window.omni.cloud.pendingDevices().catch(() => [] as SyncthingPendingDevice[]),
|
||||
window.omni.cloud.pendingFolders().catch(() => [] as SyncthingPendingFolder[]),
|
||||
window.omni.cloud.emulatorDirs().catch(() => [] as EmuDir[]),
|
||||
]);
|
||||
if (s) setStatus(s);
|
||||
else setStatus(DEFAULT_STATUS);
|
||||
} catch {
|
||||
setStatus(DEFAULT_STATUS);
|
||||
}
|
||||
setCloudEnabled(!!s.cloudSyncEnabled);
|
||||
if (cloudStatus) {
|
||||
setStatus(cloudStatus);
|
||||
// Determine which emus are synced
|
||||
const synced: Record<string, boolean> = {};
|
||||
for (const d of dirs) {
|
||||
synced[d.id] = cloudStatus.folders.some(f => f.id === `saves-${d.id}`);
|
||||
}
|
||||
setEmuSynced(synced);
|
||||
}
|
||||
setPendingDevices(pendingDev);
|
||||
setPendingFolders(pendingFol);
|
||||
setEmuDirs(dirs);
|
||||
// Auto-resolve folder paths
|
||||
const paths: Record<string, string> = {};
|
||||
for (const fol of pendingFol) {
|
||||
const resolved = await window.omni.cloud.guessPath(fol.folderLabel).catch(() => null);
|
||||
paths[fol.folderId] = resolved || '';
|
||||
}
|
||||
setPendingFolderPaths(paths);
|
||||
} catch { /* ignore */ }
|
||||
setLoading(false);
|
||||
}, []);
|
||||
|
||||
const loadSettings = useCallback(async () => {
|
||||
try {
|
||||
const s = await window.omni.settings.get();
|
||||
setCloudEnabled(!!s.cloudSyncEnabled);
|
||||
} catch { /* ignore */ }
|
||||
}, []);
|
||||
useEffect(() => { loadData(); }, [loadData]);
|
||||
|
||||
useEffect(() => { loadStatus(); loadSettings(); }, [loadStatus, loadSettings]);
|
||||
useEffect(() => {
|
||||
return () => { if (pollRef.current) clearInterval(pollRef.current); };
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const unsub = window.omni.cloud.onInstallProgress((p) => {
|
||||
@@ -56,25 +85,14 @@ export function CloudSyncPage() {
|
||||
setInstallPercent(p.percent);
|
||||
if (p.stage === 'done' || p.stage === 'error') {
|
||||
setInstalling(false);
|
||||
if (p.stage === 'done') {
|
||||
loadStatus();
|
||||
}
|
||||
if (p.stage === 'done') loadData();
|
||||
}
|
||||
});
|
||||
return unsub;
|
||||
}, [loadStatus]);
|
||||
}, [loadData]);
|
||||
|
||||
const showSuccess = (msg: string) => {
|
||||
setSuccess(msg);
|
||||
setError('');
|
||||
setTimeout(() => setSuccess(''), 4000);
|
||||
};
|
||||
|
||||
const showError = (msg: string) => {
|
||||
setError(msg);
|
||||
setSuccess('');
|
||||
setTimeout(() => setError(''), 4000);
|
||||
};
|
||||
const showSuccess = (msg: string) => { setSuccess(msg); setError(''); setTimeout(() => setSuccess(''), 4000); };
|
||||
const showError = (msg: string) => { setError(msg); setSuccess(''); setTimeout(() => setError(''), 4000); };
|
||||
|
||||
const saveCloudEnabled = async (enabled: boolean) => {
|
||||
setCloudEnabled(enabled);
|
||||
@@ -82,189 +100,118 @@ export function CloudSyncPage() {
|
||||
};
|
||||
|
||||
const handleInstall = async () => {
|
||||
setInstalling(true);
|
||||
setInstallPercent(0);
|
||||
setInstallMsg('Starting download...');
|
||||
setInstalling(true); setInstallPercent(0); setInstallMsg('Starting download...');
|
||||
try {
|
||||
const ok = await window.omni.cloud.install();
|
||||
if (!ok) {
|
||||
setInstalling(false);
|
||||
showError('Installation failed');
|
||||
}
|
||||
} catch (err) {
|
||||
setInstalling(false);
|
||||
showError(`Install error: ${err}`);
|
||||
}
|
||||
if (!ok) { setInstalling(false); showError('Installation failed'); }
|
||||
} catch (err) { setInstalling(false); showError(`Install error: ${err}`); }
|
||||
};
|
||||
|
||||
const handleStart = async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
// Start kicks off the process in the background
|
||||
const s = await window.omni.cloud.start();
|
||||
if (s) {
|
||||
setStatus(s);
|
||||
if (s.running) {
|
||||
await saveCloudEnabled(true);
|
||||
showSuccess('Syncthing started! Auto-start enabled.');
|
||||
} else {
|
||||
// Process was kicked off but may need more time — poll
|
||||
if (s.running) { await saveCloudEnabled(true); showSuccess('Syncthing started!'); setLoading(false); }
|
||||
else {
|
||||
let attempts = 0;
|
||||
const poll = setInterval(async () => {
|
||||
pollRef.current = setInterval(async () => {
|
||||
attempts++;
|
||||
try {
|
||||
const latest = await window.omni.cloud.status();
|
||||
setStatus(latest);
|
||||
if (latest.running) {
|
||||
clearInterval(poll);
|
||||
await saveCloudEnabled(true);
|
||||
showSuccess('Syncthing started! Auto-start enabled.');
|
||||
setLoading(false);
|
||||
} else if (attempts >= 15) {
|
||||
clearInterval(poll);
|
||||
showError('Syncthing took too long to start. Check that the binary is not blocked by your OS.');
|
||||
setLoading(false);
|
||||
}
|
||||
} catch {
|
||||
if (attempts >= 15) {
|
||||
clearInterval(poll);
|
||||
showError('Could not reach Syncthing.');
|
||||
setLoading(false);
|
||||
}
|
||||
}
|
||||
if (latest.running) { clearInterval(pollRef.current!); pollRef.current = null; await saveCloudEnabled(true); showSuccess('Syncthing started!'); setLoading(false); }
|
||||
else if (attempts >= 15) { clearInterval(pollRef.current!); pollRef.current = null; showError('Syncthing took too long to start.'); setLoading(false); }
|
||||
} catch { if (attempts >= 15) { clearInterval(pollRef.current!); pollRef.current = null; showError('Could not reach Syncthing.'); setLoading(false); } }
|
||||
}, 1000);
|
||||
}
|
||||
} else {
|
||||
showError('Failed to start Syncthing — binary not found');
|
||||
}
|
||||
} catch (err) {
|
||||
showError(`Start error: ${err}`);
|
||||
}
|
||||
setLoading(false);
|
||||
} else { showError('Failed to start Syncthing'); setLoading(false); }
|
||||
} catch (err) { showError(`Start error: ${err}`); setLoading(false); }
|
||||
};
|
||||
|
||||
const handleStop = async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const s = await window.omni.cloud.stop();
|
||||
setStatus(s);
|
||||
await saveCloudEnabled(false);
|
||||
showSuccess('Syncthing stopped. Auto-start disabled.');
|
||||
} catch (err) {
|
||||
showError(`Stop error: ${err}`);
|
||||
}
|
||||
try { const s = await window.omni.cloud.stop(); setStatus(s); await saveCloudEnabled(false); showSuccess('Syncthing stopped.'); }
|
||||
catch (err) { showError(`Stop error: ${err}`); }
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
const handleAddDevice = async () => {
|
||||
if (!remoteDeviceId.trim()) {
|
||||
showError('Enter a device ID');
|
||||
return;
|
||||
}
|
||||
if (!remoteDeviceId.trim()) { showError('Enter a device ID'); return; }
|
||||
setAddingDevice(true);
|
||||
try {
|
||||
const ok = await window.omni.cloud.addDevice(remoteDeviceId.trim(), remoteDeviceName.trim());
|
||||
if (ok) {
|
||||
showSuccess('Device added! Wait for it to accept, or add this device on the other machine.');
|
||||
setRemoteDeviceId('');
|
||||
setRemoteDeviceName('');
|
||||
loadStatus();
|
||||
} else {
|
||||
showError('Failed to add device');
|
||||
}
|
||||
} catch (err) {
|
||||
showError(`Error: ${err}`);
|
||||
}
|
||||
if (ok) { showSuccess('Device added!'); setRemoteDeviceId(''); setRemoteDeviceName(''); loadData(); }
|
||||
else showError('Failed to add device');
|
||||
} catch (err) { showError(`Error: ${err}`); }
|
||||
setAddingDevice(false);
|
||||
};
|
||||
|
||||
const handleAcceptPendingDevice = async (deviceId: string) => {
|
||||
setAcceptingDevice(deviceId);
|
||||
try {
|
||||
const ok = await window.omni.cloud.acceptPendingDevice(deviceId);
|
||||
if (ok) { showSuccess('Device paired!'); loadData(); } else showError('Failed to accept device');
|
||||
} catch (err) { showError(`Error: ${err}`); }
|
||||
setAcceptingDevice('');
|
||||
};
|
||||
|
||||
const handleAcceptPendingFolder = async (fol: SyncthingPendingFolder) => {
|
||||
const localPath = pendingFolderPaths[fol.folderId];
|
||||
if (!localPath?.trim()) { showError('Set a local path first'); return; }
|
||||
setAcceptingFolder(fol.folderId);
|
||||
try {
|
||||
const ok = await window.omni.cloud.acceptPendingFolder(fol.folderId, fol.folderLabel, localPath.trim(), fol.deviceId);
|
||||
if (ok) { showSuccess(`Folder "${fol.folderLabel}" accepted!`); loadData(); } else showError('Failed to accept folder');
|
||||
} catch (err) { showError(`Error: ${err}`); }
|
||||
setAcceptingFolder('');
|
||||
};
|
||||
|
||||
const handleToggleSync = async (emuId: string, sync: boolean) => {
|
||||
setTogglingSync(emuId);
|
||||
try {
|
||||
const ok = await window.omni.cloud.toggleFolderSync(emuId, sync);
|
||||
if (ok) { showSuccess(sync ? 'Sync enabled' : 'Sync disabled'); loadData(); }
|
||||
else showError('Failed to toggle sync');
|
||||
} catch (err) { showError(`Error: ${err}`); }
|
||||
setTogglingSync('');
|
||||
};
|
||||
|
||||
const handleRemoveDevice = async (deviceId: string) => {
|
||||
try {
|
||||
await window.omni.cloud.removeDevice(deviceId);
|
||||
showSuccess('Device removed');
|
||||
loadStatus();
|
||||
} catch { /* ignore */ }
|
||||
};
|
||||
|
||||
const handleAddFolder = async () => {
|
||||
if (!folderLabel.trim() || !folderPath.trim()) {
|
||||
showError('Enter folder label and path');
|
||||
return;
|
||||
}
|
||||
const id = folderLabel.toLowerCase().replace(/[^a-z0-9]/g, '-');
|
||||
const deviceIds = status?.remoteDevices?.map(d => d.id) || [];
|
||||
try {
|
||||
const ok = await window.omni.cloud.addFolder(id, folderLabel.trim(), folderPath.trim(), deviceIds);
|
||||
if (ok) {
|
||||
showSuccess('Shared folder added');
|
||||
setFolderLabel('');
|
||||
setFolderPath('');
|
||||
setShowAddFolder(false);
|
||||
loadStatus();
|
||||
} else {
|
||||
showError('Failed to add folder');
|
||||
}
|
||||
} catch (err) {
|
||||
showError(`Error: ${err}`);
|
||||
}
|
||||
};
|
||||
|
||||
const handleRemoveFolder = async (folderId: string) => {
|
||||
try {
|
||||
await window.omni.cloud.removeFolder(folderId);
|
||||
showSuccess('Folder removed');
|
||||
loadStatus();
|
||||
} catch { /* ignore */ }
|
||||
try { await window.omni.cloud.removeDevice(deviceId); showSuccess('Device removed'); loadData(); } catch { /* ignore */ }
|
||||
};
|
||||
|
||||
const handleCopyDeviceId = () => {
|
||||
if (status?.deviceId) {
|
||||
navigator.clipboard.writeText(status.deviceId);
|
||||
setCopied(true);
|
||||
setTimeout(() => setCopied(false), 2000);
|
||||
}
|
||||
if (status?.deviceId) { navigator.clipboard.writeText(status.deviceId); setCopied(true); setTimeout(() => setCopied(false), 2000); }
|
||||
};
|
||||
|
||||
const handleCopyApiKey = () => {
|
||||
if (status?.apiKey) {
|
||||
navigator.clipboard.writeText(status.apiKey);
|
||||
showSuccess('API key copied');
|
||||
}
|
||||
};
|
||||
|
||||
const handleOpenWebUI = async () => {
|
||||
await window.omni.cloud.openWebUI();
|
||||
};
|
||||
|
||||
if (loading && !status) {
|
||||
return <div className="loading">Checking Syncthing status...</div>;
|
||||
}
|
||||
if (loading && !status) return <div className="loading">Checking Syncthing status...</div>;
|
||||
|
||||
const installed = status?.installed ?? false;
|
||||
const running = status?.running ?? false;
|
||||
|
||||
// Determine current step
|
||||
let step: SetupStep;
|
||||
if (!installed) step = 'install';
|
||||
else if (!running) step = 'start';
|
||||
else if (!cloudEnabled || (status?.remoteDevices?.length ?? 0) === 0) step = 'setup';
|
||||
else if (!forceReady && (status?.remoteDevices?.length ?? 0) === 0) step = 'setup';
|
||||
else step = 'ready';
|
||||
|
||||
const stepLabel = (s: SetupStep) => s === 'install' ? 'Install' : s === 'start' ? 'Start' : s === 'setup' ? 'Pair' : 'Sync';
|
||||
const stepIdx = (s: SetupStep) => (['install', 'start', 'setup', 'ready'] as SetupStep[]).indexOf(s);
|
||||
const currentIdx = stepIdx(step);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h2 style={{ marginTop: 0, marginBottom: 16 }}>Cloud Sync</h2>
|
||||
<h2 style={{ marginTop: 0, marginBottom: 16 }}>Cloud Sync <span className="badge-beta">Beta</span></h2>
|
||||
<p className="text-muted" style={{ marginBottom: 20 }}>
|
||||
Sync your game saves between devices using Syncthing. Once set up, it runs automatically on launch.
|
||||
Sync your game saves between devices. Once set up, it runs automatically.
|
||||
</p>
|
||||
|
||||
{error && (
|
||||
<div className="info-bar mb-4" style={{ color: 'var(--danger, #ff4444)' }}>{error}</div>
|
||||
)}
|
||||
{success && (
|
||||
<div className="info-bar mb-4" style={{ color: 'var(--success, #44ff44)' }}>{success}</div>
|
||||
)}
|
||||
{error && <div className="info-bar mb-4" style={{ color: 'var(--danger, #ff4444)' }}>{error}</div>}
|
||||
{success && <div className="info-bar mb-4" style={{ color: 'var(--success, #44ff44)' }}>{success}</div>}
|
||||
|
||||
{/* Progress indicator */}
|
||||
{/* Step indicator */}
|
||||
<div style={{
|
||||
display: 'flex', gap: 8, marginBottom: 24, alignItems: 'center',
|
||||
padding: '12px 16px', borderRadius: 10,
|
||||
@@ -275,26 +222,18 @@ export function CloudSyncPage() {
|
||||
<div style={{
|
||||
width: 28, height: 28, borderRadius: '50%', display: 'flex', alignItems: 'center',
|
||||
justifyContent: 'center', fontSize: 12, fontWeight: 700,
|
||||
background: step === s
|
||||
? 'var(--accent)'
|
||||
: (['install', 'start', 'setup', 'ready'].indexOf(step) > i
|
||||
? 'var(--success, #44ff44)' : 'var(--bg-tertiary, #333)'),
|
||||
color: step === s ? '#fff' : 'var(--text-muted, #888)',
|
||||
transition: 'all 0.2s ease',
|
||||
background: step === s ? 'var(--accent)' : currentIdx > i ? 'var(--success, #44ff44)' : 'var(--bg-tertiary, #333)',
|
||||
color: step === s ? '#fff' : 'var(--text-muted, #888)', transition: 'all 0.2s ease',
|
||||
}}>
|
||||
{['install', 'start', 'setup', 'ready'].indexOf(step) > i ? '✓' : i + 1}
|
||||
{currentIdx > i ? '✓' : i + 1}
|
||||
</div>
|
||||
<span style={{
|
||||
fontSize: 12, fontWeight: step === s ? 600 : 400,
|
||||
color: step === s ? 'var(--text)' : 'var(--text-muted, #888)',
|
||||
marginRight: i < 3 ? 8 : 0,
|
||||
color: step === s ? 'var(--text)' : 'var(--text-muted, #888)', marginRight: i < 3 ? 8 : 0,
|
||||
}}>
|
||||
{s === 'install' ? 'Install' : s === 'start' ? 'Start' : s === 'setup' ? 'Pair' : 'Syncing'}
|
||||
{stepLabel(s)}
|
||||
</span>
|
||||
{i < 3 && <div style={{
|
||||
flex: 1, height: 2, background: 'var(--bg-tertiary, #333)',
|
||||
maxWidth: 40,
|
||||
}} />}
|
||||
{i < 3 && <div style={{ flex: 1, height: 2, background: 'var(--bg-tertiary, #333)', maxWidth: 40 }} />}
|
||||
</React.Fragment>
|
||||
))}
|
||||
</div>
|
||||
@@ -308,32 +247,57 @@ export function CloudSyncPage() {
|
||||
border: `1px solid ${cloudEnabled ? 'rgba(68,255,68,0.3)' : 'rgba(255,200,68,0.3)'}`,
|
||||
color: cloudEnabled ? 'var(--success, #44ff44)' : '#ffc844',
|
||||
}}>
|
||||
<span style={{
|
||||
width: 8, height: 8, borderRadius: '50%',
|
||||
background: cloudEnabled ? 'var(--success, #44ff44)' : '#ffc844',
|
||||
}} />
|
||||
<span style={{ width: 8, height: 8, borderRadius: '50%', background: cloudEnabled ? 'var(--success, #44ff44)' : '#ffc844' }} />
|
||||
{cloudEnabled ? 'Cloud sync active' : 'Running — not yet paired'}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Pending Device Requests */}
|
||||
{running && pendingDevices.length > 0 && (
|
||||
<div className="card mb-4" style={{ border: '2px solid rgba(68,200,255,0.4)' }}>
|
||||
<div className="card-header" style={{ background: 'rgba(68,200,255,0.06)' }}>
|
||||
<h3 style={{ margin: 0 }}>⏳ Pending Device Requests</h3>
|
||||
</div>
|
||||
<div style={{ padding: 12 }}>
|
||||
{pendingDevices.map(dev => (
|
||||
<div key={dev.id} style={{
|
||||
display: 'flex', alignItems: 'center', justifyContent: 'space-between',
|
||||
padding: '10px 12px', borderRadius: 8,
|
||||
border: '1px solid rgba(68,200,255,0.25)', marginBottom: 4,
|
||||
background: 'rgba(68,200,255,0.04)',
|
||||
}}>
|
||||
<div style={{ flex: 1, minWidth: 0 }}>
|
||||
<div style={{ fontWeight: 600, fontSize: 13 }}>{dev.name || 'Unknown Device'}</div>
|
||||
<div className="text-sm text-muted" style={{ fontFamily: 'monospace', fontSize: 10 }}>
|
||||
{dev.id.slice(0, 12)}...{dev.id.slice(-6)}
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
className="btn btn-primary btn-sm"
|
||||
onClick={() => handleAcceptPendingDevice(dev.id)}
|
||||
disabled={acceptingDevice === dev.id}
|
||||
style={{ fontSize: 12 }}
|
||||
>
|
||||
{acceptingDevice === dev.id ? 'Pairing...' : '✓ Accept'}
|
||||
</button>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Step 1: Install */}
|
||||
{!installed && !installing && (
|
||||
<div className="card mb-4" style={{
|
||||
border: '2px solid var(--accent)',
|
||||
background: 'linear-gradient(135deg, rgba(108,99,255,0.08), rgba(108,99,255,0.02))',
|
||||
}}>
|
||||
<div className="card-header">
|
||||
<h3 style={{ margin: 0 }}>Install Syncthing</h3>
|
||||
</div>
|
||||
<div className="card-header"><h3 style={{ margin: 0 }}>Install Syncthing</h3></div>
|
||||
<div style={{ padding: 16 }}>
|
||||
<p className="text-muted" style={{ marginBottom: 16 }}>
|
||||
Syncthing is the engine behind cloud sync. It's free, open-source, and runs locally — no third-party accounts needed.
|
||||
Syncthing is the engine behind cloud sync. Free, open-source, runs locally — no accounts needed.
|
||||
</p>
|
||||
<button
|
||||
className="btn btn-primary"
|
||||
onClick={handleInstall}
|
||||
style={{ fontSize: 15, padding: '12px 28px' }}
|
||||
>
|
||||
<button className="btn btn-primary" onClick={handleInstall} style={{ fontSize: 15, padding: '12px 28px' }}>
|
||||
⬇ Install Syncthing
|
||||
</button>
|
||||
</div>
|
||||
@@ -342,20 +306,13 @@ export function CloudSyncPage() {
|
||||
|
||||
{installing && (
|
||||
<div className="card mb-4">
|
||||
<div className="card-header">
|
||||
<h3>Installing Syncthing...</h3>
|
||||
</div>
|
||||
<div className="card-header"><h3>Installing Syncthing...</h3></div>
|
||||
<div style={{ padding: 16 }}>
|
||||
<div style={{ marginBottom: 10, fontSize: 13 }}>{installMsg}</div>
|
||||
<div style={{
|
||||
height: 8, borderRadius: 4, background: 'var(--bg-tertiary, #333)',
|
||||
overflow: 'hidden', width: '100%',
|
||||
}}>
|
||||
<div style={{ height: 8, borderRadius: 4, background: 'var(--bg-tertiary, #333)', overflow: 'hidden', width: '100%' }}>
|
||||
<div style={{
|
||||
height: '100%', borderRadius: 4,
|
||||
width: `${installPercent}%`,
|
||||
background: 'linear-gradient(90deg, var(--accent), rgba(108,99,255,0.7))',
|
||||
transition: 'width 0.3s ease',
|
||||
height: '100%', borderRadius: 4, width: `${installPercent}%`,
|
||||
background: 'linear-gradient(90deg, var(--accent), rgba(108,99,255,0.7))', transition: 'width 0.3s ease',
|
||||
}} />
|
||||
</div>
|
||||
</div>
|
||||
@@ -368,271 +325,252 @@ export function CloudSyncPage() {
|
||||
border: '2px solid var(--accent)',
|
||||
background: 'linear-gradient(135deg, rgba(108,99,255,0.08), rgba(108,99,255,0.02))',
|
||||
}}>
|
||||
<div className="card-header">
|
||||
<h3 style={{ margin: 0 }}>Start Syncthing</h3>
|
||||
</div>
|
||||
<div className="card-header"><h3 style={{ margin: 0 }}>Start Syncthing</h3></div>
|
||||
<div style={{ padding: 16 }}>
|
||||
<p className="text-muted" style={{ marginBottom: 16 }}>
|
||||
Start the sync service. It will auto-start on future app launches once enabled.
|
||||
Start the sync service. It will auto-start on future launches.
|
||||
</p>
|
||||
<button
|
||||
className="btn btn-primary"
|
||||
onClick={handleStart}
|
||||
disabled={loading}
|
||||
style={{ fontSize: 15, padding: '12px 28px' }}
|
||||
>
|
||||
<button className="btn btn-primary" onClick={handleStart} disabled={loading} style={{ fontSize: 15, padding: '12px 28px' }}>
|
||||
▶ Start Syncthing
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Steps 3-4: Host & Pair (running) */}
|
||||
{/* Steps 3-4 */}
|
||||
{running && (
|
||||
<>
|
||||
{/* Host section — show your device ID */}
|
||||
<div className="card mb-4">
|
||||
<div className="card-header">
|
||||
<h3>Host — Share This Device</h3>
|
||||
</div>
|
||||
<div style={{ padding: 16 }}>
|
||||
<p className="text-muted text-sm" style={{ marginBottom: 12 }}>
|
||||
Copy this Device ID and paste it into the other machine's OmniEmu or Syncthing to pair.
|
||||
</p>
|
||||
<div style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
|
||||
<textarea
|
||||
ref={uninstallRef}
|
||||
readOnly
|
||||
value={status?.deviceId || ''}
|
||||
style={{
|
||||
flex: 1, fontFamily: 'monospace', fontSize: 12, padding: 8,
|
||||
borderRadius: 6, border: '1px solid var(--border, #555)',
|
||||
background: 'var(--bg-tertiary, #222)', color: 'var(--text, #fff)',
|
||||
resize: 'none', height: 48,
|
||||
}}
|
||||
/>
|
||||
<button className="btn btn-primary btn-sm" onClick={handleCopyDeviceId} style={{ whiteSpace: 'nowrap' }}>
|
||||
{copied ? 'Copied!' : 'Copy ID'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Pair section — connect to another device */}
|
||||
<div className="card mb-4">
|
||||
<div className="card-header">
|
||||
<h3>Pair — Connect Another Device</h3>
|
||||
</div>
|
||||
<div style={{ padding: 16 }}>
|
||||
<p className="text-muted text-sm" style={{ marginBottom: 12 }}>
|
||||
Enter the Device ID from another machine to connect. Both devices must add each other.
|
||||
</p>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Remote Device ID"
|
||||
value={remoteDeviceId}
|
||||
onChange={e => setRemoteDeviceId(e.target.value)}
|
||||
style={{
|
||||
fontFamily: 'monospace', fontSize: 12, padding: '8px 10px',
|
||||
borderRadius: 6, border: '1px solid var(--border, #555)',
|
||||
background: 'var(--bg-tertiary, #222)', color: 'var(--text, #fff)',
|
||||
}}
|
||||
/>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Device name (optional)"
|
||||
value={remoteDeviceName}
|
||||
onChange={e => setRemoteDeviceName(e.target.value)}
|
||||
style={{
|
||||
padding: '8px 10px', borderRadius: 6,
|
||||
border: '1px solid var(--border, #555)',
|
||||
background: 'var(--bg-tertiary, #222)', color: 'var(--text, #fff)',
|
||||
}}
|
||||
/>
|
||||
<button
|
||||
className="btn btn-primary"
|
||||
onClick={handleAddDevice}
|
||||
disabled={addingDevice || !remoteDeviceId.trim()}
|
||||
style={{ alignSelf: 'flex-start' }}
|
||||
>
|
||||
{addingDevice ? 'Adding...' : '🔗 Pair Device'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Paired Devices */}
|
||||
{status?.remoteDevices && status.remoteDevices.length > 0 && (
|
||||
{/* Step 3: Your Device ID + Pair */}
|
||||
{step === 'setup' && (
|
||||
<div className="card mb-4">
|
||||
<div className="card-header">
|
||||
<h3>Paired Devices</h3>
|
||||
</div>
|
||||
<div style={{ padding: '0 12px 12px' }}>
|
||||
{status.remoteDevices.filter(d => d.id).map(device => (
|
||||
<div key={device.id} style={{
|
||||
display: 'flex', alignItems: 'center', justifyContent: 'space-between',
|
||||
padding: '8px 10px', borderRadius: 8,
|
||||
border: '1px solid var(--border, #555)', marginBottom: 4,
|
||||
background: 'var(--bg-tertiary, #222)',
|
||||
}}>
|
||||
<div style={{ flex: 1, minWidth: 0 }}>
|
||||
<div style={{ fontWeight: 600, fontSize: 13 }}>{device.name || 'Unknown Device'}</div>
|
||||
<div className="text-sm text-muted" style={{ fontFamily: 'monospace', fontSize: 10 }}>
|
||||
{device.id.slice(0, 12)}...{device.id.slice(-6)}
|
||||
</div>
|
||||
</div>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
|
||||
<span style={{
|
||||
fontSize: 11, color: device.connected ? 'var(--success, #44ff44)' : 'var(--text-muted, #888)',
|
||||
}}>
|
||||
{device.connected ? 'Connected' : 'Not connected'}
|
||||
</span>
|
||||
<button
|
||||
className="btn btn-danger btn-sm"
|
||||
onClick={() => handleRemoveDevice(device.id)}
|
||||
>
|
||||
Remove
|
||||
</button>
|
||||
</div>
|
||||
<div className="card-header"><h3>Step 3 — Pair a Device</h3></div>
|
||||
<div style={{ padding: 16 }}>
|
||||
<p className="text-muted text-sm" style={{ marginBottom: 12 }}>
|
||||
Copy this ID and paste it into the other device. Then enter their ID below.
|
||||
</p>
|
||||
<div style={{ marginBottom: 16 }}>
|
||||
<label className="text-sm text-muted" style={{ display: 'block', marginBottom: 4 }}>Your Device ID</label>
|
||||
<div style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
|
||||
<textarea
|
||||
ref={idRef}
|
||||
readOnly
|
||||
value={status?.deviceId || ''}
|
||||
style={{
|
||||
flex: 1, fontFamily: 'monospace', fontSize: 11, padding: 8,
|
||||
borderRadius: 6, border: '1px solid var(--border, #555)',
|
||||
background: 'var(--bg-tertiary, #222)', color: 'var(--text, #fff)',
|
||||
resize: 'none', height: 40,
|
||||
}}
|
||||
/>
|
||||
<button className="btn btn-primary btn-sm" onClick={handleCopyDeviceId} style={{ whiteSpace: 'nowrap' }}>
|
||||
{copied ? 'Copied!' : 'Copy ID'}
|
||||
</button>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<label className="text-sm text-muted" style={{ display: 'block', marginBottom: 4 }}>Add Remote Device</label>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
|
||||
<input
|
||||
type="text" placeholder="Remote Device ID"
|
||||
value={remoteDeviceId} onChange={e => setRemoteDeviceId(e.target.value)}
|
||||
style={{
|
||||
fontFamily: 'monospace', fontSize: 12, padding: '8px 10px',
|
||||
borderRadius: 6, border: '1px solid var(--border, #555)',
|
||||
background: 'var(--bg-tertiary, #222)', color: 'var(--text, #fff)',
|
||||
}}
|
||||
/>
|
||||
<input
|
||||
type="text" placeholder="Device name (optional)"
|
||||
value={remoteDeviceName} onChange={e => setRemoteDeviceName(e.target.value)}
|
||||
style={{
|
||||
padding: '8px 10px', borderRadius: 6,
|
||||
border: '1px solid var(--border, #555)',
|
||||
background: 'var(--bg-tertiary, #222)', color: 'var(--text, #fff)',
|
||||
}}
|
||||
/>
|
||||
<button className="btn btn-primary" onClick={handleAddDevice} disabled={addingDevice || !remoteDeviceId.trim()}>
|
||||
{addingDevice ? 'Adding...' : '🔗 Pair Device'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Shared Folders */}
|
||||
<div className="card mb-4">
|
||||
<div className="card-header">
|
||||
<h3>Shared Folders</h3>
|
||||
<button
|
||||
className="btn btn-secondary btn-sm"
|
||||
onClick={() => setShowAddFolder(!showAddFolder)}
|
||||
>
|
||||
{showAddFolder ? 'Cancel' : '+ Add Folder'}
|
||||
</button>
|
||||
</div>
|
||||
<div style={{ padding: 12 }}>
|
||||
{showAddFolder && (
|
||||
<div style={{
|
||||
marginBottom: 12, padding: 12, borderRadius: 8,
|
||||
border: '1px solid var(--border, #555)', background: 'var(--bg-tertiary, #222)',
|
||||
}}>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Folder label (e.g. RetroArch Saves)"
|
||||
value={folderLabel}
|
||||
onChange={e => setFolderLabel(e.target.value)}
|
||||
style={{
|
||||
padding: '8px 10px', borderRadius: 6,
|
||||
border: '1px solid var(--border, #555)',
|
||||
background: 'var(--bg-secondary, #1a1a1a)', color: 'var(--text, #fff)',
|
||||
}}
|
||||
/>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Folder path (e.g. ~/Documents/RetroArch/saves)"
|
||||
value={folderPath}
|
||||
onChange={e => setFolderPath(e.target.value)}
|
||||
style={{
|
||||
padding: '8px 10px', borderRadius: 6,
|
||||
border: '1px solid var(--border, #555)',
|
||||
background: 'var(--bg-secondary, #1a1a1a)', color: 'var(--text, #fff)',
|
||||
}}
|
||||
/>
|
||||
<button className="btn btn-primary btn-sm" onClick={handleAddFolder} style={{ alignSelf: 'flex-start' }}>
|
||||
Add Shared Folder
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{status?.folders && status.folders.length > 0 ? (
|
||||
status.folders.map(folder => (
|
||||
<div key={folder.id} style={{
|
||||
display: 'flex', alignItems: 'center', justifyContent: 'space-between',
|
||||
padding: '8px 10px', borderRadius: 8,
|
||||
border: '1px solid var(--border, #555)', marginBottom: 4,
|
||||
background: 'var(--bg-tertiary, #222)',
|
||||
}}>
|
||||
<div style={{ flex: 1, minWidth: 0 }}>
|
||||
<div style={{ fontWeight: 600, fontSize: 13 }}>{folder.label}</div>
|
||||
<div className="text-sm text-muted" style={{ fontFamily: 'monospace', fontSize: 10 }}>
|
||||
{folder.path}
|
||||
</div>
|
||||
</div>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
|
||||
<span className="badge badge-installed" style={{ fontSize: 10 }}>
|
||||
{folder.type}
|
||||
</span>
|
||||
<button
|
||||
className="btn btn-danger btn-sm"
|
||||
onClick={() => handleRemoveFolder(folder.id)}
|
||||
>
|
||||
Remove
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
<p className="text-muted text-sm">No shared folders. Add one to start syncing.</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Control bar */}
|
||||
<div style={{
|
||||
display: 'flex', alignItems: 'center', justifyContent: 'space-between',
|
||||
padding: '12px 16px', borderRadius: 10,
|
||||
background: 'var(--bg-secondary, #1a1a2e)', border: '1px solid var(--border, #333)',
|
||||
marginBottom: 16,
|
||||
}}>
|
||||
<div style={{ display: 'flex', gap: 8 }}>
|
||||
<button className="btn btn-secondary btn-sm" onClick={handleOpenWebUI}>
|
||||
Open Web UI
|
||||
</button>
|
||||
<button className="btn btn-secondary btn-sm" onClick={loadStatus} disabled={loading}>
|
||||
Refresh
|
||||
</button>
|
||||
</div>
|
||||
<button className="btn btn-danger btn-sm" onClick={handleStop} disabled={loading}>
|
||||
Stop Syncthing
|
||||
{/* Next button — step 3 only */}
|
||||
{step === 'setup' && (
|
||||
<button
|
||||
className="btn btn-primary"
|
||||
onClick={() => { setForceReady(true); saveCloudEnabled(true); }}
|
||||
style={{ fontSize: 15, padding: '12px 28px', width: '100%', marginBottom: 16 }}
|
||||
>
|
||||
Next →
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Advanced */}
|
||||
{status?.apiKey && (
|
||||
<details style={{ marginBottom: 16 }}>
|
||||
<summary style={{
|
||||
cursor: 'pointer', fontSize: 13, color: 'var(--text-muted, #888)',
|
||||
padding: '8px 0',
|
||||
}}>
|
||||
Advanced Settings
|
||||
</summary>
|
||||
<div className="card" style={{ marginTop: 8 }}>
|
||||
<div className="card-header">
|
||||
<h3>Advanced</h3>
|
||||
</div>
|
||||
<div style={{ padding: 12 }}>
|
||||
<p className="text-muted text-sm" style={{ marginBottom: 8 }}>
|
||||
API Key for the Syncthing Web UI.
|
||||
</p>
|
||||
<div style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
|
||||
<code style={{
|
||||
flex: 1, padding: '6px 10px', borderRadius: 6,
|
||||
background: 'var(--bg-tertiary, #222)', fontSize: 11,
|
||||
wordBreak: 'break-all',
|
||||
}}>
|
||||
{status.apiKey}
|
||||
</code>
|
||||
<button className="btn btn-secondary btn-sm" onClick={handleCopyApiKey}>
|
||||
Copy
|
||||
</button>
|
||||
</div>
|
||||
{/* Step 4: Sync Dashboard */}
|
||||
{step === 'ready' && (
|
||||
<>
|
||||
{/* Paired Devices */}
|
||||
<div className="card mb-4">
|
||||
<div className="card-header"><h3>Paired Devices</h3></div>
|
||||
<div style={{ padding: '0 12px 12px' }}>
|
||||
{status?.remoteDevices && status.remoteDevices.filter(d => d.id).length > 0 ? (
|
||||
status.remoteDevices.filter(d => d.id).map(device => (
|
||||
<div key={device.id} style={{
|
||||
display: 'flex', alignItems: 'center', justifyContent: 'space-between',
|
||||
padding: '8px 10px', borderRadius: 8,
|
||||
border: '1px solid var(--border, #555)', marginBottom: 4,
|
||||
background: 'var(--bg-tertiary, #222)',
|
||||
}}>
|
||||
<div style={{ flex: 1, minWidth: 0 }}>
|
||||
<div style={{ fontWeight: 600, fontSize: 13 }}>{device.name || 'Unknown Device'}</div>
|
||||
<div className="text-sm text-muted" style={{ fontFamily: 'monospace', fontSize: 10 }}>
|
||||
{device.id.slice(0, 12)}...{device.id.slice(-6)}
|
||||
</div>
|
||||
</div>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
|
||||
<span style={{ fontSize: 11, color: device.connected ? 'var(--success, #44ff44)' : 'var(--text-muted, #888)' }}>
|
||||
{device.connected ? 'Connected' : 'Offline'}
|
||||
</span>
|
||||
<button className="btn btn-danger btn-sm" onClick={() => handleRemoveDevice(device.id)}>
|
||||
Remove
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
<p className="text-muted text-sm" style={{ padding: 8 }}>No devices paired yet.</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
{/* Pending Folder Requests */}
|
||||
{pendingFolders.length > 0 && (
|
||||
<div className="card mb-4" style={{ border: '2px solid rgba(255,200,68,0.4)' }}>
|
||||
<div className="card-header" style={{ background: 'rgba(255,200,68,0.06)' }}>
|
||||
<h3 style={{ margin: 0 }}>Incoming Folders</h3>
|
||||
</div>
|
||||
<div style={{ padding: 12 }}>
|
||||
{pendingFolders.map(fol => (
|
||||
<div key={fol.folderId} style={{
|
||||
padding: '10px 12px', borderRadius: 8,
|
||||
border: '1px solid rgba(255,200,68,0.25)', marginBottom: 8,
|
||||
background: 'rgba(255,200,68,0.04)',
|
||||
}}>
|
||||
<div style={{ fontWeight: 600, fontSize: 13, marginBottom: 6 }}>{fol.folderLabel}</div>
|
||||
<div style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
|
||||
<input
|
||||
type="text"
|
||||
value={pendingFolderPaths[fol.folderId] || ''}
|
||||
onChange={e => setPendingFolderPaths(prev => ({ ...prev, [fol.folderId]: e.target.value }))}
|
||||
placeholder="Save location (auto-detected)"
|
||||
style={{
|
||||
flex: 1, padding: '6px 10px', borderRadius: 6,
|
||||
border: '1px solid var(--border, #555)',
|
||||
background: 'var(--bg-secondary, #1a1a1a)', color: 'var(--text, #fff)',
|
||||
fontFamily: 'monospace', fontSize: 11,
|
||||
}}
|
||||
/>
|
||||
<button
|
||||
className="btn btn-primary btn-sm"
|
||||
onClick={() => handleAcceptPendingFolder(fol)}
|
||||
disabled={acceptingFolder === fol.folderId || !(pendingFolderPaths[fol.folderId] || '').trim()}
|
||||
style={{ fontSize: 12, whiteSpace: 'nowrap' }}
|
||||
>
|
||||
{acceptingFolder === fol.folderId ? '...' : '✓ Accept'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Save Directories — Sync Toggles */}
|
||||
<div className="card mb-4">
|
||||
<div className="card-header">
|
||||
<h3>Save Directories</h3>
|
||||
</div>
|
||||
<div style={{ padding: '0 12px 12px' }}>
|
||||
<p className="text-muted text-sm" style={{ padding: '4px 0 8px' }}>
|
||||
Toggle sync on for each emulator to start sharing its saves with paired devices.
|
||||
</p>
|
||||
{emuDirs.map(emu => {
|
||||
const synced = !!emuSynced[emu.id];
|
||||
const busy = togglingSync === emu.id;
|
||||
return (
|
||||
<div key={emu.id} style={{
|
||||
display: 'flex', alignItems: 'center', justifyContent: 'space-between',
|
||||
padding: '10px 12px', borderRadius: 8,
|
||||
border: `1px solid ${synced ? 'rgba(68,255,68,0.3)' : 'var(--border, #555)'}`,
|
||||
marginBottom: 4,
|
||||
background: synced ? 'rgba(68,255,68,0.04)' : 'var(--bg-tertiary, #222)',
|
||||
transition: 'all 0.2s ease',
|
||||
}}>
|
||||
<div style={{ flex: 1, minWidth: 0 }}>
|
||||
<div style={{ fontWeight: 600, fontSize: 13 }}>{emu.name}</div>
|
||||
<div className="text-sm text-muted" style={{ fontFamily: 'monospace', fontSize: 10 }}>
|
||||
{emu.saves}
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
className="btn btn-sm"
|
||||
onClick={() => handleToggleSync(emu.id, !synced)}
|
||||
disabled={busy}
|
||||
style={{
|
||||
padding: '6px 14px', borderRadius: 20, fontSize: 12, fontWeight: 600,
|
||||
background: synced ? 'var(--success, #44ff44)' : 'var(--bg-secondary, #1a1a2e)',
|
||||
color: synced ? '#000' : 'var(--text-muted, #888)',
|
||||
border: `1px solid ${synced ? 'var(--success, #44ff44)' : 'var(--border, #555)'}`,
|
||||
transition: 'all 0.2s ease',
|
||||
}}
|
||||
>
|
||||
{busy ? '...' : synced ? 'Syncing' : 'Off'}
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Control bar */}
|
||||
<div style={{
|
||||
display: 'flex', alignItems: 'center', justifyContent: 'space-between',
|
||||
padding: '12px 16px', borderRadius: 10,
|
||||
background: 'var(--bg-secondary, #1a1a2e)', border: '1px solid var(--border, #333)',
|
||||
marginBottom: 16,
|
||||
}}>
|
||||
<div style={{ display: 'flex', gap: 8 }}>
|
||||
<button className="btn btn-secondary btn-sm" onClick={loadData} disabled={loading}>
|
||||
Refresh
|
||||
</button>
|
||||
</div>
|
||||
<button className="btn btn-danger btn-sm" onClick={handleStop} disabled={loading}>
|
||||
Stop Syncthing
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Advanced */}
|
||||
{status?.apiKey && (
|
||||
<details style={{ marginBottom: 16 }}>
|
||||
<summary style={{ cursor: 'pointer', fontSize: 13, color: 'var(--text-muted, #888)', padding: '8px 0' }}>
|
||||
Advanced Settings
|
||||
</summary>
|
||||
<div className="card" style={{ marginTop: 8 }}>
|
||||
<div className="card-header"><h3>Advanced</h3></div>
|
||||
<div style={{ padding: 12 }}>
|
||||
<p className="text-muted text-sm" style={{ marginBottom: 8 }}>Syncthing API Key</p>
|
||||
<code style={{
|
||||
display: 'block', padding: '6px 10px', borderRadius: 6,
|
||||
background: 'var(--bg-tertiary, #222)', fontSize: 11, wordBreak: 'break-all',
|
||||
}}>
|
||||
{status.apiKey}
|
||||
</code>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -1,42 +1,65 @@
|
||||
import React, { useEffect, useState, useCallback, useRef } from 'react';
|
||||
import type { EmulatorState, InstallProgress } from '../../shared/types';
|
||||
import type { EmulatorState, InstallProgress, DecompState } from '../../shared/types';
|
||||
|
||||
interface ProgressMap {
|
||||
[emulatorId: string]: InstallProgress;
|
||||
interface DecompProgressMap {
|
||||
[decompId: string]: { stage: string; percent: number; message: string; error?: string };
|
||||
}
|
||||
|
||||
const isMacOS = navigator.userAgent.includes('Mac');
|
||||
|
||||
export function EmulatorsPage() {
|
||||
const [states, setStates] = useState<EmulatorState[]>([]);
|
||||
const [decompStates, setDecompStates] = useState<DecompState[]>([]);
|
||||
const [betaFeatures, setBetaFeatures] = useState(false);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [progress, setProgress] = useState<ProgressMap>({});
|
||||
const [progress, setProgress] = useState<Record<string, InstallProgress>>({});
|
||||
const [decompProgress, setDecompProgress] = useState<DecompProgressMap>({});
|
||||
const [actioning, setActioning] = useState<string | null>(null);
|
||||
const cleanups = useRef<(() => void)[]>([]);
|
||||
|
||||
const load = useCallback(async () => {
|
||||
setLoading(true);
|
||||
const result = await window.omni.emulators.states();
|
||||
setStates(result);
|
||||
const [emuResult, decompResult, settings] = await Promise.all([
|
||||
window.omni.emulators.states(),
|
||||
window.omni.decomps.states(),
|
||||
window.omni.settings.get(),
|
||||
]);
|
||||
setStates(emuResult);
|
||||
setDecompStates(decompResult);
|
||||
setBetaFeatures(!!settings.betaFeatures);
|
||||
setLoading(false);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
load();
|
||||
|
||||
const unsub = window.omni.emulators.onInstallProgress((p: InstallProgress) => {
|
||||
const unsubEmu = window.omni.emulators.onInstallProgress((p: InstallProgress) => {
|
||||
setProgress((prev) => ({ ...prev, [p.emulatorId]: p }));
|
||||
if (p.stage === 'done' || p.stage === 'error') {
|
||||
setActioning(null);
|
||||
}
|
||||
});
|
||||
cleanups.current.push(unsub);
|
||||
|
||||
const unsubDecomp = window.omni.decomps.onInstallProgress((p) => {
|
||||
setDecompProgress((prev) => ({
|
||||
...prev,
|
||||
[p.decompId]: { stage: p.stage, percent: p.percent, message: p.message, error: (p as any).error },
|
||||
}));
|
||||
if (p.stage === 'done' || p.stage === 'error') {
|
||||
setActioning(null);
|
||||
load();
|
||||
}
|
||||
});
|
||||
|
||||
cleanups.current.push(unsubEmu, unsubDecomp);
|
||||
|
||||
return () => {
|
||||
cleanups.current.forEach((fn) => fn());
|
||||
};
|
||||
}, [load]);
|
||||
|
||||
// ── Emulator handlers ─────────────────────────────────────
|
||||
|
||||
const handleInstall = async (id: string) => {
|
||||
setActioning(id);
|
||||
setProgress((prev) => ({
|
||||
@@ -101,22 +124,47 @@ export function EmulatorsPage() {
|
||||
await window.omni.emulators.openWebsite(id);
|
||||
};
|
||||
|
||||
// ── Decomp handlers ───────────────────────────────────────
|
||||
|
||||
const handleDecompInstall = async (id: string) => {
|
||||
setActioning(id);
|
||||
setDecompProgress((prev) => ({
|
||||
...prev,
|
||||
[id]: { stage: 'downloading', percent: 0, message: 'Starting...' },
|
||||
}));
|
||||
await window.omni.decomps.install(id);
|
||||
await load();
|
||||
};
|
||||
|
||||
const handleDecompUninstall = async (id: string) => {
|
||||
if (!confirm(`Uninstall this port and remove all its files?`)) return;
|
||||
setActioning(id);
|
||||
await window.omni.decomps.uninstall(id);
|
||||
setActioning(null);
|
||||
await load();
|
||||
};
|
||||
|
||||
const handleDecompLaunch = async (id: string) => {
|
||||
setActioning(id);
|
||||
await window.omni.decomps.launch(id);
|
||||
setActioning(null);
|
||||
};
|
||||
|
||||
const handleDecompSelectRom = async (id: string) => {
|
||||
const result = await window.omni.decomps.selectRom(id);
|
||||
if (result.state) {
|
||||
setDecompStates((prev) =>
|
||||
prev.map((d) => (d.config.id === id ? result.state : d))
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const handleRefresh = () => load();
|
||||
|
||||
if (loading) {
|
||||
return <div className="loading">Checking emulators...</div>;
|
||||
}
|
||||
|
||||
if (states.length === 0) {
|
||||
return (
|
||||
<div className="empty-state">
|
||||
<div className="empty-state-icon">🕹️</div>
|
||||
<h3>No emulators configured</h3>
|
||||
<p>Ready to install and configure emulators automatically.</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const currentProgress = (id: string) => progress[id];
|
||||
|
||||
return (
|
||||
@@ -126,14 +174,14 @@ export function EmulatorsPage() {
|
||||
{states.filter((s) => s.installed).length} installed
|
||||
{' · '}
|
||||
{states.filter((s) => s.configured).length} configured
|
||||
{' · '}
|
||||
{Object.keys(progress).length > 0 && ' Installing...'}
|
||||
{Object.keys(progress).length > 0 && ' · Installing...'}
|
||||
</span>
|
||||
<button className="btn btn-secondary btn-sm" onClick={handleRefresh}>
|
||||
Refresh
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* ── Emulators Grid ───────────────────────────────── */}
|
||||
<div className="card-grid">
|
||||
{states.map((state) => {
|
||||
const prog = currentProgress(state.config.id);
|
||||
@@ -211,15 +259,7 @@ export function EmulatorsPage() {
|
||||
>
|
||||
{!state.installed && state.config.supported && (
|
||||
<>
|
||||
{state.config.id === 'esde' && isMacOS ? (
|
||||
<button
|
||||
className="btn btn-primary btn-sm"
|
||||
disabled={isActioning}
|
||||
onClick={() => handleInstall(state.config.id)}
|
||||
>
|
||||
{isActioning ? 'Working...' : 'Install Manually'}
|
||||
</button>
|
||||
) : state.config.id === 'neostation' && isMacOS ? (
|
||||
{(state.config.id === 'esde' || state.config.id === 'neostation') && isMacOS ? (
|
||||
<button
|
||||
className="btn btn-primary btn-sm"
|
||||
disabled={isActioning}
|
||||
@@ -310,6 +350,143 @@ export function EmulatorsPage() {
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
{/* ── Decompilations Section (Beta) ───────────────── */}
|
||||
{betaFeatures && (<>
|
||||
<div style={{ marginTop: 40 }}>
|
||||
<div className="info-bar" style={{ marginBottom: 16 }}>
|
||||
<h2 style={{ fontSize: 20, fontWeight: 600 }}>Decompilations <span className="badge-beta">Beta</span></h2>
|
||||
<span className="text-sm text-muted">
|
||||
Native PC ports built from reverse-engineered source code — bring your own ROM
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="card-grid">
|
||||
{decompStates.map((decomp) => {
|
||||
const dprog = decompProgress[decomp.config.id];
|
||||
const isActioning = actioning === decomp.config.id;
|
||||
|
||||
return (
|
||||
<div className="card" key={decomp.config.id}>
|
||||
<div className="card-header">
|
||||
<h3>{decomp.config.name}</h3>
|
||||
<span
|
||||
className={`badge ${
|
||||
decomp.installed
|
||||
? decomp.hasRom
|
||||
? 'badge-installed'
|
||||
: 'badge-installed'
|
||||
: 'badge-missing'
|
||||
}`}
|
||||
>
|
||||
{decomp.installed
|
||||
? decomp.hasRom
|
||||
? 'Ready to Play'
|
||||
: 'Needs ROM'
|
||||
: 'Not installed'}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<p>{decomp.config.description}</p>
|
||||
|
||||
<div style={{ marginTop: 8 }}>
|
||||
<span className="platform-tag">{decomp.config.platform}</span>
|
||||
{decomp.config.features.slice(0, 3).map((f) => (
|
||||
<span className="platform-tag" key={f} style={{ background: 'var(--accent-dim)', color: 'var(--accent)' }}>
|
||||
{f}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{decomp.version && (
|
||||
<p className="text-sm text-muted mt-2">Version: {decomp.version}</p>
|
||||
)}
|
||||
|
||||
{dprog && (
|
||||
<div className="mt-2">
|
||||
<div className="progress-bar">
|
||||
<div
|
||||
className="progress-fill"
|
||||
style={{
|
||||
width: `${dprog.percent}%`,
|
||||
background: dprog.stage === 'error' ? 'var(--error)' : 'var(--accent)',
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<p className="text-sm text-muted mt-2">
|
||||
{dprog.stage === 'error'
|
||||
? `Error: ${dprog.error || dprog.message}`
|
||||
: dprog.message}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div
|
||||
style={{
|
||||
marginTop: 12,
|
||||
display: 'flex',
|
||||
flexWrap: 'wrap',
|
||||
gap: 6,
|
||||
alignItems: 'center',
|
||||
}}
|
||||
>
|
||||
{!decomp.installed && (
|
||||
<button
|
||||
className="btn btn-primary btn-sm"
|
||||
disabled={isActioning}
|
||||
onClick={() => handleDecompInstall(decomp.config.id)}
|
||||
>
|
||||
{isActioning ? 'Working...' : 'Install'}
|
||||
</button>
|
||||
)}
|
||||
|
||||
{decomp.installed && (
|
||||
<>
|
||||
<button
|
||||
className="btn btn-primary btn-sm"
|
||||
disabled={isActioning}
|
||||
onClick={() => handleDecompLaunch(decomp.config.id)}
|
||||
>
|
||||
Launch
|
||||
</button>
|
||||
<button
|
||||
className="btn btn-secondary btn-sm"
|
||||
disabled={isActioning}
|
||||
onClick={() => handleDecompSelectRom(decomp.config.id)}
|
||||
>
|
||||
{decomp.hasRom ? 'Change ROM' : 'Select ROM'}
|
||||
</button>
|
||||
<button
|
||||
className="btn btn-danger btn-sm"
|
||||
disabled={isActioning}
|
||||
onClick={() => handleDecompUninstall(decomp.config.id)}
|
||||
>
|
||||
Uninstall
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
|
||||
<button
|
||||
className="btn-icon"
|
||||
title="View on GitHub"
|
||||
onClick={() => window.open(decomp.config.githubUrl, '_blank')}
|
||||
style={{ marginLeft: 'auto' }}
|
||||
>
|
||||
↗
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{decomp.installed && !decomp.hasRom && (
|
||||
<p className="text-sm mt-2" style={{ color: 'var(--warning)' }}>
|
||||
Supply a legal ROM dump to play. Click "Select ROM" above.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</>)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useEffect, useState, useCallback } from 'react';
|
||||
import type { GameEntry } from '../../shared/types';
|
||||
import type { GameEntry, DecompState } from '../../shared/types';
|
||||
import { GameDetailModal } from '../components/GameDetailModal';
|
||||
|
||||
const platformIcons: Record<string, string> = {
|
||||
@@ -12,6 +12,8 @@ const platformIcons: Record<string, string> = {
|
||||
|
||||
export function LibraryPage() {
|
||||
const [games, setGames] = useState<GameEntry[]>([]);
|
||||
const [decompGames, setDecompGames] = useState<DecompState[]>([]);
|
||||
const [betaFeatures, setBetaFeatures] = useState(false);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [romsDir, setRomsDir] = useState<string>('');
|
||||
const [selectedGame, setSelectedGame] = useState<GameEntry | null>(null);
|
||||
@@ -19,6 +21,7 @@ export function LibraryPage() {
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
const settings = await window.omni.settings.get();
|
||||
setBetaFeatures(!!settings.betaFeatures);
|
||||
if (settings.romsDirectory) {
|
||||
setRomsDir(settings.romsDirectory);
|
||||
setLoading(true);
|
||||
@@ -26,6 +29,9 @@ export function LibraryPage() {
|
||||
setGames(await scrapeMissingArt(results));
|
||||
setLoading(false);
|
||||
}
|
||||
// Load installed decomps
|
||||
const decompStates = await window.omni.decomps.states();
|
||||
setDecompGames(decompStates.filter(d => d.installed));
|
||||
})();
|
||||
}, []);
|
||||
|
||||
@@ -62,6 +68,12 @@ export function LibraryPage() {
|
||||
await window.omni.game.launch(game.emulatorId, game.romPath);
|
||||
};
|
||||
|
||||
const handleDecompLaunch = async (decomp: DecompState) => {
|
||||
if (decomp.romPath) {
|
||||
await window.omni.decomps.launch(decomp.config.id);
|
||||
}
|
||||
};
|
||||
|
||||
const handleShowDetail = (game: GameEntry) => {
|
||||
setSelectedGame(game);
|
||||
};
|
||||
@@ -156,6 +168,47 @@ export function LibraryPage() {
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* ── Installed Decomps as Games (Beta) ──────────────── */}
|
||||
{betaFeatures && decompGames.length > 0 && (
|
||||
<div style={{ marginTop: 32 }}>
|
||||
<div className="info-bar">
|
||||
<span style={{ fontWeight: 600 }}>Decompilations <span className="badge-beta">Beta</span></span>
|
||||
<span className="text-sm text-muted">
|
||||
{decompGames.filter(d => d.hasRom).length} ready · {decompGames.length} installed
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="library-grid">
|
||||
{decompGames.map((decomp) => (
|
||||
<div
|
||||
className="game-card"
|
||||
key={decomp.config.id}
|
||||
onClick={() => decomp.hasRom && handleDecompLaunch(decomp)}
|
||||
onKeyDown={(e) => {
|
||||
if ((e.key === 'Enter' || e.key === ' ') && decomp.hasRom) handleDecompLaunch(decomp);
|
||||
}}
|
||||
tabIndex={0}
|
||||
role="button"
|
||||
title={decomp.hasRom ? `Launch ${decomp.config.name}` : `${decomp.config.name} — needs ROM`}
|
||||
style={!decomp.hasRom ? { opacity: 0.6 } : undefined}
|
||||
>
|
||||
<div className="game-card-cover">
|
||||
<span style={{ fontSize: 32 }}>{platformIcons[decomp.config.platform.toLowerCase()] || '🎮'}</span>
|
||||
</div>
|
||||
<div className="game-card-info">
|
||||
<div className="game-card-title">{decomp.config.name}</div>
|
||||
<div className="game-card-platform">
|
||||
{decomp.config.platform} · decomp
|
||||
{!decomp.hasRom && ' · needs ROM'}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{selectedGame && (
|
||||
<GameDetailModal
|
||||
game={selectedGame}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useEffect, useState, useCallback } from 'react';
|
||||
import type { GameEntry, EmulatorSaves, SaveEntry } from '../../shared/types';
|
||||
import type { GameEntry, EmulatorSaves, SaveEntry, SyncthingFolder } from '../../shared/types';
|
||||
|
||||
function formatSize(bytes: number): string {
|
||||
if (bytes < 1024) return `${bytes} B`;
|
||||
@@ -48,6 +48,9 @@ export function SaveManagerPage() {
|
||||
const [expandedGame, setExpandedGame] = useState<string | null>(null);
|
||||
const [status, setStatus] = useState('');
|
||||
const [view, setView] = useState<'games' | 'emulators'>('games');
|
||||
const [syncFolders, setSyncFolders] = useState<SyncthingFolder[]>([]);
|
||||
const [cloudEnabled, setCloudEnabled] = useState(false);
|
||||
const [togglingSync, setTogglingSync] = useState<string | null>(null);
|
||||
|
||||
const loadData = useCallback(async () => {
|
||||
setLoading(true);
|
||||
@@ -60,6 +63,14 @@ export function SaveManagerPage() {
|
||||
const roms = await window.omni.roms.scan(settings.romsDirectory);
|
||||
setGames(roms);
|
||||
}
|
||||
// Detect cloud sync: either the flag is set, or Syncthing is actually running
|
||||
let cloudOk = !!settings.cloudSyncEnabled;
|
||||
try {
|
||||
const cloudStatus = await window.omni.cloud.status();
|
||||
setSyncFolders(cloudStatus.folders || []);
|
||||
if (cloudStatus.running) cloudOk = true;
|
||||
} catch { /* ignore */ }
|
||||
setCloudEnabled(cloudOk);
|
||||
setLoading(false);
|
||||
}, []);
|
||||
|
||||
@@ -110,6 +121,34 @@ export function SaveManagerPage() {
|
||||
window.omni.saves.openFolder(emu.saveDir);
|
||||
};
|
||||
|
||||
const isDirSynced = (dirPath: string): SyncthingFolder | undefined => {
|
||||
return syncFolders.find(f => f.path === dirPath);
|
||||
};
|
||||
|
||||
const handleToggleSync = async (emu: EmulatorSaves) => {
|
||||
const existing = isDirSynced(emu.saveDir);
|
||||
setTogglingSync(emu.emulatorId);
|
||||
try {
|
||||
if (existing) {
|
||||
await window.omni.cloud.removeFolder(existing.id);
|
||||
setSyncFolders(prev => prev.filter(f => f.id !== existing.id));
|
||||
showStatus(`${emu.emulatorName} sync disabled`);
|
||||
} else {
|
||||
const id = `saves-${emu.emulatorId}`;
|
||||
const ok = await window.omni.cloud.addFolder(id, `${emu.emulatorName} Saves`, emu.saveDir, []);
|
||||
if (ok) {
|
||||
setSyncFolders(prev => [...prev, { id, label: `${emu.emulatorName} Saves`, path: emu.saveDir, type: 'sendreceive' }]);
|
||||
showStatus(`${emu.emulatorName} sync enabled`);
|
||||
} else {
|
||||
showStatus('Failed to enable sync');
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
showStatus('Sync toggle failed');
|
||||
}
|
||||
setTogglingSync(null);
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="info-bar mb-4" style={{ justifyContent: 'space-between' }}>
|
||||
@@ -192,6 +231,7 @@ export function SaveManagerPage() {
|
||||
save={save}
|
||||
onDelete={handleDelete}
|
||||
onBackup={handleBackup}
|
||||
syncFolders={syncFolders}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
@@ -215,6 +255,7 @@ export function SaveManagerPage() {
|
||||
save={save}
|
||||
onDelete={handleDelete}
|
||||
onBackup={handleBackup}
|
||||
syncFolders={syncFolders}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
@@ -234,12 +275,24 @@ export function SaveManagerPage() {
|
||||
{emu.saves.length} file{emu.saves.length !== 1 ? 's' : ''}
|
||||
</span>
|
||||
</div>
|
||||
<button
|
||||
className="btn btn-secondary btn-sm"
|
||||
onClick={() => handleOpenEmuFolder(emu)}
|
||||
>
|
||||
Open Folder
|
||||
</button>
|
||||
<div style={{ display: 'flex', gap: 6, alignItems: 'center' }}>
|
||||
{cloudEnabled && emu.saves.length > 0 && (
|
||||
<button
|
||||
className={`btn btn-sm ${isDirSynced(emu.saveDir) ? 'btn-primary' : 'btn-secondary'}`}
|
||||
onClick={() => handleToggleSync(emu)}
|
||||
disabled={togglingSync === emu.emulatorId}
|
||||
title={isDirSynced(emu.saveDir) ? 'Sync enabled — click to disable' : 'Enable sync for this folder'}
|
||||
>
|
||||
{togglingSync === emu.emulatorId ? '...' : isDirSynced(emu.saveDir) ? '☁ Synced' : '☁ Sync'}
|
||||
</button>
|
||||
)}
|
||||
<button
|
||||
className="btn btn-secondary btn-sm"
|
||||
onClick={() => handleOpenEmuFolder(emu)}
|
||||
>
|
||||
Open Folder
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{emu.saves.length === 0 ? (
|
||||
<p className="text-sm text-muted" style={{ padding: '0 12px 12px' }}>No saves.</p>
|
||||
@@ -262,11 +315,18 @@ export function SaveManagerPage() {
|
||||
);
|
||||
}
|
||||
|
||||
function SaveRow({ save, onDelete, onBackup }: {
|
||||
function isSaveSynced(filePath: string, syncFolders: SyncthingFolder[]): boolean {
|
||||
if (!syncFolders.length) return false;
|
||||
return syncFolders.some(f => filePath.startsWith(f.path));
|
||||
}
|
||||
|
||||
function SaveRow({ save, onDelete, onBackup, syncFolders }: {
|
||||
save: SaveEntry;
|
||||
onDelete: (s: SaveEntry) => void;
|
||||
onBackup: (s: SaveEntry) => void;
|
||||
syncFolders?: SyncthingFolder[];
|
||||
}) {
|
||||
const synced = syncFolders && isSaveSynced(save.filePath, syncFolders);
|
||||
return (
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
@@ -289,6 +349,11 @@ function SaveRow({ save, onDelete, onBackup }: {
|
||||
{save.fileName} · {formatSize(save.fileSize)} · {formatDate(save.lastModified)}
|
||||
</div>
|
||||
</div>
|
||||
{synced && (
|
||||
<span style={{ fontSize: 11, color: 'var(--accent)', fontWeight: 600, whiteSpace: 'nowrap' }} title="Synced via Cloud Sync">
|
||||
☁
|
||||
</span>
|
||||
)}
|
||||
<div style={{ display: 'flex', gap: 4, flexShrink: 0 }}>
|
||||
<button className="btn btn-secondary btn-sm" onClick={() => onBackup(save)}>Backup</button>
|
||||
<button className="btn btn-danger btn-sm" onClick={() => onDelete(save)}>Delete</button>
|
||||
|
||||
@@ -235,7 +235,7 @@ export function SettingsPage() {
|
||||
<div>
|
||||
<div className="setting-label">Enable Beta Features</div>
|
||||
<div className="setting-desc">
|
||||
Unlocks experimental emulators and frontends (ES-DE, NeoStation)
|
||||
Unlocks experimental emulators, frontends, and decompilations (ES-DE, NeoStation, SoH, etc.)
|
||||
</div>
|
||||
</div>
|
||||
<label className="toggle">
|
||||
|
||||
@@ -399,6 +399,18 @@ body::before {
|
||||
border: 1px solid rgba(245, 158, 11, 0.3);
|
||||
}
|
||||
|
||||
.badge-needsrom {
|
||||
background: rgba(245, 158, 11, 0.2);
|
||||
color: var(--warning);
|
||||
border: 1px solid rgba(245, 158, 11, 0.3);
|
||||
}
|
||||
|
||||
.badge-beta {
|
||||
background: rgba(168, 85, 247, 0.2);
|
||||
color: #a855f7;
|
||||
border: 1px solid rgba(168, 85, 247, 0.3);
|
||||
}
|
||||
|
||||
/* Buttons - XMB-style with glow effects */
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import type {
|
||||
EmulatorConfig,
|
||||
EmulatorState,
|
||||
DecompProject,
|
||||
DecompState,
|
||||
GameEntry,
|
||||
GameMetadata,
|
||||
AchievementInfo,
|
||||
@@ -10,6 +12,8 @@ import type {
|
||||
ConfigPreset,
|
||||
EmulatorSaves,
|
||||
SyncthingStatus,
|
||||
SyncthingPendingDevice,
|
||||
SyncthingPendingFolder,
|
||||
} from '../shared/types';
|
||||
|
||||
declare global {
|
||||
@@ -34,6 +38,17 @@ declare global {
|
||||
updateControllerConfig: (id: string, installPath: string, controllerName?: string) => Promise<boolean>;
|
||||
onInstallProgress: (cb: (p: InstallProgress) => void) => () => void;
|
||||
};
|
||||
decomps: {
|
||||
states: () => Promise<DecompState[]>;
|
||||
check: (id: string) => Promise<DecompState>;
|
||||
install: (id: string) => Promise<DecompState>;
|
||||
uninstall: (id: string) => Promise<{ removed: boolean; state: DecompState }>;
|
||||
launch: (id: string) => Promise<boolean>;
|
||||
openWebsite: (id: string) => Promise<boolean>;
|
||||
setRom: (id: string, romPath: string) => Promise<DecompState>;
|
||||
selectRom: (id: string) => Promise<{ romPath: string | null; state: DecompState }>;
|
||||
onInstallProgress: (cb: (p: { decompId: string; stage: string; percent: number; message: string }) => void) => () => void;
|
||||
};
|
||||
roms: {
|
||||
scan: (directory?: string) => Promise<GameEntry[]>;
|
||||
selectDirectory: () => Promise<string | null>;
|
||||
@@ -94,6 +109,13 @@ declare global {
|
||||
addFolder: (id: string, label: string, path: string, deviceIds: string[]) => Promise<boolean>;
|
||||
removeFolder: (folderId: string) => Promise<boolean>;
|
||||
openWebUI: () => Promise<boolean>;
|
||||
pendingDevices: () => Promise<SyncthingPendingDevice[]>;
|
||||
acceptPendingDevice: (deviceId: string) => Promise<boolean>;
|
||||
pendingFolders: () => Promise<SyncthingPendingFolder[]>;
|
||||
acceptPendingFolder: (folderId: string, folderLabel: string, localPath: string, deviceId: string) => Promise<boolean>;
|
||||
guessPath: (label: string) => Promise<string | null>;
|
||||
emulatorDirs: () => Promise<{ id: string; name: string; saves: string | null }[]>;
|
||||
toggleFolderSync: (emuId: string, sync: boolean) => Promise<boolean>;
|
||||
onInstallProgress: (cb: (progress: { stage: string; percent: number; message: string }) => void) => () => void;
|
||||
};
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user