Skip to content

Commit

Permalink
Update serviceName on timeout page
Browse files Browse the repository at this point in the history
  • Loading branch information
kathryn-dale committed Jun 13, 2024
1 parent 382ed29 commit 77ab25a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 7 additions & 2 deletions runner/src/server/plugins/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
},
});
Expand Down
3 changes: 2 additions & 1 deletion runner/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"dom",
"ES2020.Promise",
"ES2019.Object",
"ES2019.Array"
"ES2019.Array",
"ES2021.String"
],
"skipLibCheck": true
},
Expand Down

0 comments on commit 77ab25a

Please sign in to comment.