diff --git a/internal/commands/host.go b/internal/commands/host.go index f00fd01..6b54966 100644 --- a/internal/commands/host.go +++ b/internal/commands/host.go @@ -52,9 +52,13 @@ var ( Action: func(ctx *cli.Context) error { log := zaputil.Extract(ctx.Context) + // additional mime-types that need to be explicitly registered _ = mime.AddExtensionType(".woff2", "application/font-woff2") _ = mime.AddExtensionType(".woff", "application/font-woff") _ = mime.AddExtensionType(".ttf", "font/ttf") + _ = mime.AddExtensionType(".yaml", "application/yaml") + _ = mime.AddExtensionType(".yml", "application/yaml") + _ = mime.AddExtensionType(".json", "application/json") gitService := git.NewService(hostConfig.Git) err := gitService.Load(ctx.Context) diff --git a/internal/web/src/index.js b/internal/web/src/index.js index 3369d9e..f4f3d2d 100644 --- a/internal/web/src/index.js +++ b/internal/web/src/index.js @@ -18,11 +18,13 @@ import {ulid} from 'ulid'; +const secure = window.location.protocol === "https:"; +const protocol = secure ? "wss:" : "ws:"; const sessionPrefix = "/_session"; -const domain = window.location.host; +const domain = window.location.host + (secure ? ":443" : ""); async function main() { - const ws = new WebSocket(`ws://${domain}${sessionPrefix}${window.location.pathname}`); + const ws = new WebSocket(`${protocol}//${domain}${sessionPrefix}${window.location.pathname}`); const message = `{"ID":"${ulid()}","FullName":"ping"}` let id = null;