Remove patch and update file structure

This commit is contained in:
Omar Roth
2018-07-06 07:59:56 -05:00
parent a789114f43
commit eb1df96e1b
14 changed files with 3 additions and 33 deletions

View File

@@ -0,0 +1,47 @@
<% content_for "header" do %>
<title><%= author %> - Invidious</title>
<% end %>
<h1><%= author %></h1>
<% if authorized %>
<% if subscriptions.includes? ucid %>
<p>
<a href="/subscription_ajax?action_remove_subscriptions=1&c=<%= ucid %>">
<b>Unsubscribe from <%= author %></b>
</a>
</p>
<% else %>
<p>
<a href="/subscription_ajax?action_create_subscription_to_channel=1&c=<%= ucid %>">
<b>Subscribe to <%= author %></b>
</a>
</p>
<% end %>
<% else %>
<p>
<a href="/login">
<b>Login to subscribe to <%= author %></b>
</a>
</p>
<% end %>
<% videos.each_slice(4) do |slice| %>
<div class="pure-g">
<% slice.each do |video| %>
<%= rendered "components/video" %>
<% end %>
</div>
<% end %>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-5">
<% if page > 2 %>
<a href="/channel/<%= ucid %>?page=<%= page - 1 %>">Previous page</a>
<% else %>
<a href="/channel/<%= ucid %>">Previous page</a>
<% end %>
</div>
<div class="pure-u-1 pure-u-md-3-5"></div>
<div style="text-align:right;" class="pure-u-1 pure-u-md-1-5">
<a href="/channel/<%= ucid %>?page=<%= page + 1 %>">Next page</a>
</div>
</div>

View File

@@ -0,0 +1,14 @@
<div class="pure-u-1 pure-u-md-1-4">
<div class="h-box">
<a style="width:100%;" href="/watch?v=<%= video.id %>">
<img style="width:100%;" src="https://i.ytimg.com/vi/<%= video.id %>/mqdefault.jpg"/>
<p><%= video.title %></p>
</a>
<p>
<b><a style="width:100%;" href="/channel/<%= video.ucid %>"><%= video.author %></a></b>
</p>
<p>
<h5>Shared <%= video.published.to_s("%B %-d, %Y at %r UTC") %></h5>
</p>
</div>
</div>

View File

@@ -0,0 +1,11 @@
<div class="pure-u-1 pure-u-md-1-4">
<div class="h-box">
<a style="width:100%;" href="/watch?v=<%= video.id %>">
<img style="width:100%;" src="https://i.ytimg.com/vi/<%= video.id %>/mqdefault.jpg"/>
<p><%= video.title %></p>
</a>
<p>
<b><a style="width:100%;" href="/channel/<%= video.ucid %>"><%= video.author %></a></b>
</p>
</div>
</div>

View File

@@ -0,0 +1,5 @@
<% content_for "header" do %>
<title><%= "Error" %> - Invidious</title>
<% end %>
<%= error_message %>

View File

@@ -0,0 +1,11 @@
<% content_for "header" do %>
<title>Invidious</title>
<% end %>
<% top_videos.each_slice(4) do |slice| %>
<div class="pure-g">
<% slice.each do |video| %>
<%= rendered "components/video" %>
<% end %>
</div>
<% end %>

View File

