mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-12-22 16:30:13 +00:00
x.comでも展開ができるように (#11757)
This commit is contained in:
parent
3f08581ae8
commit
cb80dff7df
2 changed files with 10 additions and 1 deletions
|
@ -133,7 +133,7 @@ let unknownUrl = $ref(false);
|
||||||
const requestUrl = new URL(props.url);
|
const requestUrl = new URL(props.url);
|
||||||
if (!['http:', 'https:'].includes(requestUrl.protocol)) throw new Error('invalid url');
|
if (!['http:', 'https:'].includes(requestUrl.protocol)) throw new Error('invalid url');
|
||||||
|
|
||||||
if (requestUrl.hostname === 'twitter.com' || requestUrl.hostname === 'mobile.twitter.com') {
|
if (requestUrl.hostname === 'twitter.com' || requestUrl.hostname === 'mobile.twitter.com' || requestUrl.hostname === 'x.com' || requestUrl.hostname === 'mobile.x.com') {
|
||||||
const m = requestUrl.pathname.match(/^\/.+\/status(?:es)?\/(\d+)/);
|
const m = requestUrl.pathname.match(/^\/.+\/status(?:es)?\/(\d+)/);
|
||||||
if (m) tweetId = m[1];
|
if (m) tweetId = m[1];
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,4 +152,13 @@ describe('MkUrlPreview', () => {
|
||||||
assert.strictEqual(iframe?.getAttribute('allow'), 'fullscreen;web-share');
|
assert.strictEqual(iframe?.getAttribute('allow'), 'fullscreen;web-share');
|
||||||
assert.strictEqual(iframe?.getAttribute('sandbox'), 'allow-popups allow-scripts allow-same-origin');
|
assert.strictEqual(iframe?.getAttribute('sandbox'), 'allow-popups allow-scripts allow-same-origin');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Loading a post in iframe', async () => {
|
||||||
|
const iframe = await renderAndOpenPreview({
|
||||||
|
url: 'https://x.com/i/web/status/1685072521782325249',
|
||||||
|
});
|
||||||
|
assert.exists(iframe, 'iframe should exist');
|
||||||
|
assert.strictEqual(iframe?.getAttribute('allow'), 'fullscreen;web-share');
|
||||||
|
assert.strictEqual(iframe?.getAttribute('sandbox'), 'allow-popups allow-scripts allow-same-origin');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue