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:
parent
1e68625f8d
commit
c985fb3ee4
4 changed files with 17 additions and 11 deletions
|
@ -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) {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 20fb611ee332a34689eea5a9e05cfd473e6195b9
|
Subproject commit 83ed7f3b312e0de67505601d13774bdcf2971420
|
|
@ -1 +1 @@
|
||||||
Subproject commit fbf0c40fbb70d712402baf3aa9294093f66a89ab
|
Subproject commit 6b6b9a43d4d9c2e429adaf76c461c0304dad1133
|
Loading…
Add table
Add a link
Reference in a new issue