Support vmap/amplify video card
This commit is contained in:
parent
ce6dace1d7
commit
8a45afdd46
3 changed files with 31 additions and 10 deletions
|
@ -970,6 +970,14 @@ video, .video-container img {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.card-content-container {
|
||||||
|
color: unset;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-content-container:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
.card-image-container {
|
.card-image-container {
|
||||||
width: 98px;
|
width: 98px;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
|
|
@ -191,6 +191,12 @@ routes:
|
||||||
let client = newAsyncHttpClient()
|
let client = newAsyncHttpClient()
|
||||||
var content = await client.getContent(url)
|
var content = await client.getContent(url)
|
||||||
|
|
||||||
|
if ".vmap" in url:
|
||||||
|
var m: RegexMatch
|
||||||
|
discard content.find(re"""url="(.+.m3u8)"""", m)
|
||||||
|
url = decodeUrl(content[m.group(0)[0]])
|
||||||
|
content = await client.getContent(url)
|
||||||
|
|
||||||
if ".m3u8" in url:
|
if ".m3u8" in url:
|
||||||
content = proxifyVideo(content, prefs.proxyVideos)
|
content = proxifyVideo(content, prefs.proxyVideos)
|
||||||
|
|
||||||
|
|
|
@ -117,22 +117,29 @@ proc renderCardImage(card: Card): VNode =
|
||||||
tdiv(class="card-overlay-circle"):
|
tdiv(class="card-overlay-circle"):
|
||||||
span(class="card-overlay-triangle")
|
span(class="card-overlay-triangle")
|
||||||
|
|
||||||
|
proc renderCardContent(card: Card): VNode =
|
||||||
|
buildHtml(tdiv(class="card-content")):
|
||||||
|
h2(class="card-title"): text card.title
|
||||||
|
p(class="card-description"): text card.text
|
||||||
|
span(class="card-destination"): text card.dest
|
||||||
|
|
||||||
proc renderCard(card: Card; prefs: Prefs): VNode =
|
proc renderCard(card: Card; prefs: Prefs): VNode =
|
||||||
const largeCards = {summaryLarge, liveEvent, promoWebsite, promoVideo}
|
const largeCards = {summaryLarge, liveEvent, promoWebsite, promoVideo}
|
||||||
let large = if card.kind in largeCards: " large" else: ""
|
let large = if card.kind in largeCards: " large" else: ""
|
||||||
|
let url = replaceUrl(card.url, prefs)
|
||||||
|
|
||||||
buildHtml(tdiv(class=("card" & large))):
|
buildHtml(tdiv(class=("card" & large))):
|
||||||
a(class="card-container", href=replaceUrl(card.url, prefs)):
|
if card.video.isSome:
|
||||||
if card.image.isSome:
|
tdiv(class="card-container"):
|
||||||
renderCardImage(card)
|
|
||||||
elif card.video.isSome:
|
|
||||||
renderVideo(get(card.video), prefs)
|
renderVideo(get(card.video), prefs)
|
||||||
|
a(class="card-content-container", href=url):
|
||||||
tdiv(class="card-content-container"):
|
renderCardContent(card)
|
||||||
tdiv(class="card-content"):
|
else:
|
||||||
h2(class="card-title"): text card.title
|
a(class="card-container", href=url):
|
||||||
p(class="card-description"): text card.text
|
if card.image.isSome:
|
||||||
span(class="card-destination"): text card.dest
|
renderCardImage(card)
|
||||||
|
tdiv(class="card-content-container"):
|
||||||
|
renderCardContent(card)
|
||||||
|
|
||||||
proc renderStats(stats: TweetStats): VNode =
|
proc renderStats(stats: TweetStats): VNode =
|
||||||
buildHtml(tdiv(class="tweet-stats")):
|
buildHtml(tdiv(class="tweet-stats")):
|
||||||
|
|
Loading…
Reference in a new issue