admin: add http checks

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/602/head
Varun Patil 2023-04-19 13:33:53 -07:00
parent 20b2baa613
commit 3113b0041e
1 changed files with 43 additions and 0 deletions

View File

@ -534,6 +534,34 @@
>{{ t("memories", "CUDA scaler") }}
</NcCheckboxRadioSwitch>
</p>
<h3>{{ t("memories", "Performance") }}</h3>
<p>
<NcNoteCard :type="isHttps ? 'success' : 'warning'">
{{
isHttps
? t("memories", "HTTPS is enabled")
: t(
"memories",
"You are accessing this page over an insecure context. Several browser APIs are not available, which will make Memories very slow. Enable HTTPS on your server to improve performance."
)
}}
</NcNoteCard>
<NcNoteCard :type="httpVerOk ? 'success' : 'warning'">
{{
httpVerOk
? t("memories", "HTTP/2 or HTTP/3 is enabled")
: t(
"memories",
"HTTP/2 or HTTP/3 is strongly recommended ({httpVer} detected)",
{
httpVer,
}
)
}}
</NcNoteCard>
</p>
</div>
</template>
@ -861,6 +889,21 @@ export default defineComponent({
vaapiStatusType(): string {
return this.status?.vaapi_dev === "ok" ? "success" : "error";
},
isHttps(): boolean {
return window.location.protocol === "https:";
},
httpVer(): string {
const entry = window.performance?.getEntriesByType?.(
"navigation"
)?.[0] as any;
return entry?.nextHopProtocol || this.t("memories", "Unknown");
},
httpVerOk(): boolean {
return this.httpVer === "h2" || this.httpVer === "h3";
},
},
});
</script>