Commit Graph

87 Commits

Author SHA1 Message Date
Daniel Markstedt
76b0f43bc1
Web UI: Inject a Go Back link on all pages, except the index and upload page (#1302)
* Move the manual and go back elements into footer; log controls in log page

* Move inline css style to stylesheet

* Touch up page layout

* Use a Home icon for going to the index page

* Use one vertical table for device info
2023-11-08 14:52:49 -08:00
Daniel Markstedt
0589a0efad
Improve UX for file upload forms (#1299)
* Improve UX for file upload forms

* Fix styles for admin service list

* Turn tabs into spaces
2023-11-04 02:21:54 -07:00
Daniel Markstedt
4eca0495a4 Refactor file upload code to make it safer 2023-11-04 11:59:54 +09:00
Daniel Markstedt
cb6174fc1d
Web UI: Remove workaround for listing English locale (#1291)
* Remove workaround for listing English locale

* Use pathlib object to construct upload path
2023-11-03 05:22:01 -07:00
Daniel Markstedt
e4c9b33778 Web UI: Create a system settings page 2023-11-03 19:25:19 +09:00
Daniel Markstedt
063e8ed32b
Static analysis fixes for Python codebase (#1277)
* Don't log names of internal symbols that can be used for attacks

* Add integrity check to dropzone.js library

* Better a11y of web form labels

* Safer handling of file download paths

* Don't invert boolean check

* Make backend auth check a flask abort

* Clean up indentation to remove unwanted tabs

* Run workflow either on PR events, or branch pushes, not both
2023-11-01 06:28:53 -07:00
Daniel Markstedt
029cf06c72
Web UI: Upload to tmp file name then rename if successful (#1272)
* Upload to tmp file name then rename if successful

* Move the dropzone.js operations back into web.py

* Move list_images() from file commands into piscsi commands (it was the only class method in that package that calls the protobuf interface)

* Remove now-redundant helptext
2023-10-31 14:54:04 -07:00
Daniel Markstedt
b5323d0cd3 Bump to Flask 3 / Werkzeug 3 2023-10-30 08:46:06 +09:00
Daniel Markstedt
65c1b194c5
Manage Samba and Netatalk with Webmin (#1217)
* Display status of Samba/Netatalk/vsftp in the footer, with links to Webmin module

* Add option to install Webmin and the netatalk2 module
2023-09-24 09:30:54 -07:00
Benjamin Krein
b514440957
Fix test failures in low-voltage PR (#1207)
* fix lint checks in web python

* fix lint checks in common python

* rework to pass tests in docker

* fix css style lint

* fix css style syntax
2023-09-04 08:08:42 -07:00
Benjamin Krein
b32027f8c0
Add web UI notification for under voltage/throttling events (#1203) 2023-08-31 23:23:12 -07:00
Daniel Markstedt
51f1e7eae7 Check for predictable network interface names in bridge check function, and always return a status message with the outcome of the check. Issue #1191 2023-07-26 18:19:22 -07:00
Daniel Markstedt
fa475d8b12
Proper handling of custom image dirs, #1170 (#1171) 2023-05-21 15:27:50 -07:00
Daniel Markstedt
b28da7001d
Always assign locale in detect_locale() (#1163)
* Always assign locale in detect_locale()

* Bump version of Debian used in CI builds from from buster to bullseye

* Update code comment

---------

Co-authored-by: nucleogenic <nr@nucleogenic.com>
2023-05-16 12:19:40 -07:00
Daniel Markstedt
09d0598c2f
Remove use of deprecated before_first_request decorator (#1162) 2023-05-01 19:21:17 -07:00
Daniel Markstedt
ff017a9c1d
Web UI: Handling for non-existence of working dirs (#1130) 2023-03-23 20:07:19 -07:00
Daniel Markstedt
5fd0dc420b
WebUI: Traverse target dir to get subdirs to download/upload to (#1115) 2023-03-04 16:57:32 -08:00
Daniel Markstedt
ddf258db57
Fix bugs in the upload to images form (#1111)
* Fix formatting of the image subdir list for uploading

* Fix upload path
2023-02-28 22:46:52 -08:00
Daniel Markstedt
dd00547f92
Formatted image file data structure that breaks down by subdir (#1102)
- New utility method for the web app, which sorts image files into dicts where the subdir is the key
- In the web ui, display each subdir in a table nested in a details tag.
- Allow for picking destination subdir when uploading files
- Style the expandable details blocks in the images table
- Add a check for ~ paths to the is_safe_path() utility method
2023-02-24 17:28:58 -08:00
Daniel Markstedt
8b0a85a143
Don't show user controlled string in UI (#1087) 2023-01-31 15:08:38 -08:00
Daniel Markstedt
bf53958636
Fix handling of properties files when they're in subdirs (#1082)
- File operation class methods create parent dirs if they don't exist
- Avoid stripping path from file names in several places
- Simplify prop file matching logic: check for existence of file
- Remove list_files() method which is now unused
2023-01-28 14:36:07 -08:00
Daniel Markstedt
956195d67e
Ability to download and upload config files (#1083)
- Rename `/config/load` endpoint to `/config/action` since it has multiple functions
- Add a `send` function to above endpoint, which triggers a download of the config file, and use it with a new Download button on the index page
- Add an option to upload to the CFG_DIR
- Improve layout of the file transfer destination web form: radio buttons before labels, and better padding between options
- Add a test for config downloading
2023-01-28 14:34:34 -08:00
Daniel Markstedt
139a6ec371
New class method for creating image file with python; use python file… (#1079)
* New class method for creating image file with python; use python file operations across the board.

Also fixed several bugs:

Added check that a file exists before copying/moving/creating
Check that parent dir exists always passed
Incorrect return message token
2023-01-26 21:51:59 -08:00
Daniel Markstedt
f15baec58e
Web UI: Introduce separate endpoint for downloading files from the config dir (#1075)
Web UI: Introduce separate endpoint for downloading files from the config dir
2023-01-26 18:10:53 -08:00
Daniel Markstedt
8823dfba7d
Web UI: Better handling of upload destination dir checks (#1076)
Web UI: Better handling of upload destination dir checks
2023-01-26 18:10:33 -08:00
Daniel Markstedt
6ca140d842
Streamline the create iso workflow, removing the attach step (#1069) 2023-01-15 07:38:41 -08:00
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