Final changes before branching
This commit is contained in:
@@ -1,13 +1,17 @@
|
||||
class TrackController < ApplicationController
|
||||
require 'net/http'
|
||||
require 'uri'
|
||||
|
||||
@@token_salt = '8FW*W#dWOH*FHW4j:Q@RQ{Qo[qF;fw0`0w4fkl'
|
||||
|
||||
def listen
|
||||
pp track = Track.where(:id => params[:id].to_i).first
|
||||
|
||||
data = Vkontakte.get(track.artist_name, track.name, (track.length / 1000).round)
|
||||
# data = Vkontakte.get(1, 1, 1)
|
||||
url = URI.parse(data['url'])
|
||||
nginx_url = '/proxy-stream/no-token/' << data['remixsid'] << '/' << '5' << '/' << url.host << url.path
|
||||
token = Digest::SHA256.hexdigest(params[:id] << @@token_salt)
|
||||
nginx_url = '/proxy-stream/' << token << '/' << data['remixsid'] << '/' << '5' << '/' << url.host << url.path
|
||||
|
||||
headers['Content-Type'] = 'audio/mpeg'
|
||||
headers['X-Accel-Redirect'] = nginx_url
|
||||
|
||||
Reference in New Issue
Block a user