feat: add oEmbed support (#6)

* feat: add oEmbed support

* more safelisted features

* fix the syntax

* Update README.md

* permissions

* names

* playerを使うように

* fix type error

* support width (for size ratio)

* test for type: video

* nullable width

* restore max height test

* ignored permissions

* restore autoplay

* Use WHATWG URL

---------

Co-authored-by: tamaina <tamaina@hotmail.co.jp>
This commit is contained in:
Kagami Sascha Rosylight
2023-03-13 18:46:41 +01:00
committed by GitHub
parent 51f3870e1f
commit eab3766db9
46 changed files with 3936 additions and 112 deletions

View File

@ -84,14 +84,15 @@ async function getResponse(args) {
limit: 0,
},
});
return await receiveResponce({ req, typeFilter: args.typeFilter });
return await receiveResponse({ req, typeFilter: args.typeFilter });
}
async function receiveResponce(args) {
async function receiveResponse(args) {
const req = args.req;
const maxSize = MAX_RESPONSE_SIZE;
req.on('response', (res) => {
// Check html
if (args.typeFilter && !res.headers['content-type']?.match(args.typeFilter)) {
// console.warn(res.headers['content-type']);
req.cancel(`Rejected by type filter ${res.headers['content-type']}`);
return;
}