feat: support get dynamic page meta data (#2632)

This commit is contained in:
Qi
2023-06-01 11:03:16 +08:00
committed by Himself65
parent a018d50780
commit 369282e29e
5 changed files with 112 additions and 76 deletions
+4 -2
View File
@@ -1,4 +1,4 @@
import { app, BrowserWindow, nativeTheme, session } from 'electron';
import { app, BrowserWindow, nativeTheme } from 'electron';
import type { NamespaceHandlers } from '../type';
import { isMacOS } from '../utils';
@@ -42,7 +42,9 @@ export const uiHandlers = {
},
getBookmarkDataByLink: async (_, url: string) => {
return getMetaData(url, {
ua: session.defaultSession.getUserAgent(),
shouldReGetHTML: metaData => {
return !metaData.title && !metaData.description;
},
});
},
} satisfies NamespaceHandlers;