remove unused lib

This commit is contained in:
srgooglo 2022-02-18 13:04:56 +01:00
parent e09664116e
commit d5b47dc0c6
4 changed files with 0 additions and 83 deletions

View File

@ -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

View File

@ -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

View File

@ -1,5 +1,3 @@
module.exports = {
fetchController: require("./fetchController"),
getLocalEndpoints: require("./getLocalEndpoints"),
serverManifest: require("./serverManifest"),
}

View File

@ -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 }