Socials
This commit is contained in:
parent
68ee9be768
commit
84f53c40b8
2 changed files with 20 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -130,3 +130,4 @@ dist
|
||||||
.yarn/install-state.gz
|
.yarn/install-state.gz
|
||||||
.pnp.*
|
.pnp.*
|
||||||
|
|
||||||
|
config
|
19
index.js
19
index.js
|
@ -15,6 +15,21 @@ var pfpSeason = "default"
|
||||||
|
|
||||||
var violetSpins = 0
|
var violetSpins = 0
|
||||||
|
|
||||||
|
var configPath = path.join(__dirname, "config")
|
||||||
|
if (!fs.existsSync(configPath)) {
|
||||||
|
fs.mkdirSync(configPath)
|
||||||
|
}
|
||||||
|
|
||||||
|
var configs = ["socials.json"]
|
||||||
|
|
||||||
|
for (var i = 0; i < configs.length; i++) {
|
||||||
|
var file = configs[i]
|
||||||
|
var filePath = path.join(configPath, file)
|
||||||
|
if (!fs.existsSync(filePath)) {
|
||||||
|
fs.writeFileSync(filePath, "{}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function randomFileInDir(directory) {
|
function randomFileInDir(directory) {
|
||||||
var dir = fs.readdirSync(directory)
|
var dir = fs.readdirSync(directory)
|
||||||
return path.join(directory, dir[Math.floor(Math.random() * dir.length)])
|
return path.join(directory, dir[Math.floor(Math.random() * dir.length)])
|
||||||
|
@ -56,6 +71,10 @@ app.get("/v1/spins", (req, res) => {
|
||||||
res.send(violetSpins.toString())
|
res.send(violetSpins.toString())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
app.get("/v1/socials", (req, res) => {
|
||||||
|
res.sendFile(path.join(configPath, "socials.json"))
|
||||||
|
})
|
||||||
|
|
||||||
// app.listen(PORT, () => {
|
// app.listen(PORT, () => {
|
||||||
// console.log("API is now listening on port 8080!")
|
// console.log("API is now listening on port 8080!")
|
||||||
// })
|
// })
|
||||||
|
|
Loading…
Reference in a new issue