diff --git a/README.md b/README.md index 79cb8a5..e7060d9 100644 --- a/README.md +++ b/README.md @@ -85,15 +85,16 @@ A Promise of an Object that contains properties below: | Property | Type | Description | |:----------------|:-------------------|:-----------------------------------------------------------| -| **title** | *string* \| *null* | The title of the web page | -| **icon** | *string* \| *null* | The url of the icon of the web page | -| **description** | *string* \| *null* | The description of the web page | -| **thumbnail** | *string* \| *null* | The url of the thumbnail of the web page | -| **sitename** | *string* \| *null* | The name of the web site | -| **player** | *Player* | The player of the web page | -| **sensitive** | *boolean* | Whether the url is sensitive | -| **activityPub** | *string* \| *null* | The url of the ActivityPub representation of that web page | -| **url** | *string* | The url of the web page | +| **title** | *string* \| *null* | The title of the web page | +| **icon** | *string* \| *null* | The url of the icon of the web page | +| **description** | *string* \| *null* | The description of the web page | +| **thumbnail** | *string* \| *null* | The url of the thumbnail of the web page | +| **sitename** | *string* \| *null* | The name of the web site | +| **player** | *Player* | The player of the web page | +| **sensitive** | *boolean* | Whether the url is sensitive | +| **activityPub** | *string* \| *null* | The url of the ActivityPub representation of that web page | +| **fediverseCreator** | *string* \| *null* | The pages fediverse handle | +| **url** | *string* | The url of the web page | #### Summary diff --git a/src/general.ts b/src/general.ts index 6351d31..c9ef255 100644 --- a/src/general.ts +++ b/src/general.ts @@ -251,6 +251,9 @@ export async function parseGeneral(_url: URL | string, res: Awaited + + + + + + Meow + + +

Hellooo!

+

:3

+ + diff --git a/test/index.ts b/test/index.ts index e983e83..9e53dfe 100644 --- a/test/index.ts +++ b/test/index.ts @@ -73,6 +73,7 @@ test('basic', async () => { sensitive: false, url: host + '/', activityPub: null, + fediverseCreator: null, }); }); @@ -102,6 +103,7 @@ test('Stage Bye Stage', async () => { 'sitename': 'YouTube', 'sensitive': false, 'activityPub': null, + 'fediverseCreator': null, 'url': 'https://www.youtube.com/watch?v=NMIEAhH_fTU', }, ); @@ -507,6 +509,36 @@ describe('ActivityPub', () => { }); }); +describe('Fediverse Creator', () => { + test('Basic', async () => { + app = fastify(); + app.get('*', (request, reply) => { + const content = fs.readFileSync(_dirname + '/htmls/fediverse-creator.html'); + reply.header('content-length', content.length); + reply.header('content-type', 'text/html'); + return reply.send(content); + }); + await app.listen({ port }); + + const summary = await summaly(host); + expect(summary.fediverseCreator).toBe('@test@example.com'); + }); + + test('Null', async () => { + app = fastify(); + app.get('*', (request, reply) => { + const content = fs.readFileSync(_dirname + '/htmls/basic.html'); + reply.header('content-length', content.length); + reply.header('content-type', 'text/html'); + return reply.send(content); + }); + await app.listen({ port }); + + const summary = await summaly(host); + expect(summary.fediverseCreator).toBeNull(); + }); +}); + describe('sensitive', () => { test('default', async () => { app = fastify();