mirror of
https://codeberg.org/Hyperpipe/Hyperpipe
synced 2025-06-28 05:08:00 +02:00
parent
7273fcabc8
commit
dc969e44ee
11 changed files with 522 additions and 177 deletions
|
@ -1,4 +1,4 @@
|
|||
import { Buffer } from 'buffer';
|
||||
import { Buffer } from 'buffer/';
|
||||
window.Buffer = Buffer;
|
||||
import { json2xml } from 'xml-js';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useStore } from './util.js';
|
||||
import { useStore, useSanitize } from './util.js';
|
||||
|
||||
export function getPipedQuery() {
|
||||
const papi = new URLSearchParams(location.search).get('pipedapi');
|
||||
|
@ -7,7 +7,7 @@ export function getPipedQuery() {
|
|||
return '';
|
||||
}
|
||||
|
||||
return '?pipedapi=' + papi;
|
||||
return '?pipedapi=' + useSanitize(papi);
|
||||
}
|
||||
|
||||
export async function getJson(url) {
|
||||
|
@ -27,9 +27,7 @@ export async function getJson(url) {
|
|||
);
|
||||
console.error(res.message);
|
||||
} else if (res) {
|
||||
return res;
|
||||
} else {
|
||||
return;
|
||||
return JSON.parse(useSanitize(JSON.stringify(res)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
import DOMPurify from 'dompurify';
|
||||
|
||||
export function useSanitize(txt) {
|
||||
return DOMPurify.sanitize(txt);
|
||||
}
|
||||
|
||||
export function useRoute(l) {
|
||||
history.pushState({}, '', l);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue