From 92bf01a18369513c8bdecd0639d9f855696118c7 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Tue, 12 Nov 2024 21:47:15 -0500 Subject: [PATCH] ssb+issues: Fix missing dependencies of my commonmarkjs extensions. --- apps/issues.json | 2 +- apps/issues/tf-utils.js | 6 ++++++ apps/ssb.json | 2 +- apps/ssb/tf-utils.js | 6 ++++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/apps/issues.json b/apps/issues.json index 73ff5b4e..d6d7c077 100644 --- a/apps/issues.json +++ b/apps/issues.json @@ -1,5 +1,5 @@ { "type": "tildefriends-app", "emoji": "🦟", - "previous": "&4QfQjoCbdmCRu0nIBdOFiHBydYlDyyXrWqve6ELAmKA=.sha256" + "previous": "&O0huuEgL/UQC9bkUfhPOyZFo9eRiz+koOkba6QwCGNA=.sha256" } diff --git a/apps/issues/tf-utils.js b/apps/issues/tf-utils.js index dcb702f4..d871f02e 100644 --- a/apps/issues/tf-utils.js +++ b/apps/issues/tf-utils.js @@ -1,5 +1,11 @@ import * as linkify from './commonmark-linkify.js'; +var reUnsafeProtocol = /^javascript:|vbscript:|file:|data:/i; +var reSafeDataProtocol = /^data:image\/(?:png|gif|jpeg|webp)/i; +var potentiallyUnsafe = function(url) { + return reUnsafeProtocol.test(url) && !reSafeDataProtocol.test(url); +}; + function image(node, entering) { if ( node.firstChild?.type === 'text' && diff --git a/apps/ssb.json b/apps/ssb.json index 2da156a5..1ce4263e 100644 --- a/apps/ssb.json +++ b/apps/ssb.json @@ -1,5 +1,5 @@ { "type": "tildefriends-app", "emoji": "🐌", - "previous": "&GDAJLaMKjeSXooWgpbw7G/40hgtRT1mYVK2twtEhWHA=.sha256" + "previous": "&CKsS2aS8+7u9S5jDCiqBLA6xr7xLdMHclMKHjzwxcnM=.sha256" } diff --git a/apps/ssb/tf-utils.js b/apps/ssb/tf-utils.js index 0fda5abb..65340824 100644 --- a/apps/ssb/tf-utils.js +++ b/apps/ssb/tf-utils.js @@ -2,6 +2,12 @@ import * as hashtagify from './commonmark-hashtag.js'; const k_code_classes = 'w3-theme-l4 w3-theme-border w3-round'; +var reUnsafeProtocol = /^javascript:|vbscript:|file:|data:/i; +var reSafeDataProtocol = /^data:image\/(?:png|gif|jpeg|webp)/i; +var potentiallyUnsafe = function(url) { + return reUnsafeProtocol.test(url) && !reSafeDataProtocol.test(url); +}; + function image(node, entering) { if ( node.firstChild?.type === 'text' &&