50 lines
2.0 KiB
JavaScript
50 lines
2.0 KiB
JavaScript
const http = require('http');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const PORT = 8888;
|
|
const APK_PATH = path.join(__dirname, 'build', 'app', 'outputs', 'flutter-apk', 'app-release.apk');
|
|
|
|
const server = http.createServer((req, res) => {
|
|
if (req.url === '/download' || req.url === '/app-release.apk' || req.url === '/motorsignal.apk') {
|
|
if (!fs.existsSync(APK_PATH)) {
|
|
res.writeHead(404, { 'Content-Type': 'text/plain' });
|
|
return res.end('APK not found. Please build first.');
|
|
}
|
|
const stat = fs.statSync(APK_PATH);
|
|
res.writeHead(200, {
|
|
'Content-Type': 'application/vnd.android.package-archive',
|
|
'Content-Length': stat.size,
|
|
'Content-Disposition': 'attachment; filename="motorsignal-evolution.apk"'
|
|
});
|
|
fs.createReadStream(APK_PATH).pipe(res);
|
|
} else {
|
|
res.writeHead(200, { 'Content-Type': 'text/html' });
|
|
res.end(`<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>MotorSignal Evolution APK</title>
|
|
<style>
|
|
body { background: #0a0a0a; color: #fff; font-family: sans-serif; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 90vh; margin: 0; }
|
|
.card { background: #141414; border: 1px solid #00E5FF; padding: 2rem; border-radius: 16px; text-align: center; max-width: 90%; box-shadow: 0 0 30px rgba(0,229,255,0.2); }
|
|
h1 { color: #00E5FF; margin-top: 0; font-size: 1.6rem; letter-spacing: 1px; }
|
|
.btn { display: inline-block; background: #00E5FF; color: #000; padding: 1rem 2rem; font-size: 1.2rem; font-weight: bold; border-radius: 10px; text-decoration: none; margin-top: 1.5rem; }
|
|
.btn:hover { background: #6effff; }
|
|
p { color: #aaa; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="card">
|
|
<h1>⚡ MotorSignal Evolution</h1>
|
|
<p>Release APK (All Screens & Landscape/Portrait Adaptive)</p>
|
|
<a class="btn" href="/download">Download APK (62.6 MB)</a>
|
|
</div>
|
|
</body>
|
|
</html>`);
|
|
}
|
|
});
|
|
|
|
server.listen(PORT, '0.0.0.0', () => {
|
|
console.log(`APK Server running on port ${PORT}`);
|
|
}); |