mirror of
https://github.com/iv-org/invidious.git
synced 2024-08-30 18:23:25 +00:00
Fix JSON serialization
This commit is contained in:
parent
0e58d99f4e
commit
3b2e142542
@ -21,9 +21,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script id="playlist_data" type="application/json">
|
<script id="playlist_data" type="application/json">
|
||||||
|
<%=
|
||||||
{
|
{
|
||||||
"csrf_token": "<%= URI.encode_www_form(env.get?("csrf_token").try &.as(String) || "") %>"
|
"csrf_token" => URI.encode_www_form(env.get?("csrf_token").try &.as(String) || "")
|
||||||
}
|
}.to_pretty_json
|
||||||
|
%>
|
||||||
</script>
|
</script>
|
||||||
<script src="/js/playlist_widget.js"></script>
|
<script src="/js/playlist_widget.js"></script>
|
||||||
|
|
||||||
|
@ -72,13 +72,15 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<script id="community_data" type="application/json">
|
<script id="community_data" type="application/json">
|
||||||
|
<%=
|
||||||
{
|
{
|
||||||
"ucid": "<%= channel.ucid %>",
|
"ucid" => channel.ucid,
|
||||||
"youtube_comments_text": "<%= HTML.escape(translate(locale, "View YouTube comments")) %>",
|
"youtube_comments_text" => HTML.escape(translate(locale, "View YouTube comments")),
|
||||||
"comments_text": "<%= HTML.escape(translate(locale, "View `x` comments", "{commentCount}")) %>",
|
"comments_text" => HTML.escape(translate(locale, "View `x` comments", "{commentCount}")),
|
||||||
"hide_replies_text": "<%= HTML.escape(translate(locale, "Hide replies")) %>",
|
"hide_replies_text" => HTML.escape(translate(locale, "Hide replies")),
|
||||||
"show_replies_text": "<%= HTML.escape(translate(locale, "Show replies")) %>",
|
"show_replies_text" => HTML.escape(translate(locale, "Show replies")),
|
||||||
"preferences": <%= env.get("preferences").as(Preferences).to_json %>
|
"preferences" => env.get("preferences").as(Preferences)
|
||||||
}
|
}.to_pretty_json
|
||||||
|
%>
|
||||||
</script>
|
</script>
|
||||||
<script src="/js/community.js?v=<%= ASSET_COMMIT %>"></script>
|
<script src="/js/community.js?v=<%= ASSET_COMMIT %>"></script>
|
||||||
|
@ -37,11 +37,13 @@
|
|||||||
</video>
|
</video>
|
||||||
|
|
||||||
<script id="player_data" type="application/json">
|
<script id="player_data" type="application/json">
|
||||||
|
<%=
|
||||||
{
|
{
|
||||||
"aspect_ratio": "<%= aspect_ratio %>",
|
"aspect_ratio" => aspect_ratio,
|
||||||
"title": "<%= video.title.dump_unquoted %>",
|
"title" => video.title,
|
||||||
"description": "<%= HTML.escape(video.short_description) %>",
|
"description" => HTML.escape(video.short_description),
|
||||||
"thumbnail": "<%= thumbnail %>"
|
"thumbnail" => thumbnail
|
||||||
}
|
}.to_pretty_json
|
||||||
|
%>
|
||||||
</script>
|
</script>
|
||||||
<script src="/js/player.js?v=<%= ASSET_COMMIT %>"></script>
|
<script src="/js/player.js?v=<%= ASSET_COMMIT %>"></script>
|
||||||
|
@ -20,14 +20,16 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<script id="subscribe_data" type="application/json">
|
<script id="subscribe_data" type="application/json">
|
||||||
|
<%=
|
||||||
{
|
{
|
||||||
"ucid": "<%= ucid %>",
|
"ucid" => ucid,
|
||||||
"author": "<%= HTML.escape(author) %>",
|
"author" => HTML.escape(author),
|
||||||
"sub_count_text": "<%= HTML.escape(sub_count_text) %>",
|
"sub_count_text" => HTML.escape(sub_count_text),
|
||||||
"csrf_token": "<%= URI.encode_www_form(env.get?("csrf_token").try &.as(String) || "") %>",
|
"csrf_token" => URI.encode_www_form(env.get?("csrf_token").try &.as(String) || ""),
|
||||||
"subscribe_text": "<%= HTML.escape(translate(locale, "Subscribe")) %>",
|
"subscribe_text" => HTML.escape(translate(locale, "Subscribe")),
|
||||||
"unsubscribe_text": "<%= HTML.escape(translate(locale, "Unsubscribe")) %>"
|
"unsubscribe_text" => HTML.escape(translate(locale, "Unsubscribe"))
|
||||||
}
|
}.to_pretty_json
|
||||||
|
%>
|
||||||
</script>
|
</script>
|
||||||
<script src="/js/subscribe_widget.js?v=<%= ASSET_COMMIT %>"></script>
|
<script src="/js/subscribe_widget.js?v=<%= ASSET_COMMIT %>"></script>
|
||||||
<% else %>
|
<% else %>
|
||||||
|
@ -16,16 +16,18 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<script id="video_data" type="application/json">
|
<script id="video_data" type="application/json">
|
||||||
|
<%=
|
||||||
{
|
{
|
||||||
"id": "<%= video.id %>",
|
"id" => video.id,
|
||||||
"index": "<%= continuation %>",
|
"index" => continuation,
|
||||||
"plid": "<%= plid %>",
|
"plid" => plid,
|
||||||
"length_seconds": "<%= video.length_seconds.to_f %>",
|
"length_seconds" => video.length_seconds.to_f,
|
||||||
"video_series": <%= video_series.to_json %>,
|
"video_series" => video_series,
|
||||||
"params": <%= params.to_json %>,
|
"params" => params,
|
||||||
"preferences": <%= preferences.to_json %>,
|
"preferences" => preferences,
|
||||||
"premiere_timestamp": <%= video.premiere_timestamp.try &.to_unix || "null" %>
|
"premiere_timestamp" => video.premiere_timestamp.try &.to_unix
|
||||||
}
|
}.to_pretty_json
|
||||||
|
%>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<%= rendered "components/player" %>
|
<%= rendered "components/player" %>
|
||||||
|
@ -19,9 +19,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script id="watched_data" type="application/json">
|
<script id="watched_data" type="application/json">
|
||||||
|
<%=
|
||||||
{
|
{
|
||||||
"csrf_token": "<%= URI.encode_www_form(env.get?("csrf_token").try &.as(String) || "") %>"
|
"csrf_token" => URI.encode_www_form(env.get?("csrf_token").try &.as(String) || "")
|
||||||
}
|
}.to_pretty_json
|
||||||
|
%>
|
||||||
</script>
|
</script>
|
||||||
<script src="/js/watched_widget.js"></script>
|
<script src="/js/watched_widget.js"></script>
|
||||||
|
|
||||||
|
@ -70,9 +70,11 @@
|
|||||||
|
|
||||||
<% if playlist.is_a?(InvidiousPlaylist) && playlist.author == user.try &.email %>
|
<% if playlist.is_a?(InvidiousPlaylist) && playlist.author == user.try &.email %>
|
||||||
<script id="playlist_data" type="application/json">
|
<script id="playlist_data" type="application/json">
|
||||||
|
<%=
|
||||||
{
|
{
|
||||||
"csrf_token": "<%= URI.encode_www_form(env.get?("csrf_token").try &.as(String) || "") %>"
|
"csrf_token" => URI.encode_www_form(env.get?("csrf_token").try &.as(String) || "")
|
||||||
}
|
}.to_pretty_json
|
||||||
|
%>
|
||||||
</script>
|
</script>
|
||||||
<script src="/js/playlist_widget.js"></script>
|
<script src="/js/playlist_widget.js"></script>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -46,9 +46,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script id="watched_data" type="application/json">
|
<script id="watched_data" type="application/json">
|
||||||
|
<%=
|
||||||
{
|
{
|
||||||
"csrf_token": "<%= URI.encode_www_form(env.get?("csrf_token").try &.as(String) || "") %>"
|
"csrf_token" => URI.encode_www_form(env.get?("csrf_token").try &.as(String) || "")
|
||||||
}
|
}.to_pretty_json
|
||||||
|
%>
|
||||||
</script>
|
</script>
|
||||||
<script src="/js/watched_widget.js"></script>
|
<script src="/js/watched_widget.js"></script>
|
||||||
|
|
||||||
|
@ -152,10 +152,12 @@
|
|||||||
<% if env.get? "user" %>
|
<% if env.get? "user" %>
|
||||||
<script src="/js/sse.js?v=<%= ASSET_COMMIT %>"></script>
|
<script src="/js/sse.js?v=<%= ASSET_COMMIT %>"></script>
|
||||||
<script id="notification_data" type="application/json">
|
<script id="notification_data" type="application/json">
|
||||||
{
|
<%=
|
||||||
"upload_text": "<%= HTML.escape(translate(locale, "`x` uploaded a video")) %>",
|
{
|
||||||
"live_upload_text": "<%= HTML.escape(translate(locale, "`x` is live")) %>"
|
"upload_text" => HTML.escape(translate(locale, "`x` uploaded a video")),
|
||||||
}
|
"live_upload_text" => HTML.escape(translate(locale, "`x` is live"))
|
||||||
|
}.to_pretty_json
|
||||||
|
%>
|
||||||
</script>
|
</script>
|
||||||
<script src="/js/notifications.js?v=<%= ASSET_COMMIT %>"></script>
|
<script src="/js/notifications.js?v=<%= ASSET_COMMIT %>"></script>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -27,23 +27,25 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<script id="video_data" type="application/json">
|
<script id="video_data" type="application/json">
|
||||||
|
<%=
|
||||||
{
|
{
|
||||||
"id": "<%= video.id %>",
|
"id" => video.id,
|
||||||
"index": "<%= continuation %>",
|
"index" => continuation,
|
||||||
"plid": "<%= plid %>",
|
"plid" => plid,
|
||||||
"length_seconds": <%= video.length_seconds.to_f %>,
|
"length_seconds" => video.length_seconds.to_f,
|
||||||
"play_next": <%= !rvs.empty? && !plid && params.continue %>,
|
"play_next" => !rvs.empty? && !plid && params.continue,
|
||||||
"next_video": "<%= rvs.select { |rv| rv["id"]? }[0]?.try &.["id"] %>",
|
"next_video" => rvs.select { |rv| rv["id"]? }[0]?.try &.["id"],
|
||||||
"youtube_comments_text": "<%= HTML.escape(translate(locale, "View YouTube comments")) %>",
|
"youtube_comments_text" => HTML.escape(translate(locale, "View YouTube comments")),
|
||||||
"reddit_comments_text": "<%= HTML.escape(translate(locale, "View Reddit comments")) %>",
|
"reddit_comments_text" => HTML.escape(translate(locale, "View Reddit comments")),
|
||||||
"reddit_permalink_text": "<%= HTML.escape(translate(locale, "View more comments on Reddit")) %>",
|
"reddit_permalink_text" => HTML.escape(translate(locale, "View more comments on Reddit")),
|
||||||
"comments_text": "<%= HTML.escape(translate(locale, "View `x` comments", "{commentCount}")) %>",
|
"comments_text" => HTML.escape(translate(locale, "View `x` comments", "{commentCount}")),
|
||||||
"hide_replies_text": "<%= HTML.escape(translate(locale, "Hide replies")) %>",
|
"hide_replies_text" => HTML.escape(translate(locale, "Hide replies")),
|
||||||
"show_replies_text": "<%= HTML.escape(translate(locale, "Show replies")) %>",
|
"show_replies_text" => HTML.escape(translate(locale, "Show replies")),
|
||||||
"params": <%= params.to_json %>,
|
"params" => params,
|
||||||
"preferences": <%= preferences.to_json %>,
|
"preferences" => preferences,
|
||||||
"premiere_timestamp": <%= video.premiere_timestamp.try &.to_unix || "null" %>
|
"premiere_timestamp" => video.premiere_timestamp.try &.to_unix
|
||||||
}
|
}.to_pretty_json
|
||||||
|
%>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div id="player-container" class="h-box">
|
<div id="player-container" class="h-box">
|
||||||
|
Loading…
Reference in New Issue
Block a user