gvr / server.js
fast72's picture
Update server.js
688cf8b verified
const express = require('express')
const fs = require('fs')
const path = require('path')
const app = express()
app.get('/', (req, res) => {
const dir = path.join(__dirname, 'dl')
fs.readdir(dir, (err, files) => {
if (err) return res.send('Gagal baca folder')
const links = files.map(f => `
<div class="item">
<div class="icon">⬇️</div>
<a href="/dl/${f}" download>${f}</a>
</div>`).join('')
res.send(`
<html>
<head>
<title>GVR Download</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
background-color: #121212;
color: #ffa500;
font-family: sans-serif;
padding: 20px;
}
h1 {
color: #ff8800;
margin-bottom: 20px;
}
.item {
display: flex;
align-items: center;
margin-bottom: 10px;
background: #1e1e1e;
padding: 10px;
border-radius: 10px;
}
.icon {
font-size: 24px;
margin-right: 10px;
}
a {
color: #ffa500;
text-decoration: none;
font-size: 16px;
}
a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<h1>GVR Download</h1>
<p>Semua versi ada disini, maaf jika ada kesalahan.</p>
<hr>
${links}
</body>
</html>
`)
})
})
app.use('/dl', express.static(path.join(__dirname, 'dl')))
app.listen(7860)