mirror of
https://github.com/misskey-dev/summaly.git
synced 2025-08-10 18:23:51 +09:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
c7d71a9ec2 | |||
994f420b46 | |||
5a3321a04f |
@ -1,3 +1,7 @@
|
|||||||
|
4.0.2 / 2023-04-20
|
||||||
|
------------------
|
||||||
|
* YouTubeをフルスクリーンにできない問題を修正
|
||||||
|
|
||||||
4.0.1 / 2023-03-16
|
4.0.1 / 2023-03-16
|
||||||
------------------
|
------------------
|
||||||
* oEmbedの読み込みでエラーが発生した際は、エラーにせずplayerの中身をnullにするように
|
* oEmbedの読み込みでエラーが発生した際は、エラーにせずplayerの中身をnullにするように
|
||||||
|
@ -103,6 +103,9 @@ async function getOEmbedPlayer($, pageUrl) {
|
|||||||
const allowedPermissions = (iframe.attr('allow') ?? '').split(/\s*;\s*/g)
|
const allowedPermissions = (iframe.attr('allow') ?? '').split(/\s*;\s*/g)
|
||||||
.filter(s => s)
|
.filter(s => s)
|
||||||
.filter(s => !ignoredList.includes(s));
|
.filter(s => !ignoredList.includes(s));
|
||||||
|
if (iframe.attr('allowfullscreen') === '') {
|
||||||
|
allowedPermissions.push('fullscreen');
|
||||||
|
}
|
||||||
if (allowedPermissions.some(allow => !safeList.includes(allow))) {
|
if (allowedPermissions.some(allow => !safeList.includes(allow))) {
|
||||||
// This iframe is probably too powerful to be embedded
|
// This iframe is probably too powerful to be embedded
|
||||||
return null;
|
return null;
|
||||||
|
13
package.json
13
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "summaly",
|
"name": "summaly",
|
||||||
"version": "4.0.1",
|
"version": "4.0.2",
|
||||||
"description": "Get web page's summary",
|
"description": "Get web page's summary",
|
||||||
"author": "syuilo <syuilotan@yahoo.co.jp>",
|
"author": "syuilo <syuilotan@yahoo.co.jp>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@ -9,6 +9,7 @@
|
|||||||
"main": "./built/index.js",
|
"main": "./built/index.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"types": "./built/index.d.ts",
|
"types": "./built/index.d.ts",
|
||||||
|
"packageManager": "pnpm@8.3.1",
|
||||||
"files": [
|
"files": [
|
||||||
"built",
|
"built",
|
||||||
"LICENSE"
|
"LICENSE"
|
||||||
@ -19,17 +20,17 @@
|
|||||||
"serve": "fastify start ./built/index.js"
|
"serve": "fastify start ./built/index.js"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@jest/globals": "^29.4.2",
|
"@jest/globals": "^29.5.0",
|
||||||
"@swc/core": "^1.3.35",
|
"@swc/core": "^1.3.52",
|
||||||
"@swc/jest": "^0.2.24",
|
"@swc/jest": "^0.2.26",
|
||||||
"@types/cheerio": "0.22.18",
|
"@types/cheerio": "0.22.18",
|
||||||
"@types/debug": "4.1.7",
|
"@types/debug": "4.1.7",
|
||||||
"@types/escape-regexp": "^0.0.1",
|
"@types/escape-regexp": "^0.0.1",
|
||||||
"@types/node": "16.11.12",
|
"@types/node": "16.11.12",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"fastify": "^4.13.0",
|
"fastify": "^4.15.0",
|
||||||
"fastify-cli": "^5.7.1",
|
"fastify-cli": "^5.7.1",
|
||||||
"jest": "^29.4.2",
|
"jest": "^29.5.0",
|
||||||
"typescript": "4.5.3"
|
"typescript": "4.5.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
1409
pnpm-lock.yaml
generated
1409
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -115,6 +115,9 @@ async function getOEmbedPlayer($: cheerio.CheerioAPI, pageUrl: string): Promise<
|
|||||||
(iframe.attr('allow') ?? '').split(/\s*;\s*/g)
|
(iframe.attr('allow') ?? '').split(/\s*;\s*/g)
|
||||||
.filter(s => s)
|
.filter(s => s)
|
||||||
.filter(s => !ignoredList.includes(s));
|
.filter(s => !ignoredList.includes(s));
|
||||||
|
if (iframe.attr('allowfullscreen') === '') {
|
||||||
|
allowedPermissions.push('fullscreen');
|
||||||
|
}
|
||||||
if (allowedPermissions.some(allow => !safeList.includes(allow))) {
|
if (allowedPermissions.some(allow => !safeList.includes(allow))) {
|
||||||
// This iframe is probably too powerful to be embedded
|
// This iframe is probably too powerful to be embedded
|
||||||
return null;
|
return null;
|
||||||
|
@ -294,7 +294,14 @@ describe("oEmbed", () => {
|
|||||||
await setUpFastify('oembed-allow-fullscreen.json');
|
await setUpFastify('oembed-allow-fullscreen.json');
|
||||||
const summary = await summaly(host);
|
const summary = await summaly(host);
|
||||||
expect(summary.player.url).toBe('https://example.com/');
|
expect(summary.player.url).toBe('https://example.com/');
|
||||||
expect(summary.player.allow).toStrictEqual(['fullscreen'])
|
expect(summary.player.allow).toStrictEqual(['fullscreen']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('allows legacy allowfullscreen', async () => {
|
||||||
|
await setUpFastify('oembed-allow-fullscreen-legacy.json');
|
||||||
|
const summary = await summaly(host);
|
||||||
|
expect(summary.player.url).toBe('https://example.com/');
|
||||||
|
expect(summary.player.allow).toStrictEqual(['fullscreen']);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('allows safelisted permissions', async () => {
|
test('allows safelisted permissions', async () => {
|
||||||
|
7
test/oembed/oembed-allow-fullscreen-legacy.json
Normal file
7
test/oembed/oembed-allow-fullscreen-legacy.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"version": "1.0",
|
||||||
|
"type": "rich",
|
||||||
|
"html": "<iframe src='https://example.com/' allowfullscreen></iframe>",
|
||||||
|
"width": 500,
|
||||||
|
"height": 300
|
||||||
|
}
|
Reference in New Issue
Block a user