mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Added links.json
This commit is contained in:
@@ -19,7 +19,8 @@
|
|||||||
"nextdir": "nextStatic/qminingPagePublic",
|
"nextdir": "nextStatic/qminingPagePublic",
|
||||||
"name": "qmining",
|
"name": "qmining",
|
||||||
"urls": [
|
"urls": [
|
||||||
"qmining.frylabs.net"
|
"qmining.frylabs.net",
|
||||||
|
"localhost"
|
||||||
],
|
],
|
||||||
"isNextJs": true
|
"isNextJs": true
|
||||||
},
|
},
|
||||||
@@ -30,8 +31,7 @@
|
|||||||
],
|
],
|
||||||
"name": "api",
|
"name": "api",
|
||||||
"urls": [
|
"urls": [
|
||||||
"api.frylabs.net",
|
"api.frylabs.net"
|
||||||
"localhost"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"main": {
|
"main": {
|
||||||
|
@@ -84,12 +84,12 @@ function GetApp(): ModuleType {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
let donateURL = ''
|
const linksFile = 'data/links.json'
|
||||||
const donateURLFile = './data/donateURL'
|
let links: any = {}
|
||||||
|
|
||||||
function loadDonateURL() {
|
function loadDonateURL() {
|
||||||
try {
|
try {
|
||||||
donateURL = utils.ReadFile(donateURLFile).replace(/\n/g, '')
|
links = utils.ReadJSON(linksFile)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.Log('Couldnt read donate URL file!', logger.GetColor('red'))
|
logger.Log('Couldnt read donate URL file!', logger.GetColor('red'))
|
||||||
console.error(err)
|
console.error(err)
|
||||||
@@ -98,7 +98,7 @@ function GetApp(): ModuleType {
|
|||||||
|
|
||||||
loadDonateURL()
|
loadDonateURL()
|
||||||
|
|
||||||
utils.WatchFile(donateURLFile, (newData) => {
|
utils.WatchFile(linksFile, (newData) => {
|
||||||
logger.Log(`Donate URL changed: ${newData.replace(/\/n/g, '')}`)
|
logger.Log(`Donate URL changed: ${newData.replace(/\/n/g, '')}`)
|
||||||
loadDonateURL()
|
loadDonateURL()
|
||||||
})
|
})
|
||||||
@@ -146,7 +146,7 @@ function GetApp(): ModuleType {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
from: '/donate',
|
from: '/donate',
|
||||||
to: donateURL,
|
to: links.donate,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
from: '/menuClick',
|
from: '/menuClick',
|
||||||
@@ -179,10 +179,16 @@ function GetApp(): ModuleType {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
from: '/irc',
|
from: '/irc',
|
||||||
to: 'https://kiwiirc.com/nextclient/irc.sub.fm/#qmining',
|
to: links.irc,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: '/discord',
|
||||||
|
to: links.discord,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
console.log(links, simpleRedirects)
|
||||||
|
|
||||||
simpleRedirects.forEach((redirect) => {
|
simpleRedirects.forEach((redirect) => {
|
||||||
app.get(redirect.from, function(req: Request, res) {
|
app.get(redirect.from, function(req: Request, res) {
|
||||||
if (!redirect.nolog) {
|
if (!redirect.nolog) {
|
||||||
|
Submodule submodules/qmining-data-editor updated: 20fb611ee3...83ed7f3b31
Submodule submodules/qmining-page updated: fbf0c40fbb...6b6b9a43d4
Reference in New Issue
Block a user