@@ -0,0 +1,73 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://unpkg.com/purecss@1.0.0/build/pure-min.css">
<link rel="stylesheet" href="https://unpkg.com/purecss@1.0.0/build/grids-responsive-min.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.6/css/all.css">
<link rel="stylesheet" href="/css/default.css">
<% if env.get? "darktheme" %>
<link rel="stylesheet" href="/css/darktheme.css">
<% else %>
<link rel="stylesheet" href="/css/lighttheme.css">
<% end %>
<%= yield_content "header" %>
</head>
<body>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-5"></div>
<div class="pure-u-1 pure-u-md-3-5">
<div class="pure-g" style="padding:1em;">
<div class="pure-u-1 pure-u-md-1-5">
<center><a href="/" class="pure-menu-heading">Invidious</a></center>
</div>
<div class="pure-u-1 pure-u-md-3-5">
<form class="pure-form" action="/search" method="get">
<fieldset>
<input type="search" style="width:100%;" name="q" placeholder="search" value="<%= env.params.query["q"]? %>">
</fieldset>
</form>
</div>
<div class="pure-u-1 pure-u-md-1-5">
<% if env.get? "authorized" %>
<div class="pure-g">
<div class="pure-u-1-3">
<a href="/feed/subscriptions" class="pure-menu-heading">
<% notifications = env.get("notifications").as(Int32) %>
<% if notifications > 0 %>
<center><%= notifications %> <i class="fas fa-bell"></i></center>
<% else %>
<center><i class="far fa-bell"></i></center>
<% end %>
</a>
</div>
<div class="pure-u-2-3">
<center><a href="/signout" class="pure-menu-heading">Sign out</a></center>
</div>
</div>
<% else %>
<center><a href="/login" class="pure-menu-heading">Login</a></center>
<% end %>
</div>
</div>
<%= content %>
<center class="h-box">
<% if env.get? "darktheme" %>
<a href="/modify_theme?light">Light theme</a>
<% else %>
<a href="/modify_theme?dark">Dark theme</a>
<% end %>
</center>
<center class="h-box">
Released under AGPLv3 by <a href="https://github.com/omarroth">Omar Roth</a> -
source available <a href="https://github.com/omarroth/invidious">here</a>
</center>
</div>
<div class="pure-u-1 pure-u-md-1-5"></div>
</div>
</body>
</html>

View File

@@ -0,0 +1,30 @@
<% content_for "header" do %>
<title>Login - Invidious</title>
<% end %>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-5"></div>
<div class="pure-u-1 pure-u-md-3-5">
<div class="h-box">
<form class="pure-form pure-form-stacked" action="/login?referer=<%= referer %>" method="post">
<fieldset>
<legend>Login to Google</legend>
<label for="email">Email</label>
<input class="pure-input-1" name="email" type="email" placeholder="Email">
<label for="password">Password</label>
<input class="pure-input-1" name="password" type="password" placeholder="Password">
<% if tfa %>
<label for="tfa">Google verification code</label>
<input class="pure-input-1" name="tfa" type="text" placeholder="Google verification code">
<% end %>
<button type="submit" class="pure-button pure-button-primary">Sign in</button>
</fieldset>
</form>
</div>
</div>
<div class="pure-u-1 pure-u-md-1-5"></div>
</div>

View File

@@ -0,0 +1,25 @@
<% content_for "header" do %>
<title><%= query.size > 30 ? query[0,30].rstrip(".") + "..." : query %> - Invidious</title>
<% end %>
<% videos.each_slice(4) do |slice| %>
<div class="pure-g">
<% slice.each do |video| %>
<%= rendered "components/video" %>
<% end %>
</div>
<% end %>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-5">
<% if page > 2 %>
<a href="/search?q=<%= query %>&page=<%= page - 1 %>">Previous page</a>
<% else %>
<a href="/search?q=<%= query %>">Previous page</a>
<% end %>
</div>
<div class="pure-u-1 pure-u-md-3-5"></div>
<div style="text-align:right;" class="pure-u-1 pure-u-md-1-5">
<a href="/search?q=<%= query %>&page=<%= page + 1 %>">Next page</a>
</div>
</div>

View File

@@ -0,0 +1,19 @@
<% content_for "header" do %>
<title>Subscription manager - Invidious</title>
<% end %>
<h1><%= subscriptions.size %> subscriptions</h1>
<% subscriptions.each do |channel| %>
<h3 class="h-box">
<div class="pure-g">
<div class="pure-u-2-5">
<a href="/channel/<%= channel.id %>"><%= channel.author %></a>
</div>
<div class="pure-u-2-5"></div>
<div class="pure-u-1-5">
<a style="vertical-align: right;" href="/subscription_ajax?action_remove_subscriptions=1&c=<%= channel.id %>">unsubscribe</a>
</div>
</div>
</h3>
<% end %>

View File

