Skip to content

Commit 26dc495

Browse files
authored
Merge pull request #134 from gnmyt/updates/optimizations
🚀 Optimierungen am Code
2 parents 8c8ad0f + b7e25ed commit 26dc495

27 files changed

+245
-114
lines changed

client/package-lock.json

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

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "client",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"scripts": {
55
"dev": "vite",
66
"build": "vite build",

client/public/locales/de.json

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,26 @@
77
"update": "Aktualisieren",
88
"close": "Schließen",
99
"unset": "Entfernen",
10+
"retry": "Erneut versuchen",
11+
"login": "Anmelden",
1012
"password": {
1113
"title": "Passwort erforderlich",
1214
"placeholder": "Dein Passwort",
1315
"wrong": "Das von dir eingegebene Passwort ist falsch"
1416
},
1517
"accept": {
16-
"title": "Nutzungsbedingungen akzeptieren",
17-
"description": "Mit dem Klick auf <Bold>Akzeptieren</Bold> bestätigst du, dass du die <EULA>EULA</EULA>, <Privacy>Datenschutzerklärung</Privacy> und <Terms>Nutzungsbedingungen</Terms> von Ookla gelesen hast und diesen zustimmst.",
18+
"title": "Wir brauchen deine Genehmigung",
19+
"description": "Wir nutzen Dienste von Ookla. Mit dem Klick auf <Bold>Akzeptieren</Bold> bestätigst du, dass du die <EULA>EULA</EULA>, <Privacy>Datenschutzerklärung</Privacy> und <Terms>Nutzungsbedingungen</Terms> von Ookla gelesen hast und diesen zustimmst.",
1820
"button": "Akzeptieren"
21+
},
22+
"api": {
23+
"title": "API nicht erreichbar",
24+
"description": "MySpeed konnte die API dieser Instanz nicht erreichen. Bitte versuche es später erneut."
1925
}
2026
},
2127
"dropdown": {
2228
"settings": "Einstellungen",
23-
"changes_applied": "Deine Änderungen wurden übernommen.",
29+
"changes_applied": "Die Änderungen wurden gespeichert.",
2430
"changes_unsaved": "Deine Änderungen wurden nicht übernommen. Überprüfe deine Eingabe.",
2531
"invalid": "Eingabe ungültig",
2632
"ping": "Optimaler Ping",
@@ -36,7 +42,7 @@
3642
"resume_tests": "Tests fortsetzen",
3743
"healthchecks": "Healthchecks",
3844
"language": "Sprache ändern",
39-
"info": "Info"
45+
"info": "Infos zum Projekt"
4046
},
4147
"options": {
4248
"time": {
@@ -55,6 +61,10 @@
5561
"export": {
5662
"json": "JSON-Datei",
5763
"csv": "CSV-Datei"
64+
},
65+
"level": {
66+
"no_access": "Kein Zugriff",
67+
"read_access": "Nur Lesezugriff"
5868
}
5969
},
6070
"update": {
@@ -64,7 +74,7 @@
6474
"upload_placeholder": "Up-Speed (Mbit/s)",
6575
"download_title": "Optimalen Down-Speed setzen (Mbit/s)",
6676
"download_placeholder": "Down-Speed (Mbit/s)",
67-
"recommendations_title": "Automatische Empfehlungen",
77+
"recommendations_title": "Optimale Empfehlungen",
6878
"recommendations_set": "Automatische Empfehlungen setzen?",
6979
"server_title": "Speedtest-Server setzen",
7080
"manually": "Manuell festlegen",
@@ -73,6 +83,8 @@
7383
"new_password": "Neues Passwort festlegen",
7484
"password_placeholder": "Neues Passwort",
7585
"password_removed": "Die Passwortsperre wurde aufgehoben und das festgelegte Passwort wurde entfernt.",
86+
"level": "Stufe ändern",
87+
"level_title": "Rechte für Besucher",
7688
"cron_title": "Test-Häufigkeit einstellen",
7789
"cron_rules": "Cron-Regel",
7890
"cron_next_test": "Nächster Test:",
@@ -94,7 +106,8 @@
94106
"start_tooltip": "Speedtest starten",
95107
"new_update": "Update verfügbar",
96108
"paused": "Speedtests sind aktuell pausiert. Bitte setze sie fort, wenn du einen machen möchtest.",
97-
"running": "Es läuft bereits ein Speedtest. Bitte gedulde dich ein wenig, bis dieser fertig ist."
109+
"running": "Es läuft bereits ein Speedtest. Bitte warte noch einen Moment.",
110+
"admin_login": "Admin-Login"
98111
},
99112
"latest": {
100113
"ping": "Ping",
@@ -125,7 +138,7 @@
125138
},
126139
"latest": {
127140
"title": "Letzter Test",
128-
"description": "Dies ist die Zeit, die dir zeigt, wann der letzte Test ausgeführt wurde. In diesem Fall wurde der letzte Test am <Bold>{{date}}</Bold> um <Bold>{{time}}</Bold> ausgeführt."
141+
"description": "Dies ist die Zeit, die dir zeigt, wann der letzte Test ausgeführt wurde. In diesem Fall fand der letzte am <Bold>{{date}}</Bold> um <Bold>{{time}}</Bold> statt."
129142
}
130143
},
131144
"time": {
@@ -142,7 +155,7 @@
142155
"not_available": "Es liegen aktuell keine Tests vor",
143156
"unknown_error": "Unbekannter Fehler:",
144157
"failed": "Test fehlgeschlagen",
145-
"recheck": "Bitte überprüfe weitestgehend, ob das öfters passiert.",
158+
"recheck": "Bitte überprüfe weitestgehend, ob das öfter passiert.",
146159
"delete": "Test löschen",
147160
"average": {
148161
"title": "Durchschnittsgeschwindigkeit",
@@ -161,13 +174,13 @@
161174
}
162175
},
163176
"errors": {
164-
"network_unreachable": "Die Internetverbindung scheint unterbrochen gewesen zu sein",
177+
"network_unreachable": "Die Internetverbindung war in der Zeit des Tests instabil",
165178
"took_too_long": "Der Test hat zu lange gedauert und wurde abgebrochen",
166179
"no_permission": "MySpeed hat keine Berechtigung, diesen Test zu starten",
167-
"resource_unavailable": "Der Test konnte nicht durchgeführt werden, da die Ressource vorübergehend nicht verfügbar ist",
168-
"no_route": "Der Test konnte nicht durchgeführt werden, da keine Route zum Host existiert",
180+
"resource_unavailable": "Der Test konnte nicht durchgeführt werden, da die Ressource vorübergehend nicht verfügbar war",
181+
"no_route": "Der Test konnte nicht durchgeführt werden, da keine Route zum Host existierte",
169182
"connection_refused": "Der Test konnte nicht durchgeführt werden, da die Verbindung abgelehnt wurde",
170-
"timed_out": "Die Internetverbindung scheint unterbrochen gewesen zu sein",
183+
"timed_out": "Die Internetverbindung war in der Zeit des Tests instabil",
171184
"config": "Die Konfigurationsdatei konnte nicht geladen werden"
172185
}
173186
}

client/public/locales/en.json

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,26 @@
77
"update": "Update",
88
"close": "Close",
99
"unset": "Remove",
10+
"retry": "Try again",
11+
"login": "Login",
1012
"password": {
1113
"title": "Password required",
1214
"placeholder": "Your password",
1315
"wrong": "The password you entered is incorrect"
1416
},
1517
"accept": {
16-
"title": "Accept Terms",
17-
"description": "By clicking <Bold>Accept</Bold>, you acknowledge that you have read and agree to Ookla's <EULA>EULA</EULA>, <Privacy>Privacy Statement</Privacy> and <Terms>Terms of Use</Terms>.",
18+
"title": "We need your permission",
19+
"description": "We use services from Ookla. By clicking <Bold>Accept</Bold>, you acknowledge that you have read and agree to Ookla's <EULA>EULA</EULA>, <Privacy>Privacy Statement</Privacy> and <Terms>Terms of Use</Terms>.",
1820
"button": "Accept"
21+
},
22+
"api": {
23+
"title": "API not reachable",
24+
"description": "MySpeed could not reach the API of this instance. Please try again later."
1925
}
2026
},
2127
"dropdown": {
2228
"settings": "Settings",
23-
"changes_applied": "Your changes have been applied.",
29+
"changes_applied": "Your changes have been saved.",
2430
"changes_unsaved": "Your changes were not applied. Check your input.",
2531
"invalid": "Input invalid",
2632
"ping": "Optimal ping",
@@ -36,7 +42,7 @@
3642
"resume_tests": "Resume tests",
3743
"healthchecks": "Healthchecks",
3844
"language": "Change language",
39-
"info": "Info"
45+
"info": "About the project"
4046
},
4147
"options": {
4248
"time": {
@@ -55,6 +61,10 @@
5561
"export": {
5662
"json": "JSON file",
5763
"csv": "CSV file"
64+
},
65+
"level": {
66+
"no_access": "No Access",
67+
"read_access": "Read-only Access"
5868
}
5969
},
6070
"update": {
@@ -64,7 +74,7 @@
6474
"upload_placeholder": "Up speed (Mbps)",
6575
"download_title": "Set optimal down-speed (Mbps)",
6676
"download_placeholder": "Down speed (Mbps)",
67-
"recommendations_title": "Automatic recommendations",
77+
"recommendations_title": "Optimal recommendations",
6878
"recommendations_set": "Set automatic recommendations?",
6979
"server_title": "Set speedtest server",
7080
"manually": "Set manually",
@@ -73,6 +83,8 @@
7383
"new_password": "Set a new password",
7484
"password_placeholder": "New password",
7585
"password_removed": "The password lock has been removed and the set password has been removed.",
86+
"level": "Change level",
87+
"level_title": "Rights for visitors",
7688
"cron_title": "Set test frequency",
7789
"cron_rules": "Cron rule",
7890
"cron_next_test": "Next Test:",
@@ -94,7 +106,8 @@
94106
"start_tooltip": "Start speedtest",
95107
"new_update": "Update available",
96108
"paused": "Speedtests are currently paused. Please continue them if you want to do one.",
97-
"running": "A speed test is already running. Please be patient until it is finished."
109+
"running": "A speedtest is already running. Please wait a moment.",
110+
"admin_login": "Admin Login"
98111
},
99112
"latest": {
100113
"ping": "Ping",
@@ -109,7 +122,7 @@
109122
"healthchecks": "MySpeed uses <HCLink>HealthChecks</HCLink> to notify you when your internet is down. To enable this, put your ping URL in the text box. Read more <WIKILink>here</WIKILink>",
110123
"credits": "<Link>MySpeed</Link> is provided by GNMYT and uses the <CLILink>Speedtest CLI</CLILink> from Ookla.",
111124
"recommendations_error": "You have to do at least 10 tests to get an average. It doesn't matter if the tests were done manually or automatically.",
112-
"recommendations_info": "Based on the last 10 test results, it was found that the optimal ping was <Bold>{{ping}} ms</Bold>, the download at <Bold>{{down}} Mbit/s</Bold> and the upload at <Bold>{{up}} Mbit/s</Bold>. It is best to orientate yourself on your internet contract and only adopt it if it matches that.",
125+
"recommendations_info": "Based on the last 10 tests, it was found that the optimal ping was <Bold>{{ping}} ms</Bold>, the download at <Bold>{{down}} Mbit/s</Bold> and the upload at <Bold>{{up}} Mbit/s</Bold>. It is best to orientate yourself on your internet contract and only adopt it if it matches that.",
113126
"update": "An update to version {{version}} is available. See <Changes>the changes</Changes> and <DLLink>download the update</DLLink>.",
114127
"down": {
115128
"title": "Download speed",
@@ -125,7 +138,7 @@
125138
},
126139
"latest": {
127140
"title": "Last test",
128-
"description": "This is the time that shows you when the last test was run. In this case, the last test was run on <Bold>{{date}}</Bold> at <Bold>{{time}}</Bold>."
141+
"description": "This is the time that shows you when the last test was run. In this case, the last one took place on <Bold>{{date}}</Bold> at <Bold>{{time}}</Bold>."
129142
}
130143
},
131144
"time": {
@@ -161,13 +174,13 @@
161174
}
162175
},
163176
"errors": {
164-
"network_unreachable": "The Internet connection seems to have been interrupted",
177+
"network_unreachable": "Internet connection was unstable during the time of the test",
165178
"took_too_long": "The test took too long and was canceled",
166179
"no_permission": "MySpeed has no permission to start this test",
167-
"resource_unavailable": "The test could not be performed because the resource is temporarily unavailable",
168-
"no_route": "The test could not be performed because there is no route to the host",
180+
"resource_unavailable": "The test could not be performed because the resource was temporarily unavailable",
181+
"no_route": "The test could not be performed because there was no route to the host",
169182
"connection_refused": "The test could not be performed because the connection was rejected",
170-
"timed_out": "The Internet connection seems to have been interrupted",
183+
"timed_out": "Internet connection was unstable during the time of the test",
171184
"config": "The configuration file could not be loaded"
172185
}
173186
}

