mirror of
https://github.com/XFox111/TabsAsideExtension.git
synced 2026-04-22 07:58:01 +03:00
feat: captureVisibleTab fallback for tab previews
This commit is contained in:
@@ -13,6 +13,7 @@ export default async function updateGraphics(
|
||||
function getGraphics(url: string): GraphicsItem | null
|
||||
{
|
||||
const preview = tempGraphics[url]?.preview ?? localGraphics[url]?.preview;
|
||||
const capture = tempGraphics[url]?.capture ?? localGraphics[url]?.capture;
|
||||
const icon = tempGraphics[url]?.icon ?? localGraphics[url]?.icon;
|
||||
|
||||
const graphics: GraphicsItem = {};
|
||||
@@ -21,6 +22,8 @@ export default async function updateGraphics(
|
||||
graphics.preview = preview;
|
||||
if (icon)
|
||||
graphics.icon = icon;
|
||||
if (capture)
|
||||
graphics.capture = capture;
|
||||
|
||||
return preview || icon ? graphics : null;
|
||||
}
|
||||
|
||||
@@ -13,12 +13,12 @@ export default function migrateCollections(legacyCollections: LegacyCollection[]
|
||||
{
|
||||
const title: string | undefined = legacyCollection.titles[index];
|
||||
const icon: string | undefined = legacyCollection.icons?.[index];
|
||||
const preview: string | undefined = legacyCollection.thumbnails?.[index];
|
||||
const capture: string | undefined = legacyCollection.thumbnails?.[index];
|
||||
|
||||
if (!graphics[url])
|
||||
graphics[url] = { icon, preview };
|
||||
graphics[url] = { icon, capture };
|
||||
else
|
||||
graphics[url] = { icon: graphics[url].icon ?? icon, preview: graphics[url].preview ?? preview };
|
||||
graphics[url] = { icon: graphics[url].icon ?? icon, capture: graphics[url].preview ?? capture };
|
||||
|
||||
return {
|
||||
type: "tab",
|
||||
|
||||
@@ -38,11 +38,11 @@ export default async function migrateStorage(): Promise<void>
|
||||
for (const [key, record] of Object.entries(v2Graphics))
|
||||
{
|
||||
if (!graphics[key])
|
||||
graphics[key] = { icon: record.iconUrl, preview: record.pageCapture };
|
||||
graphics[key] = { icon: record.iconUrl, capture: record.pageCapture };
|
||||
else
|
||||
{
|
||||
graphics[key].icon ??= record.iconUrl;
|
||||
graphics[key].preview ??= record.pageCapture;
|
||||
graphics[key].capture ??= record.pageCapture;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user