chore: Credits with commit hash (#9999)

This commit is contained in:
Leo Giovanetti authored and GitHub committed 2023-07-10 16:10:30 +02:00
1 parent 6d19cc22a5
commit 9456ffbb48
6 files changed
+33 -25

No files matched your search

+2 -6
View File
@@ -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 available
const 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 URL
canonical={
isCalcom
IS_CALCOM
? buildCanonical({ path, origin: "https://cal.com" }) // cal.com & .dev
: buildCanonical({ path, origin: WEBAPP_URL }) // self-hosted
}
+3 -4
View File
@@ -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">
+6
View File
@@ -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 instead
export 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`
-2
View File
@@ -1,2 +0,0 @@
const isCalcom = process.env.NEXT_PUBLIC_WEBSITE_URL === "https://cal.com";
export default isCalcom;
+20 -4
View File
@@ -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 recompile
import 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>
);
+2 -9
View File
@@ -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 path
const 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 });