[bug] Theme Apply button does not function #289

Closed
opened 2023-03-13 09:07:06 +00:00 by foxing · 1 comment

The theme apply button does not work due to the CSP change on style_setter.js

I have spent a good amount of time trying to solve this, I initially tried to solve this with cache busting by trying to add ?v=unixtimestamp to the end of the theme-holder href in the header to try and force the browser to reload it when someone clicks the apply theme button, which worked to apply the theme once, and then only worked again after a page reload.

However, reverting the CSP changes on index.html and style_setter.js that were made in f288d0c219 and testing with a local front end dev server, doesn't seem to actually make a difference with CSP, and no extra console errors show up. As far as I am aware, these are not considered inline scripts which is all I was able to note being changed on the CSP side, so it would make sense that they don't cause a problem, but I could easily be wrong.

So I would like to ask, are these actually a problem or were those two changes actually not needed? They cause a pretty annoying bug for anyone trying to update and customise their theme since the preview window only does so much.

Is there any other way to solve this if they are required fixes?

The theme apply button does not work due to the CSP change on style_setter.js I have spent a good amount of time trying to solve this, I initially tried to solve this with cache busting by trying to add ?v=unixtimestamp to the end of the theme-holder href in the header to try and force the browser to reload it when someone clicks the apply theme button, which worked to apply the theme once, and then only worked again after a page reload. However, reverting the CSP changes on index.html and style_setter.js that were made in f288d0c219 and testing with a local front end dev server, doesn't seem to actually make a difference with CSP, and no extra console errors show up. As far as I am aware, these are not considered inline scripts which is all I was able to note being changed on the CSP side, so it would make sense that they don't cause a problem, but I could easily be wrong. So I would like to ask, are these actually a problem or were those two changes actually not needed? They cause a pretty annoying bug for anyone trying to update and customise their theme since the preview window only does so much. Is there any other way to solve this if they are required fixes?
Author

On further investigation, using a front end compiled without those fixes through a production instance does break it, so this is indeed just a bug with the way this fix works. I believe the reason my cache busting attempt didn't work more than once is that the browser then tries to fetch the front end from the file on the server instead of locally.

I was made aware that it may be completely impossible to live update the front end theme if the css file is set up this way to be updated by javascript and that the css values need to be set a different way.

Any input on fixing this would be helpful.

On further investigation, using a front end compiled without those fixes through a production instance does break it, so this is indeed just a bug with the way this fix works. I believe the reason my cache busting attempt didn't work more than once is that the browser then tries to fetch the front end from the file on the server instead of locally. I was made aware that it may be completely impossible to live update the front end theme if the css file is set up this way to be updated by javascript and that the css values need to be set a different way. Any input on fixing this would be helpful.
Mergan added the
Bug
label 2023-03-15 21:14:35 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: AkkomaGang/akkoma-fe#289
No description provided.