mirror of
https://github.com/Zandercraft/TechnicFlux.git
synced 2026-10-29 04:39:20 +00:00
Add Discord server link to README.md
This commit is contained in:
@@ -1,14 +1,25 @@
|
|||||||
const express = require('express')
|
const express = require('express')
|
||||||
const pckg = require('../package.json')
|
const pckg = require('../package.json')
|
||||||
const branchName = require('current-git-branch')()
|
const branchName = require('current-git-branch')() || "release"
|
||||||
const database = require('../database')
|
const database = require('../database')
|
||||||
const router = express.Router()
|
const router = express.Router()
|
||||||
|
|
||||||
router.get('/', (req, res) => {
|
router.get('/', (req, res) => {
|
||||||
res.json({
|
return res.json({
|
||||||
api: pckg.prettyName,
|
api: pckg.prettyName,
|
||||||
version: pckg.version,
|
version: pckg.version,
|
||||||
stream: branchName
|
stream: branchName,
|
||||||
|
meta: {
|
||||||
|
description: "TechnicFlux implementation of Technic's Solder API for retrieval of modpack and mod info.",
|
||||||
|
license: `https://github.com/Zandercraft/TechnicFlux/blob/${branchName}/LICENSE.txt`,
|
||||||
|
repo: "https://github.com/Zandercraft/TechnicFlux",
|
||||||
|
documentation: "https://github.com/Zandercraft/TechnicFlux/wiki",
|
||||||
|
attribution: {
|
||||||
|
name: "Zandercraft",
|
||||||
|
github: "https://github.com/Zandercraft",
|
||||||
|
website: "https://zandercraft.ca",
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -134,20 +145,20 @@ router.get('/verify/:key?', (req, res) => {
|
|||||||
if (api_key !== undefined) {
|
if (api_key !== undefined) {
|
||||||
if (api_key === process.env?.API_KEY)
|
if (api_key === process.env?.API_KEY)
|
||||||
// Key validated
|
// Key validated
|
||||||
res.json({
|
return res.json({
|
||||||
valid: 'Key validated.',
|
valid: 'Key validated.',
|
||||||
name: 'API KEY',
|
name: 'API KEY',
|
||||||
created_at: 'A long time ago'
|
created_at: 'A long time ago'
|
||||||
})
|
})
|
||||||
else {
|
else {
|
||||||
// Invalid key provided
|
// Invalid key provided
|
||||||
res.json({
|
return res.json({
|
||||||
error: 'Invalid key provided.'
|
error: 'Invalid key provided.'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// No key provided
|
// No key provided
|
||||||
res.json({
|
return res.json({
|
||||||
error: 'No API key provided.'
|
error: 'No API key provided.'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -155,7 +166,7 @@ router.get('/verify/:key?', (req, res) => {
|
|||||||
|
|
||||||
/* Invalid API Routes */
|
/* Invalid API Routes */
|
||||||
router.all('*', (req, res) => {
|
router.all('*', (req, res) => {
|
||||||
res.status(405).json({
|
return res.status(405).json({
|
||||||
code: res.statusCode,
|
code: res.statusCode,
|
||||||
message: 'Invalid route.'
|
message: 'Invalid route.'
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user