mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
17 lines
377 B
Ruby
17 lines
377 B
Ruby
require_dependency 'oneboxer'
|
|
|
|
class OneboxController < ApplicationController
|
|
|
|
def show
|
|
result = Oneboxer.onebox(params[:url], invalidate_oneboxes: params[:refresh] == 'true')
|
|
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
|
|
end
|
|
|
|
end
|