Script in /head broke site


(Steven Greco) #1

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.


(RĂ©gis Hanol) #2

Is it still broken if you access directly any of the /admin URLs?


(Steven Greco) #3

yes. Its a script that is loading in the header.


(Steven Greco) #4

Does it save this info into a file in the container or is all kept in the DB?


(RĂ©gis Hanol) #5

It’s in the DB. You should be able to recover by disabling the customization via the rails console.


(Dean Taylor) #6

Check this post out it should so what you need…


Implementing Google Tag Manager with Discourse
(Steven Greco) #7

thank you. That worked.


(Dean Taylor) #8

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

(Steven Greco) #9

Nice. This thread and referenced thread bookmarked.

Just found my Oh S#!&! button.


(RĂ©gis Hanol) #10

This topic was automatically closed after 30 minutes. New replies are no longer allowed.


(Sam Saffron) #11

Note, should not break on latest cause we now normalise html