Saturday, June 29, 2024

Azure - Update firewall configurations to allow Logic Apps IP addresses

We got an email from Microsoft Azure, asking us to update firewall configurations to allow Logic Apps IP addresses by 28 September 2024.

Verified in all our accounts that the only logic apps we used were the VM automatic start/stop apps which are currently disabled. So, no action to be taken for this.

Friday, June 28, 2024

quaternion tutorial

https://www.opengl-tutorial.org/intermediate-tutorials/tutorial-17-quaternions/#how-do-i-create-a-quaternion-in-c-

It turned out that I did not need to include glm etc, as in the page above, since simple linear interpolation followed by normalization was sufficient for my use case. Apparently linear interpolation is close, though not exact - this discussion.

Wednesday, June 26, 2024

unable to see old assets after email change

One of our websites had an issue, described as below:

... User was accessing the system using old@gmail.com. She had some issues with that id and she edited her profile on CMS and changed it to new@gmail.com While the system allows her to login using her new email address, she is unable to see the assets assigned to her as editor in the new id. Even when she creates an asset, even though she logs in with her new email, the asset gets created under her old email id ...
Solution was:

In the users table of the Postgres database, only the "email" field is editable by users - now updated the "username" field to
new@gmail.com
from
old@gmail.com

(The updating of username field by users is not enabled since back-end changes to the CMS data sheet are needed when such a change happens.)

additional spam protection for forms using Cloudflare turnstile

One of our forms, which had first level protection using a hidden field, occasionally got bursts of spam submissions. Added Cloudflare turnstile as an additional layer of protection.

In the <head> section of the web page which had the form, 

<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" defer></script>

Inside the form,

<div class="cf-turnstile" data-sitekey="0x4OUR-SITE-KEY0-"></div> 

and in the done function, handling the "failed captcha" situation - 

 $.ajax({
                        method: "POST",
                        url: url,
                        data: user
                    }).done(function (msg) {

                        // When the request is successful
                        if(msg=="Success") {
                        $('span').html('<strong>Thank you for submitting your details. We will get back to you shortly, in a week or so.</strong>');
                        $("form").trigger("reset");
                        }
                        if(msg=="Failed captcha.") {
                            $('span').html('<strong>Please resubmit after the captcha loads, checking the box to confirm you are human if necessary.</strong>');
                        }
                    }).fail(function (err, textstatus, error) {
                        $('span').text(textstatus);
                    });

              

Then, we need to add some back-end code. Since we're using Google Apps Scripts, this looked like:

function doPost(e) {

var scriptProperties = PropertiesService.getScriptProperties();
var myKey = scriptProperties.getProperty('SECRET_KEY');
.....
const siteresponse = e.parameter['cf-turnstile-response'];
.....
var verifyurl = 'https://challenges.cloudflare.com/turnstile/v0/siteverify';
var formData = {
'secret': myKey,
'response': siteresponse
};
var options = {
'method' : 'post',
'payload' : formData
};

var responsetositeverify = UrlFetchApp.fetch(verifyurl, options);
var verifydata = JSON.parse(responsetositeverify.getContentText());


if (!verifydata.success) {
// do the rest of the processing only if verification returns success.
return ContentService.createTextOutput().append('Failed captcha.');
}
 
 

 


Monday, June 17, 2024

problem and workaround for Youtube api calls from Google Apps script

When trying to implement the earlier solution to one of our channels, the script would fail, complaining that the user was not authorized for live streams. Interestingly, when using google api explorer, it asks whether to use the google account or the youtube brand name. If we choose the latter, it works.

The issue and its solution are discussed at  

Accordingly, started work on a script of our own, based on this blog post, but paused development since manual creation of broadcasts was preferred due to the complicated setup which depends on GDrive service which would fail at least once a month as my previous experience with Drive service shows.

The one take-away from this exercise seemed to be that the 'consent screen' needs to be set to 'Production' for this workaround to work, otherwise the Oauth doesn't proceed.

Sunday, June 16, 2024

Missing Site UUID or Hub Secret error in Moodle

One of our Moodle sites was presenting users with this error, "Missing Site UUID or Hub Secret. Please check your Hub registration".

Apparently the fix is to change a setting, as mentioned at
https://h5p.org/node/1472461

"uncheck the option "Use H5P-hub. mod_hvp | hub_is_enabled" in the H5P settings in Moodle (.../admin/settings.php?section=modsettinghvp"

But that setting says, "It's strongly encouraged to keep this option enabled. The H5P Hub provides an easy interface for getting new content types and keeping existing content types up to date. In the future, it will also make it easier to share and reuse content. If this option is disabled you'll have to install and update content types through file upload forms."

There is also an option to "Register an account with H5P hub" just below that.

I have now tried entering some data into the "register an account" part, for one of our Moodle sites.

Hopefully this resolves the issue.

Sunday, June 02, 2024

closed Airtable and SendinBlue (now Brevo) accounts

Since I'm no longer using their services, closed Airtable and Brevo (formerly Sendinblue) accounts. For Airtable, I copy-pasted a table I had made into a Google Sheet, deleted collaborators from it, and then deleted my account. 

Saturday, June 01, 2024

VP9 codec for 4K video on Raspberry Pi4 - stutters

Tested a video encoded with VP9 - very good quality 4K video - only 2.5 GB file size for a 24 minute 4K video - but playback on Kodi running on Raspberry Pi 4 stutters for high complexity scenes. x265 is the way to go, for now.