Compare commits

..

No commits in common. "5ca87c1b7cf4f0e85fea588177b08e3068857234" and "fb200ceb936fc15e47c5392412bed16381ef0785" have entirely different histories.

2 changed files with 2 additions and 29 deletions

View File

@ -159,7 +159,7 @@ textarea { resize: vertical; min-height: 120px; }
<div class="footer">Creative AI-imbued UI • stackchain-dashboard</div>
<script src="static/markdown.js"></script>
<script src="/static/markdown.js"></script>
<script src="static/commands.js"></script>
<script>
(function(){

View File

@ -1,24 +1,9 @@
import json
import subprocess
from html.parser import HTMLParser
from pathlib import Path
from urllib.parse import urljoin
FRONTEND = Path(__file__).parent.parent / "frontend"
RENDERER = FRONTEND / "markdown.js"
class ScriptSourceParser(HTMLParser):
def __init__(self):
super().__init__()
self.sources = []
def handle_starttag(self, tag, attrs):
if tag == "script":
source = dict(attrs).get("src")
if source:
self.sources.append(source)
RENDERER = Path(__file__).parent.parent / "frontend" / "markdown.js"
def test_markdown_renderer_escapes_raw_html_before_rendering_heading():
@ -38,15 +23,3 @@ def test_markdown_renderer_escapes_raw_html_before_rendering_heading():
assert result.stdout == (
"<h1>&lt;img src=x onerror=alert(document.domain)&gt;</h1>"
)
def test_markdown_script_resolves_inside_dashboard_subpath():
parser = ScriptSourceParser()
parser.feed((FRONTEND / "index.html").read_text())
markdown_source = next(
source for source in parser.sources if source.endswith("markdown.js")
)
assert urljoin(
"https://forge.alexanderwhitestone.com/dashboard/", markdown_source
) == "https://forge.alexanderwhitestone.com/dashboard/static/markdown.js"