Merge branch 'promised_based_api_interation' of bitbucket.org:jamkazam/jam-cloud into promised_based_api_interation

This commit is contained in:
Nuwan 2023-01-26 00:48:27 +05:30
commit 20177f71dd
2 changed files with 5 additions and 3 deletions

View File

@ -60,7 +60,7 @@ module JamRuby
end
def verify_download_count
if (self.download_count < 0 || self.download_count > MAX_JAM_TRACK_DOWNLOADS) && !@current_user.admin
if (self.download_count < 0 || self.download_count > MAX_JAM_TRACK_DOWNLOADS) && !self.user.admin
errors.add(:download_count, "must be less than or equal to #{MAX_JAM_TRACK_DOWNLOADS}")
end
end

View File

@ -214,10 +214,12 @@ class ApiJamTracksController < ApiController
@jam_track_right.first_downloaded_at = now if @jam_track_right.first_downloaded_at.nil?
@jam_track_right.save!
is_jamblaster = !!params[:is_jamblaster]
#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)
# 2023: just kidding -- ignoring jamblaster code right now.
# always send https url back to client
redirect_to @jam_track_right.sign_url(120, sample_rate, true)
else
@jam_track_right.enqueue_if_needed(sample_rate)
render :json => { :message => "not available, digitally signing Jam Track offline." }, :status => 202