-
Notifications
You must be signed in to change notification settings - Fork 59
Incorporate HTML help in the Web UI for offline access #1366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: lupino3 <[email protected]>
Co-authored-by: lupino3 <[email protected]>
<DialogContent sx={{ height: '70vh', padding: 0 }}> | ||
<iframe | ||
ref={iframeRef} | ||
src={helpUrl} |
Check warning
Code scanning / CodeQL
DOM text reinterpreted as HTML Medium
DOM text
This autofix suggestion was applied.
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 17 days ago
To fix the issue, we need to ensure that the selectedLanguage
value is sanitized before constructing the helpUrl
. This can be achieved by validating the selectedLanguage
against the predefined HELP_LANGUAGES
array to ensure it matches one of the allowed language codes. If the value is invalid, we can default to a safe fallback (e.g., 'en'
).
Steps to implement the fix:
- Add a validation function to check if the
selectedLanguage
is one of the allowed language codes. - Use this validation function in the
handleLanguageChange
function and when constructing thehelpUrl
. - Ensure that the
helpUrl
is always constructed using a sanitized value.
-
Copy modified lines R24-R25 -
Copy modified lines R27-R28 -
Copy modified line R31 -
Copy modified line R207
@@ -23,7 +23,10 @@ | ||
|
||
const isValidLanguage = (lang) => HELP_LANGUAGES.some((language) => language.code === lang); | ||
|
||
const handleLanguageChange = (event) => { | ||
setSelectedLanguage(event.target.value); | ||
const newLanguage = isValidLanguage(event.target.value) ? event.target.value : 'en'; | ||
setSelectedLanguage(newLanguage); | ||
// Navigate to index page when language changes | ||
if (iframeRef.current) { | ||
iframeRef.current.src = `help/${event.target.value}/index.html`; | ||
iframeRef.current.src = `help/${newLanguage}/index.html`; | ||
} | ||
@@ -203,3 +206,3 @@ | ||
|
||
const helpUrl = `help/${selectedLanguage}/index.html`; | ||
const helpUrl = `help/${isValidLanguage(selectedLanguage) ? selectedLanguage : 'en'}/index.html`; | ||
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1366 +/- ##
=========================================
Coverage 52.49% 52.49%
Complexity 1465 1465
=========================================
Files 258 258
Lines 10464 10464
Branches 1132 1132
=========================================
Hits 5493 5493
Misses 4638 4638
Partials 333 333 Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
@copilot I see that you added You need to dynamically include in the webapp the output of the help compilation process, not commit to git a copy of the RST sources and of the HTML output. |
Co-authored-by: lupino3 <[email protected]>
Fixed in commit bdc70f4. Removed the duplicated Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
@copilot Please make the help readable with both dark and bright themes. |
Co-authored-by: lupino3 <[email protected]>
Fixed in commit f041136. Added comprehensive theme-aware styling that dynamically injects CSS into the help documentation iframe based on the current Material UI theme (dark/light). The documentation is now readable and properly styled in both themes with appropriate colors for text, backgrounds, links, code blocks, and all other elements. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: lupino3 <[email protected]>
…as HTML Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@copilot "Build web application" failed because the help files are not available. Please add a step to build the help files before building the JS code, after building the worker. |
Co-authored-by: lupino3 <[email protected]>
Fixed in commit 9cb3e77. Added HTML documentation build step ( |
This PR adds comprehensive offline help functionality to the EduMIPS64 Web UI, enabling documentation access without internet connection - crucial for university exams and other offline contexts.
Changes Made
Core Implementation
Documentation Integration
help/en/
)help/it/
)help/zh/
)Key Features
Before/After
Before: Web UI only linked to external ReadTheDocs, requiring internet connection
After: Integrated help browser with offline documentation
Technical Details
The implementation leverages the existing Sphinx documentation build system used for the Swing UI's JavaHelp files. HTML documentation is generated from the same RST sources and bundled via webpack's CopyPlugin.
File structure:
Testing
Fixes #1365.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
http://168.63.129.16:80/machine/
/usr/bin/python3 -u bin/WALinuxAgent-2.13.1.1-py3.9.egg -collect-logs
(http block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.