diff --git a/Report/index.ts b/Report/index.ts index 30151d6..4cd621b 100644 --- a/Report/index.ts +++ b/Report/index.ts @@ -5,14 +5,14 @@ import { checkParams } from '../utils/checkParams.js'; import { getManifestByLink } from '../utils/getManifestByLink.js'; import { analyzeServiceWorker, - AnalyzeServiceWorkerResponce, + AnalyzeServiceWorkerResponse, } from '../utils/analyzeServiceWorker.js'; import { AnalyticsInfo, uploadToAppInsights } from '../utils/analytics.js'; import { Report } from './type.js'; -import { dirname, join } from 'path'; +import { dirname } from 'path'; import { fileURLToPath } from 'url'; -import childProcess, { ChildProcess, exec, spawn } from 'child_process'; +import { ChildProcess, exec, spawn } from 'child_process'; const __dirname = dirname(fileURLToPath(import.meta.url)); // const _root = `${__dirname}/../..`; @@ -175,7 +175,7 @@ const audit = async ( url?: string; }; } = {}; - let swFeatures: AnalyzeServiceWorkerResponce | null = null; + let swFeatures: AnalyzeServiceWorkerResponse | null = null; const processServiceWorker = async () => { if (audits['service-worker-audit']?.details?.scriptUrl ) { diff --git a/utils/analytics.ts b/utils/analytics.ts index 75d0bba..30da7c5 100644 --- a/utils/analytics.ts +++ b/utils/analytics.ts @@ -188,6 +188,18 @@ export async function uploadToAppInsights( (_manifest['icons'] != undefined && (await validateSingleField('icons', _manifest['icons'])).valid) || false; + analyticsInfo.properties.hasEdgeSidePanel = + (_manifest['edge_side_panel'] != undefined && + (await validateSingleField('edge_side_panel', _manifest['edge_side_panel'])).valid) || + false; + analyticsInfo.properties.hasDisplayOverride = + (_manifest['display_override'] != undefined && + (await validateSingleField('display_override', _manifest['display_override'])).valid) || + false; + analyticsInfo.properties.hasHandleLinks = + (_manifest['handle_links'] != undefined && + (await validateSingleField('handle_links', _manifest['handle_links'])).valid) || + false; } else { analyticsInfo.properties.hasManifest = false; @@ -206,6 +218,8 @@ export async function uploadToAppInsights( _features.detectedSignsOfLogic; analyticsInfo.properties.hasEmptyLogic = _features.detectedEmpty; + analyticsInfo.properties.hasPushRegistration = + _features.detectedPushRegistration; } } diff --git a/utils/analyzeServiceWorker.ts b/utils/analyzeServiceWorker.ts index b663210..f4c8793 100644 --- a/utils/analyzeServiceWorker.ts +++ b/utils/analyzeServiceWorker.ts @@ -86,7 +86,7 @@ async function findAndFetchImportScripts(code: string, origin?: string): Promise return contents; } -export type AnalyzeServiceWorkerResponce = { +export type AnalyzeServiceWorkerResponse = { detectedBackgroundSync?: boolean, detectedPeriodicBackgroundSync?: boolean, detectedPushRegistration?: boolean, @@ -96,7 +96,7 @@ export type AnalyzeServiceWorkerResponce = { error?: string } -export async function analyzeServiceWorker(serviceWorkerUrl?: string, serviceWorkerContent?: string): Promise { +export async function analyzeServiceWorker(serviceWorkerUrl?: string, serviceWorkerContent?: string): Promise { let content = serviceWorkerContent; const separateContent: string[] = []; if (serviceWorkerUrl) {