Skip to content

Commit 8349733

Browse files
authored
Add a warning popup for Macos (f3d-app#1486)
1 parent c2acf9a commit 8349733

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

_sass/custom/custom.scss

+17
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,20 @@ div.install-buttons {
5050
img.cm {
5151
min-height: 10px;
5252
}
53+
54+
div.popup-container {
55+
position: fixed;
56+
top: 25%;
57+
left: 50%;
58+
transform: translate(-50%, -50%);
59+
width: 500px;
60+
max-width: 75vw;
61+
padding: 1em 1.5em;
62+
box-shadow: 3px 2px 4px 2px rgba(0, 0, 0, 0.4);
63+
border-radius: .5em;
64+
65+
.btn {
66+
display: block;
67+
margin-left: auto;
68+
}
69+
}

assets/main.js

+24
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,25 @@ function onload(event) {
55
}
66

77
function enhance_install_page() {
8+
function open_mac_warning_popup() {
9+
const popup = document.createElement("div");
10+
popup.classList = "popup-container bg-grey-dk-200";
11+
popup.innerHTML = `
12+
<h2>Warning</h2>
13+
<p>MacOS package is not signed, if macOS complains that <b>the file is invalid, damaged or corrupted</b>, see the <a href="/doc/user/LIMITATIONS_AND_TROUBLESHOOTING.html#macos">troubleshooting section</a> for a workaround.</p>
14+
`;
15+
16+
const button = document.createElement("button");
17+
button.classList = "btn btn-primary";
18+
button.innerHTML = "Ok";
19+
button.addEventListener("click", function () {
20+
popup.remove();
21+
});
22+
popup.append(button);
23+
24+
document.body.append(popup);
25+
}
26+
827
function retrieve_downloads(target_platform_re) {
928
var downloads = [];
1029
for (const table of document.querySelectorAll("table")) {
@@ -17,8 +36,12 @@ function enhance_install_page() {
1736
const link = table_cols[1].querySelector("a");
1837
if (link) {
1938
const platform = table_cols[0].innerText;
39+
2040
if (target_platform_re.test(platform))
2141
downloads.push([platform, link.innerText, link.href]);
42+
43+
if (/MacOS/i.test(platform))
44+
link.addEventListener("click", open_mac_warning_popup);
2245
}
2346
}
2447
}
@@ -56,6 +79,7 @@ function enhance_install_page() {
5679
link.setAttribute("href", url);
5780
link.setAttribute("class", i++ ? "btn" : "btn btn-primary");
5881
link.innerHTML = `<div>Get <b>F3D</b> for ${bolded_platform}</div><small>${filename}</small>`;
82+
if (current_os === "MacOS") link.addEventListener("click", open_mac_warning_popup);
5983
div.append(link);
6084
}
6185
const note = document.createElement("div");

doc/user/INSTALLATION.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
| Linux (Debian package) | [F3D-2.4.0-Linux.deb](https://github.com/f3d-app/f3d/releases/download/v2.4.0/F3D-2.4.0-Linux-x86_64-raytracing.deb) |
1212
| Linux (portable) | [F3D-2.4.0-Linux.tar.xz](https://github.com/f3d-app/f3d/releases/download/v2.4.0/F3D-2.4.0-Linux-x86_64-raytracing.tar.xz) |
1313

14-
Note: MacOS package is not signed, see the [troubleshooting](LIMITATIONS_AND_TROUBLESHOOTING.md) section for a workaround if needed.
14+
Note: MacOS package is not signed, see the [troubleshooting](LIMITATIONS_AND_TROUBLESHOOTING.md#macos) section for a workaround if needed.
1515

1616
## Alternatives
1717

0 commit comments

Comments
 (0)