summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--assets/css/default.css4
-rw-r--r--locales/tr.json31
-rw-r--r--src/invidious.cr7
-rw-r--r--src/invidious/channels.cr8
-rw-r--r--src/invidious/helpers/handlers.cr41
-rw-r--r--src/invidious/helpers/helpers.cr2
-rw-r--r--src/invidious/users.cr6
-rw-r--r--src/invidious/videos.cr4
8 files changed, 34 insertions, 69 deletions
diff --git a/assets/css/default.css b/assets/css/default.css
index 4daa9f16..f9d52281 100644
--- a/assets/css/default.css
+++ b/assets/css/default.css
@@ -282,10 +282,10 @@ input[type="search"]::-webkit-search-cancel-button {
}
/* Control Bar */
-@media screen and (max-width: 480px) {
+@media screen and (max-width: 640px) {
.video-js .vjs-control-bar,
.vjs-menu-button-popup .vjs-menu .vjs-menu-content {
- overflow: -webkit-paged-x;
+ overflow-x: scroll;
}
}
diff --git a/locales/tr.json b/locales/tr.json
index 10634ec6..c47170b9 100644
--- a/locales/tr.json
+++ b/locales/tr.json
@@ -1,7 +1,5 @@
{
- "`x` subscribers.([^0-9]|^)1([^,0-9]|$)": "`x` abone.([^0-9]|^)1([^,0-9]|$)",
"`x` subscribers.": "`x` abone.",
- "`x` videos.([^0-9]|^)1([^,0-9]|$)": "`x` video.([^0-9]|^)1([^,0-9]|$)",
"`x` videos.": "`x` video.",
"LIVE": "CANLI",
"Shared `x` ago": "`x` önce paylaşıldı",
@@ -114,15 +112,12 @@
"Subscription manager": "Abonelik yöneticisi",
"Token manager": "Jeton yöneticisi",
"Token": "Jeton",
- "`x` subscriptions.([^0-9]|^)1([^,0-9]|$)": "`x` abonelik.([^0-9]|^)1([^,0-9]|$)",
"`x` subscriptions.": "`x` abonelik.",
- "`x` tokens.([^0-9]|^)1([^,0-9]|$)": "`x` jeton.([^0-9]|^)1([^,0-9]|$)",
"`x` tokens.": "`x` jeton.",
"Import/export": "İçe/dışa aktar",
"unsubscribe": "abonelikten çık",
"revoke": "geri al",
"Subscriptions": "Abonelikler",
- "`x` unseen notifications.([^0-9]|^)1([^,0-9]|$)": "`x` okunmamış bildirim.([^0-9]|^)1([^,0-9]|$)",
"`x` unseen notifications.": "`x` okunmamış bildirim.",
"search": "ara",
"Log out": "Çıkış yap",
@@ -143,7 +138,6 @@
"Whitelisted regions: ": "Beyaz listeye alınan bölgeler: ",
"Blacklisted regions: ": "Kara listeye alınan bölgeler: ",
"Shared `x`": "`x` paylaşıldı",
- "`x` views.([^0-9]|^)1([^,0-9]|$)": "`x` izlenme.([^0-9]|^)1([^,0-9]|$)",
"`x` views.": "`x` izlenme.",
"Premieres in `x`": "`x`içinde ilk gösterim",
"Premieres `x`": "`x` ilk gösterim",
@@ -175,11 +169,9 @@
"This channel does not exist.": "Bu kanal mevcut değil.",
"Could not get channel info.": "Kanal bilgisi alınamadı.",
"Could not fetch comments": "Yorumlar alınamadı",
- "View `x` replies.([^0-9]|^)1([^,0-9]|$)": "`x` yanıtı görüntüle.([^0-9]|^)1([^,0-9]|$)",
"View `x` replies.": "`x` yanıtı görüntüle.",
"`x` ago": "`x` önce",
"Load more": "Daha fazla yükle",
- "`x` points.([^0-9]|^)1([^,0-9]|$)": "`x` puan.([^0-9]|^)1([^,0-9]|$)",
"`x` points.": "`x` puan.",
"Could not create mix.": "Mix oluşturulamadı.",
"Empty playlist": "Boş oynatma listesi",
@@ -298,20 +290,13 @@
"Yiddish": "Yiddiş",
"Yoruba": "Yoruba dili",
"Zulu": "Zuluca",
- "`x` years.([^0-9]|^)1([^,0-9]|$)": "`x` yıl.([^0-9]|^)1([^,0-9]|$)",
- "`x` years.": "`x` yıl.",
- "`x` months.([^0-9]|^)1([^,0-9]|$)": "`x` ay.([^0-9]|^)1([^,0-9]|$)",
- "`x` months.": "`x` ay.",
- "`x` weeks.([^0-9]|^)1([^,0-9]|$)": "`x` hafta.([^0-9]|^)1([^,0-9]|$)",
- "`x` weeks.": "`x` hafta.",
- "`x` days.([^0-9]|^)1([^,0-9]|$)": "`x` gün.([^0-9]|^)1([^,0-9]|$)",
- "`x` days.": "`x` gün.",
- "`x` hours.([^0-9]|^)1([^,0-9]|$)": "`x` saat.([^0-9]|^)1([^,0-9]|$)",
- "`x` hours.": "`x` saat.",
- "`x` minutes.([^0-9]|^)1([^,0-9]|$)": "`x` dakika.([^0-9]|^)1([^,0-9]|$)",
- "`x` minutes.": "`x` dakika.",
- "`x` seconds.([^0-9]|^)1([^,0-9]|$)": "`x` saniye.([^0-9]|^)1([^,0-9]|$)",
- "`x` seconds.": "`x` saniye.",
+ "`x` years": "`x` yıl",
+ "`x` months": "`x` ay",
+ "`x` weeks": "`x` hafta",
+ "`x` days": "`x` gün",
+ "`x` hours": "`x` saat",
+ "`x` minutes": "`x` dakika",
+ "`x` seconds": "`x` saniye",
"Fallback comments: ": "Yedek yorumlar: ",
"Popular": "Popüler",
"Top": "Enler",
@@ -337,4 +322,4 @@
"Playlists": "Oynatma listeleri",
"Community": "Topluluk",
"Current version: ": "Şu anki versiyon: "
-}
+} \ No newline at end of file
diff --git a/src/invidious.cr b/src/invidious.cr
index 167050fd..20a84625 100644
--- a/src/invidious.cr
+++ b/src/invidious.cr
@@ -85,6 +85,7 @@ LOCALES = {
"nl" => load_locale("nl"),
"pl" => load_locale("pl"),
"ru" => load_locale("ru"),
+ "tr" => load_locale("tr"),
"uk" => load_locale("uk"),
"zh-CN" => load_locale("zh-CN"),
}
@@ -1395,7 +1396,7 @@ post "/login" do |env|
user_array[4] = user_array[4].to_json
args = arg_array(user_array)
- PG_DB.exec("INSERT INTO users VALUES (#{args})", user_array)
+ PG_DB.exec("INSERT INTO users VALUES (#{args})", args: user_array)
PG_DB.exec("INSERT INTO session_ids VALUES ($1, $2, $3)", sid, email, Time.utc)
view_name = "subscriptions_#{sha256(user.email)}"
@@ -2907,7 +2908,7 @@ post "/feed/webhook/:token" do |env|
PG_DB.exec("INSERT INTO channel_videos VALUES (#{args}) \
ON CONFLICT (id) DO UPDATE SET title = $2, published = $3, \
updated = $4, ucid = $5, author = $6, length_seconds = $7, \
- live_now = $8, premiere_timestamp = $9, views = $10", video_array)
+ live_now = $8, premiere_timestamp = $9, views = $10", args: video_array)
# Update all users affected by insert
if emails.empty?
@@ -5323,4 +5324,6 @@ 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
diff --git a/src/invidious/channels.cr b/src/invidious/channels.cr
index 7b7d3724..fa05dce4 100644
--- a/src/invidious/channels.cr
+++ b/src/invidious/channels.cr
@@ -179,14 +179,14 @@ def get_channel(id, db, refresh = true, pull_all_videos = true)
args = arg_array(channel_array)
db.exec("INSERT INTO channels VALUES (#{args}) \
- ON CONFLICT (id) DO UPDATE SET author = $2, updated = $3", channel_array)
+ ON CONFLICT (id) DO UPDATE SET author = $2, updated = $3", args: channel_array)
end
else
channel = fetch_channel(id, db, pull_all_videos: pull_all_videos)
channel_array = channel.to_a
args = arg_array(channel_array)
- db.exec("INSERT INTO channels VALUES (#{args})", channel_array)
+ db.exec("INSERT INTO channels VALUES (#{args})", args: channel_array)
end
return channel
@@ -275,7 +275,7 @@ def fetch_channel(ucid, db, pull_all_videos = true, locale = nil)
db.exec("INSERT INTO channel_videos VALUES (#{args}) \
ON CONFLICT (id) DO UPDATE SET title = $2, published = $3, \
updated = $4, ucid = $5, author = $6, length_seconds = $7, \
- live_now = $8, views = $10", video_array)
+ live_now = $8, views = $10", args: video_array)
# Update all users affected by insert
if emails.empty?
@@ -343,7 +343,7 @@ def fetch_channel(ucid, db, pull_all_videos = true, locale = nil)
db.exec("INSERT INTO channel_videos VALUES (#{args}) \
ON CONFLICT (id) DO UPDATE SET title = $2, published = $3, \
updated = $4, ucid = $5, author = $6, length_seconds = $7, \
- live_now = $8, views = $10", video_array)
+ live_now = $8, views = $10", args: video_array)
# Update all users affected by insert
if emails.empty?
diff --git a/src/invidious/helpers/handlers.cr b/src/invidious/helpers/handlers.cr
index c8d4da4c..949eb335 100644
--- a/src/invidious/helpers/handlers.cr
+++ b/src/invidious/helpers/handlers.cr
@@ -238,40 +238,15 @@ class HTTP::Client
end
end
-# https://github.com/will/crystal-pg/pull/171
-class PG::Statement < ::DB::Statement
- protected def perform_query(args : Enumerable) : ResultSet
- params = args.map { |arg| PQ::Param.encode(arg) }
- conn = self.conn
- conn.send_parse_message(@sql)
- conn.send_bind_message params
- conn.send_describe_portal_message
- conn.send_execute_message
- conn.send_sync_message
- conn.expect_frame PQ::Frame::ParseComplete
- conn.expect_frame PQ::Frame::BindComplete
- frame = conn.read
- case frame
- when PQ::Frame::RowDescription
- fields = frame.fields
- when PQ::Frame::NoData
- fields = nil
+struct Crystal::ThreadLocalValue(T)
+ @values = Hash(Thread, T).new
+
+ def get(&block : -> T)
+ th = Thread.current
+ if !@values[th]?
+ @values[th] = yield
else
- raise "expected RowDescription or NoData, got #{frame}"
+ @values[th]
end
- ResultSet.new(self, fields)
- rescue IO::Error
- raise DB::ConnectionLost.new(connection)
- end
-
- protected def perform_exec(args : Enumerable) : ::DB::ExecResult
- result = perform_query(args)
- result.each { }
- ::DB::ExecResult.new(
- rows_affected: result.rows_affected,
- last_insert_id: 0_i64 # postgres doesn't support this
- )
- rescue IO::Error
- raise DB::ConnectionLost.new(connection)
end
end
diff --git a/src/invidious/helpers/helpers.cr b/src/invidious/helpers/helpers.cr
index 0ec117c1..615e62df 100644
--- a/src/invidious/helpers/helpers.cr
+++ b/src/invidious/helpers/helpers.cr
@@ -235,6 +235,8 @@ struct Config
hsts: {type: Bool?, default: true}, # Enables 'Strict-Transport-Security'. Ensure that `domain` and all subdomains are served securely
disable_proxy: {type: Bool? | Array(String)?, default: false}, # Disable proxying server-wide: options: 'dash', 'livestreams', 'downloads', 'local'
force_resolve: {type: Socket::Family, default: Socket::Family::UNSPEC, converter: FamilyConverter}, # Connect to YouTube over 'ipv6', 'ipv4'. Will sometimes resolve fix issues with rate-limiting (see https://github.com/ytdl-org/youtube-dl/issues/21729)
+ port: {type: Int32, default: 3000}, # Port to listen for connections (overrided by command line argument)
+ host_binding: {type: String, default: "0.0.0.0"}, # Host to bind (overrided by command line argument)
})
end
diff --git a/src/invidious/users.cr b/src/invidious/users.cr
index d3da28d7..6149ae7a 100644
--- a/src/invidious/users.cr
+++ b/src/invidious/users.cr
@@ -107,7 +107,7 @@ def get_user(sid, headers, db, refresh = true)
args = arg_array(user_array)
db.exec("INSERT INTO users VALUES (#{args}) \
- ON CONFLICT (email) DO UPDATE SET updated = $1, subscriptions = $3", user_array)
+ ON CONFLICT (email) DO UPDATE SET updated = $1, subscriptions = $3", args: user_array)
db.exec("INSERT INTO session_ids VALUES ($1,$2,$3) \
ON CONFLICT (id) DO NOTHING", sid, user.email, Time.utc)
@@ -126,7 +126,7 @@ def get_user(sid, headers, db, refresh = true)
args = arg_array(user.to_a)
db.exec("INSERT INTO users VALUES (#{args}) \
- ON CONFLICT (email) DO UPDATE SET updated = $1, subscriptions = $3", user_array)
+ ON CONFLICT (email) DO UPDATE SET updated = $1, subscriptions = $3", args: user_array)
db.exec("INSERT INTO session_ids VALUES ($1,$2,$3) \
ON CONFLICT (id) DO NOTHING", sid, user.email, Time.utc)
@@ -295,7 +295,7 @@ def get_subscription_feed(db, user, max_results = 40, page = 1)
args = arg_array(notifications)
- notifications = db.query_all("SELECT * FROM channel_videos WHERE id IN (#{args}) ORDER BY published DESC", notifications, as: ChannelVideo)
+ notifications = db.query_all("SELECT * FROM channel_videos WHERE id IN (#{args}) ORDER BY published DESC", args: notifications, as: ChannelVideo)
videos = [] of ChannelVideo
notifications.sort_by! { |video| video.published }.reverse!
diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr
index 424d1e50..e175ae39 100644
--- a/src/invidious/videos.cr
+++ b/src/invidious/videos.cr
@@ -900,7 +900,7 @@ def get_video(id, db, refresh = true, region = nil, force_refresh = false)
db.exec("UPDATE videos SET (info,updated,title,views,likes,dislikes,wilson_score,\
published,description,language,author,ucid,allowed_regions,is_family_friendly,\
genre,genre_url,license,sub_count_text,author_thumbnail)\
- = (#{args}) WHERE id = $1", video_array)
+ = (#{args}) WHERE id = $1", args: video_array)
rescue ex
db.exec("DELETE FROM videos * WHERE id = $1", id)
raise ex
@@ -913,7 +913,7 @@ def get_video(id, db, refresh = true, region = nil, force_refresh = false)
args = arg_array(video_array)
if !region
- db.exec("INSERT INTO videos VALUES (#{args}) ON CONFLICT (id) DO NOTHING", video_array)
+ db.exec("INSERT INTO videos VALUES (#{args}) ON CONFLICT (id) DO NOTHING", args: video_array)
end
end