routes: remove legacy /user/index and /artist/index API endpoints.
These endpoints get zero traffic.
This commit is contained in:
@@ -17,18 +17,10 @@ class LegacyController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def users
|
||||
@users = User.limit(100).search(params).paginate(params[:page])
|
||||
end
|
||||
|
||||
def tags
|
||||
@tags = Tag.limit(100).search(params).paginate(params[:page], :limit => params[:limit])
|
||||
end
|
||||
|
||||
def artists
|
||||
@artists = Artist.limit(100).search(search_params).paginate(params[:page])
|
||||
end
|
||||
|
||||
def unavailable
|
||||
render :plain => "this resource is no longer available", :status => 410
|
||||
end
|
||||
|
||||
@@ -483,15 +483,6 @@ class User < ApplicationRecord
|
||||
]
|
||||
end
|
||||
|
||||
def to_legacy_json
|
||||
return {
|
||||
"name" => name,
|
||||
"id" => id,
|
||||
"level" => level,
|
||||
"created_at" => created_at.strftime("%Y-%m-%d %H:%M")
|
||||
}.to_json
|
||||
end
|
||||
|
||||
def api_token
|
||||
api_key.try(:key)
|
||||
end
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
[<%= raw @artists.map(&:to_json).join(",") %>]
|
||||
@@ -1,6 +0,0 @@
|
||||
<?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_deleted? %>" name="<%= artist.name %>" updater_id="0" id="<%= artist.id %>" version="0"/>
|
||||
<% end %>
|
||||
</artists>
|
||||
@@ -1 +0,0 @@
|
||||
[<%= @users.map {|x| x.to_legacy_json}.join(", ").html_safe %>]
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<users type="array">
|
||||
<% @users.each do |user| %>
|
||||
<user name="<%= user.name %>" id="<%= user.id %>" created_at="<%= user.created_at.strftime('%Y-%m-%d %H:%M') %>" level="<%= user.level %>"></user>
|
||||
<% end %>
|
||||
</users>
|
||||
@@ -262,8 +262,6 @@ Rails.application.routes.draw do
|
||||
|
||||
# legacy aliases
|
||||
get "/artist" => redirect {|params, req| "/artists?page=#{req.params[:page]}&search[name]=#{CGI.escape(req.params[:name].to_s)}"}
|
||||
get "/artist/index.xml", :controller => "legacy", :action => "artists", :format => "xml"
|
||||
get "/artist/index.json", :controller => "legacy", :action => "artists", :format => "json"
|
||||
get "/artist/index" => redirect {|params, req| "/artists?page=#{req.params[:page]}"}
|
||||
get "/artist/show/:id" => redirect("/artists/%{id}")
|
||||
get "/artist/show" => redirect {|params, req| "/artists?name=#{CGI.escape(req.params[:name].to_s)}"}
|
||||
@@ -335,8 +333,6 @@ Rails.application.routes.draw do
|
||||
|
||||
get "/tag_implication" => redirect {|params, req| "/tag_implications?search[name_matches]=#{CGI.escape(req.params[:query].to_s)}"}
|
||||
|
||||
get "/user/index.xml", :controller => "legacy", :action => "users", :format => "xml"
|
||||
get "/user/index.json", :controller => "legacy", :action => "users", :format => "json"
|
||||
get "/user" => redirect {|params, req| "/users?page=#{req.params[:page]}"}
|
||||
get "/user/index" => redirect {|params, req| "/users?page=#{req.params[:page]}"}
|
||||
get "/user/show/:id" => redirect("/users/%{id}")
|
||||
|
||||
Reference in New Issue
Block a user