Move API endpoints under '/api/v1/' prefix

This commit is contained in:
Omar Roth 2018-07-26 13:55:45 -05:00
parent 1eedd6ebf9
commit 1202e1f2bf
2 changed files with 5 additions and 5 deletions

View File

@ -411,7 +411,7 @@ get "/watch" do |env|
templated "watch" templated "watch"
end end
get "/captions/:id" do |env| get "/api/v1/captions/:id" do |env|
id = env.params.url["id"] id = env.params.url["id"]
client = make_client(YT_URL) client = make_client(YT_URL)
@ -497,7 +497,7 @@ get "/captions/:id" do |env|
webvtt webvtt
end end
get "/comments/:id" do |env| get "/api/v1/comments/:id" do |env|
id = env.params.url["id"] id = env.params.url["id"]
source = env.params.query["source"]? source = env.params.query["source"]?
@ -653,7 +653,7 @@ get "/comments/:id" do |env|
end end
end end
get "/videos/:id" do |env| get "/api/v1/videos/:id" do |env|
id = env.params.url["id"] id = env.params.url["id"]
client = make_client(YT_URL) client = make_client(YT_URL)

View File

@ -49,7 +49,7 @@
<% end %> <% end %>
<% captions.each do |caption| %> <% captions.each do |caption| %>
<track kind="captions" src="/captions/<%= video.id %>?label=<%= caption["name"]["simpleText"] %>" <track kind="captions" src="/api/v1/captions/<%= video.id %>?label=<%= caption["name"]["simpleText"] %>"
srclang="<%= caption["languageCode"] %>" label="<%= caption["name"]["simpleText"]%> "> srclang="<%= caption["languageCode"] %>" label="<%= caption["name"]["simpleText"]%> ">
<% end %> <% end %>
<% end %> <% end %>
@ -158,7 +158,7 @@ for ( var i = 0; i < currentSources.length; i++ ) {
player.src(currentSources); player.src(currentSources);
<% end %> <% end %>
fetch("/comments/<%= video.id %>?source=reddit") fetch("/api/v1/comments/<%= video.id %>?source=reddit")
.then(function(response) { .then(function(response) {
return response.json(); return response.json();
}) })