EverydayTech Platform - Developer Reference
Complete Source Code Documentation - All Applications
Loading...
Searching...
No Matches
AgentV3Download.jsx
Go to the documentation of this file.
1import React, { useEffect, useState } from 'react';
2import { Download, Terminal, CheckCircle, Info } from 'lucide-react';
3
4const AgentV3Download = () => {
5 const [downloads, setDownloads] = useState(null);
6 const [loading, setLoading] = useState(true);
7 const [error, setError] = useState(null);
8
9 useEffect(() => {
10 fetchDownloads();
11 }, []);
12
13 const fetchDownloads = async () => {
14 try {
15 const token = localStorage.getItem('token');
16 const response = await fetch('/api/agent-v3/downloads', {
17 headers: {
18 'Authorization': `Bearer ${token}`
19 }
20 });
21
22 if (!response.ok) throw new Error('Failed to fetch downloads');
23
24 const data = await response.json();
25 setDownloads(data);
26 } catch (err) {
27 setError(err.message);
28 } finally {
29 setLoading(false);
30 }
31 };
32
33 const handleDownload = async (url, filename) => {
34 try {
35 const token = localStorage.getItem('token');
36 const response = await fetch(url, {
37 headers: {
38 'Authorization': `Bearer ${token}`
39 }
40 });
41
42 if (!response.ok) throw new Error('Download failed');
43
44 const blob = await response.blob();
45 const downloadUrl = window.URL.createObjectURL(blob);
46 const link = document.createElement('a');
47 link.href = downloadUrl;
48 link.download = filename;
49 document.body.appendChild(link);
50 link.click();
51 document.body.removeChild(link);
52 window.URL.revokeObjectURL(downloadUrl);
53 } catch (err) {
54 console.error('Download error:', err);
55 alert(`Download failed: ${err.message}`);
56 }
57 };
58
59 const PlatformCard = ({ title, icon, items, instructions }) => (
60 <div className="bg-white rounded-lg shadow-md p-6">
61 <div className="flex items-center gap-3 mb-4">
62 <div className="text-blue-600">{icon}</div>
63 <h3 className="text-xl font-semibold">{title}</h3>
64 </div>
65
66 <div className="space-y-3">
67 {items.map((item, index) => (
68 <button
69 key={index}
70 onClick={() => handleDownload(item.url, `everydaytech-agent-v3.${item.type.toLowerCase()}`)}
71 className="w-full flex items-center justify-between p-3 bg-gray-50 hover:bg-gray-100 rounded-lg transition-colors text-left"
72 >
73 <div className="flex items-center gap-2">
74 <Download size={18} className="text-gray-600" />
75 <span className="font-medium">{item.name}</span>
76 </div>
77 <span className="text-sm text-gray-500 uppercase">{item.type}</span>
78 </button>
79 ))}
80 </div>
81
82 {instructions && (
83 <div className="mt-4 p-3 bg-blue-50 rounded-lg text-sm text-blue-800">
84 <div className="flex gap-2">
85 <Info size={16} className="flex-shrink-0 mt-0.5" />
86 <div>
87 <span className="font-semibold">Installation: </span>
88 {instructions}
89 </div>
90 </div>
91 </div>
92 )}
93 </div>
94 );
95
96 if (loading) {
97 return (
98 <div className="flex items-center justify-center min-h-screen">
99 <div className="animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600"></div>
100 </div>
101 );
102 }
103
104 if (error) {
105 return (
106 <div className="flex items-center justify-center min-h-screen">
107 <div className="bg-red-50 border border-red-200 rounded-lg p-6 max-w-md">
108 <h3 className="text-red-800 font-semibold mb-2">Error Loading Downloads</h3>
109 <p className="text-red-600">{error}</p>
110 </div>
111 </div>
112 );
113 }
114
115 return (
116 <div className="min-h-screen bg-gray-50 py-8 px-4">
117 <div className="max-w-6xl mx-auto">
118 {/* Header */}
119 <div className="text-center mb-12">
120 <h1 className="text-4xl font-bold text-gray-900 mb-4">
121 EverydayTech Agent v3
122 </h1>
123 <p className="text-lg text-gray-600 mb-6">
124 Next-generation remote management agent powered by MeshCentral
125 </p>
126
127 <div className="inline-flex items-center gap-2 px-4 py-2 bg-green-50 border border-green-200 rounded-lg text-green-800">
128 <CheckCircle size={20} />
129 <span className="font-semibold">Production Ready</span>
130 </div>
131 </div>
132
133 {/* Device Types Supported */}
134 <div className="bg-gradient-to-r from-blue-50 to-indigo-50 rounded-lg shadow-md p-6 mb-8 border border-blue-200">
135 <h2 className="text-2xl font-semibold mb-4 text-blue-900">🖥️ Supported Devices</h2>
136 <div className="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-4">
137 {[
138 { icon: '💻', name: 'Windows PC', desc: 'Desktop & Laptop' },
139 { icon: '🐧', name: 'Linux', desc: 'Servers & Workstations' },
140 { icon: '🍎', name: 'macOS', desc: 'Intel & Apple Silicon' },
141 { icon: '🖨️', name: 'Printers', desc: 'Network Printers' },
142 { icon: '📡', name: 'Routers', desc: 'Network Devices' },
143 { icon: '⚙️', name: 'SNMP', desc: 'Monitoring Devices' },
144 { icon: '📱', name: 'IoT', desc: 'Smart Devices' },
145 { icon: '☁️', name: 'VMs', desc: 'Virtual Machines' },
146 { icon: '🔌', name: 'NAS', desc: 'Network Storage' },
147 { icon: '🎮', name: 'Embedded', desc: 'Custom Hardware' }
148 ].map((device, index) => (
149 <div key={index} className="bg-white rounded-lg p-4 text-center shadow-sm hover:shadow-md transition-shadow">
150 <div className="text-3xl mb-2">{device.icon}</div>
151 <div className="font-semibold text-gray-900 text-sm">{device.name}</div>
152 <div className="text-xs text-gray-600 mt-1">{device.desc}</div>
153 </div>
154 ))}
155 </div>
156 </div>
157
158 {/* Features */}
159 <div className="bg-white rounded-lg shadow-md p-6 mb-8">
160 <h2 className="text-2xl font-semibold mb-4">✨ Features</h2>
161 <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
162 {[
163 'Remote Desktop (High Performance)',
164 'Terminal/SSH/PowerShell Access',
165 'File Transfer (Drag & Drop)',
166 'System Information Collection',
167 'Hardware Inventory',
168 'Auto-Updates',
169 'Cross-Platform Support',
170 'Real-time Connection Status',
171 'Event Logging & Alerts',
172 'Wake-on-LAN',
173 'Two-Factor Authentication',
174 'Intel AMT Support'
175 ].map((feature, index) => (
176 <div key={index} className="flex items-center gap-2 text-gray-700">
177 <CheckCircle size={18} className="text-green-600 flex-shrink-0" />
178 <span>{feature}</span>
179 </div>
180 ))}
181 </div>
182 </div>
183
184 {/* Download Sections */}
185 <div className="grid grid-cols-1 lg:grid-cols-3 gap-6 mb-8">
186 {/* Windows */}
187 <PlatformCard
188 title="Windows"
189 icon={<Download size={24} />}
190 items={[
191 {
192 name: downloads?.downloads?.windows?.x64?.name || 'Windows 64-bit (EXE)',
193 type: 'EXE',
194 url: downloads?.downloads?.windows?.x64?.exe
195 },
196 {
197 name: downloads?.downloads?.windows?.x64?.name || 'Windows 64-bit (MSI)',
198 type: 'MSI',
199 url: downloads?.downloads?.windows?.x64?.msi
200 },
201 {
202 name: downloads?.downloads?.windows?.x86?.name || 'Windows 32-bit',
203 type: 'EXE',
204 url: downloads?.downloads?.windows?.x86?.exe
205 }
206 ]}
207 instructions={downloads?.instructions?.windows || 'Run installer as Administrator'}
208 />
209
210 {/* Linux */}
211 <PlatformCard
212 title="Linux"
213 icon={<Terminal size={24} />}
214 items={[
215 {
216 name: downloads?.downloads?.linux?.x64?.name || 'Linux 64-bit',
217 type: 'SH',
218 url: downloads?.downloads?.linux?.x64?.sh
219 },
220 {
221 name: downloads?.downloads?.linux?.arm?.name || 'Linux ARM',
222 type: 'SH',
223 url: downloads?.downloads?.linux?.arm?.sh
224 }
225 ]}
226 instructions={downloads?.instructions?.linux || 'Run: wget [URL] | sudo bash'}
227 />
228
229 {/* macOS */}
230 <PlatformCard
231 title="macOS"
232 icon={<Download size={24} />}
233 items={[
234 {
235 name: downloads?.downloads?.macos?.x64?.name || 'macOS Intel',
236 type: 'PKG',
237 url: downloads?.downloads?.macos?.x64?.pkg
238 },
239 {
240 name: downloads?.downloads?.macos?.arm64?.name || 'macOS Apple Silicon',
241 type: 'PKG',
242 url: downloads?.downloads?.macos?.arm64?.pkg
243 }
244 ]}
245 instructions={downloads?.instructions?.macos || 'Double-click PKG to install'}
246 />
247 </div>
248
249 {/* Quick Install Commands */}
250 <div className="bg-gray-900 rounded-lg shadow-md p-6 text-white mb-8">
251 <h2 className="text-2xl font-semibold mb-4">⚡ Quick Install</h2>
252
253 <div className="space-y-4">
254 <div>
255 <h3 className="text-sm font-semibold text-gray-400 mb-2">Linux / macOS</h3>
256 <div className="bg-gray-800 p-3 rounded font-mono text-sm overflow-x-auto">
257 <code>curl -s https://rmm-psa-backend-t9f7k.ondigitalocean.app/api/agent-v3/install-script | sudo bash</code>
258 </div>
259 </div>
260
261 <div>
262 <h3 className="text-sm font-semibold text-gray-400 mb-2">Windows (PowerShell as Admin)</h3>
263 <div className="bg-gray-800 p-3 rounded font-mono text-sm overflow-x-auto">
264 <code>iwr -useb https://rmm-psa-backend-t9f7k.ondigitalocean.app/api/agent-v3/install-script/windows | iex</code>
265 </div>
266 </div>
267 </div>
268 </div>
269
270 {/* Setup Info */}
271 <div className="bg-yellow-50 border border-yellow-200 rounded-lg p-6">
272 <div className="flex gap-3">
273 <Info size={24} className="text-yellow-600 flex-shrink-0" />
274 <div>
275 <h3 className="font-semibold text-yellow-900 mb-2">Automatic Registration</h3>
276 <p className="text-yellow-800 mb-2">
277 After installation, the agent will automatically:
278 </p>
279 <ul className="list-disc list-inside space-y-1 text-yellow-800 text-sm">
280 <li>Connect to MeshCentral</li>
281 <li>Send device information to the dashboard</li>
282 <li>Appear in your Agents page within 30 seconds</li>
283 <li>Link to existing agent records by hostname/MAC address</li>
284 <li>Create a new agent record if none exists</li>
285 </ul>
286 </div>
287 </div>
288 </div>
289
290 {/* What Happened to Agent v1/v2? */}
291 <div className="mt-8 bg-blue-50 border border-blue-200 rounded-lg p-6">
292 <h3 className="font-semibold text-blue-900 mb-2">🤔 What happened to Agent v1 and v2?</h3>
293 <p className="text-blue-800 text-sm">
294 Agent v3 replaces our custom-built agents with a proven, production-ready solution.
295 Instead of maintaining custom agent code, we white-labeled the industry-standard MeshCentral agent,
296 giving you enterprise features out of the box. Your existing agents will continue to work,
297 but we recommend upgrading to v3 for the best experience.
298 </p>
299 </div>
300 </div>
301 </div>
302 );
303};
304
305export default AgentV3Download;