2013-02-05 14:16:51 -05:00
|
|
|
require_dependency 'oneboxer'
|
|
|
|
|
|
|
|
class OneboxController < ApplicationController
|
|
|
|
|
|
|
|
def show
|
|
|
|
Oneboxer.invalidate(params[:url]) if params[:refresh].present?
|
2013-03-05 14:03:50 -05:00
|
|
|
|
|
|
|
result = Oneboxer.preview(params[:url])
|
|
|
|
result.strip! if result.present?
|
|
|
|
|
|
|
|
# If there is no result, return a 404
|
|
|
|
if result.blank?
|
|
|
|
render nothing: true, status: 404
|
|
|
|
else
|
|
|
|
render text: result
|
|
|
|
end
|
2013-02-05 14:16:51 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|