mirror of
https://github.com/misskey-dev/summaly.git
synced 2025-05-29 09:27:16 +09:00
Refactor: Move the post logic to each plugins
This commit is contained in:
parent
85e00bf66f
commit
7a28b44d44
@ -106,10 +106,10 @@ export default async (url: URL.Url): Promise<Summary> => {
|
||||
}
|
||||
|
||||
return {
|
||||
title: title,
|
||||
icon: icon,
|
||||
description: description,
|
||||
thumbnail: image,
|
||||
sitename: siteName
|
||||
title: title || null,
|
||||
icon: icon || null,
|
||||
description: description || null,
|
||||
thumbnail: image || null,
|
||||
sitename: siteName || null
|
||||
};
|
||||
};
|
||||
|
10
src/index.ts
10
src/index.ts
@ -64,16 +64,6 @@ export default async (url: string, options: Options): Promise<Result> => {
|
||||
? await match.summary(_url)
|
||||
: await general(_url);
|
||||
|
||||
// Replace '' to null
|
||||
Object.keys(summary).forEach(k => {
|
||||
if (summary[k]) {
|
||||
summary[k] = summary[k].trim();
|
||||
if (summary[k] === '') {
|
||||
summary[k] = null;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return Object.assign(summary, {
|
||||
url: actualUrl
|
||||
});
|
||||
|
@ -34,10 +34,10 @@ export async function summary(url: URL.Url) {
|
||||
const thumbnail: string = $('#landingImage').attr('src');
|
||||
|
||||
return {
|
||||
title: title,
|
||||
title: title || null,
|
||||
icon: 'https://www.amazon.com/favicon.ico',
|
||||
description: description,
|
||||
thumbnail: thumbnail,
|
||||
description: description || null,
|
||||
thumbnail: thumbnail || null,
|
||||
sitename: 'Amazon'
|
||||
};
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user