add legacy artist xml api
This commit is contained in:
@@ -21,11 +21,15 @@ class LegacyController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def users
|
def users
|
||||||
@users = User.search(params).limit(100)
|
@users = User.limit(100).search(params).paginate(params[:page])
|
||||||
end
|
end
|
||||||
|
|
||||||
def tags
|
def tags
|
||||||
@tags = Tag.search(params).limit(100)
|
@tags = Tag.limit(100).search(params).paginate(params[:page])
|
||||||
|
end
|
||||||
|
|
||||||
|
def artists
|
||||||
|
@artists = Artist.limit(100).search(params[:search]).paginate(params[:page])
|
||||||
end
|
end
|
||||||
|
|
||||||
def unavailable
|
def unavailable
|
||||||
|
|||||||
6
app/views/legacy/artists.xml.erb
Normal file
6
app/views/legacy/artists.xml.erb
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<artists type="array">
|
||||||
|
<% @artists.each do |artist| %>
|
||||||
|
<artist group_name="<%= artist.group_name %>" other_names="<%= artist.other_names %>" urls="<%= artist.urls.map {|x| x.url}.join(" ") %>" is_active="<%= artist.is_active? %>" name="<%= artist.name %>" updater_id="0" id="<%= artist.id %>" version="0"/>
|
||||||
|
<% end %>
|
||||||
|
</artists>
|
||||||
@@ -201,6 +201,7 @@ Danbooru::Application.routes.draw do
|
|||||||
|
|
||||||
# legacy aliases
|
# legacy aliases
|
||||||
match "/artist" => redirect {|params, req| "/artists?page=#{req.params[:page]}"}
|
match "/artist" => redirect {|params, req| "/artists?page=#{req.params[:page]}"}
|
||||||
|
match "/artist/index.xml", :controller => "legacy", :action => "artists"
|
||||||
match "/artist/index" => redirect {|params, req| "/artists?page=#{req.params[:page]}"}
|
match "/artist/index" => redirect {|params, req| "/artists?page=#{req.params[:page]}"}
|
||||||
match "/artist/show/:id" => redirect("/artists/%{id}")
|
match "/artist/show/:id" => redirect("/artists/%{id}")
|
||||||
match "/artist/show" => redirect {|params, req| "/artists?name=#{CGI::escape(req.params[:name])}"}
|
match "/artist/show" => redirect {|params, req| "/artists?name=#{CGI::escape(req.params[:name])}"}
|
||||||
|
|||||||
Reference in New Issue
Block a user