I'm unsure what I'm doing...
This commit is contained in:
parent
fcc6a19903
commit
b3548cfee7
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -122,4 +122,4 @@ pnpm-lock.yaml
|
||||||
*.sql*
|
*.sql*
|
||||||
players.msgpack
|
players.msgpack
|
||||||
.env
|
.env
|
||||||
ddnss/build
|
ddnss/
|
|
@ -14,8 +14,14 @@ export async function ddnssStart() {
|
||||||
for (const server of servers) {
|
for (const server of servers) {
|
||||||
const connection = `${server.ip}:${server.port}`
|
const connection = `${server.ip}:${server.port}`
|
||||||
|
|
||||||
if (!(server.num_clients > 0 && server.num_clients < (server.max_clients - 2)))
|
if (!(server.num_clients > 0 && server.num_clients < (server.max_clients - 2))) {
|
||||||
return log(`Server (essentially) full! >> ${server.ip}:${server.port} -> ${server.num_clients}/${server.max_clients} clients`)
|
log(`Server (essentially) full! >> ${connection} -> ${server.num_clients}/${server.max_clients} clients`)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if(server.password) {
|
||||||
|
log(`Server is locked >> ${connection}`)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
log(`Connecting to server >> ${connection}`)
|
log(`Connecting to server >> ${connection}`)
|
||||||
await scrapeServer(`${connection}`)
|
await scrapeServer(`${connection}`)
|
||||||
|
@ -39,36 +45,36 @@ function scrapeServer(server) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentTime = Date.now()
|
const currentTime = Date.now()
|
||||||
|
// TODO: Store statement once and reuse same statment. (whatever that means)
|
||||||
for (const entry of skinData)
|
for (const entry of skinData)
|
||||||
skinDB
|
skinDB.prepare(`
|
||||||
.prepare(`
|
|
||||||
INSERT INTO "skindata"
|
INSERT INTO "skindata"
|
||||||
(
|
(
|
||||||
timestamp,
|
$timestamp,
|
||||||
player,
|
$player,
|
||||||
clan,
|
$clan,
|
||||||
flag,
|
$flag,
|
||||||
skin,
|
$skin,
|
||||||
useColor,
|
$useColor,
|
||||||
colorBodyRaw,
|
$colorBodyRaw,
|
||||||
colorBodyHex,
|
$colorBodyHex,
|
||||||
colorFeetRaw,
|
$colorFeetRaw,
|
||||||
ColorFeetHex
|
$ColorFeetHex
|
||||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
||||||
`)
|
|
||||||
.run(
|
|
||||||
currentTime,
|
|
||||||
entry.player,
|
|
||||||
entry.clan,
|
|
||||||
entry.flag,
|
|
||||||
entry.skindata.skin,
|
|
||||||
entry.skindata.useColor,
|
|
||||||
entry.skindata.colorBody.raw,
|
|
||||||
entry.skindata.colorBody.hex,
|
|
||||||
entry.skindata.colorFeet.raw,
|
|
||||||
entry.skindata.colorFeet.hex,
|
|
||||||
)
|
)
|
||||||
|
`)
|
||||||
|
.run({
|
||||||
|
timestamp: currentTime,
|
||||||
|
player: entry.player,
|
||||||
|
clan: entry.clan,
|
||||||
|
flag: entry.flag,
|
||||||
|
skin: entry.skindata.skin,
|
||||||
|
useColor: entry.skindata.useColor,
|
||||||
|
colorBodyRaw: entry.skindata.colorBody.raw,
|
||||||
|
colorBodyHex: entry.skindata.colorBody.hex,
|
||||||
|
colorFeetRaw: entry.skindata.colorFeet.raw,
|
||||||
|
colorFeetHex: entry.skindata.colorFeet.hex,
|
||||||
|
})
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log(`Failed to handle ${server}!`)
|
log(`Failed to handle ${server}!`)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user