Added links.json

This commit is contained in:
mrfry 2021-02-24 15:28:47 +01:00
parent 1e68625f8d
commit c985fb3ee4
4 changed files with 17 additions and 11 deletions

View file

@ -19,7 +19,8 @@
"nextdir": "nextStatic/qminingPagePublic",
"name": "qmining",
"urls": [
"qmining.frylabs.net"
"qmining.frylabs.net",
"localhost"
],
"isNextJs": true
},
@ -30,8 +31,7 @@
],
"name": "api",
"urls": [
"api.frylabs.net",
"localhost"
"api.frylabs.net"
]
},
"main": {

View file

@ -84,12 +84,12 @@ function GetApp(): ModuleType {
},
})
)
let donateURL = ''
const donateURLFile = './data/donateURL'
const linksFile = 'data/links.json'
let links: any = {}
function loadDonateURL() {
try {
donateURL = utils.ReadFile(donateURLFile).replace(/\n/g, '')
links = utils.ReadJSON(linksFile)
} catch (err) {
logger.Log('Couldnt read donate URL file!', logger.GetColor('red'))
console.error(err)
@ -98,7 +98,7 @@ function GetApp(): ModuleType {
loadDonateURL()
utils.WatchFile(donateURLFile, (newData) => {
utils.WatchFile(linksFile, (newData) => {
logger.Log(`Donate URL changed: ${newData.replace(/\/n/g, '')}`)
loadDonateURL()
})
@ -146,7 +146,7 @@ function GetApp(): ModuleType {
},
{
from: '/donate',
to: donateURL,
to: links.donate,
},
{
from: '/menuClick',
@ -179,10 +179,16 @@ function GetApp(): ModuleType {
},
{
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) => {
app.get(redirect.from, function(req: Request, res) {
if (!redirect.nolog) {

@ -1 +1 @@
Subproject commit 20fb611ee332a34689eea5a9e05cfd473e6195b9
Subproject commit 83ed7f3b312e0de67505601d13774bdcf2971420

@ -1 +1 @@
Subproject commit fbf0c40fbb70d712402baf3aa9294093f66a89ab
Subproject commit 6b6b9a43d4d9c2e429adaf76c461c0304dad1133