mirror of
https://github.com/ragestudio/linebridge.git
synced 2025-06-09 10:34:17 +00:00
updated use corenode libs
This commit is contained in:
parent
f478f03773
commit
52b9932d46
@ -1,11 +1,8 @@
|
|||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
// patch corenode global runtime
|
|
||||||
global.runtime = process.runtime
|
|
||||||
|
|
||||||
//* set globals
|
//* set globals
|
||||||
global.IS_DEV = process.runtime.helpers.isDevMode()
|
global.IS_DEV = process.runtime.helpers.isDevMode()
|
||||||
global.RELIC_ORIGIN = require('./relicOrigin.json')
|
global.RELIC_ORIGIN = "https://relic.ragestudio.net"
|
||||||
|
|
||||||
global.SERVER_VERSION = process.runtime.helpers.getVersion()
|
global.SERVER_VERSION = process.runtime.helpers.getVersion()
|
||||||
global.SERVER_MANIFEST = "server.manifest"
|
global.SERVER_MANIFEST = "server.manifest"
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
//* LIBRARIES
|
//* LIBRARIES
|
||||||
const axios = require('axios')
|
const axios = require('axios')
|
||||||
const { websocket } = require('corenode/dist/net')
|
const { websocket } = require('corenode/net')
|
||||||
|
|
||||||
//* constables
|
//* constables
|
||||||
const NETHUB_HOSTNAME = IS_DEV ? "localhost" : global.NETHUB_HOSTNAME = "nethub.ragestudio.net"
|
const NETHUB_HOSTNAME = IS_DEV ? `http://localhost:1010` : `https://nethub.ragestudio.net`
|
||||||
const nethubRequest = axios.create({
|
const nethubRequest = axios.create({
|
||||||
baseURL: IS_DEV ? `http://localhost:1010` : `https://${NETHUB_HOSTNAME}`
|
baseURL: NETHUB_HOSTNAME
|
||||||
})
|
})
|
||||||
|
|
||||||
//* HANDLERS
|
//* HANDLERS
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const tokenizer = require("corenode/dist/libs/tokenizer")
|
const tokenizer = require("corenode/libs/tokenizer")
|
||||||
const path = require("path")
|
const path = require("path")
|
||||||
const fs = require("fs")
|
const fs = require("fs")
|
||||||
|
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
const fs = require("fs")
|
const fs = require("fs")
|
||||||
const express = require("express")
|
const express = require("express")
|
||||||
|
|
||||||
const { objectToArrayMap } = require("@corenode/utils")
|
|
||||||
const { nanoid } = require("nanoid")
|
const { nanoid } = require("nanoid")
|
||||||
const tokenizer = require("corenode/dist/libs/tokenizer")
|
const tokenizer = require("corenode/libs/tokenizer")
|
||||||
const net = require("corenode/dist/net")
|
const net = require("corenode/net")
|
||||||
|
|
||||||
const classes = require("../../classes")
|
const classes = require("../../classes")
|
||||||
const nethub = require("../../lib/nethub")
|
const nethub = require("../../lib/nethub")
|
||||||
@ -152,8 +151,8 @@ class Server {
|
|||||||
next()
|
next()
|
||||||
})
|
})
|
||||||
this.httpServer.use((req, res, next) => {
|
this.httpServer.use((req, res, next) => {
|
||||||
objectToArrayMap(this.headers).forEach((entry) => {
|
Object.keys(this.headers).forEach((key) => {
|
||||||
res.setHeader(entry.key, entry.value)
|
res.setHeader(key, this.headers[key])
|
||||||
})
|
})
|
||||||
|
|
||||||
next()
|
next()
|
||||||
|
@ -3,8 +3,8 @@ const socketIo = require('socket.io')
|
|||||||
|
|
||||||
class WSServer {
|
class WSServer {
|
||||||
constructor(params) {
|
constructor(params) {
|
||||||
this.params = { ...params }
|
|
||||||
|
|
||||||
|
this.params = { ...params }
|
||||||
this.io = socketIo({
|
this.io = socketIo({
|
||||||
serveClient: false,
|
serveClient: false,
|
||||||
})
|
})
|
||||||
@ -43,7 +43,7 @@ class WSServer {
|
|||||||
pingTimeout: 5000,
|
pingTimeout: 5000,
|
||||||
cookie: false
|
cookie: false
|
||||||
})
|
})
|
||||||
|
|
||||||
this.httpServer.listen(this.listenPort)
|
this.httpServer.listen(this.listenPort)
|
||||||
console.log("WSS Listen on " + this.listenPort)
|
console.log("WSS Listen on " + this.listenPort)
|
||||||
}
|
}
|
||||||
@ -53,7 +53,7 @@ class WSServer {
|
|||||||
|
|
||||||
return this.namespaces[namespace]
|
return this.namespaces[namespace]
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = WSServer
|
module.exports = WSServer
|
Loading…
x
Reference in New Issue
Block a user