refinerycms iframe dont show in my webpage - ruby-on-rails

My webpages don't show any iframe or embed html code. The wymeditor preview show the page perfectly, the information is stored on the database, but the page show nothing. I'm using Rails 4.2.6 and the newest refinerycms version.
I've tried everything, this guy had the same problem https://github.com/refinery/refinerycms/issues/1991 but the solution didn't work for me.

I think the reason the fix doesn't work anymore is because of the deprecation of the allowed_tags/allowed_attributes settings. See info on that here
However, if you trust the content, you could just skip the sanitization process altogether by overriding the default template.
bundle exec rake refinery:override view=refinery/pages/*
That will dump a couple of views into your project. Change the show template to something like this to render without sanitizing:
<%= raw(#page.content_for(:body) %>

We sanitize the SectionPresenter since Refinery CMS 3.0.2 and we are aware of whitelist problems, there is a pending pull request to help devs to add more tags in your whitelist like probably iframe.
Please test this pull request to see if it fixed your problem : https://github.com/refinery/refinerycms/pull/3164

Related

Getting a white page when testing new gem/engine. Logs show views rendering, but the page is empty

I've been developing a gem/engine for a little bit, and using an existing app of mine to test it out. Everything has worked great. Then I went to add it to another app and suddenly it wasn't working. I figured it was because that app had some weird set up, but I've tried on a couple of other apps now and they all do the same thing.
When I go to visit the gem in the browser, the page is completely empty. It receives nothing from the server. No head, style, script, body. Just a blank page. I can visit other routes for these apps just fine and the pages load as expected. However, any of the routes added by the engine do this same load issue. The strangest part is: In my server logs, I see the correct controller hit, I see the views being rendered, I get the 200 OK at the end. I can do puts in the gem views and it will show up in the logs during the load process. There is absolutely no sign that anything went wrong anywhere, but yet... White page. I'm at a loss as where to even start debugging this. Does anybody have any experience with anything of the sort?
I created a new test app to verify and things worked as expected, but for some reason other existing apps have this issue.
Working apps:
Rails 5.0.2
ruby 2.7.2p137
Fresh/blank app: (Working)
Rails 6.1.4
ruby 2.7.2p137
Apps that don't work:
Rails 6.1.3.1
ruby 2.7.2p137
Rails 6.1.4
ruby 3.0.2p107
I'm not even sure where to start debugging this as there is no "error" so I'm at a bit of a loss.
The repo for the gem is here: https://github.com/Rockster160/command_proposal but I'm mostly looking for thoughts on how to work through why this issue is happening and out how to debug it.
Turns out this was caused because the app it was added in had links inside the layout. (Like a nav bar) I had a rescue block that caught those issues and attempted to look up the route in the main_app, however, that rescue still recognized that an error was thrown so rendered the empty file. It seems odd that would be the result, but I finally discovered that was the case.
To fix the routing issue, I had to include the main app routes as a helper in my main engine controller:
helper Rails.application.routes.url_helpers
However, this broke my engine routes, so I had to go through each of my engine's routes and explicitly call them off the engine.
tasks_path # Old way
command_proposal.tasks_path # New way

Ruby on Rails link generated with link_to helper no longer works in Chrome

Chrome has been making a lot of changes recently, and one of them has broken a code statement I use to retrieve a document stored in a database, related to a parent record. The action to upload the file and create the attachment relationship is working, so my users can still add documents. They can no longer download and view stored document attachments. The code is using the link_to helper method, and appears to be building the link correctly, verified by the fact that it still works using Edge, so my users have an ugly workaround, but I need to understand what is happening. I have confirmed that it is indeed Chrome that is the problem, because at first I couldn't recreate the defect in development (until I updated my Chrome browser to current version.) Now I can recreate the defect in my development environment.
When the link in my form is clicked, Chrome displays an error screen with this text:
This page isn't working
(*localhost*) sent an invalid response
net::ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION
If I extract the link using developer tools and try and execute it in an empty browser window, I get the same error.
The link is constructed like this:
(*name of the file attachment*)
Before you ask, yes, I have confirmed there are no commas or quotes in my file names! lol
I am hoping someone somewhere can point me to a solution, hopefully simple, maybe obvious, that I can use to get my web form to play nicely with Chrome again - application code change, web server configuration (I am running on RHEL7 Apache in production and Puma in development, my database is Oracle, and I am building with Ruby 2.3.6 and Rails 5.1.5, along with many many gems).
I hope I have covered all the relevant points. Thank you for taking the time to read this post!
Issue has been resolved by upgrading gem attach to version >= 1.0.5. Many thanks to the gem author for excellent responsiveness.

Rails 5 html changes not showing even after clearing each cache

I am new to RoR and using rails5 on windows and used Devise Gem for authentication. I have to integrate HTML design for admin section. The problem is that whatever changes that i am making in /app/views/admins/sessions/new.html.erb file, they are not reflecting in the browser. I always see default login form of devise in which it shows Email and Password field with shared links.
Event by removing entire html from above new.html.erb file, i can still see login form.
I have tried executing below commands to clear cache but still i can not see my new html changes in the browser.
rake tmp:cache:clear
rake assets:clean
Not sure what else is required to make it working. Any help would be greatly appreciated
Running rails generate devise:views will generate all of the views that Devise uses. Editing the generated sessions/new.html.erb file should update the version you are seeing in the browser.
You can also delete any of the other generated files that you don't need to override.
Source:
https://github.com/plataformatec/devise#configuring-views

Favicon and headers not working in custom domain for rails app with heroku and Godaddy

I have a rails app hosted on heroku and then pointing my custom domain to it via GoDaddy.
I've been struggling to get the favicon to work and have tried everything in this post. Favicon shows up on rails local, not on hosted app
I've also tried rake assets:clobber
I've also tried deleting the favicon, recompiling it, and then pushing. None of this has worked.
Before this I was getting an error about X-frames being from SAMEORIGIN that was causing my site to not render anything in the head as well as not load.
So I added this line to my application controller per another stack overlow answer
before_filter :allow_iframe_requests
def allow_iframe_requests
response.headers.delete('X-Frame-Options')
end
I'm not sure if this is related or not but somehow everthing works on myapp.herokuapp.com but nothing is getting loaded in the head or source in inspector on myapp.com
Here's what it looks like.
As you can see.. nothing is really showing up in the head.
On myapp.herokuapp.com you can see everything that is supposed to be in the head show up.
I'd really like to understand what's going on as this has been super frustrating. I have tried many solutions that I found here but have yet to have anything work. My hypothesis is that it's something to do with Godaddy. Yes I have cleared my cache multiple times.
Thank you for your help!
Perhaps try my site to generate favicons and the correct markup for them:
https://favicongenerator.co
You can upload an icon and it generates all the sizes and the correct markup for rails.

How to install latest official refinerycms-calendar 2.0.2 in RefineryCMS 2.1.1

I have been eating my nails the whole weekend to figure out the right combination of modifications to the official refinerycms-calendar in order to make it work with RefineryCMS 2.1.1.
Here are my conclusions and efforts, hoping that someone will drive me to the right direction:
Adding just gem 'refinerycms-calendar', '~>2.0.0'
as suggested in the github page is not working out of the box. You need to correct the dependencies on the .gemspec file. There are many forks out there created only for this correction.
So, I forked the refinery/refinerycms-calendar project, corrected the dependencies and used my fork in the Gemfile.
Backend (BE) works fine: Created an event, went back to FrontEnd (FE), got a "This page is NOT live for viewing"
This frontend (FE) inconcistency is corrected to the BE > Pages > Venues page: /calendar/venues is not an existing route and needs to be corrected to /calendar/events. The seeds.rb needs to be corrected for a permanent solution.
Go back to FE, now the /calendar/events is blank! I only get the title of the Page as defined on the relative Pages page.
A look on the rails server log reveals that there is a :find_page error resulting form the fact that the refinerycms-events.css under the engine's public/stylesheets folder is neither picked up nor referenced correctly inside show.hrml.erb and index.html.erb files. I copied the refinerycms-events.css under vendor/stylesheets and changed the reference to refinerycms-events.css accordingly.
Refreshed FE but still there is a blank page both when getting /calendar/events and /calendar/events/#{event}
NOTE: If I "rake routes" I can see that the routes for the FE portion are repeated 3 times. I am not quite sure for this behavior, but when I substituted "Refinery::Core::Engine.routes.append do".gsub("append","draw"), I could only see them once.
I have tried many forks around and all of those seem to demonstrate the same behavior.
Can anybody please let me know:
a. If you finally managed to have this (official refinery release) engine fully functional in your projects and if yes which branch was used and with which exact Refinerycms and refinerycms-calendar version combination.
b. If used used a fork rather than the official refinerycms-calendar release, then which fork/branch is that.
I hope someone to have that nailed down.
Best regards,
Petros
Well, seems that changing :body_content_left and :body_content_right with :body and :side_body respectively inside the Engine's show and index views, solves the issue of the /calendar/events and /calendar/events/:event FE pages being blank.
I am still unsure why this is causing such an issue and it is kind of weird nobody to have reported it until now.

Resources