From 2f71b95322d4993a9d1b5e681ea07dbbf29b3a49 Mon Sep 17 00:00:00 2001 From: Sylwester Wroblewski Date: Wed, 16 Oct 2024 12:56:24 +0200 Subject: [PATCH] Fixed redirect to https --- package.json | 1 + src/Utils/RedirectToHttps.ts | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 src/Utils/RedirectToHttps.ts diff --git a/package.json b/package.json index 6afb82b..fd03e61 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "@parcel/transformer-vue": "^2.12.0", "@types/dateformat": "^5.0.2", "@types/js-yaml": "^4.0.9", + "@types/node": "^22.7.5", "assert": "^2.1.0", "browserify-zlib": "^0.2.0", "buffer": "^6.0.3", diff --git a/src/Utils/RedirectToHttps.ts b/src/Utils/RedirectToHttps.ts new file mode 100644 index 0000000..52d9ca5 --- /dev/null +++ b/src/Utils/RedirectToHttps.ts @@ -0,0 +1,6 @@ +export const redirectToHttps = () => { + const host = process.env.HOST; + if (window.location.href.match(`http://${host}`)) { + window.location.protocol = "https:"; + } +}; \ No newline at end of file