From 3fa36a32ee2f5a2a57b14d04716efbde4fd21af7 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 28 Oct 2023 00:46:44 +0200 Subject: [PATCH] Update Privacy dashboard, nuke %% --- README.md | 1 - css/Pages/More/Privacy.css | 7 +-- js/UI/More/Privacy/Privacy.js | 114 ++++++++++++++-------------------- js/UI/More/Privacy/tiles.js | 20 +----- public/config/config.json | 3 +- 5 files changed, 51 insertions(+), 94 deletions(-) diff --git a/README.md b/README.md index d90eb95..eb2e885 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,6 @@ Some of them are listed in _Settings_ page and can be customized by end-user. | `open_new_tab` | Tells whether clicking on a service will open it in new tab by default. | ✅ | | `blur` | Tells whether card background blur is enabled by default. | ✅ | | `animations` | Tells whether UI animations are enabled by default. | ✅ | -| `https_importance` | How important is HTTPS comparing to independence. If set to `0.25`, HTTPS will score maximum 25% in Privacy Panel. Total importance is `1`. | ❌ | ### 🔗 Adding custom services diff --git a/css/Pages/More/Privacy.css b/css/Pages/More/Privacy.css index c1baf74..62eb81c 100644 --- a/css/Pages/More/Privacy.css +++ b/css/Pages/More/Privacy.css @@ -56,7 +56,7 @@ display: flex; align-items: center; justify-content: space-between; - max-width: 600px; + max-width: 540px; padding: 24px; margin: 120px auto 80px; text-align: right; @@ -73,8 +73,3 @@ .security #report { opacity: .6; } - -.score::after { - content: "%"; - font-size: 18px; -} \ No newline at end of file diff --git a/js/UI/More/Privacy/Privacy.js b/js/UI/More/Privacy/Privacy.js index 9ab9674..0cbb1a0 100644 --- a/js/UI/More/Privacy/Privacy.js +++ b/js/UI/More/Privacy/Privacy.js @@ -26,77 +26,57 @@ export default class Privacy { stats.thirdParties += analysis.isThirdParty } - let secure_pp = 100 * stats.secure / stats.total - let indepencence_pp = 100 * (stats.total - stats.thirdParties) / stats.total - let https_importance = this.config.get("https_importance") - let privacy_score = secure_pp * https_importance + indepencence_pp * (1 - https_importance) + let encryption = stats.secure / stats.total + let encryption_t + if (encryption == 1) encryption_t = "All" + else if (encryption >= 0.9) encryption_t = "Most" + else if (encryption > 0.5) encryption_t = "Many" + else if (encryption > 0.2) encryption_t = "Some" + else if (encryption > 0) encryption_t = "Few" + else encryption_t = "No" + encryption_t = `${encryption_t} listed services use secure connections.` - let privacy_report; - if (privacy_score == 100) { - privacy_report = "Data is sent securely and no third-party services are involved." + let indepencence = (stats.total - stats.thirdParties) / stats.total + let indepencence_t + if (indepencence == 1) indepencence_t = "no" + else if (indepencence > 0.7) indepencence_t = "some" + else if (indepencence > 0.4) indepencence_t = "many" + else if (indepencence > 0) indepencence_t = "a lot of" + else indepencence_t = "only" + indepencence_t = `There are ${indepencence_t} 3rd-party services here.` + + let score = (encryption + indepencence) / 2 + score = 0.99 + let score_t, score_d + if (score == 1) { + score_t = "Superb" + score_d = "All data is sent securely and no 3rd-party services are involved." } - else if (privacy_score >= 85) { - privacy_report = "Great privacy overall, but at some point it could be better." + else if (score >= 0.9) { + score_t = "Great" + score_d = "Awesome privacy practices, but still not perfect." } - else if (privacy_score >= 40) { - privacy_report = "Decent privacy. You should pay attention what you're doing." + else if (score >= 0.6) { + score_t = "Good" + score_d = "Acceptable privacy practices, but still not perfect." + } + else if (score >= 0.3) { + score_t = "Fair" + score_d = "Definitely not a vault, but self-hosted at least." + } + else if (score > 0) { + score_t = "Dangerous" + score_d = "You should really pay attention what you're doing here." + } + else { + score_t = ":0" + score_d = "You're just testing, right?" } - else privacy_report = "Transferring data is insecure and vulnerable to various threats." - document.getElementById("report-score").innerText = Math.round(privacy_score) - document.getElementById("report").innerText = privacy_report + document.getElementById("report-score").innerText = score_t + document.getElementById("report").innerText = score_d - const phrase = " of the listed services are using secure connections" - privacyBox(secure_pp, "icon-https", [ - { - "from": 0, - "name": "No encryption", - "desc": "None" + phrase - }, - { - "from": 0.1, - "name": "Poor encryption", - "desc": "Only some" + phrase - }, - { - "from": 60, - "name": "Fair encryption", - "desc": "Most" + phrase - }, - { - "from": 90, - "name": "Good encryption", - "desc": "Nearly all" + phrase - }, - { - "from": 100, - "name": "Full encryption", - "desc": "All" + phrase - } - ]) - - privacyBox(indepencence_pp, "icon-rocket", [ - { - "from": 0, - "name": "Not independent", - "desc": "This server lists a lot of 3rd party services" - }, - { - "from": 40, - "name": "Partially independent", - "desc": "This server lists many 3rd party services" - }, - { - "from": 65, - "name": "Mostly independent", - "desc": "This server still lists some 3rd party services" - }, - { - "from": 100, - "name": "Fully independent", - "desc": "This server is free of 3rd party services" - } - ]) + privacyBox("icon-https", "Encryption", encryption_t) + privacyBox("icon-rocket", "Independence", indepencence_t) } - -} \ No newline at end of file +} diff --git a/js/UI/More/Privacy/tiles.js b/js/UI/More/Privacy/tiles.js index 68492a6..5bd2a3d 100644 --- a/js/UI/More/Privacy/tiles.js +++ b/js/UI/More/Privacy/tiles.js @@ -1,27 +1,11 @@ -export function privacyBox(privacyScore, icon_class, levels) { - let name, desc - levels = levels.reverse() - - for (let i in levels) { - let item = levels[i] - if (item.from <= privacyScore) { - name = levels[i].name - desc = levels[i].desc - break - } - } - +export function privacyBox(icon, name, desc) { let item = document.createElement("div") - item.innerHTML = ` + item.innerHTML = `
${name}
${desc}
` - if (privacyScore < 30) item.classList.add("error") - else if (privacyScore < 90) item.classList.add("warn") - else if (privacyScore < 100) item.classList.add("prewarn") - document.getElementById("report-boxes").appendChild(item) return item } diff --git a/public/config/config.json b/public/config/config.json index a21b1a2..8141ccb 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -8,8 +8,7 @@ "dark_mode": false, "open_new_tab": false, "blur": true, - "animations": true, - "https_importance": 0.5 + "animations": true }, "services": [ {