@@ -0,0 +1,38 @@
<% content_for "header" do %>
<title>Subscriptions - Invidious</title>
<% end %>
<h3><a href="/subscription_manager">View all subscriptions</a></h3>
<% if !notifications.empty? %>
<% notifications.each_slice(4) do |slice| %>
<div class="pure-g">
<% slice.each do |video| %>
<%= rendered "components/subscription_video" %>
<% end %>
</div>
<% end %>
<hr style="margin-left:1em; margin-right:1em;">
<% end %>
<% videos.each_slice(4) do |slice| %>
<div class="pure-g">
<% slice.each do |video| %>
<%= rendered "components/subscription_video" %>
<% end %>
</div>
<% end %>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-5">
<% if page > 2 %>
<a href="/feed/subscriptions?maxResults=<%= max_results %>&page=<%= page - 1 %>">Previous page</a>
<% else %>
<a href="/feed/subscriptions?maxResults=<%= max_results %>">Previous page</a>
<% end %>
</div>
<div class="pure-u-1 pure-u-md-3-5"></div>
<div style="text-align:right;" class="pure-u-1 pure-u-md-1-5">
<a href="/feed/subscriptions?maxResults=<%= max_results %>&page=<%= page + 1 %>">Next page</a>
</div>
</div>

View File

