mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-02 19:50:55 +05:30
Add timestamps to update compilation POST request
This commit is contained in:
parent
ff6a9b965d
commit
da290e5d6f
@ -14,6 +14,7 @@ CREATE TABLE IF NOT EXISTS public.compilation_videos
|
||||
published timestamptz,
|
||||
compid text references compilations(id),
|
||||
index int8,
|
||||
order_index integer,
|
||||
PRIMARY KEY (index,compid)
|
||||
);
|
||||
|
||||
|
@ -11,6 +11,7 @@ struct CompilationVideo
|
||||
property published : Time
|
||||
property compid : String
|
||||
property index : Int64
|
||||
property order_index : Int32
|
||||
|
||||
def to_xml(xml : XML::Builder)
|
||||
xml.element("entry") do
|
||||
@ -18,6 +19,7 @@ struct CompilationVideo
|
||||
xml.element("yt:videoId") { xml.text self.id }
|
||||
xml.element("yt:channelId") { xml.text self.ucid }
|
||||
xml.element("title") { xml.text self.title }
|
||||
xml.element("orderIndex") {xml.text self.order_index }
|
||||
xml.element("link", rel: "alternate", href: "#{HOST_URL}/watch?v=#{self.id}")
|
||||
|
||||
xml.element("author") do
|
||||
@ -67,6 +69,7 @@ struct CompilationVideo
|
||||
json.field "index", self.index
|
||||
end
|
||||
|
||||
json.field "orderIndex", self.order_index
|
||||
json.field "lengthSeconds", self.length_seconds
|
||||
json.field "startingTimestampSeconds", self.starting_timestamp_seconds
|
||||
json.field "endingTimestampSeconds", self.ending_timestamp_seconds
|
||||
@ -413,6 +416,7 @@ def extract_compilation_videos(initial_data : Hash(String, JSON::Any))
|
||||
published: Time.utc,
|
||||
compid: compid,
|
||||
index: index,
|
||||
order_index: order_index
|
||||
})
|
||||
end
|
||||
end
|
||||
|
@ -340,6 +340,7 @@ module Invidious::Routes::Compilations
|
||||
compid: compilation_id,
|
||||
live_now: video.live_now,
|
||||
index: Random::Secure.rand(0_i64..Int64::MAX),
|
||||
order_index: compilation.index.size
|
||||
})
|
||||
|
||||
Invidious::Database::CompilationVideos.insert(compilation_video)
|
||||
|
@ -87,6 +87,8 @@ module Invidious::Routing
|
||||
post "/create_compilation", Routes::Compilations, :create
|
||||
post "/compilation_ajax", Routes::Compilations, :compilation_ajax
|
||||
get "/add_compilation_items", Routes::Compilations, :add_compilation_items_page
|
||||
get "/edit_compilation", Routes::Compilations, :edit
|
||||
post "/edit_compilation", Routes::Compilations, :update
|
||||
end
|
||||
|
||||
def register_iv_playlist_routes
|
||||
|
@ -26,12 +26,21 @@
|
||||
<div class="compilation-video-title">
|
||||
<span class="compilation-video-title" dir="auto"><%= HTML.escape(compilation_video.title) %></span>
|
||||
</div>
|
||||
<div class="compilation-video-timestamp-set">
|
||||
<p style="margin-right:10px;">from</p>
|
||||
<input class="compilation-video-timestamp" placeholder="0:00" type="text">
|
||||
<p style="margin-right:10px; margin-left:10px">to</p>
|
||||
<input class="compilation-video-timestamp" placeholder="<%= recode_length_seconds(compilation_video.length_second) s%>" type="text">
|
||||
</div>
|
||||
<% if compid_form = env.get?("remove_compilation_items") %>
|
||||
<div class="compilation-video-timestamp-set">
|
||||
<p style="margin-right:10px;">from</p>
|
||||
<input class="compilation-video-timestamp" placeholder="0:00" disabled type="text">
|
||||
<p style="margin-right:10px; margin-left:10px">to</p>
|
||||
<input class="compilation-video-timestamp" placeholder="<%= recode_length_seconds(compilation_video.length_seconds) %>" disabled type="text">
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="compilation-video-timestamp-set">
|
||||
<p style="margin-right:10px;">from</p>
|
||||
<input maxlength="8" name="<%= compilation_video.order_index %>_start_timestamp" class="compilation-video-timestamp" placeholder="0:00" type="text">
|
||||
<p style="margin-right:10px; margin-left:10px">to</p>
|
||||
<input maxlength="8" name="<%= compilation_video.order_index %>_end_timestamp" class="compilation-video-timestamp" placeholder="<%= recode_length_seconds(compilation_video.length_seconds) %>" type="text">
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
67
src/invidious/views/edit_compilation.ecr
Normal file
67
src/invidious/views/edit_compilation.ecr
Normal file
@ -0,0 +1,67 @@
|
||||
<% title = HTML.escape(compilation.title) %>
|
||||
|
||||
<% content_for "header" do %>
|
||||
<title><%= title %> - Invidious </title>
|
||||
<% end %>
|
||||
|
||||
<form action="/edit_compilation?list=<%= compid %>" method="post">
|
||||
<div class="pure-g h-box">
|
||||
<div class="pure-u-2-3">
|
||||
<h3><input class="pure-input-1" maxlength="150" name="title" type="text" value="<%= title %>"></h3>
|
||||
<b>
|
||||
<%= HTML.escape(compilation.author) %> |
|
||||
<%= translate_count(locale, "generic_videos_count", compilation.video_count) %> |
|
||||
<%= translate(locale, "Updated `x` ago", recode_date(compilation.updated, locale)) %> |
|
||||
<i class="icon <%= {"ion-md-globe", "ion-ios-unlock", "ion-ios-lock"}[compilation.privacy.value] %>"></i>
|
||||
<select name="privacy">
|
||||
<% {"Unlisted", "Private"}.each do |option| %>
|
||||
<option value="<%= option %>" <% if option == compilation.privacy.to_s %>selected<% end %>><%= translate(locale, option) %></option>
|
||||
<% end %>
|
||||
</select>
|
||||
</b>
|
||||
</div>
|
||||
<div class="pure-u-1-3" style="text-align:right">
|
||||
<h3>
|
||||
<div class="pure-g user-field">
|
||||
<div class="pure-u-1-3">
|
||||
<a href="javascript:void(0)">
|
||||
<button type="submit" style="all:unset">
|
||||
<i class="icon ion-md-save"></i>
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
<div class="pure-u-1-3"><a href="/delete_compilation?list=<%= compid %>"><i class="icon ion-md-trash"></i></a></div>
|
||||
</div>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class="h-box">
|
||||
<textarea maxlength="5000" name="description" style="margin-top:10px;max-width:100%;height:20vh" class="pure-input-1"><%= compilation.description %></textarea>
|
||||
</div> -->
|
||||
<input type="hidden" name="csrf_token" value="<%= HTML.escape(csrf_token) %>">
|
||||
|
||||
<% if compilation.is_a?(InvidiousCompilation) && compilation.author == user.try &.email %>
|
||||
<div class="h-box" style="text-align:right">
|
||||
<h3>
|
||||
<a href="/add_compilation_items?list=<%= compid %>"><i class="icon ion-md-add"></i></a>
|
||||
</h3>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="h-box">
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<div class="pure-g">
|
||||
<% videos.each do |compilation_video| %>
|
||||
<%= rendered "components/compilation_video" %>
|
||||
<% end %>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user