diff --git a/src/SEQTA.ts b/src/SEQTA.ts index 2df60db7..d2e2a438 100644 --- a/src/SEQTA.ts +++ b/src/SEQTA.ts @@ -32,6 +32,7 @@ import LogoLightOutline from '@/resources/icons/betterseqta-light-outline.png' import icon48 from '@/resources/icons/icon-48.png?base64' import assessmentsicon from '@/seqta/icons/assessmentsIcon' import coursesicon from '@/seqta/icons/coursesIcon' +import kofi from '@/resources/kofi.png' // Stylesheets import iframeCSS from '@/css/iframe.scss?raw' @@ -337,6 +338,10 @@ export function OpenWhatsNewPopup() { `, ).firstChild + const kofi_url = browser.runtime.getURL(kofi) + + console.log(kofi_url) + let footer = stringToHTML( /* html */ `
@@ -358,6 +363,12 @@ export function OpenWhatsNewPopup() {
+ +
+ + Buy Me a Coffee at ko-fi.com + +
`).firstChild diff --git a/src/resources/kofi.png b/src/resources/kofi.png new file mode 100644 index 00000000..b4ed4045 Binary files /dev/null and b/src/resources/kofi.png differ diff --git a/src/seqta/utils/stringToHTML.ts b/src/seqta/utils/stringToHTML.ts index 37449f60..0c1a8d7d 100644 --- a/src/seqta/utils/stringToHTML.ts +++ b/src/seqta/utils/stringToHTML.ts @@ -1,12 +1,20 @@ import DOMPurify from 'dompurify'; export default function stringToHTML(str: string, styles = false) { - var parser = new DOMParser(); - str = DOMPurify.sanitize(str, { ADD_ATTR: ['onclick'] }); - var doc = parser.parseFromString(str, 'text/html'); + const parser = new DOMParser(); + + + str = DOMPurify.sanitize(str, { + ADD_ATTR: ['onclick'], + ALLOWED_URI_REGEXP: /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|chrome-extension):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i + }); + + const doc = parser.parseFromString(str, 'text/html'); + if (styles) { doc.body.style.cssText = 'height: auto; overflow: scroll; margin: 0px; background: var(--background-primary);'; } + return doc.body; } \ No newline at end of file