���Root Mod By V1rus_Alfa
User / IP
:
216.73.216.158
Host / Server
:
195.214.235.115 / npln.ir
System
:
Linux damavand.pws-dns.net 5.14.0-503.35.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 4 05:23:43 EDT 2025 x86_64
Command
|
Upload
|
Mass Deface
|
Create
:
/
home2
/
cutunixc
/
.trash
/
node_modules
/
@nuxtjs
/
i18n
/
dist
/
runtime
/
routing
/
compatibles
/
Viewing: head.js
import { unref, useNuxtApp, useRuntimeConfig } from "#imports"; import { getComposer, getLocale, getLocales, getNormalizedLocales } from "../utils.js"; import { getRouteBaseName, localeRoute, switchLocalePath } from "./routing.js"; import { isArray, isObject } from "@intlify/shared"; import { joinURL } from "ufo"; export function localeHead(common, { addDirAttribute = false, addSeoAttributes: seoAttributes = true, identifierAttribute: idAttribute = "hid" }) { const { defaultDirection } = useRuntimeConfig().public.i18n; const i18n = getComposer(common.i18n); const metaObject = { htmlAttrs: {}, link: [], meta: [] }; if (unref(i18n.locales) == null || unref(i18n.baseUrl) == null) { return metaObject; } const locale = getLocale(common.i18n); const locales = getLocales(common.i18n); const currentLocale = getNormalizedLocales(locales).find((l) => l.code === locale) || { code: locale }; const currentLanguage = currentLocale.language; const currentDir = currentLocale.dir || defaultDirection; if (addDirAttribute) { metaObject.htmlAttrs.dir = currentDir; } if (seoAttributes && locale && unref(i18n.locales)) { if (currentLanguage) { metaObject.htmlAttrs.lang = currentLanguage; } metaObject.link.push( ...getHreflangLinks(common, unref(locales), idAttribute), ...getCanonicalLink(common, idAttribute, seoAttributes) ); metaObject.meta.push( ...getOgUrl(common, idAttribute, seoAttributes), ...getCurrentOgLocale(currentLocale, currentLanguage, idAttribute), ...getAlternateOgLocales(unref(locales), currentLanguage, idAttribute) ); } return metaObject; } function getBaseUrl() { const nuxtApp = useNuxtApp(); const i18n = getComposer(nuxtApp.$i18n); return joinURL(unref(i18n.baseUrl), nuxtApp.$config.app.baseURL); } export function getHreflangLinks(common, locales, idAttribute) { const baseUrl = getBaseUrl(); const { defaultLocale, strategy } = useRuntimeConfig().public.i18n; const links = []; if (strategy === "no_prefix") return links; const localeMap = /* @__PURE__ */ new Map(); for (const locale of locales) { const localeLanguage = locale.language; if (!localeLanguage) { console.warn("Locale `language` ISO code is required to generate alternate link"); continue; } const [language, region] = localeLanguage.split("-"); if (language && region && (locale.isCatchallLocale || !localeMap.has(language))) { localeMap.set(language, locale); } localeMap.set(localeLanguage, locale); } for (const [language, mapLocale] of localeMap.entries()) { const localePath = switchLocalePath(common, mapLocale.code); if (localePath) { links.push({ [idAttribute]: `i18n-alt-${language}`, rel: "alternate", href: toAbsoluteUrl(localePath, baseUrl), hreflang: language }); } } if (defaultLocale) { const localePath = switchLocalePath(common, defaultLocale); if (localePath) { links.push({ [idAttribute]: "i18n-xd", rel: "alternate", href: toAbsoluteUrl(localePath, baseUrl), hreflang: "x-default" }); } } return links; } export function getCanonicalUrl(common, baseUrl, seoAttributes) { const route = common.router.currentRoute.value; const currentRoute = localeRoute(common, { ...route, path: void 0, name: getRouteBaseName(common, route) }); if (!currentRoute) return ""; let href = toAbsoluteUrl(currentRoute.path, baseUrl); const canonicalQueries = isObject(seoAttributes) && seoAttributes.canonicalQueries || []; const currentRouteQueryParams = currentRoute.query; const params = new URLSearchParams(); for (const queryParamName of canonicalQueries) { if (queryParamName in currentRouteQueryParams) { const queryParamValue = currentRouteQueryParams[queryParamName]; if (isArray(queryParamValue)) { queryParamValue.forEach((v) => params.append(queryParamName, v || "")); } else { params.append(queryParamName, queryParamValue || ""); } } } const queryString = params.toString(); if (queryString) { href = `${href}?${queryString}`; } return href; } export function getCanonicalLink(common, idAttribute, seoAttributes) { const baseUrl = getBaseUrl(); const href = getCanonicalUrl(common, baseUrl, seoAttributes); if (!href) return []; return [{ [idAttribute]: "i18n-can", rel: "canonical", href }]; } export function getOgUrl(common, idAttribute, seoAttributes) { const baseUrl = getBaseUrl(); const href = getCanonicalUrl(common, baseUrl, seoAttributes); if (!href) return []; return [{ [idAttribute]: "i18n-og-url", property: "og:url", content: href }]; } export function getCurrentOgLocale(currentLocale, currentLanguage, idAttribute) { if (!currentLocale || !currentLanguage) return []; return [{ [idAttribute]: "i18n-og", property: "og:locale", content: hypenToUnderscore(currentLanguage) }]; } export function getAlternateOgLocales(locales, currentLanguage, idAttribute) { const alternateLocales = locales.filter((locale) => locale.language && locale.language !== currentLanguage); return alternateLocales.map((locale) => ({ [idAttribute]: `i18n-og-alt-${locale.language}`, property: "og:locale:alternate", content: hypenToUnderscore(locale.language) })); } function hypenToUnderscore(str) { return (str || "").replace(/-/g, "_"); } function toAbsoluteUrl(urlOrPath, baseUrl) { if (urlOrPath.match(/^https?:\/\//)) return urlOrPath; return joinURL(baseUrl, urlOrPath); }
Coded With 💗 by
0x6ick Mod By V1rus_Alfa