mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-23 00:29:53 +05:30
Remove files that were prematurely added and add backend Compilation files
This commit is contained in:
parent
bef234fd74
commit
6b984c6677
@ -627,11 +627,11 @@ default_user_preferences:
|
|||||||
##
|
##
|
||||||
## Accepted values: A list of strings
|
## Accepted values: A list of strings
|
||||||
## Each entry can be one of: "Popular", "Trending",
|
## Each entry can be one of: "Popular", "Trending",
|
||||||
## "Subscriptions", "Playlists", "Compilations"
|
## "Subscriptions", "Playlists"
|
||||||
##
|
##
|
||||||
## Default: ["Popular", "Trending", "Subscriptions", "Playlists", "Compilations"] (show all feeds)
|
## Default: ["Popular", "Trending", "Subscriptions", "Playlists"] (show all feeds)
|
||||||
##
|
##
|
||||||
#feed_menu: ["Popular", "Trending", "Subscriptions", "Playlists", "Compilations"]
|
#feed_menu: ["Popular", "Trending", "Subscriptions", "Playlists"]
|
||||||
|
|
||||||
##
|
##
|
||||||
## Default feed to display on the home page.
|
## Default feed to display on the home page.
|
||||||
|
20
config/sql/compilation_videos.sql
Normal file
20
config/sql/compilation_videos.sql
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
-- Table: public.compilation_videos
|
||||||
|
|
||||||
|
-- DROP TABLE public.compilation_videos;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS public.compilation_videos
|
||||||
|
(
|
||||||
|
title text,
|
||||||
|
id text,
|
||||||
|
author text,
|
||||||
|
ucid text,
|
||||||
|
length_seconds integer,
|
||||||
|
starting_timestamp_seconds integer,
|
||||||
|
ending_timestamp_seconds integer,
|
||||||
|
published timestamptz,
|
||||||
|
compid text references compilations(id),
|
||||||
|
index int8,
|
||||||
|
PRIMARY KEY (index,compid)
|
||||||
|
);
|
||||||
|
|
||||||
|
GRANT ALL ON TABLE public.compilation_videos TO current_user;
|
@ -1,3 +1,13 @@
|
|||||||
|
-- Type: public.privacy
|
||||||
|
|
||||||
|
-- DROP TYPE public.privacy;
|
||||||
|
|
||||||
|
CREATE TYPE public.privacy AS ENUM
|
||||||
|
(
|
||||||
|
'Unlisted',
|
||||||
|
'Private'
|
||||||
|
);
|
||||||
|
|
||||||
-- Table: public.compilations
|
-- Table: public.compilations
|
||||||
|
|
||||||
-- DROP TABLE public.compilations;
|
-- DROP TABLE public.compilations;
|
||||||
@ -15,4 +25,4 @@ CREATE TABLE IF NOT EXISTS public.compilations
|
|||||||
index int8[]
|
index int8[]
|
||||||
);
|
);
|
||||||
|
|
||||||
GRANT ALL ON public.playlists TO current_user;
|
GRANT ALL ON public.compilations TO current_user;
|
||||||
|
@ -11,4 +11,4 @@ psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/annotation
|
|||||||
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/playlists.sql
|
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/playlists.sql
|
||||||
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/playlist_videos.sql
|
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/playlist_videos.sql
|
||||||
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/compilations.sql
|
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/compilations.sql
|
||||||
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/compilation_videos.sql
|
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/compilation_videos.sql
|
@ -413,7 +413,6 @@
|
|||||||
"Audio mode": "Audio mode",
|
"Audio mode": "Audio mode",
|
||||||
"Video mode": "Video mode",
|
"Video mode": "Video mode",
|
||||||
"Playlists": "Playlists",
|
"Playlists": "Playlists",
|
||||||
"Compilations": "Compilations",
|
|
||||||
"search_filters_title": "Filters",
|
"search_filters_title": "Filters",
|
||||||
"search_filters_date_label": "Upload date",
|
"search_filters_date_label": "Upload date",
|
||||||
"search_filters_date_option_none": "Any date",
|
"search_filters_date_option_none": "Any date",
|
||||||
|
@ -8,7 +8,6 @@ require "../src/invidious/channels/*"
|
|||||||
require "../src/invidious/videos/caption"
|
require "../src/invidious/videos/caption"
|
||||||
require "../src/invidious/videos"
|
require "../src/invidious/videos"
|
||||||
require "../src/invidious/playlists"
|
require "../src/invidious/playlists"
|
||||||
require "../src/invidious/compilations"
|
|
||||||
require "../src/invidious/search/ctoken"
|
require "../src/invidious/search/ctoken"
|
||||||
require "../src/invidious/trending"
|
require "../src/invidious/trending"
|
||||||
require "spectator"
|
require "spectator"
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
struct Compilation
|
|
||||||
include DB::Serializable
|
|
||||||
|
|
||||||
property title : String
|
|
||||||
property id : String
|
|
||||||
property author : String
|
|
||||||
property ucid : String
|
|
||||||
property length_seconds : Int32
|
|
||||||
property published : Time
|
|
||||||
property plid : String
|
|
||||||
property index : Int64
|
|
||||||
property live_now : Bool
|
|
||||||
|
|
||||||
end
|
|
@ -1,7 +1,7 @@
|
|||||||
require "./base.cr"
|
require "./base.cr"
|
||||||
|
|
||||||
#
|
#
|
||||||
# This module contains functions related to the "playlists" table.
|
# This module contains functions related to the "compilations" table.
|
||||||
#
|
#
|
||||||
module Invidious::Database::Compilations
|
module Invidious::Database::Compilations
|
||||||
extend self
|
extend self
|
||||||
@ -10,22 +10,22 @@ module Invidious::Database::Compilations
|
|||||||
# Insert / delete
|
# Insert / delete
|
||||||
# -------------------
|
# -------------------
|
||||||
|
|
||||||
def insert(playlist : InvidiousPlaylist)
|
def insert(compilation : InvidiousCompilation)
|
||||||
playlist_array = playlist.to_a
|
compilation_array = compilation.to_a
|
||||||
|
|
||||||
request = <<-SQL
|
request = <<-SQL
|
||||||
INSERT INTO playlists
|
INSERT INTO compilations
|
||||||
VALUES (#{arg_array(playlist_array)})
|
VALUES (#{arg_array(compilation_array)})
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
PG_DB.exec(request, args: playlist_array)
|
PG_DB.exec(request, args: compilation_array)
|
||||||
end
|
end
|
||||||
|
|
||||||
# deletes the given playlist and connected playlist videos
|
# deletes the given compilation and connected compilation videos
|
||||||
def delete(id : String)
|
def delete(id : String)
|
||||||
PlaylistVideos.delete_by_playlist(id)
|
CompilationVideos.delete_by_compilation(id)
|
||||||
request = <<-SQL
|
request = <<-SQL
|
||||||
DELETE FROM playlists *
|
DELETE FROM compilations *
|
||||||
WHERE id = $1
|
WHERE id = $1
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ module Invidious::Database::Compilations
|
|||||||
|
|
||||||
def update(id : String, title : String, privacy, description, updated)
|
def update(id : String, title : String, privacy, description, updated)
|
||||||
request = <<-SQL
|
request = <<-SQL
|
||||||
UPDATE playlists
|
UPDATE compilations
|
||||||
SET title = $1, privacy = $2, description = $3, updated = $4
|
SET title = $1, privacy = $2, description = $3, updated = $4
|
||||||
WHERE id = $5
|
WHERE id = $5
|
||||||
SQL
|
SQL
|
||||||
@ -48,7 +48,7 @@ module Invidious::Database::Compilations
|
|||||||
|
|
||||||
def update_description(id : String, description)
|
def update_description(id : String, description)
|
||||||
request = <<-SQL
|
request = <<-SQL
|
||||||
UPDATE playlists
|
UPDATE compilations
|
||||||
SET description = $1
|
SET description = $1
|
||||||
WHERE id = $2
|
WHERE id = $2
|
||||||
SQL
|
SQL
|
||||||
@ -56,19 +56,9 @@ module Invidious::Database::Compilations
|
|||||||
PG_DB.exec(request, description, id)
|
PG_DB.exec(request, description, id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_subscription_time(id : String)
|
|
||||||
request = <<-SQL
|
|
||||||
UPDATE playlists
|
|
||||||
SET subscribed = now()
|
|
||||||
WHERE id = $1
|
|
||||||
SQL
|
|
||||||
|
|
||||||
PG_DB.exec(request, id)
|
|
||||||
end
|
|
||||||
|
|
||||||
def update_video_added(id : String, index : String | Int64)
|
def update_video_added(id : String, index : String | Int64)
|
||||||
request = <<-SQL
|
request = <<-SQL
|
||||||
UPDATE playlists
|
UPDATE compilations
|
||||||
SET index = array_append(index, $1),
|
SET index = array_append(index, $1),
|
||||||
video_count = cardinality(index) + 1,
|
video_count = cardinality(index) + 1,
|
||||||
updated = now()
|
updated = now()
|
||||||
@ -80,7 +70,7 @@ module Invidious::Database::Compilations
|
|||||||
|
|
||||||
def update_video_removed(id : String, index : String | Int64)
|
def update_video_removed(id : String, index : String | Int64)
|
||||||
request = <<-SQL
|
request = <<-SQL
|
||||||
UPDATE playlists
|
UPDATE compilations
|
||||||
SET index = array_remove(index, $1),
|
SET index = array_remove(index, $1),
|
||||||
video_count = cardinality(index) - 1,
|
video_count = cardinality(index) - 1,
|
||||||
updated = now()
|
updated = now()
|
||||||
@ -94,51 +84,51 @@ module Invidious::Database::Compilations
|
|||||||
# Salect
|
# Salect
|
||||||
# -------------------
|
# -------------------
|
||||||
|
|
||||||
def select(*, id : String) : InvidiousPlaylist?
|
def select(*, id : String) : InvidiousCompilation?
|
||||||
request = <<-SQL
|
request = <<-SQL
|
||||||
SELECT * FROM playlists
|
SELECT * FROM compilations
|
||||||
WHERE id = $1
|
WHERE id = $1
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
return PG_DB.query_one?(request, id, as: InvidiousPlaylist)
|
return PG_DB.query_one?(request, id, as: InvidiousCompilation)
|
||||||
end
|
end
|
||||||
|
|
||||||
def select_all(*, author : String) : Array(InvidiousPlaylist)
|
def select_all(*, author : String) : Array(InvidiousCompilation)
|
||||||
request = <<-SQL
|
request = <<-SQL
|
||||||
SELECT * FROM playlists
|
SELECT * FROM compilations
|
||||||
WHERE author = $1
|
WHERE author = $1
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
return PG_DB.query_all(request, author, as: InvidiousPlaylist)
|
return PG_DB.query_all(request, author, as: InvidiousCompilation)
|
||||||
end
|
end
|
||||||
|
|
||||||
# -------------------
|
# -------------------
|
||||||
# Salect (filtered)
|
# Salect (filtered)
|
||||||
# -------------------
|
# -------------------
|
||||||
|
|
||||||
def select_like_iv(email : String) : Array(InvidiousPlaylist)
|
def select_like_iv(email : String) : Array(InvidiousCompilation)
|
||||||
request = <<-SQL
|
request = <<-SQL
|
||||||
SELECT * FROM playlists
|
SELECT * FROM compilation
|
||||||
WHERE author = $1 AND id LIKE 'IV%'
|
WHERE author = $1 AND id LIKE 'IV%'
|
||||||
ORDER BY created
|
ORDER BY created
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
PG_DB.query_all(request, email, as: InvidiousPlaylist)
|
PG_DB.query_all(request, email, as: InvidiousCompilation)
|
||||||
end
|
end
|
||||||
|
|
||||||
def select_not_like_iv(email : String) : Array(InvidiousPlaylist)
|
def select_not_like_iv(email : String) : Array(InvidiousCompilation)
|
||||||
request = <<-SQL
|
request = <<-SQL
|
||||||
SELECT * FROM playlists
|
SELECT * FROM compilations
|
||||||
WHERE author = $1 AND id NOT LIKE 'IV%'
|
WHERE author = $1 AND id NOT LIKE 'IV%'
|
||||||
ORDER BY created
|
ORDER BY created
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
PG_DB.query_all(request, email, as: InvidiousPlaylist)
|
PG_DB.query_all(request, email, as: InvidiousCompilation)
|
||||||
end
|
end
|
||||||
|
|
||||||
def select_user_created_playlists(email : String) : Array({String, String})
|
def select_user_created_compilations(email : String) : Array({String, String})
|
||||||
request = <<-SQL
|
request = <<-SQL
|
||||||
SELECT id,title FROM playlists
|
SELECT id,title FROM compilations
|
||||||
WHERE author = $1 AND id LIKE 'IV%'
|
WHERE author = $1 AND id LIKE 'IV%'
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
@ -149,20 +139,20 @@ module Invidious::Database::Compilations
|
|||||||
# Misc checks
|
# Misc checks
|
||||||
# -------------------
|
# -------------------
|
||||||
|
|
||||||
# Check if given playlist ID exists
|
# Check if given compilation ID exists
|
||||||
def exists?(id : String) : Bool
|
def exists?(id : String) : Bool
|
||||||
request = <<-SQL
|
request = <<-SQL
|
||||||
SELECT id FROM playlists
|
SELECT id FROM compilations
|
||||||
WHERE id = $1
|
WHERE id = $1
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
return PG_DB.query_one?(request, id, as: String).nil?
|
return PG_DB.query_one?(request, id, as: String).nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
# Count how many playlist a user has created.
|
# Count how many compilations a user has created.
|
||||||
def count_owned_by(author : String) : Int64
|
def count_owned_by(author : String) : Int64
|
||||||
request = <<-SQL
|
request = <<-SQL
|
||||||
SELECT count(*) FROM playlists
|
SELECT count(*) FROM compilations
|
||||||
WHERE author = $1
|
WHERE author = $1
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
@ -171,7 +161,7 @@ module Invidious::Database::Compilations
|
|||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# This module contains functions related to the "playlist_videos" table.
|
# This module contains functions related to the "compilation_videos" table.
|
||||||
#
|
#
|
||||||
module Invidious::Database::CompilationVideos
|
module Invidious::Database::CompilationVideos
|
||||||
extend self
|
extend self
|
||||||
@ -184,7 +174,7 @@ module Invidious::Database::CompilationVideos
|
|||||||
video_array = video.to_a
|
video_array = video.to_a
|
||||||
|
|
||||||
request = <<-SQL
|
request = <<-SQL
|
||||||
INSERT INTO playlist_videos
|
INSERT INTO compilation_videos
|
||||||
VALUES (#{arg_array(video_array)})
|
VALUES (#{arg_array(video_array)})
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
@ -193,67 +183,67 @@ module Invidious::Database::CompilationVideos
|
|||||||
|
|
||||||
def delete(index)
|
def delete(index)
|
||||||
request = <<-SQL
|
request = <<-SQL
|
||||||
DELETE FROM playlist_videos *
|
DELETE FROM compilation_videos *
|
||||||
WHERE index = $1
|
WHERE index = $1
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
PG_DB.exec(request, index)
|
PG_DB.exec(request, index)
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete_by_playlist(plid : String)
|
def delete_by_compilation(compid : String)
|
||||||
request = <<-SQL
|
request = <<-SQL
|
||||||
DELETE FROM playlist_videos *
|
DELETE FROM compilation_videos *
|
||||||
WHERE plid = $1
|
WHERE compid = $1
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
PG_DB.exec(request, plid)
|
PG_DB.exec(request, compid)
|
||||||
end
|
end
|
||||||
|
|
||||||
# -------------------
|
# -------------------
|
||||||
# Salect
|
# Salect
|
||||||
# -------------------
|
# -------------------
|
||||||
|
|
||||||
def select(plid : String, index : VideoIndex, offset, limit = 100) : Array(PlaylistVideo)
|
def select(compid : String, index : VideoIndex, offset, limit = 100) : Array(CompilationVideo)
|
||||||
request = <<-SQL
|
request = <<-SQL
|
||||||
SELECT * FROM playlist_videos
|
SELECT * FROM compilation_videos
|
||||||
WHERE plid = $1
|
WHERE compid = $1
|
||||||
ORDER BY array_position($2, index)
|
ORDER BY array_position($2, index)
|
||||||
LIMIT $3
|
LIMIT $3
|
||||||
OFFSET $4
|
OFFSET $4
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
return PG_DB.query_all(request, plid, index, limit, offset, as: PlaylistVideo)
|
return PG_DB.query_all(request, compid, index, limit, offset, as: CompilationVideo)
|
||||||
end
|
end
|
||||||
|
|
||||||
def select_index(plid : String, vid : String) : Int64?
|
def select_index(compid : String, vid : String) : Int64?
|
||||||
request = <<-SQL
|
request = <<-SQL
|
||||||
SELECT index FROM playlist_videos
|
SELECT index FROM compilation_videos
|
||||||
WHERE plid = $1 AND id = $2
|
WHERE compid = $1 AND id = $2
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
return PG_DB.query_one?(request, plid, vid, as: Int64)
|
return PG_DB.query_one?(request, compid, vid, as: Int64)
|
||||||
end
|
end
|
||||||
|
|
||||||
def select_one_id(plid : String, index : VideoIndex) : String?
|
def select_one_id(compid : String, index : VideoIndex) : String?
|
||||||
request = <<-SQL
|
request = <<-SQL
|
||||||
SELECT id FROM playlist_videos
|
SELECT id FROM compilation_videos
|
||||||
WHERE plid = $1
|
WHERE compid = $1
|
||||||
ORDER BY array_position($2, index)
|
ORDER BY array_position($2, index)
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
return PG_DB.query_one?(request, plid, index, as: String)
|
return PG_DB.query_one?(request, compid, index, as: String)
|
||||||
end
|
end
|
||||||
|
|
||||||
def select_ids(plid : String, index : VideoIndex, limit = 500) : Array(String)
|
def select_ids(compid : String, index : VideoIndex, limit = 500) : Array(String)
|
||||||
request = <<-SQL
|
request = <<-SQL
|
||||||
SELECT id FROM playlist_videos
|
SELECT id FROM compilation_videos
|
||||||
WHERE plid = $1
|
WHERE compid = $1
|
||||||
ORDER BY array_position($2, index)
|
ORDER BY array_position($2, index)
|
||||||
LIMIT $3
|
LIMIT $3
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
return PG_DB.query_all(request, plid, index, limit, as: String)
|
return PG_DB.query_all(request, compid, index, limit, as: String)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -159,7 +159,7 @@ module Invidious::Database::Playlists
|
|||||||
return PG_DB.query_one?(request, id, as: String).nil?
|
return PG_DB.query_one?(request, id, as: String).nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
# Count how many playlist a user has created.
|
# Count how many playlists a user has created.
|
||||||
def count_owned_by(author : String) : Int64
|
def count_owned_by(author : String) : Int64
|
||||||
request = <<-SQL
|
request = <<-SQL
|
||||||
SELECT count(*) FROM playlists
|
SELECT count(*) FROM playlists
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
module Invidious::Routes::Compilations
|
|
||||||
end
|
|
@ -8,6 +8,26 @@ module Invidious::Routes::Feeds
|
|||||||
def self.compilations(env)
|
def self.compilations(env)
|
||||||
locale = env.get("preferences").as(Preferences).locale
|
locale = env.get("preferences").as(Preferences).locale
|
||||||
|
|
||||||
|
user = env.get? "user"
|
||||||
|
referer = get_referer(env)
|
||||||
|
|
||||||
|
return env.redirect "/" if user.nil?
|
||||||
|
|
||||||
|
user = user.as(User)
|
||||||
|
|
||||||
|
# TODO: make a single DB call and separate the items here?
|
||||||
|
items_created = Invidious::Database::Compilations.select_like_iv(user.email)
|
||||||
|
items_created.map! do |item|
|
||||||
|
item.author = ""
|
||||||
|
item
|
||||||
|
end
|
||||||
|
|
||||||
|
items_saved = Invidious::Database::Compilations.select_not_like_iv(user.email)
|
||||||
|
items_saved.map! do |item|
|
||||||
|
item.author = ""
|
||||||
|
item
|
||||||
|
end
|
||||||
|
|
||||||
templated "feeds/compilations"
|
templated "feeds/compilations"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -23,12 +23,6 @@ module Invidious::Routes::Misc
|
|||||||
else
|
else
|
||||||
env.redirect "/feed/popular"
|
env.redirect "/feed/popular"
|
||||||
end
|
end
|
||||||
when "Compilations"
|
|
||||||
if user
|
|
||||||
env.redirect "/feed/compilations"
|
|
||||||
else
|
|
||||||
env.redirect "/feed/popular"
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
templated "search_homepage", navbar_search: false
|
templated "search_homepage", navbar_search: false
|
||||||
end
|
end
|
||||||
|
@ -99,7 +99,7 @@ module Invidious::Routes::PreferencesRoute
|
|||||||
default_home = env.params.body["default_home"]?.try &.as(String) || CONFIG.default_user_preferences.default_home
|
default_home = env.params.body["default_home"]?.try &.as(String) || CONFIG.default_user_preferences.default_home
|
||||||
|
|
||||||
feed_menu = [] of String
|
feed_menu = [] of String
|
||||||
5.times do |index|
|
4.times do |index|
|
||||||
option = env.params.body["feed_menu[#{index}]"]?.try &.as(String) || ""
|
option = env.params.body["feed_menu[#{index}]"]?.try &.as(String) || ""
|
||||||
if !option.empty?
|
if !option.empty?
|
||||||
feed_menu << option
|
feed_menu << option
|
||||||
@ -186,7 +186,7 @@ module Invidious::Routes::PreferencesRoute
|
|||||||
CONFIG.default_user_preferences.default_home = env.params.body["admin_default_home"]?.try &.as(String) || CONFIG.default_user_preferences.default_home
|
CONFIG.default_user_preferences.default_home = env.params.body["admin_default_home"]?.try &.as(String) || CONFIG.default_user_preferences.default_home
|
||||||
|
|
||||||
admin_feed_menu = [] of String
|
admin_feed_menu = [] of String
|
||||||
5.times do |index|
|
4.times do |index|
|
||||||
option = env.params.body["admin_feed_menu[#{index}]"]?.try &.as(String) || ""
|
option = env.params.body["admin_feed_menu[#{index}]"]?.try &.as(String) || ""
|
||||||
if !option.empty?
|
if !option.empty?
|
||||||
admin_feed_menu << option
|
admin_feed_menu << option
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
<% title = HTML.escape(compilation.title) %>
|
|
||||||
<% author = HTML.escape(compilation.author) %>
|
|
||||||
|
|
||||||
<% content_for "header" do %>
|
|
||||||
<title><%= title %> - Invidious</title>
|
|
||||||
<% end %>
|
|
@ -1,11 +1,11 @@
|
|||||||
<div class="feed-menu">
|
<div class="feed-menu">
|
||||||
<% feed_menu = env.get("preferences").as(Preferences).feed_menu.dup %>
|
<% feed_menu = env.get("preferences").as(Preferences).feed_menu.dup %>
|
||||||
<% if !env.get?("user") %>
|
<% if !env.get?("user") %>
|
||||||
<% feed_menu.reject! {|item| {"Subscriptions", "Playlists", "Compilations"}.includes? item} %>
|
<% feed_menu.reject! {|item| {"Subscriptions", "Playlists"}.includes? item} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% feed_menu.each do |feed| %>
|
<% feed_menu.each do |feed| %>
|
||||||
<a href="/feed/<%= feed.downcase %>" class="feed-menu-item pure-menu-heading">
|
<a href="/feed/<%= feed.downcase %>" class="feed-menu-item pure-menu-heading">
|
||||||
<%= translate(locale, feed) %>
|
<%= translate(locale, feed) %>
|
||||||
</a>
|
</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
@ -1,6 +0,0 @@
|
|||||||
<% content_for "header" do %>
|
|
||||||
<title><%= translate(locale, "Compilations") %> - Invidious</title>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= rendered "components/feed_menu" %>
|
|
||||||
|
|
@ -165,7 +165,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% if env.get?("user") %>
|
<% if env.get?("user") %>
|
||||||
<% feed_options = {"", "Popular", "Trending", "Subscriptions", "Playlists","Compilations"} %>
|
<% feed_options = {"", "Popular", "Trending", "Subscriptions", "Playlists"} %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<% feed_options = {"", "Popular", "Trending"} %>
|
<% feed_options = {"", "Popular", "Trending"} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
Loading…
Reference in New Issue
Block a user