This commit is contained in:
テクニカル諏訪子 2023-03-28 00:45:02 +09:00
parent 0242a5ee34
commit 4880e32be9
38 changed files with 56 additions and 182 deletions

View file

@ -359,103 +359,48 @@ span > select {
word-wrap: normal;
}
/*
* Light theme
*/
.dark-theme a:hover,
.dark-theme a:active,
.dark-theme summary:hover,
.light-theme a:hover,
.light-theme a:active,
.light-theme summary:hover {
color: #075A9E !important;
}
.light-theme a.pure-button-primary:hover {
color: #fff !important;
}
.light-theme a {
color: #335d7a;
text-decoration: none;
}
/* All links that do not fit with the default color goes here */
.light-theme a:not([data-id]) > .icon,
.light-theme .pure-u-lg-1-5 > .h-box > a[href^="/watch?"],
.light-theme .playlist-restricted > ol > li > a {
color: #303030;
}
.light-theme .pure-menu-heading {
color: #565d64;
}
@media (prefers-color-scheme: light) {
.no-theme a:hover,
.no-theme a:active,
.no-theme summary:hover {
color: #075A9E !important;
}
.no-theme a.pure-button-primary:hover {
color: #fff !important;
}
.no-theme a {
color: #335d7a;
text-decoration: none;
}
/* All links that do not fit with the default color goes here */
.no-theme a:not([data-id]) > .icon,
.no-theme .pure-u-lg-1-5 > .h-box > a[href^="/watch?"],
.no-theme .playlist-restricted > ol > li > a {
color: #303030;
}
.light-theme .pure-menu-heading {
color: #565d64;
}
}
/*
* Dark theme
*/
.dark-theme a:hover,
.dark-theme a:active,
.dark-theme summary:hover {
color: rgb(0, 182, 240);
}
.dark-theme a {
.dark-theme a, .light-theme a {
color: #a0a0a0;
text-decoration: none;
}
body.dark-theme {
body.dark-theme, body.light-theme {
background-color: rgba(35, 35, 35, 1);
color: #f0f0f0;
}
.dark-theme .pure-form legend {
.dark-theme .pure-form legend, .light-theme .pure-form legend {
color: #f0f0f0;
}
.dark-theme .pure-menu-heading {
.dark-theme .pure-menu-heading, .light-theme .pure-menu-heading {
color: #f0f0f0;
}
.dark-theme input,
.dark-theme select,
.dark-theme textarea {
.dark-theme textarea,
.light-theme input,
.light-theme select,
.light-theme textarea {
color: rgba(35, 35, 35, 1);
}
.dark-theme .pure-form input[type="file"] {
.dark-theme .pure-form input[type="file"],
.light-theme .pure-form input[type="file"] {
color: #f0f0f0;
}
.dark-theme .searchbar input {
.dark-theme .searchbar input, .searchbar input {
background-color: inherit;
color: inherit;
}

View file

@ -28,7 +28,7 @@ body {
.bgippan {
background-color: rgba(0,0,0,.4);
}
.dark-theme a {
.dark-theme a, .no-theme a, .light-theme a {
color: #e599e5 !important;
}
#player-container {

View file

@ -126,12 +126,10 @@ module Invidious::Routes::BeforeAll
end
end
dark_mode = convert_theme(env.params.query["dark_mode"]?) || preferences.dark_mode.to_s
thin_mode = env.params.query["thin_mode"]? || preferences.thin_mode.to_s
thin_mode = thin_mode == "true"
locale = env.params.query["hl"]? || preferences.locale
preferences.dark_mode = dark_mode
preferences.thin_mode = thin_mode
preferences.locale = locale
env.set "preferences", preferences

View file

@ -225,46 +225,6 @@ module Invidious::Routes::PreferencesRoute
env.redirect referer
end
def self.toggle_theme(env)
locale = env.get("preferences").as(Preferences).locale
referer = get_referer(env, unroll: false)
redirect = env.params.query["redirect"]?
redirect ||= "true"
redirect = redirect == "true"
if user = env.get? "user"
user = user.as(User)
case user.preferences.dark_mode
when "dark"
user.preferences.dark_mode = "light"
else
user.preferences.dark_mode = "dark"
end
Invidious::Database::Users.update_preferences(user)
else
preferences = env.get("preferences").as(Preferences)
case preferences.dark_mode
when "dark"
preferences.dark_mode = "light"
else
preferences.dark_mode = "dark"
end
env.response.cookies["PREFS"] = Invidious::User::Cookies.prefs(CONFIG.domain, preferences)
end
if redirect
env.redirect referer
else
env.response.content_type = "application/json"
"{}"
end
end
def self.data_control(env)
locale = env.get("preferences").as(Preferences).locale

View file

@ -62,7 +62,6 @@ module Invidious::Routing
# User preferences
get "/preferences", Routes::PreferencesRoute, :show
post "/preferences", Routes::PreferencesRoute, :update
get "/toggle_theme", Routes::PreferencesRoute, :toggle_theme
get "/data_control", Routes::PreferencesRoute, :data_control
post "/data_control", Routes::PreferencesRoute, :update_data_control

View file

@ -3,7 +3,7 @@ def convert_theme(theme)
when "true"
"dark"
when "false"
"light"
"dark"
when "", nil
nil
else

View file

@ -74,7 +74,7 @@ struct Preferences
if value.read_bool
"dark"
else
"light"
"dark"
end
end
end
@ -92,7 +92,7 @@ struct Preferences
when "true"
"dark"
when "false"
"light"
"dark"
when ""
CONFIG.default_user_preferences.dark_mode
else

View file

@ -1,5 +1,5 @@
<% content_for "header" do %>
<title><%= playlist.title %> - Invidious</title>
<title><%= playlist.title %> - オワコンYouTube</title>
<link rel="alternate" type="application/rss+xml" title="RSS" href="/feed/playlist/<%= plid %>" />
<% end %>

View file

@ -20,7 +20,7 @@
<% content_for "header" do %>
<%- if selected_tab.videos? -%>
<meta name="description" content="<%= channel.description %>">
<meta property="og:site_name" content="Invidious">
<meta property="og:site_name" content="オワコンYouTube">
<meta property="og:url" content="<%= HOST_URL %>/channel/<%= ucid %>">
<meta property="og:title" content="<%= author %>">
<meta property="og:image" content="/ggpht<%= channel_profile_pic %>">
@ -34,7 +34,7 @@
<%- end -%>
<link rel="alternate" href="<%= youtube_url %>">
<title><%= author %> - Invidious</title>
<title><%= author %> - オワコンYouTube</title>
<% end %>
<%= rendered "components/channel_info" %>

View file

@ -12,7 +12,7 @@
<% content_for "header" do %>
<link rel="alternate" href="<%= youtube_url %>">
<title><%= author %> - Invidious</title>
<title><%= author %> - オワコンYouTube</title>
<% end %>
<%= rendered "components/channel_info" %>

View file

@ -1,5 +1,5 @@
<% content_for "header" do %>
<title><%= translate(locale, "Create playlist") %> - Invidious</title>
<title><%= translate(locale, "Create playlist") %> - オワコンYouTube</title>
<% end %>
<div class="pure-g">

View file

@ -1,5 +1,5 @@
<% content_for "header" do %>
<title><%= translate(locale, "Delete playlist") %> - Invidious</title>
<title><%= translate(locale, "Delete playlist") %> - オワコンYouTube</title>
<% end %>
<div class="h-box">

View file

@ -1,7 +1,7 @@
<% title = HTML.escape(playlist.title) %>
<% content_for "header" do %>
<title><%= title %> - Invidious</title>
<title><%= title %> - オワコンYouTube</title>
<link rel="alternate" type="application/rss+xml" title="RSS" href="/feed/playlist/<%= plid %>" />
<% end %>

View file

@ -10,7 +10,7 @@
<script src="/videojs/videojs-overlay/videojs-overlay.js?v=<%= ASSET_COMMIT %>"></script>
<link rel="stylesheet" href="/css/default.css?v=<%= ASSET_COMMIT %>">
<link rel="stylesheet" href="/css/embed.css?v=<%= ASSET_COMMIT %>">
<title><%= HTML.escape(video.title) %> - Invidious</title>
<title><%= HTML.escape(video.title) %> - オワコンYouTube</title>
<script src="/js/_helpers.js?v=<%= ASSET_COMMIT %>"></script>
</head>

View file

@ -1,5 +1,5 @@
<% content_for "header" do %>
<title><%= "Error" %> - Invidious</title>
<title><%= "Error" %> - オワコンYouTube</title>
<% end %>
<div class="h-box">

View file

@ -1,5 +1,5 @@
<% content_for "header" do %>
<title><%= translate(locale, "History") %> - Invidious</title>
<title><%= translate(locale, "History") %> - オワコンYouTube</title>
<% end %>
<div class="pure-g h-box">

View file

@ -1,5 +1,5 @@
<% content_for "header" do %>
<title><%= translate(locale, "Playlists") %> - Invidious</title>
<title><%= translate(locale, "Playlists") %> - オワコンYouTube</title>
<% end %>
<%= rendered "components/feed_menu" %>

View file

@ -2,9 +2,9 @@
<meta name="description" content="<%= translate(locale, "An alternative front-end to YouTube") %>">
<title>
<% if env.get("preferences").as(Preferences).default_home != "Popular" %>
<%= translate(locale, "Popular") %> - Invidious
<%= translate(locale, "Popular") %> - オワコンYouTube
<% else %>
Invidious
オワコンYouTube
<% end %>
</title>
<% end %>

View file

@ -1,5 +1,5 @@
<% content_for "header" do %>
<title><%= translate(locale, "Subscriptions") %> - Invidious</title>
<title><%= translate(locale, "Subscriptions") %> - オワコンYouTube</title>
<link rel="alternate" type="application/rss+xml" title="RSS" href="/feed/private?token=<%= token %>" />
<% end %>

View file

@ -2,9 +2,9 @@
<meta name="description" content="<%= translate(locale, "An alternative front-end to YouTube") %>">
<title>
<% if env.get("preferences").as(Preferences).default_home != "Trending" %>
<%= translate(locale, "Trending") %> - Invidious
<%= translate(locale, "Trending") %> - オワコンYouTube
<% else %>
Invidious
オワコンYouTube
<% end %>
</title>
<% end %>

View file

@ -1,5 +1,5 @@
<% content_for "header" do %>
<title><%= HTML.escape(hashtag) %> - Invidious</title>
<title><%= HTML.escape(hashtag) %> - オワコンYouTube</title>
<% end %>
<hr/>

View file

@ -1,7 +1,7 @@
<% content_for "header" do %>
<meta name="description" content="<%= translate(locale, "An alternative front-end to YouTube") %>">
<title>
Invidious
オワコンYouTube
</title>
<% end %>

View file

@ -1,5 +1,5 @@
<% content_for "header" do %>
<title><%= HTML.escape(mix.title) %> - Invidious</title>
<title><%= HTML.escape(mix.title) %> - オワコンYouTube</title>
<% end %>
<div class="pure-g h-box">

View file

@ -2,7 +2,7 @@
<% author = HTML.escape(playlist.author) %>
<% content_for "header" do %>
<title><%= title %> - Invidious</title>
<title><%= title %> - オワコンYouTube</title>
<link rel="alternate" type="application/rss+xml" title="RSS" href="/feed/playlist/<%= plid %>" />
<% end %>

View file

@ -1,5 +1,5 @@
<% content_for "header" do %>
<title>Privacy Policy - Invidious</title>
<title>Privacy Policy - オワコンYouTube</title>
<% end %>
<div class="h-box">

View file

@ -1,5 +1,5 @@
<% content_for "header" do %>
<title><%= query.text.size > 30 ? HTML.escape(query.text[0,30].rstrip(".")) + "&hellip;" : HTML.escape(query.text) %> - Invidious</title>
<title><%= query.text.size > 30 ? HTML.escape(query.text[0,30].rstrip(".")) + "&hellip;" : HTML.escape(query.text) %> - オワコンYouTube</title>
<link rel="stylesheet" href="/css/search.css?v=<%= ASSET_COMMIT %>">
<% end %>

View file

@ -1,7 +1,7 @@
<% content_for "header" do %>
<meta name="description" content="<%= translate(locale, "An alternative front-end to YouTube") %>">
<title>
Invidious - <%= translate(locale, "search") %>
オワコンYouTube - <%= translate(locale, "search") %>
</title>
<link rel="stylesheet" href="/css/empty.css?v=<%= ASSET_COMMIT %>">
<% end %>
@ -10,7 +10,7 @@
<div class="pure-g h-box" id="search-widget">
<div class="pure-u-1" id="logo">
<h1 href="/" class="pure-menu-heading">Invidious</h1>
<h1 href="/" class="pure-menu-heading">オワコンYouTube</h1>
</div>
<div class="pure-u-1-4"></div>
<div class="pure-u-1 pure-u-md-12-24 searchbar">

View file

@ -12,7 +12,7 @@
<link rel="mask-icon" href="/safari-pinned-tab.svg?v=<%= ASSET_COMMIT %>" color="#575757">
<meta name="msapplication-TileColor" content="#575757">
<meta name="theme-color" content="#575757">
<link title="Invidious" type="application/opensearchdescription+xml" rel="search" href="/opensearch.xml">
<link title="オワコンYouTube" type="application/opensearchdescription+xml" rel="search" href="/opensearch.xml">
<link rel="stylesheet" href="/css/pure-min.css?v=<%= ASSET_COMMIT %>">
<link rel="stylesheet" href="/css/grids-responsive-min.css?v=<%= ASSET_COMMIT %>">
<link rel="stylesheet" href="/css/ionicons.min.css?v=<%= ASSET_COMMIT %>">
@ -23,11 +23,10 @@
<%
locale = env.get("preferences").as(Preferences).locale
dark_mode = env.get("preferences").as(Preferences).dark_mode
%>
<body class="<%= dark_mode.blank? ? "no" : dark_mode %>-theme">
<span style="display:none" id="dark_mode_pref"><%= env.get("preferences").as(Preferences).dark_mode %></span>
<body class="dark-theme">
<span style="display:none" id="dark_mode_pref">dark</span>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-2-24"></div>
<div class="pure-u-1 pure-u-md-20-24 bgcon" id="contents">
@ -43,15 +42,6 @@
<div class="pure-u-1 pure-u-md-8-24 user-field">
<% if env.get? "user" %>
<div class="pure-u-1-4">
<a id="toggle_theme" href="/toggle_theme?referer=<%= env.get?("current_page") %>" class="pure-menu-heading">
<% if env.get("preferences").as(Preferences).dark_mode == "dark" %>
<i class="icon ion-ios-sunny"></i>
<% else %>
<i class="icon ion-ios-moon"></i>
<% end %>
</a>
</div>
<div class="pure-u-1-4">
<a id="notification_ticker" title="<%= translate(locale, "Subscriptions") %>" href="/feed/subscriptions" class="pure-menu-heading">
<% notification_count = env.get("user").as(Invidious::User).notifications.size %>
@ -81,15 +71,6 @@
</form>
</div>
<% else %>
<div class="pure-u-1-3">
<a id="toggle_theme" href="/toggle_theme?referer=<%= env.get?("current_page") %>" class="pure-menu-heading">
<% if env.get("preferences").as(Preferences).dark_mode == "dark" %>
<i class="icon ion-ios-sunny"></i>
<% else %>
<i class="icon ion-ios-moon"></i>
<% end %>
</a>
</div>
<div class="pure-u-1-3">
<a title="<%= translate(locale, "Preferences") %>" href="/preferences?referer=<%= env.get?("current_page") %>" class="pure-menu-heading">
<i class="icon ion-ios-cog"></i>

View file

@ -1,5 +1,5 @@
<% content_for "header" do %>
<title><%= translate(locale, "Token") %> - Invidious</title>
<title><%= translate(locale, "Token") %> - オワコンYouTube</title>
<% end %>
<% if env.get? "access_token" %>

View file

@ -1,5 +1,5 @@
<% content_for "header" do %>
<title><%= translate(locale, "Change password") %> - Invidious</title>
<title><%= translate(locale, "Change password") %> - オワコンYouTube</title>
<% end %>
<div class="pure-g">

View file

@ -1,5 +1,5 @@
<% content_for "header" do %>
<title><%= translate(locale, "Clear watch history") %> - Invidious</title>
<title><%= translate(locale, "Clear watch history") %> - オワコンYouTube</title>
<% end %>
<div class="h-box">

View file

@ -1,5 +1,5 @@
<% content_for "header" do %>
<title><%= translate(locale, "Import and Export Data") %> - Invidious</title>
<title><%= translate(locale, "Import and Export Data") %> - オワコンYouTube</title>
<% end %>
<div class="h-box">

View file

@ -1,5 +1,5 @@
<% content_for "header" do %>
<title><%= translate(locale, "Delete account") %> - Invidious</title>
<title><%= translate(locale, "Delete account") %> - オワコンYouTube</title>
<% end %>
<div class="h-box">

View file

@ -1,5 +1,5 @@
<% content_for "header" do %>
<title><%= translate(locale, "Log in") %> - Invidious</title>
<title><%= translate(locale, "Log in") %> - オワコンYouTube</title>
<% end %>
<div class="pure-g">

View file

@ -1,5 +1,5 @@
<% content_for "header" do %>
<title><%= translate(locale, "Preferences") %> - Invidious</title>
<title><%= translate(locale, "Preferences") %> - オワコンYouTube</title>
<% end %>
<div class="h-box">
@ -150,15 +150,6 @@
</select>
</div>
<div class="pure-control-group">
<label for="dark_mode"><%= translate(locale, "preferences_dark_mode_label") %></label>
<select name="dark_mode" id="dark_mode">
<% {"", "light", "dark"}.each do |option| %>
<option value="<%= option %>" <% if preferences.dark_mode == option %> selected <% end %>><%= translate(locale, option.blank? ? "auto" : option) %></option>
<% end %>
</select>
</div>
<div class="pure-control-group">
<label for="thin_mode"><%= translate(locale, "preferences_thin_mode_label") %></label>
<input name="thin_mode" id="thin_mode" type="checkbox" <% if preferences.thin_mode %>checked<% end %>>

View file

@ -1,5 +1,5 @@
<% content_for "header" do %>
<title><%= translate(locale, "Subscription manager") %> - Invidious</title>
<title><%= translate(locale, "Subscription manager") %> - オワコンYouTube</title>
<% end %>
<div class="pure-g h-box">

View file

@ -1,5 +1,5 @@
<% content_for "header" do %>
<title><%= translate(locale, "Token manager") %> - Invidious</title>
<title><%= translate(locale, "Token manager") %> - オワコンYouTube</title>
<% end %>
<div class="pure-g h-box">

View file

@ -7,7 +7,7 @@
<meta name="thumbnail" content="<%= thumbnail %>">
<meta name="description" content="<%= HTML.escape(video.short_description) %>">
<meta name="keywords" content="<%= video.keywords.join(",") %>">
<meta property="og:site_name" content="<%= author %> | Invidious">
<meta property="og:site_name" content="<%= author %> | オワコンYouTube">
<meta property="og:url" content="<%= HOST_URL %>/watch?v=<%= video.id %>">
<meta property="og:title" content="<%= title %>">
<meta property="og:image" content="/vi/<%= video.id %>/maxres.jpg">
@ -28,7 +28,7 @@
<meta name="twitter:player:height" content="720">
<link rel="alternate" href="https://www.youtube.com/watch?v=<%= video.id %>">
<%= rendered "components/player_sources" %>
<title><%= title %> - Invidious</title>
<title><%= title %> - オワコンYouTube</title>
<!-- Description expansion also updates the 'Show more' button to 'Show less' so
we're going to need to do it here in order to allow for translations.