[dyad] Added system detection tab - wrote 4 file(s)

This commit is contained in:
[dyad]
2026-01-21 07:53:01 +01:00
parent d742339c1d
commit 8c68562830
4 changed files with 188 additions and 7 deletions

View File

@@ -28,6 +28,10 @@ export interface LinkData {
rel: string;
}
export interface DetectedSystem {
name: string;
}
export async function extractMetaData(url: string, keyword?: string) {
if (!url) {
return { error: "URL is required." };
@@ -225,6 +229,60 @@ export async function extractMetaData(url: string, keyword?: string) {
links.push({ href: absoluteUrl, text, type, rel });
});
const detectedSystems: DetectedSystem[] = [];
const htmlContent = $.html();
const uniqueSystems = new Set<string>();
// WordPress
if (
$('meta[name="generator"][content*="WordPress"]').length > 0 ||
htmlContent.includes("/wp-content/") ||
htmlContent.includes("/wp-includes/")
) {
uniqueSystems.add("WordPress");
}
// Shopify
if (
htmlContent.includes("cdn.shopify.com") ||
htmlContent.includes("Shopify.theme")
) {
uniqueSystems.add("Shopify");
}
// Next.js
if ($("#__next").length > 0) {
uniqueSystems.add("Next.js");
uniqueSystems.add("React"); // Next.js uses React
}
// React (generic)
if ($("#root").length > 0) {
uniqueSystems.add("React");
}
// Webflow
if (
$('meta[name="generator"][content="Webflow"]').length > 0 ||
htmlContent.includes("<!-- This site was created in Webflow.")
) {
uniqueSystems.add("Webflow");
}
// Wix
if ($('meta[name="generator"][content*="Wix.com"]').length > 0) {
uniqueSystems.add("Wix");
}
// Squarespace
if (htmlContent.includes("static1.squarespace.com")) {
uniqueSystems.add("Squarespace");
}
uniqueSystems.forEach((system) => {
detectedSystems.push({ name: system });
});
return {
data: {
title,
@@ -241,6 +299,7 @@ export async function extractMetaData(url: string, keyword?: string) {
keywordCount,
images: imageAltData.length > 0 ? imageAltData : null,
links: links.length > 0 ? links : null,
systems: detectedSystems.length > 0 ? detectedSystems : null,
},
};
} catch (error) {