client/src/App.sass

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,19 @@ hr
5959
@keyframes fadeIn
6060
0%
6161
opacity: 0
62-
transform: scale(1.6)
62+
transform: scale(0.4)
6363
filter: blur(5px)
6464
100%
6565
opacity: 1
6666

67+
@keyframes fadeOut
68+
0%
69+
opacity: 1
70+
100%
71+
opacity: 0
72+
transform: scale(0.4)
73+
filter: blur(5px)
74+
6775
@media (max-width: 730px)
6876
::-webkit-scrollbar
6977
width: 5px

client/src/common/components/Dropdown/DropdownComponent.jsx

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {DialogContext} from "@/common/contexts/Dialog";
1111
import {SpeedtestContext} from "@/common/contexts/Speedtests";
1212
import {downloadRequest, jsonRequest, patchRequest, postRequest} from "@/common/utils/RequestUtil";
1313
import {creditsInfo, healthChecksInfo, recommendationsInfo} from "@/common/components/Dropdown/utils/infos";
14-
import {exportOptions, languageOptions, selectOptions, timeOptions} from "@/common/components/Dropdown/utils/options";
14+
import {exportOptions, languageOptions, levelOptions, selectOptions, timeOptions} from "@/common/components/Dropdown/utils/options";
1515
import {parseCron, stringifyCron} from "@/common/components/Dropdown/utils/utils";
1616
import {changeLanguage, t} from "i18next";
1717

