mirror of
				https://gitea.invidious.io/iv-org/invidious.git
				synced 2024-08-15 00:53:41 +00:00 
			
		
		
		
	Added verification badge for channel view
This commit is contained in:
		
							parent
							
								
									bd221b7b2c
								
							
						
					
					
						commit
						66340281e6
					
				
					 4 changed files with 18 additions and 4 deletions
				
			
		|  | @ -12,7 +12,8 @@ record AboutChannel, | ||||||
|   joined : Time, |   joined : Time, | ||||||
|   is_family_friendly : Bool, |   is_family_friendly : Bool, | ||||||
|   allowed_regions : Array(String), |   allowed_regions : Array(String), | ||||||
|   tabs : Array(String) |   tabs : Array(String), | ||||||
|  |   verified : Bool | ||||||
| 
 | 
 | ||||||
| record AboutRelatedChannel, | record AboutRelatedChannel, | ||||||
|   ucid : String, |   ucid : String, | ||||||
|  | @ -41,7 +42,7 @@ def get_about_info(ucid, locale) : AboutChannel | ||||||
|   if !initdata.has_key?("metadata") |   if !initdata.has_key?("metadata") | ||||||
|     auto_generated = true |     auto_generated = true | ||||||
|   end |   end | ||||||
| 
 |   verified = false | ||||||
|   if auto_generated |   if auto_generated | ||||||
|     author = initdata["header"]["interactiveTabbedHeaderRenderer"]["title"]["simpleText"].as_s |     author = initdata["header"]["interactiveTabbedHeaderRenderer"]["title"]["simpleText"].as_s | ||||||
|     author_url = initdata["microformat"]["microformatDataRenderer"]["urlCanonical"].as_s |     author_url = initdata["microformat"]["microformatDataRenderer"]["urlCanonical"].as_s | ||||||
|  | @ -70,7 +71,10 @@ def get_about_info(ucid, locale) : AboutChannel | ||||||
|     # if banner.includes? "channels/c4/default_banner" |     # if banner.includes? "channels/c4/default_banner" | ||||||
|     #  banner = nil |     #  banner = nil | ||||||
|     # end |     # end | ||||||
| 
 |     badges = initdata["header"]["c4TabbedHeaderRenderer"]?.try &.["badges"]? | ||||||
|  |     if !badges.nil? | ||||||
|  |       verified=true | ||||||
|  |     end | ||||||
|     description = initdata["metadata"]["channelMetadataRenderer"]?.try &.["description"]?.try &.as_s? || "" |     description = initdata["metadata"]["channelMetadataRenderer"]?.try &.["description"]?.try &.as_s? || "" | ||||||
|     description_html = HTML.escape(description) |     description_html = HTML.escape(description) | ||||||
| 
 | 
 | ||||||
|  | @ -128,6 +132,7 @@ def get_about_info(ucid, locale) : AboutChannel | ||||||
|     is_family_friendly: is_family_friendly, |     is_family_friendly: is_family_friendly, | ||||||
|     allowed_regions: allowed_regions, |     allowed_regions: allowed_regions, | ||||||
|     tabs: tabs, |     tabs: tabs, | ||||||
|  |     verified: verified, | ||||||
|   ) |   ) | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -21,6 +21,9 @@ | ||||||
|         <div class="channel-profile"> |         <div class="channel-profile"> | ||||||
|             <img src="/ggpht<%= URI.parse(channel.author_thumbnail).request_target %>"> |             <img src="/ggpht<%= URI.parse(channel.author_thumbnail).request_target %>"> | ||||||
|             <span><%= author %></span> |             <span><%= author %></span> | ||||||
|  |             <% if channel.verified %> | ||||||
|  |                 <i class="icon ion ion-md-checkmark-circle"></i> | ||||||
|  |             <% end %> | ||||||
|         </div> |         </div> | ||||||
|     </div> |     </div> | ||||||
|     <div class="pure-u-1-3"> |     <div class="pure-u-1-3"> | ||||||
|  |  | ||||||
|  | @ -20,6 +20,9 @@ | ||||||
|         <div class="channel-profile"> |         <div class="channel-profile"> | ||||||
|             <img src="/ggpht<%= URI.parse(channel.author_thumbnail).request_target %>"> |             <img src="/ggpht<%= URI.parse(channel.author_thumbnail).request_target %>"> | ||||||
|             <span><%= author %></span> |             <span><%= author %></span> | ||||||
|  |             <% if channel.verified %> | ||||||
|  |                 <i class="icon ion ion-md-checkmark-circle"></i> | ||||||
|  |             <% end %> | ||||||
|         </div> |         </div> | ||||||
|     </div> |     </div> | ||||||
|     <div class="pure-u-1-3" style="text-align:right"> |     <div class="pure-u-1-3" style="text-align:right"> | ||||||
|  |  | ||||||
|  | @ -20,6 +20,9 @@ | ||||||
|         <div class="channel-profile"> |         <div class="channel-profile"> | ||||||
|             <img src="/ggpht<%= URI.parse(channel.author_thumbnail).request_target %>"> |             <img src="/ggpht<%= URI.parse(channel.author_thumbnail).request_target %>"> | ||||||
|             <span><%= author %></span> |             <span><%= author %></span> | ||||||
|  |             <% if channel.verified %> | ||||||
|  |                 <i class="icon ion ion-md-checkmark-circle"></i> | ||||||
|  |             <% end %> | ||||||
|         </div> |         </div> | ||||||
|     </div> |     </div> | ||||||
|     <div class="pure-u-1-3" style="text-align:right"> |     <div class="pure-u-1-3" style="text-align:right"> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue