insecure berk.ninja image links are secure now
This commit is contained in:
parent
5cc4c9325a
commit
bbde2909cd
2 changed files with 12 additions and 3 deletions
|
@ -4,7 +4,7 @@
|
|||
|
||||
// V A R I A B L E
|
||||
|
||||
const links = [ // TODO: Update images
|
||||
const links = [
|
||||
{
|
||||
href: "https://chat.lbry.io",
|
||||
image: "https://spee.ch/b432346bfd641990f3dc3dbceda057b4ededa360/discord-bg.jpg",
|
||||
|
|
|
@ -102,7 +102,7 @@ function generateContent(exampleNumber, displayTrendingContent) {
|
|||
try {
|
||||
renderedContentCollection.push(`
|
||||
<figure class="playground__content__trend">
|
||||
<img alt="${part.name}" data-action="choose claim" data-claim-id="${part.name}" src="${part.value.stream.metadata.thumbnail}"/>
|
||||
<img alt="${part.name}" data-action="choose claim" data-claim-id="${part.name}" src="${makeImageSourceSecure(part.value.stream.metadata.thumbnail)}"/>
|
||||
|
||||
<figcaption data-action="choose claim" data-claim-id="${part.name}">
|
||||
${part.value.stream.metadata.title}
|
||||
|
@ -156,7 +156,7 @@ function generateContent(exampleNumber, displayTrendingContent) {
|
|||
) {
|
||||
renderedContentCollection.push(`
|
||||
<figure class="playground__content__trend">
|
||||
<img alt="${part.name}" data-action="choose claim" data-claim-id="${part.claim_id}" src="${part.value.stream.metadata.thumbnail}"/>
|
||||
<img alt="${part.name}" data-action="choose claim" data-claim-id="${part.claim_id}" src="${makeImageSourceSecure(part.value.stream.metadata.thumbnail)}"/>
|
||||
<figcaption data-action="choose claim" data-claim-id="${part.claim_id}">
|
||||
${part.value.stream.metadata.title}
|
||||
<span>${part.channel_name}</span>
|
||||
|
@ -311,6 +311,15 @@ function getTrendingContent() {
|
|||
});
|
||||
}
|
||||
|
||||
function makeImageSourceSecure(url) {
|
||||
const originalUrl = new URL(url);
|
||||
|
||||
if (originalUrl.protocol !== "https")
|
||||
return `https://${originalUrl.host}${originalUrl.pathname}`;
|
||||
|
||||
return originalUrl.href;
|
||||
}
|
||||
|
||||
function newsletterSubscribe(data, socket) {
|
||||
const email = data.email;
|
||||
|
||||
|
|
Loading…
Reference in a new issue