mirror of
https://github.com/ragestudio/linebridge.git
synced 2025-06-10 19:14:17 +00:00
remove unused lib
This commit is contained in:
parent
e09664116e
commit
d5b47dc0c6
@ -1,19 +0,0 @@
|
|||||||
const fs = require("fs")
|
|
||||||
const path = require("path")
|
|
||||||
|
|
||||||
function fetchController(key, from) {
|
|
||||||
try {
|
|
||||||
const controllersPath = from ?? path.resolve(process.cwd(), `controllers`)
|
|
||||||
const controllerPath = path.join(controllersPath, key)
|
|
||||||
|
|
||||||
if (fs.existsSync(controllerPath)) {
|
|
||||||
return require(controllerPath)
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (error) {
|
|
||||||
console.error(`Failed to load controller [${key}] > ${error.message}`)
|
|
||||||
process.runtime.logger.dump(error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = fetchController
|
|
@ -1,16 +0,0 @@
|
|||||||
const fs = require("fs")
|
|
||||||
const path = require("path")
|
|
||||||
|
|
||||||
function getLocalEndpoints() {
|
|
||||||
try {
|
|
||||||
const localEndpointsFile = path.resolve(process.cwd(), `endpoints.json`)
|
|
||||||
if (fs.existsSync(localEndpointsFile)) {
|
|
||||||
return JSON.parse(fs.readFileSync(localEndpointsFile, 'utf-8'))
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
} catch (error) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = getLocalEndpoints
|
|
@ -1,5 +1,3 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
fetchController: require("./fetchController"),
|
|
||||||
getLocalEndpoints: require("./getLocalEndpoints"),
|
|
||||||
serverManifest: require("./serverManifest"),
|
serverManifest: require("./serverManifest"),
|
||||||
}
|
}
|
@ -1,46 +0,0 @@
|
|||||||
//* LIBRARIES
|
|
||||||
const axios = require('axios')
|
|
||||||
const { websocket } = require('corenode/net')
|
|
||||||
|
|
||||||
//* constables
|
|
||||||
const NETHUB_HOSTNAME = global.nethubOrigin ?? `https://nethub.ragestudio.net`
|
|
||||||
const nethubRequest = axios.create({
|
|
||||||
baseURL: NETHUB_HOSTNAME
|
|
||||||
})
|
|
||||||
|
|
||||||
//* HANDLERS
|
|
||||||
const getHeartbeat = (...context) => nethubRequest.get("heartbeat", ...context)
|
|
||||||
const putRegistry = (...context) => nethubRequest.put("registry", ...context)
|
|
||||||
const getRegistry = (...context) => nethubRequest.get("registry", ...context)
|
|
||||||
const deleteRegistry = (...context) => nethubRequest.delete("registry", ...context)
|
|
||||||
|
|
||||||
function heartbeat() {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
getHeartbeat()
|
|
||||||
.then((res) => {
|
|
||||||
return resolve(res.data)
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
console.error(`❌ [${err.response?.status ?? "0"}] [${NETHUB_HOSTNAME}] Failed to listen heartbeat > ${err}`)
|
|
||||||
process.runtime.logger.dump("error", err)
|
|
||||||
return reject(err)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
async function registerOrigin(payload) {
|
|
||||||
putRegistry({ ...payload })
|
|
||||||
.then((res) => {
|
|
||||||
console.log(res.data)
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
console.log(err.response.data)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getOrigin() {
|
|
||||||
const hubData = await getRegistry()
|
|
||||||
console.log(hubData)
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = { heartbeat, registerOrigin, getOrigin }
|
|
Loading…
x
Reference in New Issue
Block a user