Skip to content

Commit

Permalink
Add endpoint for community patch version
Browse files Browse the repository at this point in the history
  • Loading branch information
timoschwarzer authored Oct 29, 2023
1 parent c0aae82 commit c6b2101
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,19 @@ server.get('/motd/wotw', async (req, res) => {
}))
})

server.get('/wotw-community-patch/latest', async (req, res) => {
res.send(await cache.retrieve('wotw-community-patch-latest', MOTD_TTL, async () => {
const octokit = new Octokit
const base64Content = (await octokit.rest.repos.getContent({
owner: 'ori-community',
repo: 'wotw-community-patch-info',
path: 'latest-version'
})).data.content

return {
motd: Buffer.from(base64Content, 'base64').toString('utf-8'),
}
}))
})

server.listen(3000, () => console.log('Server running on port 3000'))

0 comments on commit c6b2101

Please sign in to comment.