3 class MainController < ApplicationController
4 verify :only => :ymp, :params => [:project, :repository, :arch, :binary],
16 render :template => "main/old_#{dist}.rhtml"
18 @message = "No old page found for dist #{10.2}"
19 render :template => "error", :status => 404
23 def ymp_with_arch_and_version
24 path = "/published/#{params[:project]}/#{params[:repository]}/#{params[:arch]}/#{params[:binary]}?view=ymp"
25 res = get_from_api(path)
26 render :text => res.body, :content_type => res.content_type
29 def ymp_without_arch_and_version
30 path = "/published/#{params[:project]}/#{params[:repository]}/#{params[:package]}?view=ymp"
31 res = get_from_api(path)
32 render :text => res.body, :content_type => res.content_type
36 def get_from_api(path)
37 req = Net::HTTP::Get.new(path)
38 req['x-username'] = "obs_read_only"
40 host, port = API_HOST.split(/:/)
42 res = Net::HTTP.new(host, port).start do |http|