forked from 1b-agent/opencadstudio-upstream
feat(ui): OCS Web button, prefilled feedback, drop Start About button
- Add an "OCS Web" button (bright ribbon-blue, desktop only) to the Start page that opens the web build at hakanseven12.github.io/OpenCADStudio. - Send Feedback now opens the GitHub issue with the body pre-filled: app version + platform (OS/arch on desktop, browser user-agent on web), via sys::platform_info + sys::percent_encode. - Remove the redundant About button from the Start page (ABOUT command / menu still opens it). Native + web build; 75 tests pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
a146795952
commit
17f7924e77
4 files changed
+95
-7
No files matched your search
+30
@@ -59,3 +59,33 @@ pub fn download_bytes(name: &str, bytes: &[u8]) {
|
||||
}
|
||||
let _ = web_sys::Url::revoke_object_url(&url);
|
||||
}
|
||||
|
||||
/// Short platform string for bug reports: OS + architecture on the desktop,
|
||||
/// the browser user-agent on the web.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub fn platform_info() -> String {
|
||||
format!("{} {}", std::env::consts::OS, std::env::consts::ARCH)
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
pub fn platform_info() -> String {
|
||||
web_sys::window()
|
||||
.and_then(|w| w.navigator().user_agent().ok())
|
||||
.map(|ua| format!("Web — {ua}"))
|
||||
.unwrap_or_else(|| "Web (wasm)".to_string())
|
||||
}
|
||||
|
||||
/// Percent-encode `s` for use in a URL query value (e.g. a GitHub issue
|
||||
/// `?body=`). Encodes everything outside the unreserved set.
|
||||
pub fn percent_encode(s: &str) -> String {
|
||||
let mut out = String::with_capacity(s.len());
|
||||
for &b in s.as_bytes() {
|
||||
match b {
|
||||
b'A'..=b'Z' | b'a'..=b'z' | b'0'..=b'9' | b'-' | b'_' | b'.' | b'~' => {
|
||||
out.push(b as char)
|
||||
}
|
||||
_ => out.push_str(&format!("%{b:02X}")),
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
Reference in new issue
Block a user