Big issue with custom javascript


#1

Hello,

I did a big mistake,

i added this code in the section custom script

document.write(‘

Print this after the script tag
’);

And now on all my pages i can only see this sentence : “Print this after the script tag” https://chatpsy.herokuapp.com/home

If someone could tell me how can i remove this javacript via the database?

Or is there a way to block this specific line of code, enter in the admin and remove it ?

Thanks for your help


#2

Without any guarantee: you should be able to restore the MongoDB database of Rocket.Chat - more specifically to your case: the settings collection from your last backup.

If you got no backup (then first: shame on your house!) you could also try to look up the document in the settings collection that stores the custom script settings and either edit or delete it. It will be initialized with default settings once you restart Rocket.Chat.

Cheers
Thomas


#3

My suggestion is find the setting name. You can right click it in browser and inspect element and see the id. Then goto mongo and do: db.rocketchat_settings.remove({_id: 'Setting_Id'})