Skip to content

Commit a85eaed

Browse files
committed
Add telemetry toggle and link to privacy policy
1 parent 37c3d85 commit a85eaed

File tree

5 files changed

+47
-7
lines changed

5 files changed

+47
-7
lines changed

src/gui/css/styles.css

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,10 @@ button:hover {
308308
margin: 15px 0;
309309
}
310310

311+
#telemetry-toggle {
312+
accent-color: #fecc44;
313+
}
314+
311315
.scale-slider-container label {
312316
display: block;
313317
margin-bottom: 5px;
@@ -333,7 +337,7 @@ button:hover {
333337

334338
#bbox-coords {
335339
width: 100%;
336-
padding: 8px;
340+
padding: 5px;
337341
border: 1px solid #fecc44;
338342
border-radius: 4px;
339343
font-size: 14px;
@@ -380,7 +384,7 @@ button:hover {
380384

381385
.license-button-row {
382386
justify-content: center;
383-
margin-top: 10px;
387+
margin-top: 5px;
384388
}
385389

386390
.license-button {
@@ -420,7 +424,7 @@ button:hover {
420424
.generation-mode-dropdown {
421425
width: 100%;
422426
max-width: 180px;
423-
padding: 5px 8px;
427+
padding: 3px 8px;
424428
border-radius: 4px;
425429
border: 1px solid #fecc44;
426430
background-color: #ffffff;
@@ -448,7 +452,7 @@ button:hover {
448452
.language-dropdown {
449453
width: 100%;
450454
max-width: 180px;
451-
padding: 5px 8px;
455+
padding: 3px 8px;
452456
border-radius: 4px;
453457
border: 1px solid #fecc44;
454458
background-color: #ffffff;
@@ -476,7 +480,7 @@ button:hover {
476480
.theme-dropdown {
477481
width: 100%;
478482
max-width: 180px;
479-
padding: 5px 8px;
483+
padding: 3px 8px;
480484
border-radius: 4px;
481485
border: 1px solid #fecc44;
482486
background-color: #ffffff;

src/gui/index.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,14 @@ <h2 data-localize="customization_settings">Customization Settings</h2>
186186
</div>
187187
</div>
188188

189+
<!-- Telemetry Consent Toggle -->
190+
<div class="settings-row">
191+
<label for="telemetry-toggle">Anonymous Crash Reports</label>
192+
<div class="settings-control">
193+
<input type="checkbox" id="telemetry-toggle" name="telemetry-toggle">
194+
</div>
195+
</div>
196+
189197
<!-- License and Credits Button -->
190198
<div class="settings-row license-button-row">
191199
<button type="button" id="license-button" class="license-button" onclick="openLicense()" data-localize="license_and_credits">License and Credits</button>
@@ -210,7 +218,7 @@ <h2 data-localize="customization_settings">Customization Settings</h2>
210218
<h2>Help improve Arnis</h2>
211219
<p style="text-align:left; margin-top:6px; color:#ececec;">
212220
We’d like to collect anonymous usage data like crashes and performance to make Arnis more stable and faster.
213-
No personal data or world contents are collected.
221+
<a href="https://arnismc.com/privacypolicy.html" style="color: inherit;" target="_blank">No personal data or world contents are collected.</a>
214222
</p>
215223
<div class="modal-actions" style="margin-top:14px;">
216224
<button type="button" class="btn-secondary" onclick="rejectTelemetry()">No thanks</button>

src/gui/js/license.js

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/gui/js/main.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,20 @@ function initSettings() {
306306
}
307307
});
308308

309+
// Telemetry consent toggle
310+
const telemetryToggle = document.getElementById("telemetry-toggle");
311+
const telemetryKey = 'telemetry-consent';
312+
313+
// Load saved telemetry consent
314+
const savedConsent = localStorage.getItem(telemetryKey);
315+
telemetryToggle.checked = savedConsent === 'true';
316+
317+
// Handle telemetry consent change
318+
telemetryToggle.addEventListener("change", () => {
319+
const isEnabled = telemetryToggle.checked;
320+
localStorage.setItem(telemetryKey, isEnabled ? 'true' : 'false');
321+
});
322+
309323

310324
/// License and Credits
311325
function openLicense() {
@@ -349,11 +363,21 @@ function initTelemetryConsent() {
349363
window.acceptTelemetry = () => {
350364
localStorage.setItem(key, 'true');
351365
modal.style.display = 'none';
366+
// Update settings toggle to reflect the consent
367+
const telemetryToggle = document.getElementById('telemetry-toggle');
368+
if (telemetryToggle) {
369+
telemetryToggle.checked = true;
370+
}
352371
};
353372

354373
window.rejectTelemetry = () => {
355374
localStorage.setItem(key, 'false');
356375
modal.style.display = 'none';
376+
// Update settings toggle to reflect the consent
377+
const telemetryToggle = document.getElementById('telemetry-toggle');
378+
if (telemetryToggle) {
379+
telemetryToggle.checked = false;
380+
}
357381
};
358382

359383
// Utility for other scripts to read consent

src/telemetry.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ struct CrashReport<'a> {
2828
fn send_crash_report(error_message: String, platform: &str, app_version: &str) {
2929
let _ = (|| -> Result<(), Box<dyn std::error::Error>> {
3030
let client = Client::new();
31-
let url = "https://arnismc.com/report_telemetry.php";
31+
let url = "https://arnismc.com/telemetry/report_telemetry.php";
3232

3333
let payload = CrashReport {
3434
error_message: &error_message,

0 commit comments

Comments
 (0)