diff options
Diffstat (limited to 'app.js')
| -rw-r--r-- | app.js | 22 |
1 files changed, 16 insertions, 6 deletions
@@ -19,6 +19,7 @@ const mime = { png: 'image/png', webp: 'image/webp', avif: 'image/avif', + ico: 'image/ico', svg: 'image/svg+xml', js: 'application/javascript' } @@ -57,12 +58,21 @@ class App { string: req.path } - if (this.path.split[1] === 'favicon.ico') { - const data = this.readfile.GetFile('/img/favicon.ico') - data.mime.then(output => this.#FileOpen({data: data, mime: output, res: res})) - } else { - if (this.path.string.endsWith('/') && this.path.string.length > 1) this.path.string = this.path.string.substring(0, this.path.string.length - 1) - if (output.has(this.path.string)) {res.send(this.readfile.GetMain())} else {res.sendStatus(404)} + switch (this.path.split[1]) { + case 'favicon.ico': + this.data = this.readfile.GetFavicon() + this.data.mime.then(output => this.#FileOpen({data: this.data, mime: output, res: res})) + break + case 'robots.txt': + console.log('hit') + this.data = this.readfile.GetRobots() + this.data.mime.then(output => this.#FileOpen({data: this.data, mime: output, res: res})) + break + default: + if (this.path.string.endsWith('/') && this.path.string.length > 1) this.path.string = this.path.string.substring(0, this.path.string.length - 1) + if (output.has(this.path.string)) {res.send(this.readfile.GetMain())} else {res.sendStatus(404)} + break + } }) }) |