@@ -0,0 +1,231 @@
<% content_for "header" do %>
<meta name="thumbnail" content="<%= thumbnail %>">
<link rel="stylesheet" href="https://vjs.zencdn.net/6.6.3/video-js.css">
<link rel="stylesheet" href="https://unpkg.com/silvermine-videojs-quality-selector/dist/css/quality-selector.css">
<script src="https://vjs.zencdn.net/6.6.3/video.js"></script>
<script src="https://cdn.sc.gl/videojs-hotkeys/latest/videojs.hotkeys.min.js"></script>
<script src="https://unpkg.com/silvermine-videojs-quality-selector/dist/js/silvermine-videojs-quality-selector.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/videojs-offset/dist/videojs-offset.min.js"></script>
<title><%= video.title %> - Invidious</title>
<% end %>
<div class="h-box">
<video style="width:100%" playsinline poster="<%= thumbnail %>" title="<%= HTML.escape(video.title) %>" id="player" class="video-js vjs-16-9" data-setup="{}" controls>
<% if listen %>
<% audio_streams.each_with_index do |fmt, i| %>
<source src="<%= fmt["url"] %>" type='<%= fmt["type"] %>' label="<%= fmt["bitrate"] %>k" selected="<%= i == 0 ? true : false %>">
<% end %>
<% else %>
<% fmt_stream.each_with_index do |fmt, i| %>
<source src="<%= fmt["url"] %>" type='<%= fmt["type"] %>' label="<%= fmt["label"] %>" selected="<%= i == 0 ? true : false %>">
<% end %>
<% end %>
</video>
</div>
<script>
var options = {
preload: "auto",
playbackRates: [0.5, 1, 1.5, 2],
controlBar: {
children: [
'playToggle',
'volumePanel',
'progressControl',
'remainingTimeDisplay',
'qualitySelector',
'playbackRateMenuButton',
'fullscreenToggle',
],
},
};
var player = videojs('player', options, function() {
this.hotkeys({
volumeStep: 0.1,
seekStep: 5,
enableModifiersForNumbers: false,
enableVolumeScroll: false,
customKeys: {
play: {
key: function(e) {
// Toggle play with K Key
return (e.which === 75);
},
handler: function(player, options, e) {
if (player.paused()) {
player.play();
} else {
player.pause();
}
}
},
backward: {
key: function(e) {
// Go backward 5 seconds
return (e.which === 74);
},
handler: function(player, options, e) {
player.currentTime(player.currentTime() - 5);
}
},
forward: {
key: function(e) {
// Go forward 5 seconds
return (e.which === 76);
},
handler: function(player, options, e) {
player.currentTime(player.currentTime() + 5);
}
}
}
});
});
player.offset({
start: <%= video_start %>,
end: <%= video_end %>
});
function toggle(target) {
body = target.parentNode.parentNode.children[1];
if (body.style.display === null || body.style.display === '') {
target.innerHTML = '[ + ]';
body.style.display = 'none';
} else {
target.innerHTML = '[ - ]';
body.style.display = '';
}
};
function toggle_comments(target) {
body = target.parentNode.parentNode.parentNode.children[1];
if (body.style.display === null || body.style.display === '') {
target.innerHTML = '[ + ]';
body.style.display = 'none';
} else {
target.innerHTML = '[ - ]';
body.style.display = '';
}
};
<% if !listen %>
var currentSources = player.currentSources();
for ( var i = 0; i < currentSources.length; i++ ) {
if (player.canPlayType(currentSources[i]["type"].split(";")[0]) === "") {
currentSources.splice(i);
i--;
}
}
player.src(currentSources);
<% end %>
</script>
<div class="h-box">
<h1>
<%= video.title %>
<% if listen %>
<a href="/watch?<%= env.params.query %>">
<i class="fa fa-video" aria-hidden="true"></i>
</a>
<% else %>
<a href="/watch?<%= env.params.query %>&listen=true">
<i class="fa fa-volume-up" aria-hidden="true"></i>
</a>
<% end %>
</h1>
</div>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-5">
<div class="h-box">
<p><i class="fa fa-eye" aria-hidden="true"></i> <%= number_with_separator(video.views) %></p>
<p><i class="fa fa-thumbs-up" aria-hidden="true"></i> <%= number_with_separator(video.likes) %></p>
<p><i class="fa fa-thumbs-down" aria-hidden="true"></i> <%= number_with_separator(video.dislikes) %></p>
<p id="Wilson">Wilson Score : <%= video.wilson_score.round(4) %></p>
<p id="Rating">Rating : <%= rating.round(4) %> / 5</p>
<p id="Engagement">Engagement : <%= engagement.round(2) %>%</p>
<% if ad_slots %>
<p id="Slots">Ad Slots : <%= ad_slots %></p>
<% end %>
<% if engage_types %>
<p id="Engage">Engage Types : <%= engage_types %></p>
<% end %>
<% if ad_tag %>
<p id="Category">Ad Category : <%= ad_category %></p>
<p id="Tags">Ad Tags(?) : <%= k2 %></p>
<% end %>
</div>
</div>
<div class="pure-u-1 pure-u-md-3-5">
<div class="h-box">
<p>
<a href="/channel/<%= video.ucid %>">
<h3><%= video.author %></h3>
</a>
</p>
<% if authorized %>
<% if subscriptions.includes? video.ucid %>
<p>
<a href="/subscription_ajax?action_remove_subscriptions=1&c=<%= video.ucid %>">
<b>Unsubscribe from <%= video.author %></b>
</a>
</p>
<% else %>
<p>
<a href="/subscription_ajax?action_create_subscription_to_channel=1&c=<%= video.ucid %>">
<b>Subscribe to <%= video.author %></b>
</a>
</p>
<% end %>
<% else %>
<p>
<a href="/login">
<b>Login to subscribe to <%= video.author %></b>
</a>
</p>
<% end %>
<p>
<b>Shared <%= video.published.to_s("%B %-d, %Y") %></b>
</p>
<div>
<%= video.description %>
</div>
<hr style="margin-left:1em; margin-right:1em;">
<% if reddit_thread && !reddit_html.empty? %>
<div id="Comments">
<div>
<h3>
<a href="javascript:void(0)" onclick="toggle_comments(this)">[ - ]</a>
<%= reddit_thread.title %>
</h3>
<b>
<a target="_blank" href="https://reddit.com<%= reddit_thread.permalink %>">View more comments on Reddit</a>
</b>
</div>
<div>
<%= reddit_html %>
</div>
</div>
<hr style="margin-left:1em; margin-right:1em;">
<% end %>
</div>
</div>
<div class="pure-u-1 pure-u-md-1-5">
<div class="h-box">
<% rvs.each do |rv| %>
<% if rv.has_key?("id") %>
<a href="/watch?v=<%= rv["id"] %>">
<img style="width:100%;" alt="thumbnail" src="<%= rv["iurlmq"] %>">
<p style="width:100%"><%= rv["title"] %></p>
<p>
<b style="width: 100%"><%= rv["author"] %></b>
</p>
</a>
<% end %>
<% end %>
</div>
</div>
</div>