Add a fallback function to crypto.randomUUID, Property Brokers is using Orchard Core - This week in Orchard (13/10/2023)

Gábor Domonkos's avatar
Announcement, This week in Orchard

Add IsViewOrPageResult extension, add a fallback function to crypto.randomUUID; and the brand-new Orchard Core site of Property Brokers! Check out our post for the details!

Orchard Core updates

Add IsViewOrPageResult extension

In the filters, we need to inject stuff only if the request is in full view. And in Orchard Core, we need to do this check a lot. To decide whether the rendering result is a full view, you can use the newly added IsViewOrPageResult extension.

Add IsViewOrPageResult extension

Add a fallback function to crypto.randomUUID

The issue here was the crypto.randomUUID function is only available in the HTTPS context, not in HTTP. In HTTP, you get the following error in the console: crypto.randomUUID is not a function.

We use this method to upload images to the Media Library. In an HTTP context, if you access the Media Library and upload a file, nothing happens, and you will get the mentioned error in the console.

There is a website called HTTP Forever, which does not use HTTPS. If you visit this site and type the crypto.randomUUID() in the console, you will get an error saying it's not a function.

randomUUID is not a function in HTTP

But if you visit a site that uses HTTPS, like Lombiq.com, and type the same in the console, you will get a result.

randomUUID in HTTPS

So, the crypto exists on HTTP, but the randomUUID function is not. Of course, shipping a website that is not HTTPS is maybe not a good idea but if you have a preview/staging environment where you don't want to maintain SSL certificates and so on, you may use HTTP.

After this fix, if you host your Orchard Core site in HTTP, you will be able to call this function and upload files to the Media Library.

News from the community

A new website using Orchard Core: Property Brokers

Property Brokers is New Zealand's largest regional real estate agency. Check out this brand-new, amazing-looking Orchard Core site here!

Property Brokers

If you are interested in more websites using Orchard and Orchard Core, don't forget to visit Show Orchard. Show Orchard is a website for showing representative Orchard CMS (and now Orchard Core) websites all around the internet. It was started by Ryan Drew Burnett, but since he doesn't work with Orchard anymore, as announced earlier, it is now maintained by our team at Lombiq Technologies.

Orchard Dojo Newsletter

Lombiq's Orchard Dojo Newsletter has 493 subscribers! We have started this newsletter to inform the community around Orchard of the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post is published to Orchard Dojo, including This week in Orchard of course.

Do you know of other Orchard enthusiasts who would like to read our weekly articles? Tell them to subscribe here!

If you are interested in more news about Orchard and the details of the topics above, don't forget to check out the recording of this Orchard meeting!

No Comments

Add a Comment