It may be useful to be able to have <replay-web-page> embed also take over the favicons for the page, propagating them from the replay (eg. if in a single page app where replay takes up most of the view). This PR adds a `updateFavicons` attribute, used as `<replay-web-page ... updateFavicons>` to have icons propagated from the replay to the top-level frame. (This may be especially useful with `deepLink` option, which allows for linking directly to archived pages) Details: - enabled via 'updateFavicons' attribute on <replay-web-page> - pass icons via postMessage() update, adding type to embed message to allow different types of message - currently supporting 'urlchange' and 'favicons' message types - add shared updateFaviconLinks() in misc.ts, used by both embed and main app --------- Co-authored-by: emma <hi@emma.cafe>
60 lines
1.1 KiB
TypeScript
60 lines
1.1 KiB
TypeScript
export type URLResource = {
|
|
id: number;
|
|
title: string;
|
|
url: string;
|
|
mime: string;
|
|
status: string;
|
|
date: Date;
|
|
ts: string;
|
|
desc?: string;
|
|
timestamp?: string;
|
|
size: number;
|
|
favIconUrl: string;
|
|
text?: string;
|
|
};
|
|
|
|
export type Page = URLResource;
|
|
|
|
export type ItemType = {
|
|
filename: string;
|
|
sourceUrl: string;
|
|
replayPrefix: string;
|
|
apiPrefix: string;
|
|
|
|
/**
|
|
* Archived Item ID
|
|
*/
|
|
coll?: string;
|
|
// TODO(emma) is `id` the same as `coll`? should they be merged?
|
|
id?: string;
|
|
name?: string;
|
|
title?: string;
|
|
loadUrl?: string;
|
|
desc?: string;
|
|
description?: string;
|
|
resources?: { path: string; name: string }[];
|
|
verify?: {
|
|
numValid?: number;
|
|
numInvalid?: number;
|
|
domain?: string;
|
|
certFingerprint?: string;
|
|
datapackageHash?: string;
|
|
publicKey?: string;
|
|
software?: string;
|
|
};
|
|
onDemand?: boolean;
|
|
pages: URLResource[];
|
|
curatedPages: (URLResource & { list: string })[];
|
|
lists: URLResource[];
|
|
ctime?: string;
|
|
totalSize?: unknown;
|
|
size?: number | string;
|
|
};
|
|
|
|
export type FavIconEventDetail = {
|
|
icons: {
|
|
rel: string;
|
|
href: string;
|
|
}[];
|
|
};
|