'patches' にファイルをアップロード
このコミットが含まれているのは:
コミット
3e3758b609
|
@ -0,0 +1,358 @@
|
|||
From 6a19f66c5380488896c341d88a52b99601008d8c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=89milien=20Devos?= <contact@emiliendevos.be>
|
||||
Date: Tue, 19 Oct 2021 07:12:15 +0000
|
||||
Subject: [PATCH] limit feeds and delete materialized views
|
||||
|
||||
---
|
||||
config/migrate-scripts/migrate-db-8bc91ce.sh | 6 ++
|
||||
config/sql/channel_videos.sql | 8 +--
|
||||
kubernetes/values.yaml | 1 -
|
||||
src/invidious.cr | 12 ----
|
||||
src/invidious/config.cr | 2 -
|
||||
src/invidious/jobs/refresh_feeds_job.cr | 75 --------------------
|
||||
src/invidious/routes/account.cr | 2 -
|
||||
src/invidious/routes/login.cr | 3 -
|
||||
src/invidious/routes/search.cr | 2 +
|
||||
src/invidious/search/processors.cr | 18 ++---
|
||||
src/invidious/users.cr | 51 ++++++-------
|
||||
11 files changed, 43 insertions(+), 137 deletions(-)
|
||||
create mode 100644 config/migrate-scripts/migrate-db-8bc91ce.sh
|
||||
delete mode 100644 src/invidious/jobs/refresh_feeds_job.cr
|
||||
|
||||
diff --git a/config/migrate-scripts/migrate-db-8bc91ce.sh b/config/migrate-scripts/migrate-db-8bc91ce.sh
|
||||
new file mode 100644
|
||||
index 000000000..04388175e
|
||||
--- /dev/null
|
||||
+++ b/config/migrate-scripts/migrate-db-8bc91ce.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+CREATE INDEX channel_videos_ucid_published_idx
|
||||
+ ON public.channel_videos
|
||||
+ USING btree
|
||||
+ (ucid COLLATE pg_catalog."default", published);
|
||||
+
|
||||
+DROP INDEX channel_videos_ucid_idx;
|
||||
\ No newline at end of file
|
||||
diff --git a/config/sql/channel_videos.sql b/config/sql/channel_videos.sql
|
||||
index cd4e0ffdb..f2ac4876c 100644
|
||||
--- a/config/sql/channel_videos.sql
|
||||
+++ b/config/sql/channel_videos.sql
|
||||
@@ -19,12 +19,12 @@ CREATE TABLE IF NOT EXISTS public.channel_videos
|
||||
|
||||
GRANT ALL ON TABLE public.channel_videos TO current_user;
|
||||
|
||||
--- Index: public.channel_videos_ucid_idx
|
||||
+-- Index: public.channel_videos_ucid_published_idx
|
||||
|
||||
--- DROP INDEX public.channel_videos_ucid_idx;
|
||||
+-- DROP INDEX public.channel_videos_ucid_published_idx;
|
||||
|
||||
-CREATE INDEX IF NOT EXISTS channel_videos_ucid_idx
|
||||
+CREATE INDEX IF NOT EXISTS channel_videos_ucid_published_idx
|
||||
ON public.channel_videos
|
||||
USING btree
|
||||
- (ucid COLLATE pg_catalog."default");
|
||||
+ (ucid COLLATE pg_catalog."default", published);
|
||||
|
||||
diff --git a/kubernetes/values.yaml b/kubernetes/values.yaml
|
||||
index 2dc4db2c4..5506c772d 100644
|
||||
--- a/kubernetes/values.yaml
|
||||
+++ b/kubernetes/values.yaml
|
||||
@@ -49,7 +49,6 @@ postgresql:
|
||||
# Adapted from ../config/config.yml
|
||||
config:
|
||||
channel_threads: 1
|
||||
- feed_threads: 1
|
||||
db:
|
||||
user: kemal
|
||||
password: kemal
|
||||
diff --git a/src/invidious.cr b/src/invidious.cr
|
||||
index 9f3d5d10f..6c6bd32ce 100644
|
||||
--- a/src/invidious.cr
|
||||
+++ b/src/invidious.cr
|
||||
@@ -86,14 +86,6 @@ Kemal.config.extra_options do |parser|
|
||||
exit
|
||||
end
|
||||
end
|
||||
- parser.on("-f THREADS", "--feed-threads=THREADS", "Number of threads for refreshing feeds (default: #{CONFIG.feed_threads})") do |number|
|
||||
- begin
|
||||
- CONFIG.feed_threads = number.to_i
|
||||
- rescue ex
|
||||
- puts "THREADS must be integer"
|
||||
- exit
|
||||
- end
|
||||
- end
|
||||
parser.on("-o OUTPUT", "--output=OUTPUT", "Redirect output (default: #{CONFIG.output})") do |output|
|
||||
CONFIG.output = output
|
||||
end
|
||||
@@ -141,10 +133,6 @@ if CONFIG.channel_threads > 0
|
||||
Invidious::Jobs.register Invidious::Jobs::RefreshChannelsJob.new(PG_DB)
|
||||
end
|
||||
|
||||
-if CONFIG.feed_threads > 0
|
||||
- Invidious::Jobs.register Invidious::Jobs::RefreshFeedsJob.new(PG_DB)
|
||||
-end
|
||||
-
|
||||
DECRYPT_FUNCTION = DecryptFunction.new(CONFIG.decrypt_polling)
|
||||
if CONFIG.decrypt_polling
|
||||
Invidious::Jobs.register Invidious::Jobs::UpdateDecryptFunctionJob.new
|
||||
diff --git a/src/invidious/config.cr b/src/invidious/config.cr
|
||||
index 93c4c0f7a..6fe72dbda 100644
|
||||
--- a/src/invidious/config.cr
|
||||
+++ b/src/invidious/config.cr
|
||||
@@ -62,8 +62,6 @@ class Config
|
||||
# Time interval between two executions of the job that crawls channel videos (subscriptions update).
|
||||
@[YAML::Field(converter: Preferences::TimeSpanConverter)]
|
||||
property channel_refresh_interval : Time::Span = 30.minutes
|
||||
- # Number of threads to use for updating feeds
|
||||
- property feed_threads : Int32 = 1
|
||||
# Log file path or STDOUT
|
||||
property output : String = "STDOUT"
|
||||
# Default log level, valid YAML values are ints and strings, see src/invidious/helpers/logger.cr
|
||||
diff --git a/src/invidious/jobs/refresh_feeds_job.cr b/src/invidious/jobs/refresh_feeds_job.cr
|
||||
deleted file mode 100644
|
||||
index 4b52c9596..000000000
|
||||
--- a/src/invidious/jobs/refresh_feeds_job.cr
|
||||
+++ /dev/null
|
||||
@@ -1,75 +0,0 @@
|
||||
-class Invidious::Jobs::RefreshFeedsJob < Invidious::Jobs::BaseJob
|
||||
- private getter db : DB::Database
|
||||
-
|
||||
- def initialize(@db)
|
||||
- end
|
||||
-
|
||||
- def begin
|
||||
- max_fibers = CONFIG.feed_threads
|
||||
- active_fibers = 0
|
||||
- active_channel = Channel(Bool).new
|
||||
-
|
||||
- loop do
|
||||
- db.query("SELECT email FROM users WHERE feed_needs_update = true OR feed_needs_update IS NULL") do |rs|
|
||||
- rs.each do
|
||||
- email = rs.read(String)
|
||||
- view_name = "subscriptions_#{sha256(email)}"
|
||||
-
|
||||
- if active_fibers >= max_fibers
|
||||
- if active_channel.receive
|
||||
- active_fibers -= 1
|
||||
- end
|
||||
- end
|
||||
-
|
||||
- active_fibers += 1
|
||||
- spawn do
|
||||
- begin
|
||||
- # Drop outdated views
|
||||
- column_array = Invidious::Database.get_column_array(db, view_name)
|
||||
- ChannelVideo.type_array.each_with_index do |name, i|
|
||||
- if name != column_array[i]?
|
||||
- LOGGER.info("RefreshFeedsJob: DROP MATERIALIZED VIEW #{view_name}")
|
||||
- db.exec("DROP MATERIALIZED VIEW #{view_name}")
|
||||
- raise "view does not exist"
|
||||
- end
|
||||
- end
|
||||
-
|
||||
- if !db.query_one("SELECT pg_get_viewdef('#{view_name}')", as: String).includes? "WHERE ((cv.ucid = ANY (u.subscriptions))"
|
||||
- LOGGER.info("RefreshFeedsJob: Materialized view #{view_name} is out-of-date, recreating...")
|
||||
- db.exec("DROP MATERIALIZED VIEW #{view_name}")
|
||||
- end
|
||||
-
|
||||
- db.exec("REFRESH MATERIALIZED VIEW #{view_name}")
|
||||
- db.exec("UPDATE users SET feed_needs_update = false WHERE email = $1", email)
|
||||
- rescue ex
|
||||
- # Rename old views
|
||||
- begin
|
||||
- legacy_view_name = "subscriptions_#{sha256(email)[0..7]}"
|
||||
-
|
||||
- db.exec("SELECT * FROM #{legacy_view_name} LIMIT 0")
|
||||
- LOGGER.info("RefreshFeedsJob: RENAME MATERIALIZED VIEW #{legacy_view_name}")
|
||||
- db.exec("ALTER MATERIALIZED VIEW #{legacy_view_name} RENAME TO #{view_name}")
|
||||
- rescue ex
|
||||
- begin
|
||||
- # While iterating through, we may have an email stored from a deleted account
|
||||
- if db.query_one?("SELECT true FROM users WHERE email = $1", email, as: Bool)
|
||||
- LOGGER.info("RefreshFeedsJob: CREATE #{view_name}")
|
||||
- db.exec("CREATE MATERIALIZED VIEW #{view_name} AS #{MATERIALIZED_VIEW_SQL.call(email)}")
|
||||
- db.exec("UPDATE users SET feed_needs_update = false WHERE email = $1", email)
|
||||
- end
|
||||
- rescue ex
|
||||
- LOGGER.error("RefreshFeedJobs: REFRESH #{email} : #{ex.message}")
|
||||
- end
|
||||
- end
|
||||
- end
|
||||
-
|
||||
- active_channel.send(true)
|
||||
- end
|
||||
- end
|
||||
- end
|
||||
-
|
||||
- sleep 5.seconds
|
||||
- Fiber.yield
|
||||
- end
|
||||
- end
|
||||
-end
|
||||
diff --git a/src/invidious/routes/account.cr b/src/invidious/routes/account.cr
|
||||
index 9bb731360..e3220cdb8 100644
|
||||
--- a/src/invidious/routes/account.cr
|
||||
+++ b/src/invidious/routes/account.cr
|
||||
@@ -128,10 +128,8 @@ module Invidious::Routes::Account
|
||||
return error_template(400, ex)
|
||||
end
|
||||
|
||||
- view_name = "subscriptions_#{sha256(user.email)}"
|
||||
Invidious::Database::Users.delete(user)
|
||||
Invidious::Database::SessionIDs.delete(email: user.email)
|
||||
- PG_DB.exec("DROP MATERIALIZED VIEW #{view_name}")
|
||||
|
||||
env.request.cookies.each do |cookie|
|
||||
cookie.expires = Time.utc(1990, 1, 1)
|
||||
diff --git a/src/invidious/routes/login.cr b/src/invidious/routes/login.cr
|
||||
index 99fc13a2b..ca223b425 100644
|
||||
--- a/src/invidious/routes/login.cr
|
||||
+++ b/src/invidious/routes/login.cr
|
||||
@@ -430,9 +430,6 @@ module Invidious::Routes::Login
|
||||
Invidious::Database::Users.insert(user)
|
||||
Invidious::Database::SessionIDs.insert(sid, email)
|
||||
|
||||
- view_name = "subscriptions_#{sha256(user.email)}"
|
||||
- PG_DB.exec("CREATE MATERIALIZED VIEW #{view_name} AS #{MATERIALIZED_VIEW_SQL.call(user.email)}")
|
||||
-
|
||||
env.response.cookies["SID"] = Invidious::User::Cookies.sid(CONFIG.domain, sid)
|
||||
|
||||
if env.request.cookies["PREFS"]?
|
||||
diff --git a/src/invidious/routes/search.cr b/src/invidious/routes/search.cr
|
||||
index e60d00815..1d4911bde 100644
|
||||
--- a/src/invidious/routes/search.cr
|
||||
+++ b/src/invidious/routes/search.cr
|
||||
@@ -51,6 +51,8 @@ module Invidious::Routes::Search
|
||||
else
|
||||
user = env.get? "user"
|
||||
|
||||
+ user = user ? user.as(User) : nil
|
||||
+
|
||||
begin
|
||||
videos = query.process
|
||||
rescue ex : ChannelSearchException
|
||||
diff --git a/src/invidious/search/processors.cr b/src/invidious/search/processors.cr
|
||||
index d1409c06c..1ff6f95a9 100644
|
||||
--- a/src/invidious/search/processors.cr
|
||||
+++ b/src/invidious/search/processors.cr
|
||||
@@ -45,18 +45,18 @@ module Invidious::Search
|
||||
|
||||
# Search inside of user subscriptions
|
||||
def subscriptions(query : Query, user : Invidious::User) : Array(ChannelVideo)
|
||||
- view_name = "subscriptions_#{sha256(user.email)}"
|
||||
-
|
||||
return PG_DB.query_all("
|
||||
SELECT id,title,published,updated,ucid,author,length_seconds
|
||||
FROM (
|
||||
- SELECT *,
|
||||
- to_tsvector(#{view_name}.title) ||
|
||||
- to_tsvector(#{view_name}.author)
|
||||
- as document
|
||||
- FROM #{view_name}
|
||||
- ) v_search WHERE v_search.document @@ plainto_tsquery($1) LIMIT 20 OFFSET $2;",
|
||||
- query.text, (query.page - 1) * 20,
|
||||
+ SELECT cv.*,
|
||||
+ to_tsvector(cv.title) ||
|
||||
+ to_tsvector(cv.author) AS document
|
||||
+ FROM channel_videos cv
|
||||
+ JOIN users ON cv.ucid = any(users.subscriptions)
|
||||
+ WHERE users.email = $1 AND published > now() - interval '1 month'
|
||||
+ ORDER BY published
|
||||
+ ) v_search WHERE v_search.document @@ plainto_tsquery($2) LIMIT 20 OFFSET $3;",
|
||||
+ user.email, query.text, (query.page - 1) * 20,
|
||||
as: ChannelVideo
|
||||
)
|
||||
end
|
||||
diff --git a/src/invidious/users.cr b/src/invidious/users.cr
|
||||
index b763596bc..6f82ead33 100644
|
||||
--- a/src/invidious/users.cr
|
||||
+++ b/src/invidious/users.cr
|
||||
@@ -12,24 +12,12 @@ def get_user(sid, headers, refresh = true)
|
||||
|
||||
Invidious::Database::Users.insert(user, update_on_conflict: true)
|
||||
Invidious::Database::SessionIDs.insert(sid, user.email, handle_conflicts: true)
|
||||
-
|
||||
- begin
|
||||
- view_name = "subscriptions_#{sha256(user.email)}"
|
||||
- PG_DB.exec("CREATE MATERIALIZED VIEW #{view_name} AS #{MATERIALIZED_VIEW_SQL.call(user.email)}")
|
||||
- rescue ex
|
||||
- end
|
||||
end
|
||||
else
|
||||
user, sid = fetch_user(sid, headers)
|
||||
|
||||
Invidious::Database::Users.insert(user, update_on_conflict: true)
|
||||
Invidious::Database::SessionIDs.insert(sid, user.email, handle_conflicts: true)
|
||||
-
|
||||
- begin
|
||||
- view_name = "subscriptions_#{sha256(user.email)}"
|
||||
- PG_DB.exec("CREATE MATERIALIZED VIEW #{view_name} AS #{MATERIALIZED_VIEW_SQL.call(user.email)}")
|
||||
- rescue ex
|
||||
- end
|
||||
end
|
||||
|
||||
return user, sid
|
||||
@@ -128,7 +116,6 @@ def get_subscription_feed(user, max_results = 40, page = 1)
|
||||
offset = (page - 1) * limit
|
||||
|
||||
notifications = Invidious::Database::Users.select_notifications(user)
|
||||
- view_name = "subscriptions_#{sha256(user.email)}"
|
||||
|
||||
if user.preferences.notifications_only && !notifications.empty?
|
||||
# Only show notifications
|
||||
@@ -154,33 +141,39 @@ def get_subscription_feed(user, max_results = 40, page = 1)
|
||||
# Show latest video from a channel that a user hasn't watched
|
||||
# "unseen_only" isn't really correct here, more accurate would be "unwatched_only"
|
||||
|
||||
- if user.watched.empty?
|
||||
- values = "'{}'"
|
||||
- else
|
||||
- values = "VALUES #{user.watched.map { |id| %(('#{id}')) }.join(",")}"
|
||||
- end
|
||||
- videos = PG_DB.query_all("SELECT DISTINCT ON (ucid) * FROM #{view_name} WHERE NOT id = ANY (#{values}) ORDER BY ucid, published DESC", as: ChannelVideo)
|
||||
+ # "SELECT cv.* FROM channel_videos cv JOIN users ON cv.ucid = any(users.subscriptions) WHERE users.email = $1 AND published > now() - interval '1 month' ORDER BY published DESC"
|
||||
+ # "SELECT DISTINCT ON (cv.ucid) cv.* FROM channel_videos cv JOIN users ON cv.ucid = any(users.subscriptions) WHERE users.email = ? AND NOT cv.id = any(users.watched) AND published > now() - interval '1 month' ORDER BY ucid, published DESC"
|
||||
+ videos = PG_DB.query_all("SELECT DISTINCT ON (cv.ucid) cv.* " \
|
||||
+ "FROM channel_videos cv " \
|
||||
+ "JOIN users ON cv.ucid = any(users.subscriptions) " \
|
||||
+ "WHERE users.email = $1 AND NOT cv.id = any(users.watched) AND published > now() - interval '1 month' " \
|
||||
+ "ORDER BY ucid, published DESC", user.email, as: ChannelVideo)
|
||||
else
|
||||
# Show latest video from each channel
|
||||
|
||||
- videos = PG_DB.query_all("SELECT DISTINCT ON (ucid) * FROM #{view_name} ORDER BY ucid, published DESC", as: ChannelVideo)
|
||||
+ videos = PG_DB.query_all("SELECT DISTINCT ON (cv.ucid) cv.* " \
|
||||
+ "FROM channel_videos cv " \
|
||||
+ "JOIN users ON cv.ucid = any(users.subscriptions) " \
|
||||
+ "WHERE users.email = $1 AND published > now() - interval '1 month' " \
|
||||
+ "ORDER BY ucid, published DESC", user.email, as: ChannelVideo)
|
||||
end
|
||||
|
||||
videos.sort_by!(&.published).reverse!
|
||||
else
|
||||
if user.preferences.unseen_only
|
||||
# Only show unwatched
|
||||
-
|
||||
- if user.watched.empty?
|
||||
- values = "'{}'"
|
||||
- else
|
||||
- values = "VALUES #{user.watched.map { |id| %(('#{id}')) }.join(",")}"
|
||||
- end
|
||||
- videos = PG_DB.query_all("SELECT * FROM #{view_name} WHERE NOT id = ANY (#{values}) ORDER BY published DESC LIMIT $1 OFFSET $2", limit, offset, as: ChannelVideo)
|
||||
+ videos = PG_DB.query_all("SELECT cv.* " \
|
||||
+ "FROM channel_videos cv " \
|
||||
+ "JOIN users ON cv.ucid = any(users.subscriptions) " \
|
||||
+ "WHERE users.email = $1 AND NOT cv.id = any(users.watched) AND published > now() - interval '1 month' " \
|
||||
+ "ORDER BY published DESC LIMIT $2 OFFSET $3", user.email, limit, offset, as: ChannelVideo)
|
||||
else
|
||||
# Sort subscriptions as normal
|
||||
-
|
||||
- videos = PG_DB.query_all("SELECT * FROM #{view_name} ORDER BY published DESC LIMIT $1 OFFSET $2", limit, offset, as: ChannelVideo)
|
||||
+ videos = PG_DB.query_all("SELECT cv.* " \
|
||||
+ "FROM channel_videos cv " \
|
||||
+ "JOIN users ON cv.ucid = any(users.subscriptions) " \
|
||||
+ "WHERE users.email = $1 AND published > now() - interval '1 month' " \
|
||||
+ "ORDER BY published DESC LIMIT $2 OFFSET $3", user.email, limit, offset, as: ChannelVideo)
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
From 78773d732672d8985795fb040a39dd7e946c7b7c Mon Sep 17 00:00:00 2001
|
||||
From: Emilien Devos <contact@emiliendevos.be>
|
||||
Date: Sat, 22 May 2021 17:42:23 +0200
|
||||
Subject: [PATCH] add the ability to listen on unix sockets
|
||||
|
||||
---
|
||||
src/invidious.cr | 15 ++++++++++++---
|
||||
src/invidious/helpers/helpers.cr | 1 +
|
||||
2 files changed, 13 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/invidious.cr b/src/invidious.cr
|
||||
index ae20e13e5..65b1091bb 100644
|
||||
--- a/src/invidious.cr
|
||||
+++ b/src/invidious.cr
|
||||
@@ -3917,6 +3917,15 @@ add_context_storage_type(Preferences)
|
||||
add_context_storage_type(User)
|
||||
|
||||
Kemal.config.logger = LOGGER
|
||||
-Kemal.config.host_binding = Kemal.config.host_binding != "0.0.0.0" ? Kemal.config.host_binding : CONFIG.host_binding
|
||||
-Kemal.config.port = Kemal.config.port != 3000 ? Kemal.config.port : CONFIG.port
|
||||
-Kemal.run
|
||||
+
|
||||
+Kemal.run do |config|
|
||||
+ if CONFIG.bind_unix
|
||||
+ if File.exists?(CONFIG.bind_unix.not_nil!)
|
||||
+ File.delete(CONFIG.bind_unix.not_nil!)
|
||||
+ end
|
||||
+ config.server.not_nil!.bind_unix CONFIG.bind_unix.not_nil!
|
||||
+ else
|
||||
+ config.host_binding = config.host_binding != "0.0.0.0" ? config.host_binding : CONFIG.host_binding
|
||||
+ config.port = config.port != 3000 ? config.port : CONFIG.port
|
||||
+ end
|
||||
+end
|
||||
diff --git a/src/invidious/helpers/helpers.cr b/src/invidious/helpers/helpers.cr
|
||||
index e1d877b78..6a5789a0e 100644
|
||||
--- a/src/invidious/helpers/helpers.cr
|
||||
+++ b/src/invidious/helpers/helpers.cr
|
||||
@@ -98,6 +98,7 @@ class Config
|
||||
property force_resolve : Socket::Family = Socket::Family::UNSPEC # Connect to YouTube over 'ipv6', 'ipv4'. Will sometimes resolve fix issues with rate-limiting (see https://github.com/ytdl-org/youtube-dl/issues/21729)
|
||||
property port : Int32 = 3000 # Port to listen for connections (overrided by command line argument)
|
||||
property host_binding : String = "0.0.0.0" # Host to bind (overrided by command line argument)
|
||||
+ property bind_unix : String? = nil # Make Invidious listening on UNIX sockets - Example: /tmp/invidious.sock
|
||||
property pool_size : Int32 = 100 # Pool size for HTTP requests to youtube.com and ytimg.com (each domain has a separate pool of `pool_size`)
|
||||
property use_quic : Bool = true # Use quic transport for youtube api
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
From cdf9dc079fe4a3835205525a01750e803d85a5cd Mon Sep 17 00:00:00 2001
|
||||
From: Emilien Devos <github@emiliendevos.be>
|
||||
Date: Thu, 14 Apr 2022 09:49:52 +0000
|
||||
Subject: [PATCH 1/1] more csp
|
||||
|
||||
---
|
||||
src/invidious.cr | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/invidious.cr b/src/invidious.cr
|
||||
index 9f3d5d10..a7b2e240 100644
|
||||
--- a/src/invidious.cr
|
||||
+++ b/src/invidious.cr
|
||||
@@ -195,9 +195,9 @@ before_all do |env|
|
||||
# Allow media resources to be loaded from google servers
|
||||
# TODO: check if *.youtube.com can be removed
|
||||
if CONFIG.disabled?("local") || !preferences.local
|
||||
- extra_media_csp = " https://*.googlevideo.com:443 https://*.youtube.com:443"
|
||||
+ extra_media_csp = " https://*.googlevideo.com:443 https://*.youtube.com:443 https://*.proxy.yewtu.be:443"
|
||||
else
|
||||
- extra_media_csp = ""
|
||||
+ extra_media_csp = " https://*.proxy.yewtu.be:443"
|
||||
end
|
||||
|
||||
# Only allow the pages at /embed/* to be embedded
|
||||
@@ -215,7 +215,7 @@ before_all do |env|
|
||||
"style-src 'self' 'unsafe-inline'",
|
||||
"img-src 'self' data:",
|
||||
"font-src 'self' data:",
|
||||
- "connect-src 'self'",
|
||||
+ "connect-src 'self' https://*.proxy.yewtu.be:443",
|
||||
"manifest-src 'self'",
|
||||
"media-src 'self' blob:" + extra_media_csp,
|
||||
"child-src 'self' blob:",
|
||||
--
|
||||
2.33.0
|
|
@ -0,0 +1,99 @@
|
|||
From 12a044aae4ad517fce6367eb56a1b42fffaa4153 Mon Sep 17 00:00:00 2001
|
||||
From: Emilien Devos <contact@emiliendevos.be>
|
||||
Date: Thu, 12 Aug 2021 23:16:22 +0200
|
||||
Subject: [PATCH] donate page
|
||||
|
||||
---
|
||||
src/invidious.cr | 1 +
|
||||
src/invidious/routes/misc.cr | 5 +++
|
||||
src/invidious/views/components/feed_menu.ecr | 3 ++
|
||||
src/invidious/views/donate.ecr | 35 ++++++++++++++++++++
|
||||
4 files changed, 44 insertions(+)
|
||||
create mode 100644 src/invidious/views/donate.ecr
|
||||
|
||||
diff --git a/src/invidious.cr b/src/invidious.cr
|
||||
index ba8f8484..60ba7688 100644
|
||||
--- a/src/invidious.cr
|
||||
+++ b/src/invidious.cr
|
||||
@@ -304,6 +304,7 @@ end
|
||||
|
||||
{% unless flag?(:api_only) %}
|
||||
Invidious::Routing.get "/", Invidious::Routes::Misc, :home
|
||||
+ Invidious::Routing.get "/donate", Invidious::Routes::Misc, :donate
|
||||
Invidious::Routing.get "/privacy", Invidious::Routes::Misc, :privacy
|
||||
Invidious::Routing.get "/licenses", Invidious::Routes::Misc, :licenses
|
||||
|
||||
diff --git a/src/invidious/routes/misc.cr b/src/invidious/routes/misc.cr
|
||||
index d6bd9571..81fb9a98 100644
|
||||
--- a/src/invidious/routes/misc.cr
|
||||
+++ b/src/invidious/routes/misc.cr
|
||||
@@ -33,6 +33,11 @@ module Invidious::Routes::Misc
|
||||
templated "privacy"
|
||||
end
|
||||
|
||||
+ def self.donate(env)
|
||||
+ locale = env.get("preferences").as(Preferences).locale
|
||||
+ templated "donate"
|
||||
+ end
|
||||
+
|
||||
def self.licenses(env)
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
rendered "licenses"
|
||||
diff --git a/src/invidious/views/components/feed_menu.ecr b/src/invidious/views/components/feed_menu.ecr
|
||||
index 3dbeaf37..d84d03d0 100644
|
||||
--- a/src/invidious/views/components/feed_menu.ecr
|
||||
+++ b/src/invidious/views/components/feed_menu.ecr
|
||||
@@ -1,4 +1,7 @@
|
||||
<div class="feed-menu">
|
||||
+ <a href="/donate" class="feed-menu-item pure-menu-heading">
|
||||
+ Donate
|
||||
+ </a>
|
||||
<% feed_menu = env.get("preferences").as(Preferences).feed_menu.dup %>
|
||||
<% if !env.get?("user") %>
|
||||
<% feed_menu.reject! {|item| {"Subscriptions", "Playlists"}.includes? item} %>
|
||||
diff --git a/src/invidious/views/donate.ecr b/src/invidious/views/donate.ecr
|
||||
new file mode 100644
|
||||
index 00000000..1264f50a
|
||||
--- /dev/null
|
||||
+++ b/src/invidious/views/donate.ecr
|
||||
@@ -0,0 +1,36 @@
|
||||
+<% content_for "header" do %>
|
||||
+<title>Donate - Invidious</title>
|
||||
+<% end %>
|
||||
+
|
||||
+<div class="h-box">
|
||||
+ <h2>Donate to YewTube</h2>
|
||||
+ <h3>Why donating?</h3>
|
||||
+ <p>Every day YewTube handle 40 million requests and 2TB (2000GB) of bandwidth. All this traffic has a cost.</p>
|
||||
+ <p>By donating, you are helping me cover the costs and also improve the user experience because I'll be able to rent more powerful servers.</p>
|
||||
+ <p>I truly thank you if you consider donating to YewTube.</p>
|
||||
+ <h3>Payment methods</h3>
|
||||
+ <h4>Credit/debit card and bank transfer</h4>
|
||||
+ <ul>
|
||||
+ <li>Liberapay (recurrent donation): <a href="https://liberapay.com/yewtube/">https://liberapay.com/yewtube/</a></li>
|
||||
+ <li>Buy Me a Coffee (one time donation): <a href="https://www.buymeacoffee.com/yewtube">https://www.buymeacoffee.com/yewtube</a></li>
|
||||
+ </ul>
|
||||
+ <h4>Cryptocurrency</h4>
|
||||
+ <ul>
|
||||
+ <li>Bitcoin: <a href="bitcoin:1fyoJKdFo5cDPt21CGHW2RDQtcktQU9cL">1fyoJKdFo5cDPt21CGHW2RDQtcktQU9cL</a> (Segwit compatible)</li>
|
||||
+ <li>Bitcoin cash: <a href="bitcoincash:qz6qvjt9m4wqrqhyet3v3gljrpnys3wl2yxz0jfuu2">qz6qvjt9m4wqrqhyet3v3gljrpnys3wl2yxz0jfuu2</a></li>
|
||||
+ <li>Ethereum: <a href="ethereum:0x52B72e00be486C03C9b09AA0D441ADE1EfA5d2CB">0x52B72e00be486C03C9b09AA0D441ADE1EfA5d2CB</a> (you can send any ERC20 token)</li>
|
||||
+ <li>Monero: <a href="monero:82VziQe69ynRNKZ2Bk7XcoYUA6Q1eRuPyGxV3gVWDju7EPkUXZE2oGTGWiah51cCKRMAmwTY11D6qcH3NpGtfdjcNccmXL5">82VziQe69ynRNKZ2Bk7XcoYUA6Q1eRuPyGxV3gVWDju7EPkUXZE2oGTGWiah51cCKRMAmwTY11D6qcH3NpGtfdjcNccmXL5</a></li>
|
||||
+ <li>Nano: <a href="nano:nano_3hrphgbgi4px1gfiftsphokukcj1tkk168it6xeetxpc9c7jt5e6i7kmjupi">nano_3hrphgbgi4px1gfiftsphokukcj1tkk168it6xeetxpc9c7jt5e6i7kmjupi</a></li>
|
||||
+ <li>Stellar: <a href="stellar:GB5LHWSIOM6BRO7CMWRMWVWJUGPCKVRAVINGUJHA7PYP3CHES2XCMDG5">GB5LHWSIOM6BRO7CMWRMWVWJUGPCKVRAVINGUJHA7PYP3CHES2XCMDG5</a></li>
|
||||
+ <li>Dogecoin: <a href="dogecoin:D6dsXSZEp1rkqvLAV41QxXTPPgvDSU2rjo">D6dsXSZEp1rkqvLAV41QxXTPPgvDSU2rjo</a></li>
|
||||
+ <li>Dash: <a href="dash:XmWHgigKxxNuCiiYfE5ZY6EoRDBwmfUJA5">XmWHgigKxxNuCiiYfE5ZY6EoRDBwmfUJA5</a></li>
|
||||
+ <li>Decred: <a href="dcr:DsY4tZLcikXjJwdLBFr2pYWgGPatY9y81cZ">DsY4tZLcikXjJwdLBFr2pYWgGPatY9y81cZ</a></li>
|
||||
+ <li>Ripple: <a href="ripple:rwM9qRsciVWdvAfPjgJHFV4hpP6HtdCVi">rwM9qRsciVWdvAfPjgJHFV4hpP6HtdCVi</a></li>
|
||||
+ <li>Binance coin: <a href="bnb:bnb10vd22k3ujp9ezjc6s8x7vqvuh02hlvcwqtsepq">bnb10vd22k3ujp9ezjc6s8x7vqvuh02hlvcwqtsepq</a> (you can send any BEP20 token)</li>
|
||||
+ <li>Litecoin: <a href="litecoin:ltc1qre3xwwjsnctpfrx6eu0y77nca3cwlhe8kzy27d">ltc1qre3xwwjsnctpfrx6eu0y77nca3cwlhe8kzy27d</a></li>
|
||||
+ <li>USD Coin: <a href="usdcoin:0xd415a7A9455DBf1a666F933c78A7325914E73C6b">0xd415a7A9455DBf1a666F933c78A7325914E73C6b</a> (ETH) - <a href="usdcoin:bnb10vd22k3ujp9ezjc6s8x7vqvuh02hlvcwqtsepq">bnb10vd22k3ujp9ezjc6s8x7vqvuh02hlvcwqtsepq</a> (BNB)</li>
|
||||
+ <li>Wownero: <a href="wownero:Wo55BYoJFbucoaxybV3PJRKcCLXWhkWTm1p1a6k7Jfbt7f3xA6caGgNWwxjQhejcBZ4XH8Q6XiQhZDncT2DVeaEW2THSonTJH">Wo55BYoJFbucoaxybV3PJRKcCLXWhkWTm1p1a6k7Jfbt7f3xA6caGgNWwxjQhejcBZ4XH8Q6XiQhZDncT2DVeaEW2THSonTJH</a></li>
|
||||
+ </ul>
|
||||
+ <h4>Is your prefered payment method not listed?</h4>
|
||||
+ <p>Feel ask me by email at <code>donate[at]yewtu.be</code> to add it.</p>
|
||||
+</div>
|
||||
\ No newline at end of file
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
From 9139da5a877cabba7df2035b3c06f675816a3aff Mon Sep 17 00:00:00 2001
|
||||
From: Emilien Devos <github@emiliendevos.be>
|
||||
Date: Fri, 22 Apr 2022 22:45:54 +0200
|
||||
Subject: [PATCH 1/1] decrease buffer seconds for saving bandwidth
|
||||
|
||||
---
|
||||
assets/js/player.js | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/assets/js/player.js b/assets/js/player.js
|
||||
index f5bec651..bd4deb0d 100644
|
||||
--- a/assets/js/player.js
|
||||
+++ b/assets/js/player.js
|
||||
@@ -47,6 +47,9 @@ videojs.Vhs.xhr.beforeRequest = function(options) {
|
||||
return options;
|
||||
};
|
||||
|
||||
+videojs.Vhs.GOAL_BUFFER_LENGTH = 20;
|
||||
+videojs.Vhs.MAX_GOAL_BUFFER_LENGTH = 30;
|
||||
+
|
||||
var player = videojs('player', options);
|
||||
|
||||
player.on('error', () => {
|
||||
--
|
||||
2.32.0 (Apple Git-132)
|
読み込み中…
新しいイシューから参照