Skip to content

Commit

Permalink
robots.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
motdotla committed Jun 16, 2024
1 parent ec25041 commit 588d44f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
15 changes: 15 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,26 @@ fs.readFile(path.join(__dirname, 'VERSION'), 'utf8', (err, data) => {
VERSION = data.trim()
})

// Read the robots.txt once at the start
let ROBOTS = '' // hardcode for added redundancy (in case read fails somehow)
fs.readFile(path.join(__dirname, 'robots.txt'), 'utf8', (err, data) => {
if (err) {
console.error('Error reading robots.txt file', err)
process.exit(1) // Exit if the script cannot be read
}
ROBOTS = data.trim()
})

app.get('/', (req, res) => {
res.type('text/plain')
res.send(installerScript)
})

app.get('/robots.txt', (req, res) => {
res.type('text/plain')
res.send(ROBOTS)
})

app.get('/VERSION', (req, res) => {
res.type('text/plain')
res.send(VERSION)
Expand Down
4 changes: 4 additions & 0 deletions robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
User-agent: *
Disallow: /
Allow: /$
Allow: /install.sh

0 comments on commit 588d44f

Please sign in to comment.