Admin panel not working after including buggy js in head/

AI-generated summary

Admin Panel Not Working After Including Buggy Script

The admin panel stopped working after adding a buggy JavaScript file to the head section. The error messages indicate issues with MIME types, failed resource loading, and a forbidden status. Michael_Katrantzis tried to resolve the issue but was unable to edit the head section or save changes.

Solution

zogstrip provided a solution by suggesting to SSH into the server, enter the running container, launch the Rails console, and disable all customizations using SiteCustomization.update_all(enabled: false). This allowed Michael_Katrantzis to access the site again and fix the issue. Additionally, zogstrip recommended rebuilding the container using ./launcher rebuild app to ensure the customizations aren’t cached.

Location of Saved Customizations

zogstrip mentioned that the customizations are stored in Redis. By following the provided steps, Michael_Katrantzis was able to resolve the issue successfully.

So in an attempt to work well with iframes I tried including an iframe resizer lib using the below:

<script type="application/javascript" src="https://raw.githubusercontent.com/davidjbradshaw/iframe-resizer/master/js/iframeResizer.contentWindow.min.js"></script>
<script type="application/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

JQuery was not meant to be there but due to copy paste I included that too.

The above was added in the head/ section and not only it didnt work but now I cannot edit the head/ again or rather save it or complete any actions in the backend admin panel. For example changing the SSO url or even enabling it wont work after that.

In any case the error that I am getting now is the below:

Refused to execute script from 'https://raw.githubusercontent.com/davidjbradshaw/iframe-resizer/master/js/iframeResizer.contentWindow.min.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.
Uncaught TypeError: t.DivResizer is not a function
Uncaught TypeError: $(...).modal is not a function
DEBUG: For more advanced debugging, install the Ember Inspector from https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi
Failed to load resource: the server responded with a status of 403 (Forbidden)
Error: Forbidden
    at a (vendor-d726f166eae32585d948cc4b83590d33.js:18)
    at Object.e.default.trigger (vendor-d726f166eae32585d948cc4b83590d33.js:23)
    at h._onerror (vendor-d726f166eae32585d948cc4b83590d33.js:24)
    at p (vendor-d726f166eae32585d948cc4b83590d33.js:23)
    at vendor-d726f166eae32585d948cc4b83590d33.js:18
    at r.invoke (vendor-d726f166eae32585d948cc4b83590d33.js:11)
    at Object.r.flush (vendor-d726f166eae32585d948cc4b83590d33.js:11)
    at Object.n.flush (vendor-d726f166eae32585d948cc4b83590d33.js:11)
    at Object.s.end (vendor-d726f166eae32585d948cc4b83590d33.js:11)
    at Object.s.run (vendor-d726f166eae32585d948cc4b83590d33.js:11)
Failed to load resource: the server responded with a status of 403 (Forbidden)
Error: Forbidden
    at a (vendor-d726f166eae32585d948cc4b83590d33.js:18)
    at Object.e.default.trigger (vendor-d726f166eae32585d948cc4b83590d33.js:23)
    at h._onerror (vendor-d726f166eae32585d948cc4b83590d33.js:24)
    at p (vendor-d726f166eae32585d948cc4b83590d33.js:23)
    at vendor-d726f166eae32585d948cc4b83590d33.js:18
    at r.invoke (vendor-d726f166eae32585d948cc4b83590d33.js:11)
    at Object.r.flush (vendor-d726f166eae32585d948cc4b83590d33.js:11)
    at Object.n.flush (vendor-d726f166eae32585d948cc4b83590d33.js:11)
    at Object.s.end (vendor-d726f166eae32585d948cc4b83590d33.js:11)
    at Object.s.run (vendor-d726f166eae32585d948cc4b83590d33.js:11)
Failed to load resource: net::ERR_CONNECTION_REFUSED

Can anyone tell me a different way of removing those lines? (NOTE: I do have SSH but not sure where these are being saved)

Here’s what I would do

# ssh into your server
cd /var/discourse
./launcher enter app
rails c
SiteCustomization.update_all(enabled: false)

Which will do what exactly?

Enter the running container. Launch the rails console. Disable all customizations so that you can access your site again and fix it :wink:

Sounds good let me give it a try! thanks

You might have to rebuild the container (./launcher rebuild app) in order to make sure the customizations aren’t cached.

Rebuilding now but out of curiosity where are those saved?

That did it! Thanks a bunch!

They’re stored in Redis I believe.