Compare commits
1
Commits
c205c1bdaf
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a433f57a58
|
No files matched your search
+5
-4
@@ -179,11 +179,11 @@ setInterval(async () => {
|
|||||||
|
|
||||||
app.ws('/ws', {
|
app.ws('/ws', {
|
||||||
maxPayloadLength: 10 * 1024 * 1024,
|
maxPayloadLength: 10 * 1024 * 1024,
|
||||||
open (ws) {
|
open(ws) {
|
||||||
clients.add(ws)
|
clients.add(ws)
|
||||||
// console.log(ws.id, 'connected')
|
// console.log(ws.id, 'connected')
|
||||||
},
|
},
|
||||||
async message (ws, message: any) {
|
async message(ws, message: any) {
|
||||||
console.log('received:', message, 'from', ws.id)
|
console.log('received:', message, 'from', ws.id)
|
||||||
if (message == 'ping') ws.send('ping')
|
if (message == 'ping') ws.send('ping')
|
||||||
if (message.type) {
|
if (message.type) {
|
||||||
@@ -903,7 +903,7 @@ app.ws('/ws', {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async close (ws) {
|
async close(ws) {
|
||||||
clients.forEach(client => {
|
clients.forEach(client => {
|
||||||
if (client.id === ws.id) clients.delete(client)
|
if (client.id === ws.id) clients.delete(client)
|
||||||
})
|
})
|
||||||
@@ -986,7 +986,8 @@ app.get('/launcher/versions', context => launcherVersionsHandler(context), {
|
|||||||
hide: true
|
hide: true
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
clientplatform: t.Optional(t.String())
|
clientplatform: t.Optional(t.String()),
|
||||||
|
authorization: t.Optional(t.String())
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
app.get('/launcher/latest', launcherLatestHandler, {
|
app.get('/launcher/latest', launcherLatestHandler, {
|
||||||
|
|||||||
@@ -9,6 +9,11 @@ export const handler = async (context: Context) => {
|
|||||||
return jsonResponse({ error: 'Failed to connect to database' }, 500)
|
return jsonResponse({ error: 'Failed to connect to database' }, 500)
|
||||||
const { connection, db } = dbResult
|
const { connection, db } = dbResult
|
||||||
|
|
||||||
|
const authorization =
|
||||||
|
context.headers.authorization?.trim() == '' ||
|
||||||
|
context.headers.authorization == null
|
||||||
|
? null
|
||||||
|
: context.headers.authorization
|
||||||
const clientplatform = context.headers.clientplatform
|
const clientplatform = context.headers.clientplatform
|
||||||
const platform = clientplatform?.split('-')[0]
|
const platform = clientplatform?.split('-')[0]
|
||||||
const arch = clientplatform?.split('-')[1]
|
const arch = clientplatform?.split('-')[1]
|
||||||
|
|||||||
Reference in new issue
Block a user