Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

ran prettier

Steven Tey9389637814b8
diff --git a/components/app/links-container.tsx b/components/app/links-container.tsx
index 10646936d6..c391441933 100644
--- a/components/app/links-container.tsx
+++ b/components/app/links-container.tsx
@@ -21,7 +21,7 @@ export default function LinksContainer({
const { project: { domain } = {} } = useProject();
const { data: links } = useSWR<LinkProps[]>(
domain ? `/api/projects/${slug}/domains/${domain}/links` : `/api/links`,
- fetcher
+ fetcher,
);
return (
diff --git a/components/app/modals/add-edit-link-modal.tsx b/components/app/modals/add-edit-link-modal.tsx
index 8268e2ffe8..33f57eb694 100644
--- a/components/app/modals/add-edit-link-modal.tsx
+++ b/components/app/modals/add-edit-link-modal.tsx
@@ -49,7 +49,7 @@ function AddEditLinkModal({
key: "",
url: "",
title: "",
- }
+ },
);
const { key, url, title } = data;
@@ -78,7 +78,7 @@ function AddEditLinkModal({
fetch(
domain
? `/api/projects/${slug}/domains/${domain}/links/${debouncedKey}/exists`
- : `/api/edge/links/${debouncedKey}/exists`
+ : `/api/edge/links/${debouncedKey}/exists`,
).then(async (res) => {
if (res.status === 200) {
const exists = await res.json();
@@ -93,7 +93,7 @@ function AddEditLinkModal({
const res = await fetch(
domain
? `/api/projects/${slug}/domains/${domain}/links/random`
- : `/api/edge/links/random`
+ : `/api/edge/links/random`,
);
const key = await res.json();
setData((prev) => ({ ...prev, key }));
@@ -119,7 +119,7 @@ function AddEditLinkModal({
}
});
},
- [debouncedUrl]
+ [debouncedUrl],
);
const endpoint = useMemo(() => {
@@ -174,7 +174,7 @@ function AddEditLinkModal({
mutate(
domain
? `/api/projects/${slug}/domains/${domain}/links`
- : `/api/links`
+ : `/api/links`,
);
setShowAddEditLinkModal(false);
}
@@ -360,7 +360,7 @@ function AdvancedSettings({ data, setData, debouncedUrl }) {
}
});
},
- [debouncedUrl]
+ [debouncedUrl],
);
const onChangePicture = useCallback(
@@ -372,7 +372,7 @@ function AdvancedSettings({ data, setData, debouncedUrl }) {
};
reader.readAsDataURL(file);
},
- [setData]
+ [setData],
);
return (
@@ -567,6 +567,6 @@ export function useAddEditLinkModal({ props }: { props?: LinkProps }) {
setShowAddEditLinkModal,
AddEditLinkModalCallback,
AddEditLinkButtonCallback,
- ]
+ ],
);
}
diff --git a/components/app/modals/add-project-modal.tsx b/components/app/modals/add-project-modal.tsx
index 707b63222f..7c8cfe49a8 100644
--- a/components/app/modals/add-project-modal.tsx
+++ b/components/app/modals/add-project-modal.tsx
@@ -60,7 +60,7 @@ function AddProjectModalHelper({
const exists = await res.json();
setDomainError(exists === 1 ? "Domain is already in use." : null);
}
- }
+ },
);
}
}, [debouncedDomain, domainError]);
@@ -278,6 +278,6 @@ export function useAddProjectModal({ domain }: { domain?: string }) {
return useMemo(
() => ({ setShowAddProjectModal, AddProjectModal }),
- [setShowAddProjectModal, AddProjectModal]
+ [setShowAddProjectModal, AddProjectModal],
);
}
diff --git a/components/app/modals/delete-link-modal.tsx b/components/app/modals/delete-link-modal.tsx
index e0a3cee076..58d8902805 100644
--- a/components/app/modals/delete-link-modal.tsx
+++ b/components/app/modals/delete-link-modal.tsx
@@ -72,14 +72,14 @@ function DeleteLinkModal({
headers: {
"Content-Type": "application/json",
},
- }
+ },
).then(async (res) => {
setDeleting(false);
if (res.status === 200) {
mutate(
domain
? `/api/projects/${slug}/domains/${domain}/links`
- : `/api/links`
+ : `/api/links`,
);
setShowDeleteLinkModal(false);
}
@@ -142,6 +142,6 @@ export function useDeleteLinkModal({ props }: { props?: LinkProps }) {
setShowDeleteLinkModal,
DeleteLinkModal: DeleteLinkModalCallback,
}),
- [setShowDeleteLinkModal, DeleteLinkModalCallback]
+ [setShowDeleteLinkModal, DeleteLinkModalCallback],
);
}
diff --git a/components/app/modals/delete-project-modal.tsx b/components/app/modals/delete-project-modal.tsx
index aeed2a243e..aa43a34f30 100644
--- a/components/app/modals/delete-project-modal.tsx
+++ b/components/app/modals/delete-project-modal.tsx
@@ -153,6 +153,6 @@ export function useDeleteProjectModal() {
setShowDeleteProjectModal,
DeleteProjectModal: DeleteProjectModalCallback,
}),
- [setShowDeleteProjectModal, DeleteProjectModalCallback]
+ [setShowDeleteProjectModal, DeleteProjectModalCallback],
);
}
diff --git a/components/app/modals/edit-domain-modal.tsx b/components/app/modals/edit-domain-modal.tsx
index dcfc459499..b55a860d3b 100644
--- a/components/app/modals/edit-domain-modal.tsx
+++ b/components/app/modals/edit-domain-modal.tsx
@@ -39,7 +39,7 @@ function EditDomainModal({
const exists = await res.json();
setDomainError(exists === 1 ? "Domain is already in use." : null);
}
- }
+ },
);
}
}, [debouncedDomain]);
@@ -231,6 +231,6 @@ export function useEditDomainModal() {
setShowEditDomainModal,
EditDomainModal: EditDomainModalCallback,
}),
- [setShowEditDomainModal, EditDomainModalCallback]
+ [setShowEditDomainModal, EditDomainModalCallback],
);
}
diff --git a/components/app/modals/link-qr-modal.tsx b/components/app/modals/link-qr-modal.tsx
index b18f2d9de2..bddfea4a1f 100644
--- a/components/app/modals/link-qr-modal.tsx
+++ b/components/app/modals/link-qr-modal.tsx
@@ -6,17 +6,17 @@ import {
useRef,
useState,
} from "react";
+import { HexColorInput, HexColorPicker } from "react-colorful";
import BlurImage from "@/components/shared/blur-image";
-import { Download, Logo, ChevronRight } from "@/components/shared/icons";
+import { ChevronRight, Download, Logo } from "@/components/shared/icons";
import Modal from "@/components/shared/modal";
-import { getQRAsCanvas, getQRAsSVGDataUri, QRCodeSVG } from "@/lib/qr";
+import Switch from "@/components/shared/switch";
+import Tooltip, { TooltipContent } from "@/components/shared/tooltip";
+import { QRCodeSVG, getQRAsCanvas, getQRAsSVGDataUri } from "@/lib/qr";
import useProject from "@/lib/swr/use-project";
+import useUsage from "@/lib/swr/use-usage";
import { SimpleLinkProps } from "@/lib/types";
import { linkConstructor } from "@/lib/utils";
-import useUsage from "@/lib/swr/use-usage";
-import { HexColorPicker, HexColorInput } from "react-colorful";
-import Tooltip, { TooltipContent } from "@/components/shared/tooltip";
-import Switch from "@/components/shared/switch";
function LinkQRModalHelper({
showLinkQRModal,
@@ -40,7 +40,7 @@ function LinkQRModalHelper({
const qrDestUrl = useMemo(
() => linkConstructor({ key: props.key, domain }),
- [props, domain]
+ [props, domain],
);
const qrLogoUrl = useMemo(() => {
@@ -311,6 +311,6 @@ export function useLinkQRModal({ props }: { props: SimpleLinkProps }) {
return useMemo(
() => ({ setShowLinkQRModal, LinkQRModal }),
- [setShowLinkQRModal, LinkQRModal]
+ [setShowLinkQRModal, LinkQRModal],
);
}
diff --git a/components/app/modals/stats-modal.tsx b/components/app/modals/stats-modal.tsx
index 04c52ca218..d01435e01e 100644
--- a/components/app/modals/stats-modal.tsx
+++ b/components/app/modals/stats-modal.tsx
@@ -69,6 +69,6 @@ export function useStatsModal() {
return useMemo(
() => ({ setShowStatsModal, StatsModal }),
- [setShowStatsModal, StatsModal]
+ [setShowStatsModal, StatsModal],
);
}
diff --git a/components/app/modals/upgrade-plan-modal.tsx b/components/app/modals/upgrade-plan-modal.tsx
index 48f5a09da3..a51f517b0e 100644
--- a/components/app/modals/upgrade-plan-modal.tsx
+++ b/components/app/modals/upgrade-plan-modal.tsx
@@ -26,7 +26,7 @@ function UpgradePlanModal({
const [annualBilling, setAnnualBilling] = useState(true);
const period = useMemo(
() => (annualBilling ? "yearly" : "monthly"),
- [annualBilling]
+ [annualBilling],
);
const env =
process.env.NEXT_PUBLIC_VERCEL_ENV === "production" ? "production" : "test";
@@ -93,7 +93,7 @@ function UpgradePlanModal({
`/api/stripe/upgrade?priceId=${PRO_TIERS[tier].price[period].priceIds[env]}&usageLimit=${PRO_TIERS[tier].quota}`,
{
method: "POST",
- }
+ },
)
.then(async (res) => {
const data = await res.json();
@@ -147,6 +147,6 @@ export function useUpgradePlanModal() {
setShowUpgradePlanModal,
UpgradePlanModal: UpgradePlanModalCallback,
}),
- [setShowUpgradePlanModal, UpgradePlanModalCallback]
+ [setShowUpgradePlanModal, UpgradePlanModalCallback],
);
}
diff --git a/components/app/project-card.tsx b/components/app/project-card.tsx
index c6ab1dc3a8..21ac2f6194 100644
--- a/components/app/project-card.tsx
+++ b/components/app/project-card.tsx
@@ -21,7 +21,7 @@ export default function ProjectCard({
fetcher,
{
keepPreviousData: true,
- }
+ },
);
return (
<Link key={slug} href={`/${slug}`}>
diff --git a/components/app/settings/custom-domain/domain-configuration.tsx b/components/app/settings/custom-domain/domain-configuration.tsx
index 09dae505ff..491b170b6b 100644
--- a/components/app/settings/custom-domain/domain-configuration.tsx
+++ b/components/app/settings/custom-domain/domain-configuration.tsx
@@ -21,7 +21,7 @@ export default function DomainConfiguration({
if (data.status === "Pending Verification") {
const txtVerification = domainJson.verification.find(
- (x: any) => x.type === "TXT"
+ (x: any) => x.type === "TXT",
);
return (
<div className="border-t border-gray-200 pt-5">
@@ -40,7 +40,7 @@ export default function DomainConfiguration({
<p className="text-sm font-mono mt-2">
{txtVerification.domain.slice(
0,
- txtVerification.domain.length - domainJson.apexName.length - 1
+ txtVerification.domain.length - domainJson.apexName.length - 1,
)}
</p>
</div>
diff --git a/components/app/settings/custom-domain/index.tsx b/components/app/settings/custom-domain/index.tsx
index 31f9035447..6bb587c8f7 100644
--- a/components/app/settings/custom-domain/index.tsx
+++ b/components/app/settings/custom-domain/index.tsx
@@ -28,7 +28,7 @@ export default function CustomDomain() {
{
revalidateOnMount: true,
refreshInterval: 5000,
- }
+ },
);
const { setShowEditDomainModal, EditDomainModal } = useEditDomainModal();
diff --git a/components/app/settings/landing-page.tsx b/components/app/settings/landing-page.tsx
index de705cc716..373ac6258a 100644
--- a/components/app/settings/landing-page.tsx
+++ b/components/app/settings/landing-page.tsx
@@ -18,12 +18,12 @@ export default function DefaultPage() {
const { data: rootDomain } = useSWR<string>(
slug && domain && `/api/projects/${slug}/domains/${domain}/root`,
- fetcher
+ fetcher,
);
const { data: clicks, isValidating } = useSWR<string>(
slug && domain && `/api/projects/${slug}/domains/${domain}/root/clicks`,
- fetcher
+ fetcher,
);
const [saving, setSaving] = useState(false);
diff --git a/components/home/demo.tsx b/components/home/demo.tsx
index dc8f00af0e..83b9b80c48 100644
--- a/components/home/demo.tsx
+++ b/components/home/demo.tsx
@@ -28,7 +28,7 @@ const Demo = () => {
headers: {
"Content-Type": "application/json",
},
- }
+ },
).then(async (response) => {
setSaving(false);
if (response.ok) {
diff --git a/components/home/globe.tsx b/components/home/globe.tsx
index 0bafa09e9e..97eff5d163 100644
--- a/components/home/globe.tsx
+++ b/components/home/globe.tsx
@@ -40,7 +40,7 @@ export default function Globe({ hostname }: { hostname?: string }) {
} catch (e) {
// WebGL isn't properly supported
console.log(
- "WebGL not supported, hiding globe animation and showing fallback video..."
+ "WebGL not supported, hiding globe animation and showing fallback video...",
);
setShowFallback(true);
return;
@@ -49,7 +49,7 @@ export default function Globe({ hostname }: { hostname?: string }) {
const { data: markers } = useSWR<MarkerProps[]>(
`/api/edge/coordinates${hostname ? `?hostname=${hostname}` : ""}`,
- fetcher
+ fetcher,
);
return (
diff --git a/components/home/pricing.tsx b/components/home/pricing.tsx
index 4a68287a93..db4454dc84 100644
--- a/components/home/pricing.tsx
+++ b/components/home/pricing.tsx
@@ -220,7 +220,7 @@ const Pricing = () => {
</Link>
</div>
</div>
- )
+ ),
)}
</div>
</MaxWidthWrapper>
diff --git a/components/home/vercel-edge-functions.tsx b/components/home/vercel-edge-functions.tsx
index 77c76bd459..1828c2066a 100644
--- a/components/home/vercel-edge-functions.tsx
+++ b/components/home/vercel-edge-functions.tsx
@@ -2,7 +2,7 @@ import { useEffect, useState } from "react";
export default function VercelEdgeFunctions() {
const [vercelFontColor, setVercelFontColor] = useState(
- "from-blue-600 to-cyan-600"
+ "from-blue-600 to-cyan-600",
);
const updateColor = () => {
diff --git a/components/shared/icons/download.tsx b/components/shared/icons/download.tsx
index 2ec8cbce64..6bb10ddbc2 100644
--- a/components/shared/icons/download.tsx
+++ b/components/shared/icons/download.tsx
@@ -1,10 +1,17 @@
export default function Download({ className }: { className?: string }) {
return (
- <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 16 16" className={className}>
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ width="1em"
+ height="1em"
+ preserveAspectRatio="xMidYMid meet"
+ viewBox="0 0 16 16"
+ className={className}
+ >
<g fill="currentColor">
<path d="M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5z" />
<path d="M7.646 11.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V1.5a.5.5 0 0 0-1 0v8.793L5.354 8.146a.5.5 0 1 0-.708.708l3 3z" />
</g>
</svg>
);
-}
\ No newline at end of file
+}
diff --git a/components/shared/icons/qr.tsx b/components/shared/icons/qr.tsx
index 3e0a4e1390..7e19a58632 100644
--- a/components/shared/icons/qr.tsx
+++ b/components/shared/icons/qr.tsx
@@ -1,6 +1,13 @@
export default function QR({ className }: { className?: string }) {
return (
- <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32" className={className}>
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ width="1em"
+ height="1em"
+ preserveAspectRatio="xMidYMid meet"
+ viewBox="0 0 32 32"
+ className={className}
+ >
<path
fill="currentColor"
d="M24 28v-2h2v2zm-6-4v-2h2v2zm0 6h4v-2h-2v-2h-2v4zm8-4v-4h2v4zm2 0h2v4h-4v-2h2v-2zm-2-6v-2h4v4h-2v-2h-2zm-2 0h-2v4h-2v2h4v-6zm-6 0v-2h4v2zM6 22h4v4H6z"
@@ -10,4 +17,4 @@ export default function QR({ className }: { className?: string }) {
<path fill="currentColor" d="M14 14H2V2h12ZM4 12h8V4H4Z" />
</svg>
);
-}
\ No newline at end of file
+}
diff --git a/components/shared/switch.tsx b/components/shared/switch.tsx
index 4d55e79727..105e35acec 100644
--- a/components/shared/switch.tsx
+++ b/components/shared/switch.tsx
@@ -25,14 +25,14 @@ const Switch = ({
? "cursor-not-allowed bg-gray-200"
: "cursor-pointer radix-state-checked:bg-blue-500 radix-state-unchecked:bg-gray-200",
`relative inline-flex ${trackDimensions} flex-shrink-0 rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out`,
- "focus:outline-none focus-visible:ring focus-visible:ring-blue-500 focus-visible:ring-opacity-75"
+ "focus:outline-none focus-visible:ring focus-visible:ring-blue-500 focus-visible:ring-opacity-75",
)}
>
<SwitchPrimitive.Thumb
className={cx(
`radix-state-checked:${thumbTranslate}`,
"radix-state-unchecked:translate-x-0",
- `pointer-events-none ${thumbDimensions} transform ${thumbTranslate} rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out`
+ `pointer-events-none ${thumbDimensions} transform ${thumbTranslate} rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out`,
)}
/>
</SwitchPrimitive.Root>
diff --git a/components/shared/tooltip.tsx b/components/shared/tooltip.tsx
index 392e022cc1..71e7068bca 100644
--- a/components/shared/tooltip.tsx
+++ b/components/shared/tooltip.tsx
@@ -162,7 +162,7 @@ export function OGImageProxy() {
export function ProTiers({ usageLimit }: { usageLimit?: number }) {
const [tier, setTier] = useState(
- usageLimit > 1000 ? PRO_TIERS.map((t) => t.quota).indexOf(usageLimit) : 0
+ usageLimit > 1000 ? PRO_TIERS.map((t) => t.quota).indexOf(usageLimit) : 0,
);
return (
diff --git a/components/stats/index.tsx b/components/stats/index.tsx
index edc5460b81..3661b070a3 100644
--- a/components/stats/index.tsx
+++ b/components/stats/index.tsx
@@ -33,7 +33,7 @@ export default function Stats({
{
keepPreviousData: true,
fallbackData: dummyData,
- }
+ },
);
return (
diff --git a/components/stats/toggle.tsx b/components/stats/toggle.tsx
index 05ead2b2e8..d7a26fbb57 100644
--- a/components/stats/toggle.tsx
+++ b/components/stats/toggle.tsx
@@ -66,9 +66,9 @@ export default function Toggle({
},
},
`/${pageType}/${encodeURI(
- router.query.key as string
+ router.query.key as string,
)}?interval=${interval}`,
- { shallow: true }
+ { shallow: true },
);
}}
/>
diff --git a/lib/auth.ts b/lib/auth.ts
index 7ff2ddb90b..0c6b3ec6f5 100644
--- a/lib/auth.ts
+++ b/lib/auth.ts
@@ -17,7 +17,7 @@ export async function getSession(req: NextApiRequest, res: NextApiResponse) {
const session = (await unstable_getServerSession(
req,
res,
- authOptions
+ authOptions,
)) as Session | null;
return session;
}
@@ -26,7 +26,7 @@ interface WithProjectNextApiHandler {
(
req: NextApiRequest,
res: NextApiResponse,
- project?: ProjectProps
+ project?: ProjectProps,
): Promise<void>;
}
@@ -43,7 +43,7 @@ const withProjectAuth =
needVerifiedDomain?: boolean;
needProSubscription?: boolean;
needNotExceededUsage?: boolean;
- } = {}
+ } = {},
) =>
async (req: NextApiRequest, res: NextApiResponse) => {
const session = await getSession(req, res);
@@ -125,7 +125,7 @@ interface WithUsertNextApiHandler {
req: NextApiRequest,
res: NextApiResponse,
userId: string,
- user?: UserProps
+ user?: UserProps,
): Promise<void>;
}
@@ -138,7 +138,7 @@ const withUserAuth =
}: {
needUserDetails?: boolean;
needProSubscription?: boolean;
- } = {}
+ } = {},
) =>
async (req: NextApiRequest, res: NextApiResponse) => {
const session = await getSession(req, res);
diff --git a/lib/cron/domains.tsx b/lib/cron/domains.tsx
index 56b06b3dd8..f558af2382 100644
--- a/lib/cron/domains.tsx
+++ b/lib/cron/domains.tsx
@@ -11,7 +11,7 @@ export const handleDomainUpdates = async (
createdAt: Date,
verified: boolean,
changed: boolean,
- sentEmails: string[]
+ sentEmails: string[],
) => {
if (changed) {
await log(`Domain *${domain}* changed status to *${verified}*`);
@@ -20,19 +20,19 @@ export const handleDomainUpdates = async (
if (verified) return;
const invalidDays = Math.floor(
- (new Date().getTime() - new Date(createdAt).getTime()) / (1000 * 3600 * 24)
+ (new Date().getTime() - new Date(createdAt).getTime()) / (1000 * 3600 * 24),
);
if (invalidDays >= 14 && invalidDays < 28) {
const sentFirstDomainInvalidEmail = sentEmails.includes(
- "firstDomainInvalidEmail"
+ "firstDomainInvalidEmail",
);
if (!sentFirstDomainInvalidEmail) {
sendDomainInvalidEmail(projectSlug, domain, invalidDays, "first");
}
} else if (invalidDays >= 28) {
const sentSecondDomainInvalidEmail = sentEmails.includes(
- "secondDomainInvalidEmail"
+ "secondDomainInvalidEmail",
);
if (!sentSecondDomainInvalidEmail) {
sendDomainInvalidEmail(projectSlug, domain, invalidDays, "second");
@@ -63,7 +63,7 @@ export const handleDomainUpdates = async (
]);
} else {
return await log(
- `Domain *${domain}* has been invalid for > 30 days but has links, not deleting.`
+ `Domain *${domain}* has been invalid for > 30 days but has links, not deleting.`,
);
}
}
@@ -74,7 +74,7 @@ const sendDomainInvalidEmail = async (
projectSlug: string,
domain: string,
invalidDays: number,
- type: "first" | "second"
+ type: "first" | "second",
) => {
const ownerEmail = await getProjectOwnerEmail(projectSlug);
return await Promise.all([
diff --git a/lib/cron/usage.tsx b/lib/cron/usage.tsx
index 952a506e69..2564bccfee 100644
--- a/lib/cron/usage.tsx
+++ b/lib/cron/usage.tsx
@@ -51,29 +51,29 @@ export const updateUsage = async () => {
? await getUsage(domain, billingCycleStart)
: 0,
};
- })
+ }),
);
let totalUsage = usageArr.reduce((acc, { usage }) => acc + usage, 0);
let ownerExceededUsage = totalUsage > usageLimit;
if (ownerExceededUsage) {
await log(
- `${email} is over usage limit. Usage: ${totalUsage}, Limit: ${usageLimit}`
+ `${email} is over usage limit. Usage: ${totalUsage}, Limit: ${usageLimit}`,
);
const sentFirstUsageLimitEmail = sentEmails.some(
- (email) => email.type === "firstUsageLimitEmail"
+ (email) => email.type === "firstUsageLimitEmail",
);
if (!sentFirstUsageLimitEmail) {
sendUsageLimitEmail(email, totalUsage, usageLimit, "first");
} else {
const sentSecondUsageLimitEmail = sentEmails.some(
- (email) => email.type === "secondUsageLimitEmail"
+ (email) => email.type === "secondUsageLimitEmail",
);
if (!sentSecondUsageLimitEmail) {
const daysSinceFirstEmail = Math.floor(
(new Date().getTime() -
new Date(sentEmails[0].createdAt).getTime()) /
- (1000 * 3600 * 24)
+ (1000 * 3600 * 24),
);
if (daysSinceFirstEmail >= 3) {
sendUsageLimitEmail(email, totalUsage, usageLimit, "second");
@@ -114,7 +114,7 @@ export const updateUsage = async () => {
ownerExceededUsage,
},
});
- })
+ }),
),
]);
@@ -122,8 +122,8 @@ export const updateUsage = async () => {
updateUser,
updateProjects,
};
- }
- )
+ },
+ ),
);
return response;
@@ -133,7 +133,7 @@ const sendUsageLimitEmail = async (
email: string,
usage: number,
usageLimit: number,
- type: "first" | "second"
+ type: "first" | "second",
) => {
return await Promise.all([
sendMail({
diff --git a/lib/domains.ts b/lib/domains.ts
index 636f31fe73..ad4da60294 100644
--- a/lib/domains.ts
+++ b/lib/domains.ts
@@ -13,7 +13,7 @@ export const addDomain = async (domain: string): Promise<CustomResponse> => {
"Content-Type": "application/json",
},
method: "POST",
- }
+ },
).then((res) => res.json());
};
@@ -25,7 +25,7 @@ export const removeDomain = async (domain: string) => {
Authorization: `Bearer ${process.env.AUTH_BEARER_TOKEN}`,
},
method: "DELETE",
- }
+ },
).then((res) => res.json());
};
@@ -38,7 +38,7 @@ export const getDomainResponse = async (domain: string) => {
Authorization: `Bearer ${process.env.AUTH_BEARER_TOKEN}`,
"Content-Type": "application/json",
},
- }
+ },
).then((res) => {
return res.json();
});
@@ -53,7 +53,7 @@ export const getConfigResponse = async (domain: string) => {
Authorization: `Bearer ${process.env.AUTH_BEARER_TOKEN}`,
"Content-Type": "application/json",
},
- }
+ },
).then((res) => res.json());
};
@@ -66,6 +66,6 @@ export const verifyDomain = async (domain: string) => {
Authorization: `Bearer ${process.env.AUTH_BEARER_TOKEN}`,
"Content-Type": "application/json",
},
- }
+ },
).then((res) => res.json());
};
diff --git a/lib/hooks/use-intersection-observer.ts b/lib/hooks/use-intersection-observer.ts
index bb82d9030e..2d198c59ab 100644
--- a/lib/hooks/use-intersection-observer.ts
+++ b/lib/hooks/use-intersection-observer.ts
@@ -11,7 +11,7 @@ function useIntersectionObserver(
root = null,
rootMargin = "0%",
freezeOnceVisible = false,
- }: Args
+ }: Args,
): IntersectionObserverEntry | undefined {
const [entry, setEntry] = useState<IntersectionObserverEntry>();
diff --git a/lib/hooks/use-local-storage.ts b/lib/hooks/use-local-storage.ts
index e64311701b..bdbd07bb7d 100644
--- a/lib/hooks/use-local-storage.ts
+++ b/lib/hooks/use-local-storage.ts
@@ -2,7 +2,7 @@ import { useEffect, useState } from "react";
const useLocalStorage = <T>(
key: string,
- initialValue: T
+ initialValue: T,
): [T, (value: T) => void] => {
const [storedValue, setStoredValue] = useState(initialValue);
diff --git a/lib/middleware/link.ts b/lib/middleware/link.ts
index 78b9890994..5dad425e7a 100644
--- a/lib/middleware/link.ts
+++ b/lib/middleware/link.ts
@@ -5,7 +5,7 @@ import { LinkProps } from "../types";
export default async function LinkMiddleware(
req: NextRequest,
- ev: NextFetchEvent
+ ev: NextFetchEvent,
) {
const url = req.nextUrl.clone();
const { hostname, key } = parse(req);
@@ -16,7 +16,7 @@ export default async function LinkMiddleware(
const response = await redis.hget<Omit<LinkProps, "key">>(
`${hostname}:links`,
- key
+ key,
);
const { url: target, description, image } = response || {};
diff --git a/lib/middleware/root.ts b/lib/middleware/root.ts
index 68742d03de..3295734f8a 100644
--- a/lib/middleware/root.ts
+++ b/lib/middleware/root.ts
@@ -4,7 +4,7 @@ import { parse } from "./utils";
export default async function RootMiddleware(
req: NextRequest,
- ev: NextFetchEvent
+ ev: NextFetchEvent,
) {
const { hostname } = parse(req);
diff --git a/lib/middleware/utils.ts b/lib/middleware/utils.ts
index b277b4e32a..04fe53ac65 100644
--- a/lib/middleware/utils.ts
+++ b/lib/middleware/utils.ts
@@ -16,7 +16,7 @@ export const detectBot = (req: NextRequest) => {
if (ua) {
// Note: MetaInspector is for https://metatags.io/
return /bot|google|baidu|bing|msn|duckduckbot|teoma|slurp|yandex|MetaInspector/i.test(
- ua
+ ua,
);
}
return false;
diff --git a/lib/qr/codegen.ts b/lib/qr/codegen.ts
index 738edbed8b..fd57f3a743 100644
--- a/lib/qr/codegen.ts
+++ b/lib/qr/codegen.ts
@@ -48,7 +48,7 @@ namespace qrcodegen {
// The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.
public static encodeBinary(
data: Readonly<Array<byte>>,
- ecl: QrCode.Ecc
+ ecl: QrCode.Ecc,
): QrCode {
const seg: QrSegment = qrcodegen.QrSegment.makeBytes(data);
return QrCode.encodeSegments([seg], ecl);
@@ -71,7 +71,7 @@ namespace qrcodegen {
minVersion: int = 1,
maxVersion: int = 40,
mask: int = -1,
- boostEcl: boolean = true
+ boostEcl: boolean = true,
): QrCode {
if (
!(
@@ -143,7 +143,7 @@ namespace qrcodegen {
let dataCodewords: Array<byte> = [];
while (dataCodewords.length * 8 < bb.length) dataCodewords.push(0);
bb.forEach(
- (b: bit, i: int) => (dataCodewords[i >>> 3] |= b << (7 - (i & 7)))
+ (b: bit, i: int) => (dataCodewords[i >>> 3] |= b << (7 - (i & 7))),
);
// Create the QR Code object
@@ -184,7 +184,7 @@ namespace qrcodegen {
dataCodewords: Readonly<Array<byte>>,
- msk: int
+ msk: int,
) {
// Check scalar arguments
if (version < QrCode.MIN_VERSION || version > QrCode.MAX_VERSION)
@@ -351,7 +351,7 @@ namespace qrcodegen {
this.setFunctionModule(
x + dx,
y + dy,
- Math.max(Math.abs(dx), Math.abs(dy)) != 1
+ Math.max(Math.abs(dx), Math.abs(dy)) != 1,
);
}
}
@@ -378,7 +378,7 @@ namespace qrcodegen {
QrCode.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver];
const blockEccLen: int = QrCode.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver];
const rawCodewords: int = Math.floor(
- QrCode.getNumRawDataModules(ver) / 8
+ QrCode.getNumRawDataModules(ver) / 8,
);
const numShortBlocks: int = numBlocks - (rawCodewords % numBlocks);
const shortBlockLen: int = Math.floor(rawCodewords / numBlocks);
@@ -389,7 +389,7 @@ namespace qrcodegen {
for (let i = 0, k = 0; i < numBlocks; i++) {
let dat: Array<byte> = data.slice(
k,
- k + shortBlockLen - blockEccLen + (i < numShortBlocks ? 0 : 1)
+ k + shortBlockLen - blockEccLen + (i < numShortBlocks ? 0 : 1),
);
k += dat.length;
const ecc: Array<byte> = QrCode.reedSolomonComputeRemainder(dat, rsDiv);
@@ -638,7 +638,7 @@ namespace qrcodegen {
// Returns the Reed-Solomon error correction codeword for the given data and divisor polynomials.
private static reedSolomonComputeRemainder(
data: Readonly<Array<byte>>,
- divisor: Readonly<Array<byte>>
+ divisor: Readonly<Array<byte>>,
): Array<byte> {
let result: Array<byte> = divisor.map((_) => 0);
for (const b of data) {
@@ -646,7 +646,7 @@ namespace qrcodegen {
const factor: byte = b ^ (result.shift() as byte);
result.push(0);
divisor.forEach(
- (coef, i) => (result[i] ^= QrCode.reedSolomonMultiply(coef, factor))
+ (coef, i) => (result[i] ^= QrCode.reedSolomonMultiply(coef, factor)),
);
}
return result;
@@ -688,7 +688,7 @@ namespace qrcodegen {
private finderPenaltyTerminateAndCount(
currentRunColor: boolean,
currentRunLength: int,
- runHistory: Array<int>
+ runHistory: Array<int>,
): int {
if (currentRunColor) {
// Terminate dark run
@@ -703,7 +703,7 @@ namespace qrcodegen {
// Pushes the given value to the front and drops the last value. A helper function for getPenaltyScore().
private finderPenaltyAddHistory(
currentRunLength: int,
- runHistory: Array<int>
+ runHistory: Array<int>,
): void {
if (runHistory[0] == 0) currentRunLength += this.size; // Add light border to initial run
runHistory.pop();
@@ -841,7 +841,7 @@ namespace qrcodegen {
public static makeAlphanumeric(text: string): QrSegment {
if (!QrSegment.isAlphanumeric(text))
throw new RangeError(
- "String contains unencodable characters in alphanumeric mode"
+ "String contains unencodable characters in alphanumeric mode",
);
let bb: Array<bit> = [];
let i: int;
@@ -857,7 +857,7 @@ namespace qrcodegen {
appendBits(
QrSegment.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i)),
6,
- bb
+ bb,
);
return new QrSegment(QrSegment.Mode.ALPHANUMERIC, text.length, bb);
}
@@ -918,7 +918,7 @@ namespace qrcodegen {
public readonly numChars: int,
// The data bits of this segment. Accessed through getData().
- private readonly bitData: Array<bit>
+ private readonly bitData: Array<bit>,
) {
if (numChars < 0) throw new RangeError("Invalid argument");
this.bitData = bitData.slice(); // Make defensive copy
@@ -935,7 +935,7 @@ namespace qrcodegen {
// the given version. The result is infinity if a segment has too many characters to fit its length field.
public static getTotalBits(
segs: Readonly<Array<QrSegment>>,
- version: int
+ version: int,
): number {
let result: number = 0;
for (const seg of segs) {
@@ -998,7 +998,7 @@ namespace qrcodegen.QrCode {
// In the range 0 to 3 (unsigned 2-bit integer).
public readonly ordinal: int,
// (Package-private) In the range 0 to 3 (unsigned 2-bit integer).
- public readonly formatBits: int
+ public readonly formatBits: int,
) {}
}
}
@@ -1026,7 +1026,7 @@ namespace qrcodegen.QrSegment {
// The mode indicator bits, which is a uint4 value (range 0 to 15).
public readonly modeBits: int,
// Number of character count bits for three different version ranges.
- private readonly numBitsCharCount: [int, int, int]
+ private readonly numBitsCharCount: [int, int, int],
) {}
/*-- Method --*/
diff --git a/lib/qr/index.tsx b/lib/qr/index.tsx
index 4d00b3c32c..957983c7c9 100644
--- a/lib/qr/index.tsx
+++ b/lib/qr/index.tsx
@@ -3,21 +3,19 @@
* Copyright (c) Paul O'Shannessy
* SPDX-License-Identifier: ISC
*/
+import type { CSSProperties } from "react";
+import React, { useEffect, useRef, useState } from "react";
+import { escape } from "html-escaper";
+import qrcodegen from "./codegen";
-import { escape } from 'html-escaper';
-import type { CSSProperties } from 'react';
-import React, { useEffect, useRef, useState } from 'react';
-
-import qrcodegen from './codegen';
-
-type Modules = ReturnType<qrcodegen.QrCode['getModules']>;
+type Modules = ReturnType<qrcodegen.QrCode["getModules"]>;
type Excavation = { x: number; y: number; w: number; h: number };
const ERROR_LEVEL_MAP: { [index: string]: qrcodegen.QrCode.Ecc } = {
L: qrcodegen.QrCode.Ecc.LOW,
M: qrcodegen.QrCode.Ecc.MEDIUM,
Q: qrcodegen.QrCode.Ecc.QUARTILE,
- H: qrcodegen.QrCode.Ecc.HIGH
+ H: qrcodegen.QrCode.Ecc.HIGH,
};
type ImageSettings = {
@@ -44,9 +42,9 @@ type QRPropsCanvas = QRProps & React.CanvasHTMLAttributes<HTMLCanvasElement>;
type QRPropsSVG = QRProps & React.SVGProps<SVGSVGElement>;
const DEFAULT_SIZE = 128;
-const DEFAULT_LEVEL = 'L';
-const DEFAULT_BGCOLOR = '#FFFFFF';
-const DEFAULT_FGCOLOR = '#000000';
+const DEFAULT_LEVEL = "L";
+const DEFAULT_BGCOLOR = "#FFFFFF";
+const DEFAULT_FGCOLOR = "#000000";
const DEFAULT_INCLUDEMARGIN = false;
const MARGIN_SIZE = 4;
@@ -65,7 +63,9 @@ function generatePath(modules: Modules, margin = 0): string {
if (!cell && start !== null) {
// M0 0h7v1H0z injects the space with the move and drops the comma,
// saving a char per operation
- ops.push(`M${start + margin} ${y + margin}h${x - start}v1H${start + margin}z`);
+ ops.push(
+ `M${start + margin} ${y + margin}h${x - start}v1H${start + margin}z`,
+ );
start = null;
return;
}
@@ -82,7 +82,11 @@ function generatePath(modules: Modules, margin = 0): string {
ops.push(`M${x + margin},${y + margin} h1v1H${x + margin}z`);
} else {
// Otherwise finish the current line.
- ops.push(`M${start + margin},${y + margin} h${x + 1 - start}v1H${start + margin}z`);
+ ops.push(
+ `M${start + margin},${y + margin} h${x + 1 - start}v1H${
+ start + margin
+ }z`,
+ );
}
return;
}
@@ -92,7 +96,7 @@ function generatePath(modules: Modules, margin = 0): string {
}
});
});
- return ops.join('');
+ return ops.join("");
}
// We could just do this in generatePath, except that we want to support
@@ -115,7 +119,7 @@ function getImageSettings(
cells: Modules,
size: number,
includeMargin: boolean,
- imageSettings?: ImageSettings
+ imageSettings?: ImageSettings,
): null | {
x: number;
y: number;
@@ -132,8 +136,14 @@ function getImageSettings(
const scale = numCells / size;
const w = (imageSettings.width || defaultSize) * scale;
const h = (imageSettings.height || defaultSize) * scale;
- const x = imageSettings.x == null ? cells.length / 2 - w / 2 : imageSettings.x * scale;
- const y = imageSettings.y == null ? cells.length / 2 - h / 2 : imageSettings.y * scale;
+ const x =
+ imageSettings.x == null
+ ? cells.length / 2 - w / 2
+ : imageSettings.x * scale;
+ const y =
+ imageSettings.y == null
+ ? cells.length / 2 - h / 2
+ : imageSettings.y * scale;
let excavation = null;
if (imageSettings.excavate) {
@@ -189,20 +199,32 @@ export function QRCodeCanvas(props: QRPropsCanvas) {
if (_canvas.current != null) {
const canvas = _canvas.current;
- const ctx = canvas.getContext('2d');
+ const ctx = canvas.getContext("2d");
if (!ctx) {
return;
}
- let cells = qrcodegen.QrCode.encodeText(value, ERROR_LEVEL_MAP[level]).getModules();
+ let cells = qrcodegen.QrCode.encodeText(
+ value,
+ ERROR_LEVEL_MAP[level],
+ ).getModules();
const margin = includeMargin ? MARGIN_SIZE : 0;
const numCells = cells.length + margin * 2;
- const calculatedImageSettings = getImageSettings(cells, size, includeMargin, imageSettings);
+ const calculatedImageSettings = getImageSettings(
+ cells,
+ size,
+ includeMargin,
+ imageSettings,
+ );
const image = _image.current;
const haveImageToRender =
- calculatedImageSettings != null && image !== null && image.complete && image.naturalHeight !== 0 && image.naturalWidth !== 0;
+ calculatedImageSettings != null &&
+ image !== null &&
+ image.complete &&
+ image.naturalHeight !== 0 &&
+ image.naturalWidth !== 0;
if (haveImageToRender) {
if (calculatedImageSettings.excavation != null) {
@@ -243,7 +265,7 @@ export function QRCodeCanvas(props: QRPropsCanvas) {
calculatedImageSettings.x + margin,
calculatedImageSettings.y + margin,
calculatedImageSettings.w,
- calculatedImageSettings.h
+ calculatedImageSettings.h,
);
}
}
@@ -262,7 +284,7 @@ export function QRCodeCanvas(props: QRPropsCanvas) {
<img
src={imgSrc}
key={imgSrc}
- style={{ display: 'none' }}
+ style={{ display: "none" }}
onLoad={() => {
setIsImageLoaded(true);
}}
@@ -272,7 +294,13 @@ export function QRCodeCanvas(props: QRPropsCanvas) {
}
return (
<>
- <canvas style={canvasStyle} height={size} width={size} ref={_canvas} {...otherProps} />
+ <canvas
+ style={canvasStyle}
+ height={size}
+ width={size}
+ ref={_canvas}
+ {...otherProps}
+ />
{img}
</>
);
@@ -290,11 +318,19 @@ export function QRCodeSVG(props: QRPropsSVG) {
...otherProps
} = props;
- let cells = qrcodegen.QrCode.encodeText(value, ERROR_LEVEL_MAP[level]).getModules();
+ let cells = qrcodegen.QrCode.encodeText(
+ value,
+ ERROR_LEVEL_MAP[level],
+ ).getModules();
const margin = includeMargin ? MARGIN_SIZE : 0;
const numCells = cells.length + margin * 2;
- const calculatedImageSettings = getImageSettings(cells, size, includeMargin, imageSettings);
+ const calculatedImageSettings = getImageSettings(
+ cells,
+ size,
+ includeMargin,
+ imageSettings,
+ );
let image = null;
if (imageSettings != null && calculatedImageSettings != null) {
@@ -323,8 +359,17 @@ export function QRCodeSVG(props: QRPropsSVG) {
const fgPath = generatePath(cells, margin);
return (
- <svg height={size} width={size} viewBox={`0 0 ${numCells} ${numCells}`} {...otherProps}>
- <path fill={bgColor} d={`M0,0 h${numCells}v${numCells}H0z`} shapeRendering="crispEdges" />
+ <svg
+ height={size}
+ width={size}
+ viewBox={`0 0 ${numCells} ${numCells}`}
+ {...otherProps}
+ >
+ <path
+ fill={bgColor}
+ d={`M0,0 h${numCells}v${numCells}H0z`}
+ shapeRendering="crispEdges"
+ />
<path fill={fgColor} d={fgPath} shapeRendering="crispEdges" />
{image}
</svg>
@@ -339,26 +384,35 @@ export function getQRAsSVGDataUri(props: QRProps) {
bgColor = DEFAULT_BGCOLOR,
fgColor = DEFAULT_FGCOLOR,
includeMargin = DEFAULT_INCLUDEMARGIN,
- imageSettings
+ imageSettings,
} = props;
- let cells = qrcodegen.QrCode.encodeText(value, ERROR_LEVEL_MAP[level]).getModules();
+ let cells = qrcodegen.QrCode.encodeText(
+ value,
+ ERROR_LEVEL_MAP[level],
+ ).getModules();
const margin = includeMargin ? MARGIN_SIZE : 0;
const numCells = cells.length + margin * 2;
- const calculatedImageSettings = getImageSettings(cells, size, includeMargin, imageSettings);
+ const calculatedImageSettings = getImageSettings(
+ cells,
+ size,
+ includeMargin,
+ imageSettings,
+ );
- let image = '';
+ let image = "";
if (imageSettings != null && calculatedImageSettings != null) {
- if (calculatedImageSettings.excavation != null) cells = excavateModules(cells, calculatedImageSettings.excavation);
+ if (calculatedImageSettings.excavation != null)
+ cells = excavateModules(cells, calculatedImageSettings.excavation);
image = [
`<image xlinkHref="${escape(imageSettings.src)}"`,
`height="${calculatedImageSettings.h}"`,
`width="${calculatedImageSettings.w}"`,
`x="${calculatedImageSettings.x + margin}"`,
`y="${calculatedImageSettings.y + margin}"`,
- 'preserveAspectRatio="none"></image>'
- ].join(' ');
+ 'preserveAspectRatio="none"></image>',
+ ].join(" ");
}
const fgPath = generatePath(cells, margin);
@@ -367,8 +421,8 @@ export function getQRAsSVGDataUri(props: QRProps) {
`<path fill="${bgColor}" d="M0,0 h${numCells}v${numCells}H0z" shapeRendering="crispEdges"></path>`,
`<path fill="${fgColor}" d="${fgPath}" shapeRendering="crispEdges"></path>`,
image,
- '</svg>'
- ].join('');
+ "</svg>",
+ ].join("");
return `data:image/svg+xml,${encodeURIComponent(svgData)}`;
}
@@ -383,7 +437,7 @@ function waitUntilImageLoaded(img: HTMLImageElement, src: string) {
img.onload = onFinish;
img.onerror = onFinish;
img.src = src;
- img.loading = 'eager';
+ img.loading = "eager";
});
}
@@ -395,16 +449,24 @@ export async function getQRAsCanvas(props: QRProps, type: string) {
bgColor = DEFAULT_BGCOLOR,
fgColor = DEFAULT_FGCOLOR,
includeMargin = DEFAULT_INCLUDEMARGIN,
- imageSettings
+ imageSettings,
} = props;
- const canvas = document.createElement('canvas');
- const ctx = canvas.getContext('2d');
+ const canvas = document.createElement("canvas");
+ const ctx = canvas.getContext("2d");
- let cells = qrcodegen.QrCode.encodeText(value, ERROR_LEVEL_MAP[level]).getModules();
+ let cells = qrcodegen.QrCode.encodeText(
+ value,
+ ERROR_LEVEL_MAP[level],
+ ).getModules();
const margin = includeMargin ? MARGIN_SIZE : 0;
const numCells = cells.length + margin * 2;
- const calculatedImageSettings = getImageSettings(cells, size, includeMargin, imageSettings);
+ const calculatedImageSettings = getImageSettings(
+ cells,
+ size,
+ includeMargin,
+ imageSettings,
+ );
const image = new Image();
if (calculatedImageSettings) {
@@ -438,14 +500,18 @@ export async function getQRAsCanvas(props: QRProps, type: string) {
}
const haveImageToRender =
- calculatedImageSettings != null && image !== null && image.complete && image.naturalHeight !== 0 && image.naturalWidth !== 0;
+ calculatedImageSettings != null &&
+ image !== null &&
+ image.complete &&
+ image.naturalHeight !== 0 &&
+ image.naturalWidth !== 0;
if (haveImageToRender) {
ctx.drawImage(
image,
calculatedImageSettings.x + margin,
calculatedImageSettings.y + margin,
calculatedImageSettings.w,
- calculatedImageSettings.h
+ calculatedImageSettings.h,
);
}
diff --git a/lib/stats.ts b/lib/stats.ts
index 44c53c7f82..5b1db5ecea 100644
--- a/lib/stats.ts
+++ b/lib/stats.ts
@@ -77,7 +77,7 @@ interface getTimeIntervalsOutputProps {
}
export const getTimeIntervals = (
- interval: IntervalProps
+ interval: IntervalProps,
): getTimeIntervalsOutputProps => {
const { milliseconds, intervals, coefficient } = intervalData[interval];
const endTimestamp = Math.ceil(Date.now() / coefficient) * coefficient;
@@ -92,14 +92,14 @@ export const getTimeIntervals = (
export function processData(
key: string,
data: RawStatsProps[],
- interval?: IntervalProps // if undefined, 24h is used
+ interval?: IntervalProps, // if undefined, 24h is used
): StatsProps {
const { timeIntervals } = getTimeIntervals(interval || "24h");
const clicksData = timeIntervals.map((interval) => ({
...interval,
count: data.filter(
- (d) => d.timestamp > interval.start && d.timestamp < interval.end
+ (d) => d.timestamp > interval.start && d.timestamp < interval.end,
).length,
}));
@@ -160,7 +160,7 @@ export type LocationTabs = "country" | "city" | "region";
export const processLocationData = (
data: StatsProps["locationData"],
- tab: LocationTabs
+ tab: LocationTabs,
): LocationStatsProps[] => {
const countryCodeMap: { [key: string]: string } = {};
@@ -193,7 +193,7 @@ export interface DeviceStatsProps {
export const processDeviceData = (
data: StatsProps["deviceData"],
tab: DeviceTabs,
- showBots: boolean
+ showBots: boolean,
): DeviceStatsProps[] => {
const results =
data && data.length > 0
diff --git a/lib/stripe/client.ts b/lib/stripe/client.ts
index 6a0000a6f8..5bb9d701d6 100644
--- a/lib/stripe/client.ts
+++ b/lib/stripe/client.ts
@@ -8,7 +8,7 @@ export const getStripe = () => {
stripePromise = loadStripe(
process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY_LIVE ??
process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY ??
- ""
+ "",
);
}
diff --git a/lib/stripe/index.ts b/lib/stripe/index.ts
index 594c7567db..807040270a 100644
--- a/lib/stripe/index.ts
+++ b/lib/stripe/index.ts
@@ -8,5 +8,5 @@ export const stripe = new Stripe(
name: "Dub.sh",
version: "0.1.0",
},
- }
+ },
);
diff --git a/lib/swr/use-project.ts b/lib/swr/use-project.ts
index 4fcf68fafb..b3039bf711 100644
--- a/lib/swr/use-project.ts
+++ b/lib/swr/use-project.ts
@@ -16,7 +16,7 @@ export default function useProject() {
fetcher,
{
dedupingInterval: 30000,
- }
+ },
);
const isOwner = useMemo(() => {
diff --git a/lib/swr/use-usage.ts b/lib/swr/use-usage.ts
index c31a093535..4e9d9ce5e4 100644
--- a/lib/swr/use-usage.ts
+++ b/lib/swr/use-usage.ts
@@ -10,7 +10,7 @@ export default function useUsage() {
const { slug } = router.query;
const { data, error } = useSWR<UsageProps>(
slug ? `/api/projects/${slug}/usage` : `/api/usage`,
- fetcher
+ fetcher,
);
const exceededUsage = useMemo(() => {
@@ -22,7 +22,7 @@ export default function useUsage() {
const plan = useMemo(() => {
if (data) {
return getPlanFromUsageLimit(
- slug ? data.ownerUsageLimit : data.usageLimit
+ slug ? data.ownerUsageLimit : data.usageLimit,
);
}
}, [data]);
diff --git a/lib/upstash.ts b/lib/upstash.ts
index 552bc7d223..60e14299e6 100644
--- a/lib/upstash.ts
+++ b/lib/upstash.ts
@@ -25,7 +25,7 @@ export const redis = new Redis({
const nanoid = customAlphabet(
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
- 7
+ 7,
); // 7-character random string
export async function setKey(
@@ -34,7 +34,7 @@ export async function setKey(
url: string,
title?: string,
description?: string, // only for Pro users: customize description
- image?: string // only for Pro users: customize OG image
+ image?: string, // only for Pro users: customize OG image
) {
return await redis.hsetnx(`${hostname}:links`, key, {
url,
@@ -49,7 +49,7 @@ export async function setKey(
export async function setRandomKey(
hostname: string,
url: string,
- title?: string
+ title?: string,
): Promise<{ response: number; key: string }> {
/* recursively set link till successful */
const key = nanoid();
@@ -88,7 +88,7 @@ export async function checkIfKeyExists(hostname: string, key: string) {
export async function recordClick(
hostname: string,
req: NextRequest,
- key?: string
+ key?: string,
) {
return await redis.zadd(
key ? `${hostname}:clicks:${key}` : `${hostname}:root:clicks`,
@@ -100,7 +100,7 @@ export async function recordClick(
referer: req.headers.get("referer"),
timestamp: Date.now(),
},
- }
+ },
);
}
@@ -109,7 +109,7 @@ export async function recordClick(
**/
export async function getLinksForProject(
slug: string,
- userId?: string
+ userId?: string,
): Promise<LinkProps[]> {
/*
This function is used to get all links for a project.
@@ -124,7 +124,7 @@ export async function getLinksForProject(
-1,
{
rev: true,
- }
+ },
);
if (!keys || keys.length === 0) return []; // no links for this project
const metadata = (await redis.hmget(`${slug}:links`, ...keys)) as {
@@ -154,7 +154,7 @@ export async function getLinkClicksCount(hostname: string, key: string) {
export async function addLink(
hostname: string,
link: LinkProps,
- userId?: string // only applicable for dub.sh links
+ userId?: string, // only applicable for dub.sh links
) {
const {
key, // if key is provided, it will be used
@@ -177,7 +177,7 @@ export async function addLink(
{
score: Date.now(),
member: key,
- }
+ },
);
} else {
return null; // key already exists
@@ -191,7 +191,7 @@ export async function editLink(
domain: string,
oldKey: string,
link: LinkProps,
- userId?: string
+ userId?: string,
) {
let { key, url, title, timestamp, description: rawDescription, image } = link;
@@ -225,7 +225,7 @@ export async function editLink(
// remove old key from links:timestamps and add new key (with same timestamp)
pipeline.zrem(
`${domain}:links:timestamps${userId ? `:${userId}` : ""}`,
- oldKey
+ oldKey,
);
pipeline.zadd(`${domain}:links:timestamps${userId ? `:${userId}` : ""}`, {
score: timestamp,
@@ -255,7 +255,7 @@ export async function deleteLink(domain: string, key: string, userId?: string) {
**/
export async function getUsage(
hostname: string,
- billingCycleStart: number
+ billingCycleStart: number,
): Promise<number> {
const { firstDay, lastDay } = getFirstAndLastDay(billingCycleStart);
@@ -268,7 +268,7 @@ export async function getUsage(
pipeline.zcount(
`${hostname}:clicks:${link}`,
firstDay.getTime(),
- lastDay.getTime()
+ lastDay.getTime(),
);
});
results = await pipeline.exec();
@@ -281,19 +281,19 @@ export async function changeDomain(hostname: string, newHostname: string) {
const keys = await redis.zrange<string[]>(
`${hostname}:links:timestamps`,
0,
- -1
+ -1,
);
const pipeline = redis.pipeline();
pipeline.rename(`${hostname}:links`, `${newHostname}:links`);
pipeline.rename(
`${hostname}:links:timestamps`,
- `${newHostname}:links:timestamps`
+ `${newHostname}:links:timestamps`,
);
pipeline.rename(`${hostname}:root:clicks`, `${newHostname}:root:clicks`);
keys.forEach((key) => {
pipeline.rename(
`${hostname}:clicks:${key}`,
- `${newHostname}:clicks:${key}`
+ `${newHostname}:clicks:${key}`,
);
});
try {
@@ -307,7 +307,7 @@ export async function deleteProject(hostname: string) {
const keys = await redis.zrange<string[]>(
`${hostname}:links:timestamps`,
0,
- -1
+ -1,
);
const pipeline = redis.pipeline();
pipeline.del(`${hostname}:links`);
diff --git a/lib/utils.ts b/lib/utils.ts
index c708b71aae..5b03b1fb68 100644
--- a/lib/utils.ts
+++ b/lib/utils.ts
@@ -7,7 +7,7 @@ interface SWRError extends Error {
export async function fetcher<JSON = any>(
input: RequestInfo,
- init?: RequestInit
+ init?: RequestInit,
): Promise<JSON> {
const res = await fetch(input, init);
@@ -137,14 +137,14 @@ export const generateSlugFromName = (name: string) => {
}
const shortestString = [normalizedName, devowel, acronym].reduce((a, b) =>
- a.length < b.length ? a : b
+ a.length < b.length ? a : b,
);
return `${shortestString}.sh`;
};
export const validDomainRegex = new RegExp(
- "^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$"
+ "^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$",
);
export const getFirstAndLastDay = (day: number) => {
diff --git a/pages/api/auth/account-exists.ts b/pages/api/auth/account-exists.ts
index 13c688caae..53e8e9a1e5 100644
--- a/pages/api/auth/account-exists.ts
+++ b/pages/api/auth/account-exists.ts
@@ -3,7 +3,7 @@ import prisma from "@/lib/prisma";
export default async function handler(
req: NextApiRequest,
- res: NextApiResponse
+ res: NextApiResponse,
) {
if (req.method === "POST") {
const { email } = req.body;
diff --git a/pages/api/cron/domains.ts b/pages/api/cron/domains.ts
index d5199446ae..cb9b4507c2 100644
--- a/pages/api/cron/domains.ts
+++ b/pages/api/cron/domains.ts
@@ -74,7 +74,7 @@ async function handler(_req: NextApiRequest, res: NextApiResponse) {
createdAt,
newDomainVerified,
changed,
- project.sentEmails.map((email) => email.type)
+ project.sentEmails.map((email) => email.type),
);
return {
@@ -85,7 +85,7 @@ async function handler(_req: NextApiRequest, res: NextApiResponse) {
updates,
prismaResponse,
};
- })
+ }),
);
res.status(200).json(results);
} catch (error) {
diff --git a/pages/api/cron/links.ts b/pages/api/cron/links.ts
index d4e8059482..4ad5f5671a 100644
--- a/pages/api/cron/links.ts
+++ b/pages/api/cron/links.ts
@@ -15,7 +15,7 @@ async function handler(_req: NextApiRequest, res: NextApiResponse) {
"dub.sh:links:timestamps:generic",
0,
aWeekAgo,
- { byScore: true }
+ { byScore: true },
);
const pipeline = redis.pipeline();
for (const link of links) {
diff --git a/pages/api/edge/coordinates.ts b/pages/api/edge/coordinates.ts
index e17142c1f1..2678bdafe9 100644
--- a/pages/api/edge/coordinates.ts
+++ b/pages/api/edge/coordinates.ts
@@ -14,7 +14,7 @@ export default async function handler(req: NextRequest) {
hostname ? `${hostname}:root:clicks` : "dub.sh:clicks:github",
0,
numPoints,
- { rev: true }
+ { rev: true },
);
const latestCoordinates = rawData.map((data, idx) => {
const { latitude, longitude } = data.geo;
diff --git a/pages/api/edge/links/[key]/stats.ts b/pages/api/edge/links/[key]/stats.ts
index 1a58c43c8c..e5d56bfe9b 100644
--- a/pages/api/edge/links/[key]/stats.ts
+++ b/pages/api/edge/links/[key]/stats.ts
@@ -26,7 +26,7 @@ export default async function handler(req: NextRequest) {
end,
{
byScore: true,
- }
+ },
);
const data = await processData(key, response, interval);
return new Response(JSON.stringify(data), { status: 200 });
diff --git a/pages/api/edge/links/index.ts b/pages/api/edge/links/index.ts
index f6e1cf433c..28e839ec3d 100644
--- a/pages/api/edge/links/index.ts
+++ b/pages/api/edge/links/index.ts
@@ -23,14 +23,14 @@ export default async function handler(req: NextRequest) {
key,
url,
}),
- { status: 200 }
+ { status: 200 },
);
} else {
return new Response(
JSON.stringify({
error: "failed to save link",
}),
- { status: 500 }
+ { status: 500 },
);
}
} else {
diff --git a/pages/api/links/[key].ts b/pages/api/links/[key].ts
index 9ac0bca9cc..657cfe4fb7 100644
--- a/pages/api/links/[key].ts
+++ b/pages/api/links/[key].ts
@@ -4,14 +4,14 @@ import { deleteLink, editLink, redis } from "@/lib/upstash";
export default async function handler(
req: NextApiRequest,
- res: NextApiResponse
+ res: NextApiResponse,
) {
const session = await getSession(req, res);
const { key: oldKey } = req.query as { key: string };
const isOwner = await redis.zscore(
`dub.sh:links:timestamps:${session.user.id}`,
- oldKey
+ oldKey,
);
if (!session?.user.id || !isOwner) return res.status(401).end("Unauthorized");
@@ -32,7 +32,7 @@ export default async function handler(
title,
timestamp,
},
- session.user.id
+ session.user.id,
);
if (response === null) {
return res.status(400).json({ error: "Key already exists" });
diff --git a/pages/api/links/index.ts b/pages/api/links/index.ts
index 06cbc10137..aa36f96814 100644
--- a/pages/api/links/index.ts
+++ b/pages/api/links/index.ts
@@ -6,7 +6,7 @@ import { addLink, getLinksForProject } from "@/lib/upstash";
export default async function handler(
req: NextApiRequest,
- res: NextApiResponse
+ res: NextApiResponse,
) {
const session = await getSession(req, res);
if (!session?.user.id) return res.status(401).end("Unauthorized");
@@ -25,7 +25,7 @@ export default async function handler(
const response = await addLink(
"dub.sh",
{ url, key, title },
- session.user.id
+ session.user.id,
);
if (response === null) {
diff --git a/pages/api/projects/[slug]/domains/[domain]/exists.ts b/pages/api/projects/[slug]/domains/[domain]/exists.ts
index 04ca90bca0..384554eae0 100644
--- a/pages/api/projects/[slug]/domains/[domain]/exists.ts
+++ b/pages/api/projects/[slug]/domains/[domain]/exists.ts
@@ -4,7 +4,7 @@ import prisma from "@/lib/prisma";
export default async function handler(
req: NextApiRequest,
- res: NextApiResponse
+ res: NextApiResponse,
) {
const session = await getSession(req, res);
if (!session?.user.id) return res.status(401).end("Unauthorized");
diff --git a/pages/api/projects/[slug]/domains/[domain]/index.ts b/pages/api/projects/[slug]/domains/[domain]/index.ts
index f8644ff86b..f04affb220 100644
--- a/pages/api/projects/[slug]/domains/[domain]/index.ts
+++ b/pages/api/projects/[slug]/domains/[domain]/index.ts
@@ -62,5 +62,5 @@ export default withProjectAuth(
.status(405)
.json({ error: `Method ${req.method} Not Allowed` });
}
- }
+ },
);
diff --git a/pages/api/projects/[slug]/domains/[domain]/links/[key]/clicks.ts b/pages/api/projects/[slug]/domains/[domain]/links/[key]/clicks.ts
index c8f28dbdfe..b5408eca5b 100644
--- a/pages/api/projects/[slug]/domains/[domain]/links/[key]/clicks.ts
+++ b/pages/api/projects/[slug]/domains/[domain]/links/[key]/clicks.ts
@@ -15,5 +15,5 @@ export default withProjectAuth(
.status(405)
.json({ error: `Method ${req.method} Not Allowed` });
}
- }
+ },
);
diff --git a/pages/api/projects/[slug]/domains/[domain]/links/[key]/exists.ts b/pages/api/projects/[slug]/domains/[domain]/links/[key]/exists.ts
index c0a38aae58..760d7f0d6d 100644
--- a/pages/api/projects/[slug]/domains/[domain]/links/[key]/exists.ts
+++ b/pages/api/projects/[slug]/domains/[domain]/links/[key]/exists.ts
@@ -15,5 +15,5 @@ export default withProjectAuth(
.status(405)
.json({ error: `Method ${req.method} Not Allowed` });
}
- }
+ },
);
diff --git a/pages/api/projects/[slug]/domains/[domain]/links/[key]/index.ts b/pages/api/projects/[slug]/domains/[domain]/links/[key]/index.ts
index 5f4ee14fb5..0d9fff0540 100644
--- a/pages/api/projects/[slug]/domains/[domain]/links/[key]/index.ts
+++ b/pages/api/projects/[slug]/domains/[domain]/links/[key]/index.ts
@@ -47,7 +47,7 @@ export default withProjectAuth(
image,
}),
fetch(
- `https://dub.sh/api/projects/${slug}/domains/${domain}/links/${oldKey}/revalidate?secret=${process.env.REVALIDATE_TOKEN}`
+ `https://dub.sh/api/projects/${slug}/domains/${domain}/links/${oldKey}/revalidate?secret=${process.env.REVALIDATE_TOKEN}`,
),
]);
if (response === null) {
@@ -72,5 +72,5 @@ export default withProjectAuth(
{
needVerifiedDomain: true,
needNotExceededUsage: true,
- }
+ },
);
diff --git a/pages/api/projects/[slug]/domains/[domain]/links/[key]/revalidate.ts b/pages/api/projects/[slug]/domains/[domain]/links/[key]/revalidate.ts
index ec9eeb91eb..b73dfb548f 100644
--- a/pages/api/projects/[slug]/domains/[domain]/links/[key]/revalidate.ts
+++ b/pages/api/projects/[slug]/domains/[domain]/links/[key]/revalidate.ts
@@ -2,7 +2,7 @@ import type { NextApiRequest, NextApiResponse } from "next";
export default async function handler(
req: NextApiRequest,
- res: NextApiResponse
+ res: NextApiResponse,
) {
if (req.query.secret !== process.env.REVALIDATE_TOKEN) {
return res.status(401).json({ message: "Invalid token" });
diff --git a/pages/api/projects/[slug]/domains/[domain]/links/[key]/stats.ts b/pages/api/projects/[slug]/domains/[domain]/links/[key]/stats.ts
index 167c75126e..a211120250 100644
--- a/pages/api/projects/[slug]/domains/[domain]/links/[key]/stats.ts
+++ b/pages/api/projects/[slug]/domains/[domain]/links/[key]/stats.ts
@@ -25,7 +25,7 @@ export default withProjectAuth(
end,
{
byScore: true,
- }
+ },
);
const data = await processData(key, response, interval);
return res.status(200).json(data);
@@ -36,5 +36,5 @@ export default withProjectAuth(
.json({ error: `Method ${req.method} Not Allowed` });
}
},
- { needNotExceededUsage: true }
+ { needNotExceededUsage: true },
);
diff --git a/pages/api/projects/[slug]/domains/[domain]/links/count.ts b/pages/api/projects/[slug]/domains/[domain]/links/count.ts
index 2776894654..27b7cc4da3 100644
--- a/pages/api/projects/[slug]/domains/[domain]/links/count.ts
+++ b/pages/api/projects/[slug]/domains/[domain]/links/count.ts
@@ -18,5 +18,5 @@ export default withProjectAuth(
.status(405)
.json({ error: `Method ${req.method} Not Allowed` });
}
- }
+ },
);
diff --git a/pages/api/projects/[slug]/domains/[domain]/links/index.ts b/pages/api/projects/[slug]/domains/[domain]/links/index.ts
index a768b0c0fd..9e83b6996c 100644
--- a/pages/api/projects/[slug]/domains/[domain]/links/index.ts
+++ b/pages/api/projects/[slug]/domains/[domain]/links/index.ts
@@ -48,5 +48,5 @@ export default withProjectAuth(
excludeGet: true,
needVerifiedDomain: true,
needNotExceededUsage: true,
- }
+ },
);
diff --git a/pages/api/projects/[slug]/domains/[domain]/links/random.ts b/pages/api/projects/[slug]/domains/[domain]/links/random.ts
index 7a959f98db..201fb595e2 100644
--- a/pages/api/projects/[slug]/domains/[domain]/links/random.ts
+++ b/pages/api/projects/[slug]/domains/[domain]/links/random.ts
@@ -18,5 +18,5 @@ export default withProjectAuth(
.status(405)
.json({ error: `Method ${req.method} Not Allowed` });
}
- }
+ },
);
diff --git a/pages/api/projects/[slug]/domains/[domain]/root/clicks.ts b/pages/api/projects/[slug]/domains/[domain]/root/clicks.ts
index 4658607bda..0bf790930c 100644
--- a/pages/api/projects/[slug]/domains/[domain]/root/clicks.ts
+++ b/pages/api/projects/[slug]/domains/[domain]/root/clicks.ts
@@ -19,5 +19,5 @@ export default withProjectAuth(
.status(405)
.json({ error: `Method ${req.method} Not Allowed` });
}
- }
+ },
);
diff --git a/pages/api/projects/[slug]/domains/[domain]/root/index.ts b/pages/api/projects/[slug]/domains/[domain]/root/index.ts
index c77cccbfdf..743e898dc7 100644
--- a/pages/api/projects/[slug]/domains/[domain]/root/index.ts
+++ b/pages/api/projects/[slug]/domains/[domain]/root/index.ts
@@ -29,5 +29,5 @@ export default withProjectAuth(
needNotExceededUsage: true,
// TODO: For when we make this a pro feature
// needProSubscription: true,
- }
+ },
);
diff --git a/pages/api/projects/[slug]/domains/[domain]/verify.ts b/pages/api/projects/[slug]/domains/[domain]/verify.ts
index 26fcc33a11..e42c39eac4 100644
--- a/pages/api/projects/[slug]/domains/[domain]/verify.ts
+++ b/pages/api/projects/[slug]/domains/[domain]/verify.ts
@@ -91,5 +91,5 @@ export default withProjectAuth(
.status(405)
.json({ error: `Method ${req.method} Not Allowed` });
}
- }
+ },
);
diff --git a/pages/api/projects/[slug]/exists.ts b/pages/api/projects/[slug]/exists.ts
index 32de38fb2d..8bf3314546 100644
--- a/pages/api/projects/[slug]/exists.ts
+++ b/pages/api/projects/[slug]/exists.ts
@@ -5,7 +5,7 @@ import prisma from "@/lib/prisma";
export default async function handler(
req: NextApiRequest,
- res: NextApiResponse
+ res: NextApiResponse,
) {
const session = await getSession(req, res);
if (!session?.user.id) return res.status(401).end("Unauthorized");
diff --git a/pages/api/projects/[slug]/index.ts b/pages/api/projects/[slug]/index.ts
index 62a9947755..6da7954b3c 100644
--- a/pages/api/projects/[slug]/index.ts
+++ b/pages/api/projects/[slug]/index.ts
@@ -46,5 +46,5 @@ export default withProjectAuth(
.status(405)
.json({ error: `Method ${req.method} Not Allowed` });
}
- }
+ },
);
diff --git a/pages/api/projects/[slug]/usage.ts b/pages/api/projects/[slug]/usage.ts
index 7b2efdcc81..2b3d870a7b 100644
--- a/pages/api/projects/[slug]/usage.ts
+++ b/pages/api/projects/[slug]/usage.ts
@@ -21,5 +21,5 @@ export default withProjectAuth(
.status(405)
.json({ error: `Method ${req.method} Not Allowed` });
}
- }
+ },
);
diff --git a/pages/api/projects/index.ts b/pages/api/projects/index.ts
index 3d23d5918a..ccd3f49826 100644
--- a/pages/api/projects/index.ts
+++ b/pages/api/projects/index.ts
@@ -95,5 +95,5 @@ export default withUserAuth(
},
{
needProSubscription: true,
- }
+ },
);
diff --git a/pages/api/stripe/manage-subscription.ts b/pages/api/stripe/manage-subscription.ts
index e92b0e5514..a4cecd6f6d 100644
--- a/pages/api/stripe/manage-subscription.ts
+++ b/pages/api/stripe/manage-subscription.ts
@@ -23,5 +23,5 @@ export default withUserAuth(
.json({ error: `Method ${req.method} Not Allowed` });
}
},
- { needUserDetails: true }
+ { needUserDetails: true },
);
diff --git a/pages/api/stripe/upgrade.ts b/pages/api/stripe/upgrade.ts
index 824e833243..c9a5028b76 100644
--- a/pages/api/stripe/upgrade.ts
+++ b/pages/api/stripe/upgrade.ts
@@ -8,7 +8,7 @@ export default withUserAuth(
req: NextApiRequest,
res: NextApiResponse,
userId: string,
- user: UserProps
+ user: UserProps,
) => {
// POST /api/stripe/upgrade – upgrade a user's account from free to pro
if (req.method === "POST") {
@@ -39,5 +39,5 @@ export default withUserAuth(
.json({ error: `Method ${req.method} Not Allowed` });
}
},
- { needUserDetails: true }
+ { needUserDetails: true },
);
diff --git a/pages/api/stripe/webhook.ts b/pages/api/stripe/webhook.ts
index 0f23ca18fc..4d737ade30 100644
--- a/pages/api/stripe/webhook.ts
+++ b/pages/api/stripe/webhook.ts
@@ -28,7 +28,7 @@ const relevantEvents = new Set([
export default async function webhookHandler(
req: NextApiRequest,
- res: NextApiResponse
+ res: NextApiResponse,
) {
// POST /api/projects/[slug]/upgrade/webhook – listen to Stripe webhooks
if (req.method === "POST") {
@@ -70,7 +70,7 @@ export default async function webhookHandler(
const tier = PRO_TIERS.find(
(tier) =>
tier.price.monthly.priceIds[env] === newPriceId ||
- tier.price.yearly.priceIds[env] === newPriceId
+ tier.price.yearly.priceIds[env] === newPriceId,
);
const usageLimit = tier.quota;
const stripeId = subscriptionUpdated.customer.toString();
@@ -114,7 +114,7 @@ export default async function webhookHandler(
ownerUsageLimit: usageLimit,
},
});
- })
+ }),
),
]);
} else if (event.type === "customer.subscription.deleted") {
@@ -160,7 +160,7 @@ export default async function webhookHandler(
ownerUsageLimit: 1000,
},
});
- })
+ }),
),
]);
} else {
diff --git a/pages/api/usage/index.ts b/pages/api/usage/index.ts
index e350fe23b8..75ed5c4c34 100644
--- a/pages/api/usage/index.ts
+++ b/pages/api/usage/index.ts
@@ -32,5 +32,5 @@ export default withUserAuth(
.status(405)
.json({ error: `Method ${req.method} Not Allowed` });
}
- }
+ },
);
diff --git a/pages/index.tsx b/pages/index.tsx
index 999e76ff3d..0d766d1a06 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -55,7 +55,7 @@ export async function getStaticProps() {
"Content-Type": "application/json",
},
}),
- }
+ },
).then((res) => res.json());
return {
diff --git a/pages/proxy/[domain]/[key].tsx b/pages/proxy/[domain]/[key].tsx
index 12384aa126..445d3421c6 100644
--- a/pages/proxy/[domain]/[key].tsx
+++ b/pages/proxy/[domain]/[key].tsx
@@ -61,7 +61,7 @@ export async function getStaticProps(ctx) {
const { domain, key } = ctx.params;
const response = await redis.hget<Omit<LinkProps, "key">>(
`${domain}:links`,
- key
+ key,
);
const { url, title, description, image } = response || {};
if (!url || !title || !description || !image) {