This commit is contained in:
Kieran 2023-01-03 22:24:53 +00:00
parent 8e783b0eb6
commit 455cdc4bf0
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
2 changed files with 48 additions and 42 deletions

View File

@ -111,6 +111,7 @@ export default function Note(props) {
if (typeof f === "string") {
return f.split(UrlRegex).map(a => {
if (a.startsWith("http")) {
try {
let url = new URL(a);
let ext = url.pathname.toLowerCase().match(FileExtensionRegex);
if (ext) {
@ -133,6 +134,9 @@ export default function Note(props) {
} else {
return <a href={url}>{url.toString()}</a>
}
} catch (e) {
console.warn(`Not a valid url: ${a}`);
}
}
return a;
});

View File

@ -43,6 +43,7 @@ export default class Connection {
}
OnMessage(e) {
if (e.data.length > 0) {
let msg = JSON.parse(e.data);
let tag = msg[0];
switch (tag) {
@ -69,6 +70,7 @@ export default class Connection {
}
}
}
}
OnError(e) {
console.log(e);