disable sync endpoint
This commit is contained in:
21
disabled/old.js
Normal file
21
disabled/old.js
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
// This file contains old code not used anymore
|
||||||
|
|
||||||
|
app.post("/api/sync", (rreq,rres) => {
|
||||||
|
checkToken(rreq.query.auth,"fpupdate").then(checkResponse => {
|
||||||
|
if (checkResponse === true) {
|
||||||
|
if (rreq.headers["x-github-event"] == "ping") {
|
||||||
|
rres.sendStatus(200)
|
||||||
|
} else if (rreq.headers["x-github-event"] == "push") {
|
||||||
|
execSync("git pull")
|
||||||
|
logRequest(rres,rreq,200,"Ran git pull, exiting to restart...")
|
||||||
|
rres.sendStatus(200)
|
||||||
|
process.exit(0)
|
||||||
|
} else {
|
||||||
|
logRequest(rres,rreq,400)
|
||||||
|
rres.sendStatus(400)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
rres.sendStatus(401)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -43,26 +43,6 @@ app.get("/urltoolbox", (rreq,rres) => {
|
|||||||
rres.send("Under construction")
|
rres.send("Under construction")
|
||||||
})
|
})
|
||||||
|
|
||||||
app.post("/api/sync", (rreq,rres) => {
|
|
||||||
checkToken(rreq.query.auth,"fpupdate").then(checkResponse => {
|
|
||||||
if (checkResponse === true) {
|
|
||||||
if (rreq.headers["x-github-event"] == "ping") {
|
|
||||||
rres.sendStatus(200)
|
|
||||||
} else if (rreq.headers["x-github-event"] == "push") {
|
|
||||||
execSync("git pull")
|
|
||||||
logRequest(rres,rreq,200,"Ran git pull, exiting to restart...")
|
|
||||||
rres.sendStatus(200)
|
|
||||||
process.exit(0)
|
|
||||||
} else {
|
|
||||||
logRequest(rres,rreq,400)
|
|
||||||
rres.sendStatus(400)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
rres.sendStatus(401)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
function parseFiles() {
|
function parseFiles() {
|
||||||
let files = fs.readdirSync(process.cwd()+"/website/posts")
|
let files = fs.readdirSync(process.cwd()+"/website/posts")
|
||||||
let result = ""
|
let result = ""
|
||||||
|
|||||||
Reference in New Issue
Block a user