Implement the new design from #649
User description
I will close #649 to follow up here in this PR. Thanks to @Timendus there for implementing it.
The when the merge is ready we will have a new design as proposed by @Chris-ZoGo in #585
PR Type
Enhancement
Description
-
Implement new fromScratch design for LibreSpeed frontend
-
Add complete HTML/CSS/JS frontend with modern UI components
-
Update Docker configurations to include frontend directory
-
Add server selection, gauges, and telemetry support
Diagram Walkthrough
flowchart LR
A["New Frontend Files"] -->|HTML/CSS/JS| B["Modern UI Design"]
C["Docker Config"] -->|Copy Frontend| D["Frontend Deployment"]
B -->|Server Selection| E["Test Interface"]
B -->|Gauges & Metrics| E
E -->|Telemetry Support| F["Results Sharing"]
File Walkthrough
| Relevant files | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Enhancement | 10 files
| ||||||||||||||||||||
| Configuration changes | 5 files
| ||||||||||||||||||||
| Documentation | 1 files
|
PR Reviewer Guide 🔍
(Review updated until commit https://github.com/librespeed/speedtest/commit/dda78410139b4af549de22c7af8dba7f1d845ec0)
Here are some key observations to aid the review process:
|
🎫 Ticket compliance analysis ✅ 585 - Fully compliant Compliant requirements:
|
| ⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪ |
| 🧪 PR contains tests |
| 🔒 No security concerns identified |
⚡ Recommended focus areas for reviewError Handling
|
PR Code Suggestions ✨
Latest suggestions up to 4fc0932
| Category | Suggestion | Impact |
| Possible issue |
Fix mode logic inconsistencyThere's a logical error in the conditional blocks. In the first block, if mode
Suggestion importance[1-10]: 9__ Why: The suggestion correctly identifies a critical logical error in the mode handling. The current code sets SPEEDTEST_SERVERS to empty for standalone mode but then tries to add a server in dual mode only, which would cause standalone mode to have no servers. The fix properly aligns with the entrypoint.sh logic. | High |
Fix mode configuration consistencyThe server-list.json file is only created for standalone mode, but the ui.php
Suggestion importance[1-10]: 7__ Why: The suggestion correctly identifies a potential inconsistency between the entrypoint.sh and ui.php handling of dual mode. The improved code consolidates the logic for copying frontend files and creates a more maintainable structure that ensures proper configuration across different modes. | Medium | |
| General |
Fix duplicate server namesMultiple servers have the same name "Amsterdam, Netherlands" with different IDs frontend/server-list.json [2-12]
Suggestion importance[1-10]: 7__ Why: Having multiple servers with identical names ("Amsterdam, Netherlands") but different IDs (51 and 94) could confuse users when selecting a server. Adding the sponsor name to differentiate them improves usability and prevents potential selection errors. | Medium |
| Possible issue |
Complete test loop implementationThe test script has a loop structure but doesn't contain any actual commands docker/test/test-script.sh [15-16]
Suggestion importance[1-10]: 9__ Why: The suggestion correctly identifies that the test script has empty loops without any actual testing commands. Adding the w3m commands to test each container combination is critical for the test script to function properly. | High |
| Security |
Fix privacy policy placeholderThe privacy policy contains a placeholder email address that needs to be
Suggestion importance[1-10]: 8__ Why: The suggestion identifies a critical issue where a placeholder email address in the privacy policy could cause compliance problems with privacy regulations. Using an environment variable would properly configure the contact email. | Medium |
Use explicit HTTPS protocolProtocol-relative URLs (starting with "//") can cause issues in certain frontend/server-list.json [4-11]
Suggestion importance[1-10]: 7__ Why: Protocol-relative URLs can cause issues in certain contexts like file:// access or embedded environments. Using explicit HTTPS improves security and reliability, making this a valuable suggestion that affects multiple server entries in the file. | Medium | |
| General |
Handle invalid gauge valuesThe rotation calculation for the gauge could produce NaN if speed is negative, frontend/javascript/index.js [382-383]
Suggestion importance[1-10]: 7__ Why: This suggestion addresses a potential bug where NaN values could cause visual issues in the gauge display. Adding a check for NaN values improves the robustness of the UI rendering code. | Medium |
Fix dialog positioningThe large fixed margin-top of 23rem pushes dialogs far down the page, frontend/styling/dialog.css [10-14]
Suggestion importance[1-10]: 6__ Why: The fixed margin-top of 23rem could push dialogs too far down on medium-sized screens, potentially causing accessibility issues. The suggestion to use auto margin is reasonable and would improve the dialog positioning across different screen sizes. | Low | |
| ||
Previous suggestions
✅ Suggestions up to commit dda7841
| Category | Suggestion | Impact |
| Possible issue |
Fix conditional logic errorThere's a logical error in the conditional checks. The "dual" mode is first
Suggestion importance[1-10]: 9__ Why: The suggestion correctly identifies a critical logical error in the conditional checks. In dual mode, SPEEDTEST_SERVERS would be set to an empty array first, then the code would try to add a server to it with unshift(), which would result in incorrect behavior. The fix properly separates the conditions. | High |
✅
| Medium | |
Add missing sanity checkThe script is missing the actual sanitycheck call mentioned in the comment. The docker/test/test-script.sh [1-10]
Suggestion importance[1-10]: 7__ Why: The suggestion correctly points out that the script installs w3m but doesn't actually use it to perform any sanity checks as mentioned in the comment. Adding a function to perform these checks would improve the script's functionality and align with its stated purpose. | Medium | |
Add missing display propertyThe dialog element is missing the frontend/styling/dialog.css [3-8]
Suggestion importance[1-10]: 6__ Why: The dialog element needs | Low | |
| Security |
Use explicit HTTPS protocolThe server URLs starting with "//" (protocol-relative URLs) may cause issues in frontend/server-list.json [2-12]
Suggestion importance[1-10]: 7__ Why: Using protocol-relative URLs (starting with "//") can cause issues in certain contexts, especially when accessed via file:// protocol. Explicitly using HTTPS improves security and reliability. | Medium |
| Possible issue |
Fix logarithmic calculationThe frontend/javascript/index.js [364-384]
Suggestion importance[1-10]: 7__ Why: The suggestion correctly identifies a mathematical issue where calculating log10(minSpeed + 1) is redundant since minSpeed is 0. The improved code simplifies the calculation while maintaining the logarithmic scale, making the gauge calculation more efficient and clearer. | Medium |
Add null checkThe frontend/javascript/index.js [212-216]
Suggestion importance[1-10]: 6__ Why: The suggestion adds a defensive null check to prevent potential errors if the server parameter is undefined or null. This is a good defensive programming practice that improves code robustness, especially since server selection could potentially fail. | Low | |
| General |
Add error handlingThe function doesn't handle errors that might occur when trying to access the frontend/javascript/index.js [98-108]
Suggestion importance[1-10]: 7__ Why: The suggestion adds proper error handling for clipboard operations which might fail due to permissions or browser compatibility issues. This improves user experience by providing feedback when clipboard operations fail instead of silently failing. | Medium |
Improve dialog positioningThe fixed frontend/styling/dialog.css [10]
Suggestion importance[1-10]: 7__ Why: The fixed margin-top of 23rem could cause dialogs to appear off-screen on smaller viewports. Changing to just | Medium | |
Fix gauge pointer positioningUsing frontend/styling/results.css [118-120]
Suggestion importance[1-10]: 5__ Why: Using | Low | |