mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-21 19:25:56 +00:00
Modules page: places held for Auction House Bot, NPC Enchanter and Playerbots with a Soon badge; module GitHub links from the catalog are allowed to open
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3b4cea7530
commit
31c08934ad
11 files changed
+76
-11
No files matched your search
@@ -1115,7 +1115,9 @@ fn open_link(url: String) -> std::result::Result<(), UiError> {
|
||||
const NEW_ISSUE: &str = "https://github.com/Corfirean/coa-server-manager/issues/new";
|
||||
let issue = url == NEW_ISSUE || url.starts_with(&format!("{NEW_ISSUE}?"));
|
||||
let chars_ok = url.chars().all(|c| c.is_ascii_alphanumeric() || "/:._-?=#%".contains(c) || (issue && c == '&'));
|
||||
if !(issue || ALLOWED.iter().any(|p| url.starts_with(p))) || !chars_ok || url.len() > 12_000 {
|
||||
// the GitHub page of a module that is in the bundled catalog (some are not ours)
|
||||
let catalog = coa_core::modules::catalog().iter().any(|e| e.repo == url);
|
||||
if !(issue || catalog || ALLOWED.iter().any(|p| url.starts_with(p))) || !chars_ok || url.len() > 12_000 {
|
||||
return Err(Error::Invalid("That link is not allowed.".into()).into());
|
||||
}
|
||||
// explorer.exe opens the address in the default browser without going through a shell.
|
||||
|
||||
Reference in new issue
Block a user