Skip to content

Commit

Permalink
add AI generated podcast link to the blog
Browse files Browse the repository at this point in the history
  • Loading branch information
nishit130 committed Sep 29, 2024
1 parent df36531 commit ceff701
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 0 deletions.
95 changes: 95 additions & 0 deletions _includes/open-embed.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<style>
.videoWrapper {
position: relative;
padding-bottom: 56.333%;
height: 0;
background: black;
}
.videoWrapper iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: 0;
}
</style>

<script>
function get_youtube_id(url) {
var p = /^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/;
return (url.match(p)) ? RegExp.$1 : false;
}
function vimeo_embed(url,el) {
var id = false;
$.ajax({
url: 'https://vimeo.com/api/oembed.json?url='+url,
async: true,
success: function(response) {
if(response.video_id) {
id = response.video_id;
if(url.indexOf('autoplay=1') !== -1) var autoplay=1; else var autoplay=0;
if(url.indexOf('loop=1') !== -1) var loop=1; else var loop=0;
var theInnerHTML = '<div class="videoWrapper"><iframe src="https://player.vimeo.com/video/'+id+'/?byline=0&title=0&portrait=0';
if(autoplay==1) theInnerHTML += '&autoplay=1';
if(loop==1) theInnerHTML += '&loop=1';
theInnerHTML += '" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div>';
el.innerHTML = theInnerHTML;
}
}
});
}
function video_embed() {
var p = document.getElementsByTagName('p');
for(var i = 0; i < p.length; i++) {
//check if this is an external url (that starts with https:// or http://
if (p[i].innerHTML.indexOf("http://") == 0 ||
p[i].innerHTML.indexOf("https://") == 0) {
var youtube_id = get_youtube_id(p[i].innerHTML);
if(youtube_id) {
if(p[i].innerHTML.indexOf('autoplay=1') !== -1) var autoplay=1; else var autoplay=0;
if(p[i].innerHTML.indexOf('loop=1') !== -1) var loop=1; else var loop=0;
var theInnerHTML = '<div class="videoWrapper"><iframe width="720" height="420" src="https://www.youtube.com/embed/' + youtube_id + '?rel=0&showinfo=0';
if(autoplay==1) theInnerHTML += '&autoplay=1';
if(loop==1) theInnerHTML += '&loop=1&playlist='+youtube_id+'&version=3';
if(p[i].innerHTML.indexOf('start=') !== -1) theInnerHTML += '&start='+p[i].innerHTML.substring(p[i].innerHTML.indexOf('start=')+6);
theInnerHTML += '" frameborder="0" allowfullscreen></iframe></div>';
p[i].innerHTML = theInnerHTML;
}
if(p[i].innerHTML.indexOf('vimeo.com') !== -1) {
//ask vimeo for the id and place the embed
vimeo_embed(p[i].innerHTML,p[i]);
}
}
}
}
video_embed();

function mp3_embed() {
var p = document.getElementsByTagName('p');
for(var i = 0; i < p.length; i++) {
if(p[i].innerHTML.indexOf('.mp3') !== -1) {
var str = p[i].innerHTML.split('?');
if(str.length == 1) str[1] = '';
var str1 = str[1];
str1 = str1.replace('&','').replace('&','');
str1 = str1.replace('autoplay=1','').replace('autoplay=0','');
str1 = str1.replace('loop=1','').replace('loop=0','');
str1 = str1.replace('controls=0','').replace('controls=1','');

if (str[0].lastIndexOf('.mp3', str[0].length - 4) === str[0].length - 4 && str1.length == 0) {
if(str[1].indexOf('autoplay=1') !== -1) var autoplay=1; else var autoplay=0;
if(str[1].indexOf('loop=1') !== -1) var loop=1; else var loop=0;
if(str[1].indexOf('controls=0') !== -1) var controls=0; else var controls=1;
var newInnerHTML = '<audio';
if(autoplay==1) newInnerHTML += ' autoplay';
if(loop==1) newInnerHTML += ' loop';
if(controls==1) newInnerHTML += ' controls';
newInnerHTML += '><source src="'+str[0]+'" type="audio/mpeg">Your browser does not support the audio element.</audio>';
p[i].innerHTML = newInnerHTML;
}
}
}
}
mp3_embed();
</script>
5 changes: 5 additions & 0 deletions _posts/2023-06-01-custom-signed-urls.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ excerpt: "In today's cloud-based world, secure and efficient access to private r

![signed-url-blog.png](../../../../assets/img/signed-url-blog.png)

Listen to blog in podcast format 👇

../../../../assets/custom_url_podcast.mp3

In today's cloud-based world, secure and efficient access to private resources stored on cloud platforms is crucial. One of the ways to provide secure access to these resources is by using Signed URLs. Signed URLs allow users to access private objects on cloud platforms like Amazon Web Services (AWS) S3 and Google Cloud Storage (GCS).

A signed URL is a special type of URL that includes a signature, or token, that verifies the identity of the user or application making the request to access a specific resource, such as an object stored in GCS/S3 bucket. This token allows the server to confirm that the user or application has the necessary permissions to access the resource and prevent unauthorized access.
Expand Down Expand Up @@ -131,3 +135,4 @@ We check if calculated value of HMAC matches the `token` to make sure that the u
Concluding, signed URLs are your trusted allies in securing access to your cloud-hosted private resources. However, the 7-day expiry limit can sometimes be a hindrance. Creating custom signed URLs, honoring the principles of time-limited access, controlled access permissions, and secure authentication and authorization, is a savvy way to circumvent this challenge. This strategy empowers you to provide temporary access to your resources while ensuring optimal security and control.


{% include open-embed.html %}
Binary file added assets/custom_url_podcast.mp3
Binary file not shown.

0 comments on commit ceff701

Please sign in to comment.