feat(dashboard): clarify server navigation and refresh gallery
Build and publish Docker image / build-and-publish (push) Successful in 40s
Build and publish Docker image / build-and-publish (push) Successful in 40s
This commit is contained in:
1 parent
ad5bf1d015
commit
3523a2e141
8 files changed
+88
-48
No files matched your search
@@ -1,15 +1,15 @@
|
||||
# Public assets
|
||||
|
||||
Recovered from https://www.anchorhost.eu/ on 2026-06-09.
|
||||
Existing assets were recovered from https://www.anchorhost.eu/ on 2026-06-09. The hero gallery replacements below are downloaded from Unsplash and used under its free commercial-use license.
|
||||
|
||||
| File | Size | Source |
|
||||
|------|------|--------|
|
||||
| `transparent_anchorhost.png` | 82 KB | `/assets/transparent_anchorhost.png` |
|
||||
| `hero-bg.jpg` | 41 KB | `/assets/hero-bg.jpg` |
|
||||
| `pricing-bg.jpg` | Hero gallery: [Ethernet cables connected to a network device](https://unsplash.com/photos/ethernet-cables-connected-to-the-back-of-a-network-device-y4GHs9GEFdM) by Manuel Luikenga (Unsplash License) |
|
||||
| `data-center.jpg` | Hero gallery: [A rack of servers in a server room](https://unsplash.com/photos/a-rack-of-servers-in-a-server-room-2JJ3wBHu4_0) by Kevin Ache, used under the Unsplash License |
|
||||
| `fiber-network.jpg` | Hero gallery: [Yellow and green electric wires for optical networks](https://unsplash.com/photos/yellow-and-green-electric-wires-ohBcGYJ8brQ) by Kirill Sh, used under the Unsplash License |
|
||||
| `code.jpg` | 6.6 MB | `/assets/code.jpg` |
|
||||
| `dark-bg.png` | 1.8 MB | `/assets/dark-bg.png` |
|
||||
| `server-2.jpg` | Hero gallery: [Two server racks filled with electronic components and wires](https://unsplash.com/photos/two-server-racks-filled-with-electronic-components-and-wires-k27hkqXuveo) by Eric Stoynov (Unsplash License) |
|
||||
|
||||
Root-level icons (in `public/`):
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 294 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 328 KiB |
@@ -628,30 +628,14 @@ const FileManager = forwardRef(({ serverId, serverImage, sendMessage, isActive,
|
||||
const filePath = getFullPath(file.name);
|
||||
const CHUNK_SIZE = 512 * 1024; // 512KB chunks (reduced to prevent WebSocket frame size issues)
|
||||
const fileSize = file.size;
|
||||
const totalChunks = Math.ceil(fileSize / CHUNK_SIZE);
|
||||
const totalChunks = Math.max(1, Math.ceil(fileSize / CHUNK_SIZE));
|
||||
|
||||
// Always use chunked upload for better progress tracking and binary file support
|
||||
const chunks = [];
|
||||
let chunkIndex = 0;
|
||||
const reader = new FileReader();
|
||||
|
||||
reader.onload = (e) => {
|
||||
const chunk = e.target.result;
|
||||
// Convert ArrayBuffer to base64 (works for all file types)
|
||||
const uint8Array = new Uint8Array(chunk);
|
||||
const binaryString = Array.from(uint8Array, byte => String.fromCharCode(byte)).join('');
|
||||
const base64Chunk = btoa(binaryString);
|
||||
|
||||
chunks.push(base64Chunk);
|
||||
chunkIndex++;
|
||||
|
||||
if (chunkIndex < totalChunks) {
|
||||
// Read next chunk
|
||||
const start = chunkIndex * CHUNK_SIZE;
|
||||
const end = Math.min(start + CHUNK_SIZE, fileSize);
|
||||
reader.readAsArrayBuffer(file.slice(start, end));
|
||||
} else {
|
||||
// All chunks read, start upload
|
||||
const queueUpload = () => {
|
||||
activeUploadsRef.current[filePath] = {
|
||||
chunks,
|
||||
currentChunkIndex: 0,
|
||||
@@ -671,26 +655,44 @@ const FileManager = forwardRef(({ serverId, serverImage, sendMessage, isActive,
|
||||
}
|
||||
}));
|
||||
|
||||
// Initiate chunked upload only if connection is ready
|
||||
if (connectionStatus === 'connected') {
|
||||
sendMessage({
|
||||
type: 'start_chunked_upload',
|
||||
serverId: serverId,
|
||||
filePath: filePath,
|
||||
serverId,
|
||||
filePath,
|
||||
fileName: file.name,
|
||||
totalSize: fileSize,
|
||||
totalChunks: totalChunks,
|
||||
totalChunks,
|
||||
chunkSize: CHUNK_SIZE
|
||||
});
|
||||
} else {
|
||||
console.warn('Cannot start upload - WebSocket not connected. Status:', connectionStatus);
|
||||
// Remove from active uploads if connection not ready
|
||||
delete activeUploadsRef.current[filePath];
|
||||
const errorProgress = { ...uploadProgress };
|
||||
delete errorProgress[filePath];
|
||||
setUploadProgress(errorProgress);
|
||||
setUploadProgress(prev => {
|
||||
const next = { ...prev };
|
||||
delete next[filePath];
|
||||
return next;
|
||||
});
|
||||
showAlert('Upload Blocked', 'WebSocket connection not available. Please wait for connection to be restored.', 'warning');
|
||||
}
|
||||
};
|
||||
|
||||
reader.onload = (e) => {
|
||||
const chunk = e.target.result;
|
||||
// Convert ArrayBuffer to base64 (works for all file types)
|
||||
const uint8Array = new Uint8Array(chunk);
|
||||
const binaryString = Array.from(uint8Array, byte => String.fromCharCode(byte)).join('');
|
||||
const base64Chunk = btoa(binaryString);
|
||||
|
||||
chunks.push(base64Chunk);
|
||||
chunkIndex++;
|
||||
|
||||
if (chunkIndex < totalChunks) {
|
||||
// Read next chunk
|
||||
const start = chunkIndex * CHUNK_SIZE;
|
||||
const end = Math.min(start + CHUNK_SIZE, fileSize);
|
||||
reader.readAsArrayBuffer(file.slice(start, end));
|
||||
} else {
|
||||
queueUpload();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -704,8 +706,13 @@ const FileManager = forwardRef(({ serverId, serverImage, sendMessage, isActive,
|
||||
activeUploadsRef.current = errorActiveUploads;
|
||||
};
|
||||
|
||||
// Start reading first chunk
|
||||
// Empty files still use one empty chunk so the upload protocol can create them.
|
||||
if (fileSize === 0) {
|
||||
chunks.push('');
|
||||
queueUpload();
|
||||
} else {
|
||||
reader.readAsArrayBuffer(file.slice(0, Math.min(CHUNK_SIZE, fileSize)));
|
||||
}
|
||||
});
|
||||
|
||||
// Reset file input
|
||||
@@ -770,6 +777,9 @@ const FileManager = forwardRef(({ serverId, serverImage, sendMessage, isActive,
|
||||
</div>
|
||||
<div>
|
||||
<h3 className="font-semibold text-lg" style={{ color: colors.brightWhite }}>File Manager & SFTP</h3>
|
||||
<p className="text-xs" role="status" style={{ color: connectionStatus === 'connected' ? colors.brightGreen : colors.yellow }}>
|
||||
{connectionStatus === 'connected' ? 'Server connected' : 'Reconnect to manage files'}
|
||||
</p>
|
||||
{!initialized && (
|
||||
<div className="flex items-center space-x-2 text-sm" style={{ color: colors.yellow }}>
|
||||
<RefreshCw className="w-3 h-3 animate-spin" />
|
||||
@@ -780,11 +790,14 @@ const FileManager = forwardRef(({ serverId, serverImage, sendMessage, isActive,
|
||||
</div>
|
||||
<div className="flex items-center space-x-3">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
setInitialized(false);
|
||||
detectWorkingDirectory();
|
||||
}}
|
||||
className="p-3 rounded-xl transition-all duration-200 hover:scale-105 border"
|
||||
disabled={connectionStatus !== 'connected'}
|
||||
aria-label="Refresh file list and detect path"
|
||||
className="p-3 rounded-xl transition-all duration-200 hover:scale-105 border disabled:cursor-not-allowed disabled:opacity-40"
|
||||
style={{
|
||||
backgroundColor: colors.brightBlack,
|
||||
color: colors.foreground,
|
||||
@@ -802,8 +815,10 @@ const FileManager = forwardRef(({ serverId, serverImage, sendMessage, isActive,
|
||||
<div className="flex items-center justify-between mb-4">
|
||||
<div className="flex items-center space-x-3 text-sm">
|
||||
<button
|
||||
type="button"
|
||||
onClick={goToParent}
|
||||
disabled={currentPath === '/' || currentPath === getBasePath()}
|
||||
aria-label="Go to parent folder"
|
||||
className="p-2 rounded-xl transition-all duration-200 hover:scale-105 disabled:opacity-50 border"
|
||||
style={{
|
||||
backgroundColor: colors.brightBlack,
|
||||
@@ -863,6 +878,8 @@ const FileManager = forwardRef(({ serverId, serverImage, sendMessage, isActive,
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
disabled={connectionStatus !== 'connected'}
|
||||
onClick={() => {
|
||||
const zipName = currentPath === getBasePath() ? 'archive.zip' : `${currentPath.split('/').filter(Boolean).pop()}.zip`;
|
||||
const zipPath = getFullPath(zipName);
|
||||
@@ -873,7 +890,7 @@ const FileManager = forwardRef(({ serverId, serverImage, sendMessage, isActive,
|
||||
zipPath: zipPath
|
||||
});
|
||||
}}
|
||||
className="flex items-center space-x-2 px-3 py-2 rounded-xl text-sm transition-all duration-200 hover:scale-105 border"
|
||||
className="flex items-center space-x-2 px-3 py-2 rounded-xl text-sm transition-all duration-200 hover:scale-105 border disabled:cursor-not-allowed disabled:opacity-40"
|
||||
style={{
|
||||
backgroundColor: `${colors.green}20`,
|
||||
borderColor: colors.green,
|
||||
@@ -891,8 +908,10 @@ const FileManager = forwardRef(({ serverId, serverImage, sendMessage, isActive,
|
||||
{selectedFiles.size === 0 && (
|
||||
<>
|
||||
<button
|
||||
type="button"
|
||||
disabled={connectionStatus !== 'connected'}
|
||||
onClick={() => setCreateFolderModalOpen(true)}
|
||||
className="flex items-center space-x-2 px-3 py-2 rounded-xl text-sm transition-all duration-200 hover:scale-105 border"
|
||||
className="flex items-center space-x-2 px-3 py-2 rounded-xl text-sm transition-all duration-200 hover:scale-105 border disabled:cursor-not-allowed disabled:opacity-40"
|
||||
style={{
|
||||
backgroundColor: `${colors.green}20`,
|
||||
borderColor: colors.green,
|
||||
@@ -904,8 +923,10 @@ const FileManager = forwardRef(({ serverId, serverImage, sendMessage, isActive,
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
disabled={connectionStatus !== 'connected'}
|
||||
onClick={() => setUploadModalOpen(true)}
|
||||
className="flex items-center space-x-2 px-3 py-2 rounded-xl text-sm transition-all duration-200 hover:scale-105 border"
|
||||
className="flex items-center space-x-2 px-3 py-2 rounded-xl text-sm transition-all duration-200 hover:scale-105 border disabled:cursor-not-allowed disabled:opacity-40"
|
||||
style={{
|
||||
backgroundColor: `${colors.blue}20`,
|
||||
borderColor: colors.blue,
|
||||
@@ -972,8 +993,10 @@ const FileManager = forwardRef(({ serverId, serverImage, sendMessage, isActive,
|
||||
|
||||
{clipboard && (
|
||||
<button
|
||||
type="button"
|
||||
disabled={connectionStatus !== 'connected'}
|
||||
onClick={pasteFiles}
|
||||
className="flex items-center space-x-2 px-3 py-2 rounded-xl text-sm transition-all duration-200 hover:scale-105 border animate-pulse"
|
||||
className="flex items-center space-x-2 px-3 py-2 rounded-xl text-sm transition-all duration-200 hover:scale-105 border disabled:cursor-not-allowed disabled:opacity-40"
|
||||
style={{ backgroundColor: `${colors.green}20`, borderColor: colors.green, color: colors.brightGreen }}
|
||||
>
|
||||
<Upload className="w-4 h-4 rotate-180" />
|
||||
|
||||
@@ -48,6 +48,11 @@
|
||||
height: auto;
|
||||
}
|
||||
|
||||
svg.lucide {
|
||||
flex: 0 0 auto;
|
||||
aspect-ratio: 1 / 1;
|
||||
}
|
||||
|
||||
input,
|
||||
textarea,
|
||||
select {
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
Server, Terminal, User, Settings, Plus, Trash2, Play, Square, RefreshCw,
|
||||
Cpu, HardDrive, MemoryStick, Copy, Maximize2, Minimize2, AlertCircle,
|
||||
ShoppingCart, Coins, Globe, Database, Activity, Menu, LogOut, Wifi, WifiOff,
|
||||
Home, BookOpen,
|
||||
Home, BookOpen, FileText,
|
||||
BarChart3, HardDriveIcon, NetworkIcon, Clock, Info,
|
||||
CheckCircle, Gamepad2,
|
||||
Folder, Edit,
|
||||
@@ -2933,12 +2933,12 @@ const handleWebSocketMessage = useCallback((data) => {
|
||||
</div>
|
||||
|
||||
<div className="border-b border-dash-border bg-black/5 shrink-0">
|
||||
<div className="flex space-x-1 px-6 overflow-x-auto custom-scrollbar">
|
||||
<div role="tablist" aria-label="Server sections" className="flex space-x-1 px-6 overflow-x-auto custom-scrollbar">
|
||||
{[
|
||||
{ id: 'overview', label: 'Overview', icon: Info },
|
||||
...(selectedServer.type === 'game'
|
||||
? [
|
||||
{ id: 'game-console', label: 'Game Console', icon: Gamepad2 },
|
||||
{ id: 'game-console', label: 'Console', icon: Gamepad2 },
|
||||
...(selectedServer.image && selectedServer.image.toLowerCase().includes('minecraft')
|
||||
? [
|
||||
{ id: 'plugin-store', label: 'Plugin Store', icon: Package },
|
||||
@@ -2948,8 +2948,10 @@ const handleWebSocketMessage = useCallback((data) => {
|
||||
]
|
||||
: []),
|
||||
...(selectedServer.type !== 'database' && selectedServer.type !== 'vps'
|
||||
? [{ id: 'files', label: 'Files & SFTP', icon: Folder }]
|
||||
? [{ id: 'files', label: 'Files', icon: Folder }]
|
||||
: []),
|
||||
{ id: 'terminal', label: 'Terminal', icon: Terminal },
|
||||
{ id: 'logs', label: 'Logs', icon: FileText },
|
||||
{ id: 'network', label: 'Network', icon: NetworkIcon },
|
||||
{ id: 'backups', label: 'Backups', icon: Database },
|
||||
].map((tab) => {
|
||||
@@ -2958,6 +2960,10 @@ const handleWebSocketMessage = useCallback((data) => {
|
||||
return (
|
||||
<button
|
||||
key={tab.id}
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={active}
|
||||
id={`server-tab-${tab.id}`}
|
||||
onClick={() => {
|
||||
setActiveServerDetailTab(tab.id);
|
||||
if (tab.id !== 'network') setShowPortMappingGuide(false);
|
||||
@@ -2976,7 +2982,13 @@ const handleWebSocketMessage = useCallback((data) => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex-1 min-h-0 overflow-y-auto custom-scrollbar">
|
||||
<div
|
||||
role="tabpanel"
|
||||
id="server-detail-panel"
|
||||
aria-labelledby={`server-tab-${activeServerDetailTab}`}
|
||||
tabIndex={0}
|
||||
className="flex-1 min-h-0 overflow-y-auto custom-scrollbar"
|
||||
>
|
||||
<div className={dashLayout.bodyPadding}>
|
||||
{activeServerDetailTab === 'overview' && (
|
||||
<div className="max-w-7xl mx-auto space-y-8">
|
||||
|
||||
@@ -1048,7 +1048,7 @@ Restart Apache: \`sudo systemctl restart apache2\`. Visit your IP in the browser
|
||||
return (
|
||||
<div className="flex h-screen overflow-hidden bg-dash-surface font-sans selection:bg-primary/30 text-dash-textMuted antialiased">
|
||||
{/* Sidebar */}
|
||||
<aside className={`fixed inset-y-0 left-0 z-50 w-72 transform transition-transform duration-300 ease-in-out md:relative md:translate-x-0 border-r border-dash-border bg-dash-surfaceElevated/50 backdrop-blur-md pt-[env(safe-area-inset-top,0px)] ${isMobileMenuOpen ? 'translate-x-0' : '-translate-x-full'}`}>
|
||||
<aside className={`fixed inset-y-0 left-0 z-50 w-72 transform transition-transform duration-300 ease-in-out md:relative md:translate-x-0 border-r border-dash-border bg-dash-surfaceElevated pt-[env(safe-area-inset-top,0px)] ${isMobileMenuOpen ? 'translate-x-0' : '-translate-x-full'}`}>
|
||||
<div className="flex flex-col h-full">
|
||||
<div className="p-6 border-b border-dash-border bg-black/10">
|
||||
<Link to="/" className="flex items-center space-x-3 group">
|
||||
|
||||
@@ -44,14 +44,14 @@ const heroGallery = [
|
||||
title: 'Your work, online',
|
||||
},
|
||||
{
|
||||
src: '/assets/server-2.jpg',
|
||||
alt: 'Network hardware and cabling inside a blue server rack',
|
||||
title: 'Servers and network hardware',
|
||||
src: '/assets/data-center.jpg',
|
||||
alt: 'Rows of server and network equipment in a data center',
|
||||
title: 'Infrastructure that stays online',
|
||||
},
|
||||
{
|
||||
src: '/assets/pricing-bg.jpg',
|
||||
alt: 'Ethernet cables connected to a network switch',
|
||||
title: 'Connections, made visible',
|
||||
src: '/assets/fiber-network.jpg',
|
||||
alt: 'Fiber optic cables connected to telecommunications equipment',
|
||||
title: 'A network built on fiber',
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
Reference in new issue
Block a user