diff --git a/server/controller/ApiController.ts b/server/controller/ApiController.ts index 7caa5a7..bf2f31b 100644 --- a/server/controller/ApiController.ts +++ b/server/controller/ApiController.ts @@ -50,13 +50,17 @@ export default class ApiController extends Controller { if (Date.now() < cacheExpiry) { this.ok(cachedClient); } else { - const response = await fetch(`http://${Config.githost}/tgpholly/t00-multiuser/raw/branch/master/client/Terminal-00-Multiuser.user.js?${Date.now()}`); - if (response.status === 200) { - cachedClient = await response.text(); - return this.ok(cachedClient); - } else { + fetch(`http://${Config.githost}/tgpholly/t00-multiuser/raw/branch/master/client/Terminal-00-Multiuser.user.js?${Date.now()}`) + .then(async response => { + if (response.status === 200) { + cachedClient = await response.text(); + return this.ok(cachedClient); + } else { + return this.badRequest(); + } + }).catch(() => { return this.badRequest(); - } + }); } } } \ No newline at end of file