I was copying over a script i created on my test site and ended up missing a close tag. Bad copy/paste job. This broke my site and i can no longer get to the customization screen to change it. Is there a way I can get to this from another way.
AI-generated summary
Grex315 reported that a malformed script in the header broke their Discourse site, preventing access to the customization screen. After confirming the issue persisted via /admin URLs, zogstrip explained that customizations are stored in the database and suggested disabling them via the Rails console. DeanMarkTaylor provided specific commands to enter the container, run SiteCustomization.update_all(enabled: false), and restart the app, which successfully resolved the issue for Grex315. Additionally, DeanMarkTaylor shared an alternative method using the API for administrators who cannot access the server shell, detailing how to use curl to disable specific customizations. Grex315 bookmarked the thread as a useful resource. Finally, sam noted that this specific issue should not occur on the latest version due to HTML normalization.
Is it still broken if you access directly any of the /admin URLs?
yes. Its a script that is loading in the header.
Does it save this info into a file in the container or is all kept in the DB?
It’s in the DB. You should be able to recover by disabling the customization via the rails console.
Check this post out it should so what you need…
thank you. That worked.
For future reference for anybody in the crazy situation where they are an admin but don’t have access to the Discourse instance’s shell…
…but are an admin and still authenticated - you can use the API:
API Key can be found here (THE_API_KEY_OBTAINED_BEFORE_GOES_HERE):
http://www.example.com/admin/api.json
List of customisations to find ID here (THE_CUSTOMIZATION_ID_HERE):
http://www.example.com/admin/customize/css_html.json
Then replacing the domain, customisation ID and API key:
curl -vs 'http://www.example.com/admin/site_customizations/THE_CUSTOMIZATION_ID_HERE?api_key=THE_API_KEY_OBTAINED_BEFORE_GOES_HERE&api_username=system' -X PUT -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' --data $'site_customization%5Benabled%5D=false' 2>&1
Nice. This thread and referenced thread bookmarked.
Just found my Oh S#!&! button.
Note, should not break on latest cause we now normalise html