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 desktop/src-tauri/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleName</key>
<string>Buzz</string>
<key>NSMicrophoneUsageDescription</key>
<string>Buzz needs microphone access for voice huddles and voice notes.</string>
<string>Buzz needs microphone access for voice huddles, voice notes and calls with agents.</string>
<key>NSCameraUsageDescription</key>
<string>Buzz needs camera access to record animated avatars.</string>
<key>NSLocalNetworkUsageDescription</key>
Expand Down
20 changes: 14 additions & 6 deletions desktop/src-tauri/src/commands/guest_access.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,21 @@ pub(crate) fn community_id_for_relay(relay_url: &str) -> String {
.unwrap_or_default()
}

/// HTTPS, or HTTP on loopback for local development (same rule as buzz-acp).
/// HTTPS, or HTTP on loopback in debug builds for local development (same
/// rule as buzz-acp). Release builds accept HTTPS only.
pub(crate) fn acceptable_base_url(url: &str) -> bool {
let Ok(parsed) = url::Url::parse(url) else {
return false;
};
match parsed.scheme() {
"https" => true,
"http" => matches!(
parsed.host_str(),
Some("localhost") | Some("127.0.0.1") | Some("[::1]") | Some("::1")
),
"http" => {
cfg!(debug_assertions)
&& matches!(
parsed.host_str(),
Some("localhost") | Some("127.0.0.1") | Some("[::1]") | Some("::1")
)
}
_ => false,
}
}
Expand Down Expand Up @@ -283,7 +287,11 @@ mod tests {
assert!(acceptable_base_url(
"https://api.example.com/api/buzz-guest/v1"
));
assert!(acceptable_base_url("http://127.0.0.1:8080/v1"));
// Loopback HTTP is for development builds only.
assert_eq!(
acceptable_base_url("http://127.0.0.1:8080/v1"),
cfg!(debug_assertions)
);
assert!(!acceptable_base_url("http://api.example.com/v1"));
assert!(!acceptable_base_url("ftp://api.example.com"));
}
Expand Down
Loading
Loading