@@ -63,13 +63,12 @@ function DropdownComponent() {
6363
});
6464

6565
const patchDialog = async (key, dialog, toggle = true, postValue = (val) => val) => {
66-
if (toggle) toggleDropdown();
66+
toggle ? toggleDropdown() : setDialog();
6767

68-
setDialog({
69-
...(await dialog(config[key])),
68+
setTimeout(async () => setDialog({...(await dialog(config[key])),
7069
onSuccess: value => patchRequest(`/config/${key}`, {value: postValue(value)})
7170
.then(res => showFeedback(!res.ok ? t("dropdown.changes_unsaved") : undefined))
72-
})
71+
}), 160);
7372
}
7473

7574
const updatePing = async () => patchDialog("ping", (value) => ({
@@ -119,7 +118,7 @@ function DropdownComponent() {
119118
const updatePassword = async () => {
120119
toggleDropdown();
121120
setDialog({
122-
title: t("update.new_password"),
121+
title: <>{t("update.new_password")} » <a onClick={updatePasswordLevel}>{t("update.level")}</a></>,
123122
placeholder: t("update.password_placeholder"),
124123
type: "password",
125124
unsetButton: localStorage.getItem("password") != null ? "Sperre aufheben" : undefined,
@@ -132,6 +131,10 @@ function DropdownComponent() {
132131
})
133132
}
134133

134+
const updatePasswordLevel = () => patchDialog("passwordLevel", async (value) => ({
135+
title: t("update.level_title"), select: true, selectOptions: levelOptions(), value
136+
}), false);
137+
135138
const updateCron = async () => {
136139
toggleDropdown();
137140
setDialog({
@@ -200,7 +203,7 @@ function DropdownComponent() {
200203
placeholder: t("update.healthchecks_url"), value,
201204
buttonText: t("dialog.update"),
202205
unsetButton: !value.includes("<uuid>") ? "Deaktivieren" : undefined,
203-
onClear: () => patchDialog("/config/healthChecksUrl", {value: "https://hc-ping.com/<uuid>"})
206+
onClear: () => patchRequest("/config/healthChecksUrl", {value: "https://hc-ping.com/<uuid>"})
204207
.then(() => showFeedback(t("update.healthchecks_activated")))
205208
}));
206209

@@ -235,27 +238,29 @@ function DropdownComponent() {
235238
{run: updateServer, icon: faServer, text: t("dropdown.server")},
236239
{run: updatePassword, icon: faKey, text: t("dropdown.password")},
237240
{run: updateCron, icon: faClock, text: t("dropdown.cron")},
238-
{run: updateTime, icon: faCalendarDays, text: t("dropdown.time")},
241+
{run: updateTime, icon: faCalendarDays, text: t("dropdown.time"), allowView: true},
239242
{run: exportDialog, icon: faFileExport, text: t("dropdown.export")},
240243
{run: togglePause, icon: status.paused ? faPlay : faPause, text: t("dropdown." + (status.paused ? "resume_tests" : "pause_tests"))},
241244
{run: updateIntegration, icon: faCircleNodes, text: t("dropdown.healthchecks")},
242-
{run: updateLanguage, icon: faGlobeEurope, text: t("dropdown.language")},
243-
{run: showCredits, icon: faInfo, text: t("dropdown.info")}
245+
{run: updateLanguage, icon: faGlobeEurope, text: t("dropdown.language"), allowView: true},
246+
{run: showCredits, icon: faInfo, text: t("dropdown.info"), allowView: true}
244247
];
245248

246249
return (
247250
<div className="dropdown dropdown-invisible" id="dropdown" ref={ref}>
248251
<div className="dropdown-content">
249252
<h2>{t("dropdown.settings")}</h2>
250253
<div className="dropdown-entries">
251-
{options.map(entry => !entry.hr ? (
252-
<div className="dropdown-item" onClick={entry.run} key={entry.run}>
253-
<FontAwesomeIcon icon={entry.icon}/>
254-
<h3>{entry.text}</h3>
255-
</div>
256-
) : <div className="center" key={entry.key}>
257-
<hr className="dropdown-hr"/>
258-
</div>)}
254+
{options.map(entry => {
255+
if (!config.viewMode || (config.viewMode && entry.allowView)) {
256+
if (!entry.hr) {
257+
return (<div className="dropdown-item" onClick={entry.run} key={entry.run}>
258+
<FontAwesomeIcon icon={entry.icon}/>
259+
<h3>{entry.text}</h3>
260+
</div>);
261+
} else return (<div className="center" key={entry.key}><hr className="dropdown-hr"/></div>);
262+
}
263+
})}
259264
</div>
260265
</div>
261266
</div>

client/src/common/components/Dropdown/styles.sass

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
@import "@/common/styles/colors"
22

3+
.dropdown
4+
visibility: visible
5+
opacity: 1
6+
transition: opacity 0.1s linear
7+
user-select: none
8+
39
.dropdown-content
410
float: right
511
margin-right: 10%
612
display: inline-block
713
position: absolute
8-
width: 320px
14+
width: auto
915
overflow: auto
1016
border-radius: 10px
1117
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2)
@@ -16,6 +22,8 @@
1622

1723
.dropdown-invisible
1824
visibility: hidden
25+
opacity: 0
26+
transition: visibility 0s 0.1s, opacity 0.1s linear
1927

2028
.dropdown-content h2
2129
color: $darker-white

0 commit comments

Comments
 (0)