Last update for tonight

This commit is contained in:
raven 2023-01-08 23:47:16 -05:00
parent 74ecb69e90
commit b6c0327810

View File

@ -57,7 +57,6 @@ async function startContainer(key) {
return startContainer.body return startContainer.body
} }
async function stopContainer(key) { async function stopContainer(key) {
let stopContainer = await unirest let stopContainer = await unirest
.get('https://api.discord-linux.com/stop') .get('https://api.discord-linux.com/stop')
@ -68,7 +67,6 @@ async function stopContainer(key) {
return stopContainer.body return stopContainer.body
} }
async function restartContainer(key) { async function restartContainer(key) {
let restartContainer = await unirest let restartContainer = await unirest
.get('https://api.discord-linux.com/restart') .get('https://api.discord-linux.com/restart')
@ -89,7 +87,6 @@ async function getStats(key) {
return getStats.body return getStats.body
} }
swarm.on('connection', conn => { swarm.on('connection', conn => {
const name = b4a.toString(conn.remotePublicKey, 'hex') const name = b4a.toString(conn.remotePublicKey, 'hex')
console.log(`* got a connection from ${name} (${USERNAME}) *`) console.log(`* got a connection from ${name} (${USERNAME}) *`)
@ -110,7 +107,6 @@ const rl = readline.createInterface({
// When the user inputs a line of text, broadcast it to all connections // When the user inputs a line of text, broadcast it to all connections
rl.on('line', input => { rl.on('line', input => {
const signIn = input.match(/^\/login (\S+)$/) const signIn = input.match(/^\/login (\S+)$/)
if (signIn) { if (signIn) {
const APIKEY = signIn[1] const APIKEY = signIn[1]
@ -141,7 +137,6 @@ rl.on('line', input => {
} }
const execute = input.startsWith(">") const execute = input.startsWith(">")
if (execute) { if (execute) {
let inputdata = input.split(2) let inputdata = input.split(2)
@ -165,10 +160,9 @@ rl.on('line', input => {
}) })
} }
const stop = input.startsWith("/stop") const stop = input.startsWith("/stop")
if (stop) { if (stop) {
startContainer(DAPI_KEY.key).then((data) => { stopContainer(DAPI_KEY.key).then((data) => {
console.log(data) console.log(data)
for (const conn of conns) { for (const conn of conns) {
conn.write(`${USERNAME} ran stop.`) conn.write(`${USERNAME} ran stop.`)
@ -176,7 +170,6 @@ rl.on('line', input => {
}) })
} }
const restart = input.startsWith("/restart") const restart = input.startsWith("/restart")
if (restart) { if (restart) {
startContainer(DAPI_KEY.key).then((data) => { startContainer(DAPI_KEY.key).then((data) => {
@ -187,8 +180,6 @@ rl.on('line', input => {
}) })
} }
const stats = input.startsWith("/stats") const stats = input.startsWith("/stats")
if (stats) { if (stats) {
getStats(DAPI_KEY.key).then((data) => { getStats(DAPI_KEY.key).then((data) => {
@ -198,11 +189,10 @@ rl.on('line', input => {
} }
}) })
} }
else { else {
// if (!LOGGEDIN) return console.log("Please login using /login [API KEY]") // if (!LOGGEDIN) return console.log("Please login using /login [API KEY]")
if (input.match(/^\/login (\S+)$/)) return if (input.startsWith("/")) return
for (const conn of conns) { for (const conn of conns) {
conn.write(`${USERNAME}: ${input}`) conn.write(`${USERNAME}: ${input}`)
} }