-
Notifications
You must be signed in to change notification settings - Fork 86
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
Created custom css style upload #485
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the whole, this works as documented.
The CSS links on the Style upload page are broken when VIVO is deployed at the root and not /vivo.
Also there is some security risk with this feature as a whole, since it's possible that CSS injection could be used in the uploaded css file (or potentially other malware). I suppose this is mitigated by the fact that only an admin has access to the page, but it still feels worth pointing out.
I wonder if it would be better to allow the user to specify a remote url for css rather than uploading the file locally.
@@ -0,0 +1,130 @@ | |||
<div> | |||
<h2>Site Styles</h2> | |||
<div class="button-group"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These links don't work if VIVO is deployed at the root instead of at /vivo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch, I'll fix this right away
VIVO GitHub issue
Linked Vivo PR
What does this pull request do?
This pull request enables administrators to manage custom CSS styles directly from the Site Admin page. Admins can upload, download, and remove custom CSS styles, as well as reset styles to ensure accessibility and functionality remain intact.
What's new?
Screenshoots
Style edit page
Example css
Broken contrast css (RESET button is still visible)
How should this be tested?
Test for every theme
Uploading regular CSS
Expected Result: The site background should change to red.
Download Custom CSS
Expected Result: The downloaded file should match the uploaded custom CSS.
Removing Custom CSS
After uploading custom CSS, navigate to the Change CSS Styles page.
Click Remove Custom CSS.
Expected Result: The site should revert to the default styles.
Uploading broken CSS
Example:
or
Reset button should still be visible and working
Additional Notes:
The custom CSS file is saved using the Vitro FileStorage class and file is stored into vivo-home/uploads.
The file's path is stored in the ApplicationBean under the key customCssPath (vitro-kb-applicationMetadata).