Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "kinode_process_lib"
description = "A library for writing Kinode processes in Rust."
version = "0.9.7"
version = "0.10.0"
edition = "2021"
license-file = "LICENSE"
homepage = "https://kinode.org"
Expand Down
26 changes: 2 additions & 24 deletions src/http/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,18 +186,13 @@ pub enum HttpServerAction {
WebSocketBind {
path: String,
authenticated: bool,
encrypted: bool,
extension: bool,
},
/// SecureBind is the same as Bind, except that it forces new connections to be made
/// from the unique subdomain of the process that bound the path. These are *always*
/// authenticated. Since the subdomain is unique, it will require the user to be
/// logged in separately to the general domain authentication.
WebSocketSecureBind {
path: String,
encrypted: bool,
extension: bool,
},
WebSocketSecureBind { path: String, extension: bool },
/// Unbind a previously-bound WebSocket path
WebSocketUnbind { path: String },
/// When sent, expects a [`crate::LazyLoadBlob`] containing the WebSocket message bytes to send.
Expand Down Expand Up @@ -398,16 +393,12 @@ impl HttpBindingConfig {
/// `authenticated` is set to true by default and means that the WebSocket server will
/// require a valid login cookie to access this path.
///
/// `encrypted` is set to false by default and means that the WebSocket server will
/// not apply a custom encryption to the WebSocket connection using the login cookie.
///
/// `extension` is set to false by default and means that the WebSocket will
/// not use the WebSocket extension protocol to connect with a runtime extension.
#[derive(Clone, Copy, Debug)]
pub struct WsBindingConfig {
authenticated: bool,
secure_subdomain: bool,
encrypted: bool,
extension: bool,
}

Expand All @@ -419,22 +410,15 @@ impl WsBindingConfig {
Self {
authenticated: true,
secure_subdomain: false,
encrypted: false,
extension: false,
}
}

/// Create a new WsBindingConfig with the given values.
pub fn new(
authenticated: bool,
secure_subdomain: bool,
encrypted: bool,
extension: bool,
) -> Self {
pub fn new(authenticated: bool, secure_subdomain: bool, extension: bool) -> Self {
Self {
authenticated,
secure_subdomain,
encrypted,
extension,
}
}
Expand Down Expand Up @@ -535,15 +519,13 @@ impl HttpServer {
.body(if config.secure_subdomain {
serde_json::to_vec(&HttpServerAction::WebSocketSecureBind {
path: path.clone(),
encrypted: config.encrypted,
extension: config.extension,
})
.unwrap()
} else {
serde_json::to_vec(&HttpServerAction::WebSocketBind {
path: path.clone(),
authenticated: config.authenticated,
encrypted: config.encrypted,
extension: config.extension,
})
.unwrap()
Expand Down Expand Up @@ -672,7 +654,6 @@ impl HttpServer {
.body(
serde_json::to_vec(&HttpServerAction::WebSocketSecureBind {
path: path.clone(),
encrypted: false,
extension: false,
})
.unwrap(),
Expand All @@ -690,7 +671,6 @@ impl HttpServer {
WsBindingConfig {
authenticated: true,
secure_subdomain: true,
encrypted: false,
extension: false,
},
);
Expand Down Expand Up @@ -756,15 +736,13 @@ impl HttpServer {
.body(if entry.secure_subdomain {
serde_json::to_vec(&HttpServerAction::WebSocketSecureBind {
path: path.to_string(),
encrypted: config.encrypted,
extension: config.extension,
})
.unwrap()
} else {
serde_json::to_vec(&HttpServerAction::WebSocketBind {
path: path.to_string(),
authenticated: config.authenticated,
encrypted: config.encrypted,
extension: config.extension,
})
.unwrap()
Expand Down
Loading