Commit Graph

61 Commits

Author SHA1 Message Date
Daniel Markstedt
1af48e6e71
Get page title from string variable (#1056) 2022-12-25 07:23:16 -08:00
Daniel Markstedt
cde4866844
Allow generating ISO image from local file (#1046)
- Break out generate_iso() into its own class method in file_cmds
- Add form and handling of using local file to generate iso image
- Reorder index page sections to group actions that create new image files
2022-12-23 16:13:52 -08:00
Daniel Markstedt
6b6a303986
Tweak dropzone config and introduce dedicated Upload page (#1040)
- Introduce a dedicated Upload page and move the upload form there
- Style the utility hyperlinks on the index page with icons and bold text
- Display the cancel / dismiss downloads link, and tweak the link text to make more sense. Note: Cancelled downloads won't remove the partially uploaded file.
- Hide image preview thumbnails. Not relevant to our usecase, and mess up the layout when it happens.
- Turn on chunk retries and tweaks chunk size to be a full MiB (probably won't make a big difference)
2022-12-19 17:21:01 -08:00
nucleogenic
0128660d40
Disabled auth improvements (#1029)
* Improve styling support when web authentication disabled, fix issue #1017

* Fix sudo PATH issue in Docker web container (allows easyinstall.sh to call commands in sbin)

* Fix logout button icon flicker/reload on resize
2022-12-11 03:31:37 +00:00
Daniel Markstedt
52c2aa474f
Rebrand project to PiSCSI (#1016)
* Rebrand project to PiSCSI
- rascsi ->piscsi
- rasctl -> scsictl
- rasdump -> scsidump
- ras* -> piscsi* (rasutil -> piscsi_util, etc.)

* Refined the formatting and wording of the app startup banner
* Kept some references to rascsi and rasctl where backwards compatibility is concerned
* Point to the new github repo URL

Co-authored-by: nucleogenic <nr@nucleogenic.com>
Co-authored-by: Uwe Seimet <Uwe.Seimet@seimet.de>
2022-12-05 09:58:23 -08:00
nucleogenic
88ff542aeb
Run web API test suite in GitHub Actions (#1009)
- Fixed ignore patterns in .dockerignore
- Added healthchecks to backend and web containers
- Reduced Docker image sizes
- Removed RaSCSI references in various areas (e.g. rascsi -> backend)
- Added compilation-only step to easyinstall.sh
- Moved apt package lists to variables
- Revert to triggering GitHub Actions runs on push
- Updated web/frontend_checks workflow to run black and flake8 against all Python sources
- Capture log files from backend/web containers
- Fix None to float conversion bug when user agent is absent or unrecognised
2022-12-04 14:31:57 +00:00
nucleogenic
315ef9f248
Auto-format Python sources with black, fix all issues reported by flake8 (#1010)
* Update config for black and flake8
* Auto-format Python sources with black
* Fix issues reported by flake8
* Exclude protobuf files from black
* Address formatting feedback
2022-11-30 05:19:17 +00:00
Daniel Markstedt
0d95890887
Get and set pretty hostname to use as system name in Web UI (#997)
- Display the pretty hostname as system name in header
- Move IP and hostname down to the footer
- New endpoint for setting the pretty hostname, plus form field in the Web UI
- (unrelated) Use platform.uname() instead of shell uname
- (unrelated) Better logic for fetching the Mac HD Drivers zip file in easyinstall.sh
2022-11-20 10:20:32 -08:00
Daniel Markstedt
4afb11d3dd
Shutdown splash for the OLED script; restore non-Latin transliteration; other refactoring (#991)
- Bring back the shutdown splash, with the tweak that is blanks out after 700ms
- Restore the non-Latin transliteration originally from https://github.com/akuker/RASCSI/pull/449 which was lost when the `common` package was introduced
- Bump to the latest libraries, while removing implicit dependencies from requirements.txt
- Shorter duration of the startup splash
- Reintroduce shell shutdown/reboot methods for use with the Web UI. This addresses https://github.com/akuker/RASCSI/issues/538 (the ctrlboard client will continue to use the built-in rascsi system calls which are slightly faster)
- Remove overt references to RPi. This addresses https://github.com/akuker/RASCSI/issues/990
- Other refactorings
2022-11-17 16:21:18 -08:00
Daniel Markstedt
4645e8c975
Display hardware info in footer; close open file handlers; better error handling (#989)
* Expose hardware info in env string

* Improve error handling for get_properties_by_drive_name

* Verbose uname parameters.

* Close open file in introspect method

* Add error handling for when no drive name was matched with props in the database
2022-11-15 22:28:27 -08:00
nucleogenic
3627b39af4
New theme for web UI (#957)
* Docker environment fixes

* New theme for web UI

* Apply breaking wrap to filenames only

* Reduce font sizes, whitespace and padding

* Right align action fields/buttons

* Improve mobile header, hide superfluous UI elements when logged out, drop placeholders from login labels, various other adjustments

* Force footer to bottom of screen

* Show manual link to logged out users

* Reduce header text size on desktop

* Fix incorrect selector ID

* Fix selector referencing old class name

* Fix right-aligned message when images table empty

* Add CSS linter/auto-formatter

* Run Stylelint + Prettier against modern theme CSS

* Select default theme based on browser’s user agent

* Style inputs on mobile/tablet devices

* Fixes for Safari 14 on iOS + iPad OS

* Explicitly define mobile browser support, switch to bare ua-parser without user-agent wrapper

* Add LICENSE file for modern theme icons

* Improve theme selection query string/field naming.

* Remove patch workaround from Docker build

* Update log level for UAs to info

* Move Bootstrap Reboot CSS to CDN

* Account for LUN column in attached devices table

* Prevent wrapping of config forms on small viewports

* Fix Stylelint issues

* Auto-format CSS with Prettier
2022-11-14 09:32:15 -08:00
Daniel Markstedt
85edd50047
Partition and format HFS/FAT volumes in the Web UI + SMB install (#946)
- New "format as" option when creating new images; removing the image creation options from easyinstall
- Bring in HFSer as new submodule providing the driver binaries; removing the Lido driver binary from this repo
- Add SpeedTools driver option
- Point to github mirror of hfdisk, since the original git server is down
- While rearranging the easyinstall options, moved the CtrlBoard option up to the main section
- Add an easyinstall script to configure Samba, while consolidating file sharing with Netatalk
2022-11-01 16:43:24 -07:00
Daniel Markstedt
4b109a70b0
Improve Web UI integration tests (#939)
* Remove deprecated critital log level from test

* Move drive_properties back into template data sets

* Move properties data integrity checks to test code

* Streamline the drive formatting logic
2022-10-25 08:51:04 -07:00
Daniel Markstedt
5172d167e7
Web UI: More file path sanitation, better network bridge warnings, each endpoint return one message (#932)
- Sanitize file paths with Path: for flat file structures, always extract Path().name, and for nested file structures either look for absolute paths, or someone trying to use ".." to traverse the dir strucutre.
- Reduce redundancy in network bridge detection method, and return somewhat more informative messages
- Make all endpoints return exactly one message
- Move some warning messages to logging
- Use tempfile for iso generation temp file handling
2022-10-23 19:05:29 -07:00
Daniel Markstedt
e3e833b4d2
Fix one case of Path object conversion that was missed during the refactoring (#929) 2022-10-22 08:01:08 -07:00
Daniel Markstedt
aed793001d Change locale fallback to info logging 2022-10-14 19:39:32 -07:00
Daniel Markstedt
5a679509a1
More refactoring of Python code to address Sonar issues (#906)
- Use Path objects for file operations
- Use urllib to sanitize URLs
- Some explicit type conversions
- Consistent regex syntax
- Add rudimentary logging when archive extraction caching fails
- Fixed two cases of the property file creation not being notified in the Flash message
- added doctype and html lang attribute to the web server 502 page
2022-10-12 12:59:01 -07:00
Daniel Markstedt
1b10b123d2
Refactor python code to address Sonarcloud issues (#900)
- copy/move/delete file class methods now take Path objects as arguments
- The file download endpoint in the Web UI uses the safer download from dir method
- Simplified logging
- Merged nested if statements
- Removed naked handling of unknown error states
- Added fallback empty list for drive_properties, to avoid errors when json file is missing or broken
- Move drive_properties to env[]
- Constants for common error messages
- Dummy variable for list comprehension
2022-10-09 13:50:20 -07:00
Daniel Markstedt
62e287c96d
Remove redundant help text, table columns and parameters from the Web UI (#898)
- Remove the Size option from the Drives page, since we offer custom sizes with Drive profiles now in the Create Image form
- Fetch size from drive props data structure rather than the web form
- Remove a range of redundant / obvious help text to reduce UI clutter and emphasize the important help text
- Remove the Size column from the CD-ROM drives table since it's always N/A
- Merge the two Logging related sections, and the two Create Image related sections (semantically associated)
2022-10-07 19:55:53 -07:00
Daniel Markstedt
d1a703418c
Address Sonarcloud issues for the html code; improve on css styles (#892)
Refactor and clean up code to conform to SonarCloud static analysis, improve readability and semantics.
- Add labels for each form input, and tweak placeholder text accordingly.
- Move CSS styles to the stylesheet; minor tweaks for clarity and consistency
- Use the legacy align=center attribute for centering paragraphs (backwards compatible)
- Remove all instances of using tables for layout
- Add header tags to all remaining tables, with scope parameters.
- Add descriptions to each table
- Move drive reference hyperlinks to the drive name column (addresses "same link text leads to different URL" code smell.)
- Inject lang parameters to each html tag
- Standardize on h2 tags as top header for each template
- Add 'json' to config file UI elements, to communicate actual file name/format
- Clean up indentation
- Dropbox styling: Added a colored outline, added padding to more clearly communicate its function. Hid the (X) SVG that indicates failure, since failure is already communicated by the error text. Also, the SVG always obstructed the file name or error so was quite counter-productive.
2022-10-07 13:13:29 -07:00
Daniel Markstedt
90ace5fd53
Introduce utility method to look up drive props by drive name. (#888)
* Introduce utility method to look up drive props by drive name.

* Make /drive/create endpoint fetch file ending from properties data structure; update tests
2022-10-06 14:04:41 -07:00
Daniel Markstedt
52ebb3a2ae
Improve the logic and data structure for SCSI ID management in Web UI (#893)
- Have the get_scsi_ids() utility method return a dict, while adding occupied_ids. Leverage this to improve the logic for detecting which IDs are available to be reserved in the Web UI. (Which fixes a recent regression bug that's causing no IDs to be detected as available to be reserved.)
- Improve /scsi/attach endpoint logic to capture dynamic parameter fields now prefixed with "param_" (previous it scanned for any arbitrary field, which wasn't very accurate or secure)
- Added Product string to the block_size:512 CD-ROM device, so that it's obvious when it's being used.
- Tweaked test data for attach_device tests
2022-10-06 10:00:57 -07:00
Daniel Markstedt
52259c374f
Improve the logic for checking the network bridge configuration (#894)
* Improve the logic for checking the network bridge configuration
2022-10-05 14:14:48 -07:00
Daniel Markstedt
0e4d42f04c
Use man2html to generate man pages in the Web UI (#887)
* Use man2html to generate man pages in the web UI

* Fix tests
2022-10-04 06:38:15 -07:00
Daniel Markstedt
dcb4b33f2e
Add capabilities to get and render manpage output in the Web UI (#881)
- class method to get arbitrary file contents
- new web UI endpoint to fetch the contents of rascsi man pages (rendered txt files)
- Link to manpage in page footer
- Link to new wiki page for image type docs
- Other UI tweaks
2022-10-03 12:46:18 -07:00
Daniel Markstedt
fd47411322
Device table refinement in Web UI (#884)
* Refine the attached device table to optimize information displayed

* Error handling when attempting to insert withough image file

* Format the parameters in the jinja template instead

* Call the DaynaPORT device Ethernet Adapter in the Web UI
2022-10-03 11:47:08 -07:00
Daniel Markstedt
c07e1a8ede Allow for generating properties files in the Create Image UI 2022-10-01 19:56:19 -07:00
Daniel Markstedt
d969fbdcce
Attach empty removable drives in the Web UI (#877)
* Read the drive properties file once and store it in the Flask app config. Spin out the drive properties formatting to a helper method.

* Add empty removable disk drives to the attach peripherals UI

* Refinement of UI labels and help text, moving some context to the wiki
2022-10-01 16:51:30 -07:00
Daniel Markstedt
3c8e7dbef0
Allow the selecting of target dir when uploading or downloading files (#867)
Uses a single endpoint for downloading files
Adds a select field to pick target dir for both download and upload forms
Moves the Macproxy/Netatalk helptext into the helptext blocks, and the related status messages down into the page footer
2022-09-27 17:38:34 -07:00
Daniel Markstedt
5da3d6c24b
Introduce info.html template and use it to render detailed info (#863)
new:
- new templates to render structured info contents in
- get_diskinfo() class method that calls disktype and returns the results
- /diskinfo endpoint in the Flask app that renders the results from get_diskinfo()

changed:
- /logs/show and /scsi/info endpoints in the Flask app render in templates
- Now using the "RaSCSI Reloaded Control Page" header to function as the link back to the homepage (instead of the github project) which is in line with how most webapps work
- Removed the center style for "Attached!" to allow the ? button to be placed on the same line
- Remove individual device info, and introduced show all device info in a template
2022-09-26 17:44:41 -07:00
nucleogenic
f8e58708aa
Update comments 2022-09-26 00:00:19 +01:00
nucleogenic
1a15c4c648
Expose env info to API clients 2022-09-26 00:00:19 +01:00
nucleogenic
fb8f306005
Implement response generator for HTML and JSON requests
Supporting updates to web.py and templates
2022-09-26 00:00:18 +01:00
nucleogenic
1e9a7d2283
Move flattening of file type lists to template layer 2022-09-25 23:58:07 +01:00
nucleogenic
4ef2e20b4f
Update get_supported_locales to return a JSON serializable result 2022-09-25 23:58:07 +01:00
Daniel Markstedt
e7775a72cc
Generate list of image types to create programmatically in the Web UI (#850)
* Generate list of image types to create programmatically based on rascsi capabilities, rather than a hard-coded list in the Web UI.

* Add explicit sorting of dicts for display in the Web UI, to avoid random order in certain environments.

* Remove redundant sorting line, and add code comments.

* Add helptext for the SCSI-1 image type
2022-09-21 17:14:53 -07:00
nucleogenic
673da6312b
Add Docker environment for development and testing of the web UI
Add --token parameter to easyinstall.sh

Add --skip-token parameter to easyinstall.sh

Install required apt packages explicitly (--no-install-recommends)

Allow standalone RaSCSI and web UI installations to specify an auth token

Add development mode to web UI (web/start.sh --dev-mode)

Initial Docker-based development environment for Python and web UI

Bump protobuf version

Workaround for Flask development server and asyncio incompatibility

Build Python protobuf interface on container launch, if it doesn’t exist

Allow containers to be configured with environment variables, add support for token authentication

Move web UI live editing setup out of main Docker Compose config

Update dockerignore to exclude by default

Update README

Add OS_DISTRO, OS_VERSION and OS_ARCH build args

Allow extracted files to be moved to target when crossing a filesystem boundary

Reduce noise from watchmedo auto-restarts

Update Docker tag structure to rascsi:{build}-{platform}-{variant}

Prevent Docker Compose from attempting to pull images from Docker registry

Add workaround for issue #821

Allow container processes to be stopped with Ctrl+C

Update README, bind to ports 8080/8443 on the Docker host by default

Update README to clarify audience and no board connectivity

Add AIBOM and GAMERNIUM to --connect_type validation

Update cfilesystem.patch following rebase
2022-09-08 12:19:30 +01:00
nucleogenic
8c7ab75835
Update web UI following SASI removal; clean up references to SAHD in Python sources 2022-09-03 17:43:51 +01:00
Daniel Markstedt
2411afb2c4
Remove file extension validation in upload form (#826)
* Remove file extension validation in upload form. Improve on the related help text.

* Split up image and archive file suffixes.
2022-09-03 09:14:13 +02:00
nucleogenic
b5e6438a45
Allow images to be extracted from StuffIt, tarball, gzip, and 7z archives 2022-08-12 04:19:02 +01:00
nucleogenic
7a18939171
Add support for --log-level argument to web UI (#781)
Increase verbosity of web UI log format

Add critical to supported log levels for completeness
2022-07-31 19:02:14 -05:00
nucleogenic
dc1414ba71
Add RASCSI host and port arguments to web/start.sh (#771)
* Fix data type of --rascsi-port argument

* Add support for --rascsi-host and --rascsi-port arguments

* Add short parameter names, increase specificity of web port parameter
2022-07-25 21:47:11 -07:00
Daniel Markstedt
6397d9c9a3
Add a Copy image file flow to the Web UI. (#760)
* Add a Copy image file flow to the Web UI.

* Introduce a generic file creation message and use that consistently.

* Clarify code comment
2022-06-14 21:03:56 -05:00
Daniel Markstedt
a1a2e6089b
Fix a malformatted gettext string, and update the localization README (#758)
* Fix a gettext marked string that has one too many parantheses around it, excluding it from translations. Also, clean up layout around it.

* Add Swedish translation for the above.

* More explicit localization steps in the README to avoid recurring mistakes.
2022-05-02 14:42:09 -05:00
Daniel Markstedt
aa1f3b02e3
Make the ip and hostname show up on the Drive page as well. (#759) 2022-05-02 14:41:11 -05:00
Daniel Markstedt
da02eccb2e
Improve logic for the get_logs() method. Add rascsi-ctrlboard service. (#714) 2022-02-28 09:49:48 -08:00
Daniel Markstedt
e8f392c3f1
Create SysCmds common class, and refactor Python codebase (#697)
* Move the oled script's PiCmds module to common, and rename it SysCmds.

* Use sys_cmds.get_ip_and_host() in web UI code.

* Move the auth_active() method to device_utils

* Rename device_utils to web_utils. Make auth_active() method take the group as argument.

* Migrate all pi_cmds methods to the SysCmds common class.

* Display hostname and ip in Web UI.

* Resolve or suppress pylint warnings.

* Resolve a pylint warning.

* Resolve or suppress pylint warnings.

* Import libraries at the top level for readability. In my testing on a Pi3B+, this leads to ~1.5k more memory being used by the python3 process.

* Change page title as requested by akuker.

* Reenable the import-outside-toplevel pylint rule.

* Resolve pylint warnings.

* Fix error following refactoring.

* Minor UI tweaks.

* Cleanup.

* Break out bridge config validation into a utility method.

* Move the dropzonejs method into the web_utils package

* Move get_logs method into SysCmds class.

* Improve get logs UI.

* Resolve pylint warning.

* Standardize class instance name.
2022-02-26 21:46:35 -08:00
Daniel Markstedt
5d92590877
Use the word Release in the context of making a SCSI ID available for use, rather than the word Unreserve which is poor English. (#692) 2022-02-21 20:31:38 +01:00
Daniel Markstedt
4252d46844
Inquire the backend for device capabilities instead of Web UI assumptions (#688)
* Add capabilities to RaCtlCmds.get_device_types() to return the image file support boolean, and list of supported block sizes.

* Inquire rascsi backend about the min block size rather than hard coding values in the web UI.

* Add class methods for getting lists of certain device types.

* Use the new class methods to get lists of device types in the web ui.

* Make use of the new class methods in the oled script.

* Remove now unused constants, and simplify logic in common_settings

* Improve device name mapping to extend the existing dictionary rather than creating a new data structure.

* Use jinja2 sort filters instead of sorting in python code. Removing redundant variables.

* Introduce the get_device_name() utility method which returns the translated name for a device acronym. Use the new method to display device name when attaching devices.

* Fix typo

* Rename Support Device to Periperal Device. General tweaks to UI strings.

* Tweak UI string.

* Fix error.
2022-02-21 09:27:31 -08:00
Daniel Markstedt
01e1aaae3e
Make the support device UI entirely procedurally generated (#686)
* Make the support device UI entirely procedurally generated, removing the special case network device UI flow.

* Clean up helptext.
2022-02-20 09:49:23 -08:00