From 77ab25a66917e9740e86d5eb4e1e59dec0dca604 Mon Sep 17 00:00:00 2001 From: Kathryn Dale Date: Thu, 13 Jun 2024 11:46:52 +0100 Subject: [PATCH] Update serviceName on timeout page --- runner/src/server/plugins/router.ts | 9 +++++++-- runner/tsconfig.json | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/runner/src/server/plugins/router.ts b/runner/src/server/plugins/router.ts index 6b7bd57ad7..90ad7b627d 100644 --- a/runner/src/server/plugins/router.ts +++ b/runner/src/server/plugins/router.ts @@ -145,18 +145,23 @@ export default { } let startPage = "/"; + let name = ""; const { referer } = request.headers; + console.log("🚀 ~ referer", referer) if (referer) { - const match = referer.match(/https?:\/\/[^/]+\/([^/]+).*/); + const match = referer.match(/https?:\/\/[^/]+\/([^/]+)(\/([^/]+))?.*/); if (match && match.length > 1) { startPage = `/${match[1]}`; + name = (match[1].split(/(?=[A-Z])/)).toString() + name = (name[0]+name.slice(1).toLowerCase()).replaceAll(",", " ") } } - + return h.view("timeout", { startPage, + name }); }, }); diff --git a/runner/tsconfig.json b/runner/tsconfig.json index 878beb1d58..ae227afe03 100644 --- a/runner/tsconfig.json +++ b/runner/tsconfig.json @@ -15,7 +15,8 @@ "dom", "ES2020.Promise", "ES2019.Object", - "ES2019.Array" + "ES2019.Array", + "ES2021.String" ], "skipLibCheck": true },