Download server.js from dinzymari/DYIIOP: direct link, hf CLI and curl.
- Browser
- Download file 2.34 kB
-
https://huggingface.co/spaces/dinzymari/DYIIOP/resolve/main/server.js
- Command line
-
hf download hf://spaces/dinzymari/DYIIOP/server.js
-
curl -L -o server.js https://huggingface.co/spaces/dinzymari/DYIIOP/resolve/main/server.js
2.34 kB
| const http = require('http'); | |
| const dns = require('dns'); | |
| // Get DNS servers from environment variables | |
| const dnsServers = [ | |
| process.env.DNS_SERVER_1 || '8.8.8.8', // Default to Google DNS | |
| process.env.DNS_SERVER_2 || '8.8.4.4' | |
| ]; | |
| // Set the DNS servers | |
| dns.setServers(dnsServers); | |
| // DNS resolution example | |
| const checkDNS = (domain) => { | |
| return new Promise((resolve, reject) => { | |
| dns.resolve4(domain, (err, addresses) => { | |
| if (err) { | |
| reject(`Error resolving ${domain}: ${err.message}`); | |
| } else { | |
| resolve(`Resolved ${domain} to IP addresses: ${addresses.join(', ')}`); | |
| } | |
| }); | |
| }); | |
| }; | |
| // HTML template | |
| const htmlTemplate = async () => { | |
| let dnsStatus = 'Checking DNS...'; | |
| try { | |
| dnsStatus = await checkDNS('web.whatsapp.com'); | |
| } catch (err) { | |
| dnsStatus = err; | |
| } | |
| return ` | |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Ayanokoji Kiyotaka</title> | |
| <style> | |
| body { | |
| display: flex; | |
| flex-direction: column; | |
| justify-content: center; | |
| align-items: center; | |
| height: 100vh; | |
| margin: 0; | |
| background-color: #282c34; | |
| color: white; | |
| font-family: 'Arial', sans-serif; | |
| } | |
| h1 { | |
| font-size: 4em; | |
| text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); | |
| } | |
| marquee { | |
| font-size: 3em; | |
| color: #ffcc00; | |
| font-weight: bold; | |
| margin: 20px; | |
| } | |
| p { | |
| font-size: 1.2em; | |
| margin-top: 20px; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <h1>Welcome to Ayanokoji Kiyotaka's World!</h1> | |
| <marquee>AYANOKOJI KIYOTAKA</marquee> | |
| <p>DNS Status: ${dnsStatus}</p> | |
| </body> | |
| </html> | |
| `; | |
| }; | |
| // Create the HTTP server | |
| http.createServer(async (req, res) => { | |
| res.writeHead(200, { 'Content-Type': 'text/html' }); | |
| const content = await htmlTemplate(); | |
| res.end(content); | |
| }).listen(7860, () => { | |
| console.log('Server listening on port 7860'); | |
| console.log(`Using DNS servers: ${dnsServers.join(', ')}`); | |
| }); | |