Skip to content

Commit

Permalink
content types
Browse files Browse the repository at this point in the history
  • Loading branch information
proller committed Jan 8, 2024
1 parent bb7afa6 commit 9f96fe8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/network/wssocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,19 @@ void WSSocket::on_http(const websocketpp::connection_hdl &hdl)
const auto uri = con->get_request().get_uri();
if (uri == "/") {
path_serve = http_root + DIR_DELIM + "index.html";
con->append_header("Access-Control-Allow-Origin", "*");
con->append_header("Cross-Origin-Embedder-Policy", "require-corp");
con->append_header("Cross-Origin-Opener-Policy", "same-origin");
} else if (uri == "/favicon.ico") {
path_serve = porting::path_share + DIR_DELIM + "misc" + DIR_DELIM +
PROJECT_NAME + ".ico";
} else if (!uri.empty()) {
path_serve = http_root + uri;
if (uri.ends_with(".wasm")) {
con->append_header("Content-Type", "application/wasm");
} else if (uri.ends_with(".js")) {
con->append_header("Content-Type", "application/javascript");
}
}

if (!path_serve.empty()) {
Expand Down

0 comments on commit 9f96fe8

Please sign in to comment.