mirror of
https://codeberg.org/Hyperpipe/Hyperpipe
synced 2025-06-27 12:48:01 +02:00
chore(deps): remove dompurify
This commit is contained in:
parent
7b18bdd9d5
commit
8d01101331
8 changed files with 14 additions and 24 deletions
|
@ -123,7 +123,6 @@ You can reach out to me personally on:
|
|||
- ViteJS -> [MIT][vite]
|
||||
- shaka-player -> [Apache-2.0][shaka]
|
||||
- PeerJS -> [MIT][peer]
|
||||
- DOMPurify -> [Apache-2.0][purify]
|
||||
- SortableJS -> [MIT][sortable]
|
||||
- Bootstrap Icons -> [MIT][bi]
|
||||
- VueJS theme -> [MIT][vuetheme]
|
||||
|
@ -151,7 +150,6 @@ You can reach out to me personally on:
|
|||
[bi]: https://github.com/twbs/icons/blob/main/LICENSE.md
|
||||
[peer]: https://github.com/peers/peerjs/blob/master/LICENSE
|
||||
[shaka]: https://github.com/shaka-project/shaka-player/blob/main/LICENSE
|
||||
[purify]: https://github.com/cure53/DOMPurify/blob/main/LICENSE
|
||||
[sortable]: https://github.com/SortableJS/Sortable/blob/master/LICENSE
|
||||
[nord]: https://github.com/arcticicestudio/nord/blob/develop/LICENSE.md
|
||||
[vuetheme]: https://github.com/vuejs/theme/blob/main/LICENSE
|
||||
|
|
6
package-lock.json
generated
6
package-lock.json
generated
|
@ -9,7 +9,6 @@
|
|||
"version": "0.0.0",
|
||||
"dependencies": {
|
||||
"bootstrap-icons": "^1.11.3",
|
||||
"dompurify": "^3.1.6",
|
||||
"peerjs": "^1.5.4",
|
||||
"pinia": "^2.1.7",
|
||||
"shaka-player": "^4.10.5",
|
||||
|
@ -3097,11 +3096,6 @@
|
|||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/dompurify": {
|
||||
"version": "3.1.6",
|
||||
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.1.6.tgz",
|
||||
"integrity": "sha512-cTOAhc36AalkjtBpfG6O8JimdTMWNXjiePT2xQH/ppBGi/4uIpmj8eKyIkMJErXWARyINV/sB38yf8JCLF5pbQ=="
|
||||
},
|
||||
"node_modules/ejs": {
|
||||
"version": "3.1.10",
|
||||
"resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz",
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"bootstrap-icons": "^1.11.3",
|
||||
"dompurify": "^3.1.6",
|
||||
"peerjs": "^1.5.4",
|
||||
"pinia": "^2.1.7",
|
||||
"shaka-player": "^4.10.5",
|
||||
|
|
|
@ -12,8 +12,8 @@ const { t } = useI18n(),
|
|||
<template>
|
||||
<TextModal>
|
||||
<template #content>
|
||||
<pre class="placeholder" :data-placeholder="t('info.no_info')">{{
|
||||
text ? parse(text.replaceAll('<br>', '\n')) : ''
|
||||
<pre class="placeholder" :data-placeholder="t('info.no_info')">{{
|
||||
text && parse(text.replaceAll('<br>', '\n'))
|
||||
}}</pre>
|
||||
</template>
|
||||
</TextModal>
|
||||
|
|
|
@ -44,9 +44,7 @@ get();
|
|||
|
||||
watch(
|
||||
() => data.state.url,
|
||||
() => {
|
||||
get();
|
||||
},
|
||||
() => get(),
|
||||
);
|
||||
</script>
|
||||
|
||||
|
|
|
@ -32,7 +32,10 @@ export async function getJson(url, opts) {
|
|||
);
|
||||
|
||||
console.error(res.message);
|
||||
} else if (res) return JSON.parse(useSanitize(JSON.stringify(res)));
|
||||
return {};
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
export async function getJsonPiped(path, opts) {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import DOMPurify from 'dompurify';
|
||||
import { useI18n } from '@/stores/misc.js';
|
||||
|
||||
export const AMP = /&/g;
|
||||
|
@ -6,9 +5,10 @@ export const PL_EXP =
|
|||
/[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}/;
|
||||
|
||||
export function useSanitize(txt) {
|
||||
return DOMPurify.sanitize(txt, {
|
||||
ALLOWED_TAGS: ['br'],
|
||||
});
|
||||
return ('' + txt).replace(AMP, '&')
|
||||
.replace(/&/g, '&')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/</g, '<');
|
||||
}
|
||||
|
||||
export function useAutoTheme(t) {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { useSanitize } from '@/scripts/util.js';
|
||||
|
||||
function useAttr(json) {
|
||||
let attrs = '';
|
||||
|
||||
|
@ -28,11 +30,7 @@ function useElems(json) {
|
|||
} else elems += '/>';
|
||||
break;
|
||||
case 'string':
|
||||
elems += ('' + elem)
|
||||
.replace(/&/g, '&')
|
||||
.replace(/&/g, '&')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/</g, '<');
|
||||
elems += useSanitize(elem);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue