* allow jamblaster to fetch http

This commit is contained in:
Seth Call 2015-09-15 05:23:27 -05:00
parent 5c8fb6b01e
commit 30965c6351
2 changed files with 7 additions and 3 deletions

View File

@ -99,9 +99,9 @@ module JamRuby
# the idea is that this is used when a user who has the rights to this tries to download this JamTrack
# we would verify their rights (can_download?), and generates a URL in response to the click so that they can download
# but the url is short lived enough so that it wouldn't be easily shared
def sign_url(expiration_time = 120, bitrate=48)
def sign_url(expiration_time = 120, bitrate=48, secure=true)
field_name = (bitrate==48) ? "url_48" : "url_44"
s3_manager.sign_url(self[field_name], {:expires => expiration_time, :secure => true})
s3_manager.sign_url(self[field_name], {:expires => expiration_time, :secure => secure})
end
def delete_s3_files

View File

@ -101,7 +101,11 @@ class ApiJamTracksController < ApiController
@jam_track_right.last_downloaded_at = now
@jam_track_right.first_downloaded_at = now if @jam_track_right.first_downloaded_at.nil?
@jam_track_right.save!
redirect_to @jam_track_right.sign_url(120, sample_rate)
is_jamblaster = !!params[:is_jamblaster]
# if it's not the jamblaster, keep the URL https
redirect_to @jam_track_right.sign_url(120, sample_rate, !is_jamblaster)
else
@jam_track_right.enqueue_if_needed(sample_rate)
render :json => { :message => "not available, digitally signing Jam Track offline." }, :status => 202