Scheduling infrastructure for absolutely everyone.
chore: Credits with commit hash (#9999)
Leo Giovanetti9456ffbb48f4
diff --git a/apps/web/components/PageWrapper.tsx b/apps/web/components/PageWrapper.tsxindex ecf7667081c..c076ebd2daf 100644--- a/apps/web/components/PageWrapper.tsx+++ b/apps/web/components/PageWrapper.tsx@@ -6,7 +6,7 @@ import Script from "next/script";import "@calcom/embed-core/src/embed-iframe";import LicenseRequired from "@calcom/features/ee/common/components/LicenseRequired";-import { WEBAPP_URL } from "@calcom/lib/constants";+import { WEBAPP_URL, IS_CALCOM } from "@calcom/lib/constants";import { buildCanonical } from "@calcom/lib/next-seo.config";import type { AppProps } from "@lib/app-providers";@@ -53,10 +53,6 @@ function PageWrapper(props: AppProps) {// Use the layout defined at the page level, if availableconst getLayout = Component.getLayout ?? ((page) => page);- // Canonical: Check if the URL is from cal.com so that we set the canonical conditionally- const isCalcom =- WEBAPP_URL &&- (new URL(WEBAPP_URL).hostname.endsWith("cal.com") || new URL(WEBAPP_URL).hostname.endsWith("cal.dev"));const path = router.asPath;return (@@ -70,7 +66,7 @@ function PageWrapper(props: AppProps) {<DefaultSeo// Set canonical to https://cal.com or self-hosted URLcanonical={- isCalcom+ IS_CALCOM? buildCanonical({ path, origin: "https://cal.com" }) // cal.com & .dev: buildCanonical({ path, origin: WEBAPP_URL }) // self-hosted}diff --git a/apps/web/pages/404.tsx b/apps/web/pages/404.tsxindex 26d6dde4c0b..7d4ee6af706 100644--- a/apps/web/pages/404.tsx+++ b/apps/web/pages/404.tsx@@ -4,7 +4,7 @@ import { useRouter } from "next/router";import { useEffect, useState } from "react";import { orgDomainConfig, subdomainSuffix } from "@calcom/features/ee/organizations/lib/orgDomains";-import { DOCS_URL, JOIN_DISCORD, WEBSITE_URL } from "@calcom/lib/constants";+import { DOCS_URL, JOIN_DISCORD, WEBSITE_URL, IS_CALCOM } from "@calcom/lib/constants";import { useLocale } from "@calcom/lib/hooks/useLocale";import { HeadSeo } from "@calcom/ui";import { BookOpen, Check, ChevronRight, FileText, Shield } from "@calcom/ui/components/icon";@@ -75,7 +75,6 @@ export default function Custom404() {const isSuccessPage = router.asPath.startsWith("/booking");const isSubpage = router.asPath.includes("/", 2) || isSuccessPage;const isSignup = router.asPath.startsWith("/signup");- const isCalcom = process.env.NEXT_PUBLIC_WEBAPP_URL === "https://app.cal.com";/*** If we're on 404 and the route is insights it means it is disabled* TODO: Abstract this for all disabled features@@ -249,7 +248,7 @@ export default function Custom404() {<span className="mt-2 inline-block text-lg ">{t("check_spelling_mistakes_or_go_back")}</span>- ) : isCalcom ? (+ ) : IS_CALCOM ? (<a target="_blank" href={url} className="mt-2 inline-block text-lg" rel="noreferrer">{t(`404_the_${currentPageType.toLowerCase()}`)}{" "}<strong className="text-blue-500">@@ -267,7 +266,7 @@ export default function Custom404() {)}</div><div className="mt-12">- {((!isSubpage && isCalcom) ||+ {((!isSubpage && IS_CALCOM) ||currentPageType === pageType.ORG ||currentPageType === pageType.TEAM) && (<ul role="list" className="my-4">diff --git a/packages/lib/constants.ts b/packages/lib/constants.tsindex c90674f2a71..ea73c0b90c3 100644--- a/packages/lib/constants.ts+++ b/packages/lib/constants.ts@@ -23,6 +23,12 @@ export const SENDER_NAME = process.env.NEXT_PUBLIC_SENDGRID_SENDER_NAME || "Cal.// As website isn't setup for preview environments, use the webapp url insteadexport const CAL_URL = new URL(WEBAPP_URL).hostname.endsWith(".vercel.app") ? WEBAPP_URL : WEBSITE_URL;+export const IS_CALCOM =+ WEBAPP_URL &&+ (new URL(WEBAPP_URL).hostname.endsWith("cal.com") ||+ new URL(WEBAPP_URL).hostname.endsWith("cal.dev") ||+ new URL(WEBAPP_URL).hostname.endsWith("cal-staging.com"));+export const CONSOLE_URL =new URL(WEBAPP_URL).hostname.endsWith(".cal.dev") || process.env.NODE_ENV !== "production"? `https://console.cal.dev`diff --git a/packages/lib/isCalcom.ts b/packages/lib/isCalcom.tsdeleted file mode 100644index 1a5a79aa003..00000000000--- a/packages/lib/isCalcom.ts+++ /dev/null@@ -1,2 +0,0 @@-const isCalcom = process.env.NEXT_PUBLIC_WEBSITE_URL === "https://cal.com";-export default isCalcom;diff --git a/packages/ui/components/credits/Credits.tsx b/packages/ui/components/credits/Credits.tsxindex 74536fa782d..0791ed09ed3 100644--- a/packages/ui/components/credits/Credits.tsx+++ b/packages/ui/components/credits/Credits.tsx@@ -1,11 +1,15 @@import Link from "next/link";import { useEffect, useState } from "react";-import { COMPANY_NAME, IS_SELF_HOSTED } from "@calcom/lib/constants";+import { COMPANY_NAME, IS_SELF_HOSTED, IS_CALCOM } from "@calcom/lib/constants";// Relative to prevent triggering a recompileimport pkg from "../../../../apps/web/package.json";+// eslint-disable-next-line turbo/no-undeclared-env-vars+const vercelCommitHash = process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA;+const commitHash = vercelCommitHash ? `-${vercelCommitHash.slice(0, 7)}` : "";+export const CalComVersion = `v.${pkg.version}-${!IS_SELF_HOSTED ? "h" : "sh"}`;export default function Credits() {@@ -22,9 +26,21 @@ export default function Credits() {{COMPANY_NAME}</Link>{" "}{hasMounted && (- <Link href="https://go.cal.com/releases" target="_blank" className="hover:underline">- {CalComVersion}- </Link>+ <>+ <Link href="https://go.cal.com/releases" target="_blank" className="hover:underline">+ {CalComVersion}+ </Link>+ {vercelCommitHash && IS_CALCOM ? (+ <Link+ href={`https://github.com/calcom/cal.com/commit/${vercelCommitHash}`}+ target="_blank"+ className="hover:underline">+ {commitHash}+ </Link>+ ) : (+ commitHash+ )}+ </>)}</small>);diff --git a/packages/ui/components/head-seo/HeadSeo.tsx b/packages/ui/components/head-seo/HeadSeo.tsxindex 3415b1107c5..3891960d5cf 100644--- a/packages/ui/components/head-seo/HeadSeo.tsx+++ b/packages/ui/components/head-seo/HeadSeo.tsx@@ -5,8 +5,7 @@ import { useRouter } from "next/router";import type { AppImageProps, MeetingImageProps } from "@calcom/lib/OgImages";import { constructAppImage, constructGenericImage, constructMeetingImage } from "@calcom/lib/OgImages";-import { getBrowserInfo } from "@calcom/lib/browser/browser.utils";-import { APP_NAME, WEBSITE_URL } from "@calcom/lib/constants";+import { APP_NAME, WEBSITE_URL, IS_CALCOM } from "@calcom/lib/constants";import { seoConfig, getSeoImage, buildCanonical } from "@calcom/lib/next-seo.config";import { truncateOnWord } from "@calcom/lib/text";@@ -71,17 +70,11 @@ const buildSeoMeta = (pageProps: {export const HeadSeo = (props: HeadSeoProps): JSX.Element => {// The below code sets the defaultUrl for our canonical tags-- // Get the current URL from the window object- const { url } = getBrowserInfo();- // Check if the URL is from cal.com- const isCalcom =- url && (new URL(url).hostname.endsWith("cal.com") || new URL(url).hostname.endsWith("cal.dev"));// Get the router's pathconst path = useRouter().asPath;const selfHostedOrigin = WEBSITE_URL || "https://cal.com";// Set the default URL to either the current URL (if self-hosted) or https://cal.com canonical URL- const defaultUrl = isCalcom+ const defaultUrl = IS_CALCOM? buildCanonical({ path, origin: "https://cal.com" }): buildCanonical({ path, origin: selfHostedOrigin });