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