UI: allowlist Discord and X community links across macOS, Linux, and Windows
This commit is contained in:
1 parent
ba09bde5a7
commit
f59e53ebce
2 files changed
+5
-1
No files matched your search
@@ -1210,6 +1210,8 @@ fn allowed_url(url: &str) -> bool {
|
||||
| "https://runkiri.com/releases/"
|
||||
| "https://runkiri.com/share/notice"
|
||||
| "https://canestack.com"
|
||||
| "https://discord.gg/K5A8wuqcC"
|
||||
| "https://x.com/runkiri"
|
||||
| "https://learn.microsoft.com/windows/wsl/about"
|
||||
| "https://github.com/libracoder/kiri/issues/new"
|
||||
| "https://github.com/libracoder/kiri"
|
||||
@@ -1297,6 +1299,8 @@ mod tests {
|
||||
assert!(allowed_url("https://runkiri.com/releases/"));
|
||||
assert!(allowed_url("https://runkiri.com/share/notice"));
|
||||
assert!(allowed_url("https://canestack.com"));
|
||||
assert!(allowed_url("https://discord.gg/K5A8wuqcC"));
|
||||
assert!(allowed_url("https://x.com/runkiri"));
|
||||
assert!(allowed_url("https://kiri.canestack.com"));
|
||||
assert!(allowed_url("https://github.com/libracoder/kiri"));
|
||||
assert!(allowed_url("https://github.com/libracoder/kiri/issues/new"));
|
||||
|
||||
@@ -2856,7 +2856,7 @@ fn handle(text: &str, tx: &Sender<Cmd>, autostart: bool, view: Option<&str>) {
|
||||
let local = msg.name.strip_prefix("http://").or_else(|| msg.name.strip_prefix("https://")).and_then(|r| r.split(['/', ':']).next()).is_some_and(|h| h == "localhost" || h.ends_with(".kiri.localhost") || h.ends_with(".kiri.local"));
|
||||
// A build warning's rule page (docs.docker.com/go/dockerfile/rule/…).
|
||||
let docs = msg.name.strip_prefix("https://docs.docker.com/go/").is_some_and(|rest| rest.bytes().all(|b| b.is_ascii_alphanumeric() || b"-/".contains(&b)));
|
||||
if local || docs || msg.name == "https://runkiri.com" || msg.name == "https://runkiri.com/share/notice" || msg.name == "https://canestack.com" || msg.name == "https://github.com/libracoder/kiri/issues/new" || msg.name == "https://github.com/libracoder/kiri" || msg.name == "https://github.com/anchore/grype" || msg.name == "https://login.docker.com/activate" || msg.name == "https://github.com/login/device" {
|
||||
if local || docs || msg.name == "https://runkiri.com" || msg.name == "https://runkiri.com/releases/" || msg.name == "https://runkiri.com/share/notice" || msg.name == "https://canestack.com" || msg.name == "https://discord.gg/K5A8wuqcC" || msg.name == "https://x.com/runkiri" || msg.name == "https://github.com/libracoder/kiri/issues/new" || msg.name == "https://github.com/libracoder/kiri" || msg.name == "https://github.com/anchore/grype" || msg.name == "https://login.docker.com/activate" || msg.name == "https://github.com/login/device" {
|
||||
open(&msg.name);
|
||||
}
|
||||
Ok(())
|
||||
|
||||
Reference in new issue
Block a user