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.

fix anonymous link creation

Steven Tey49f522eebb47
diff --git a/apps/web/app/api/links/route.ts b/apps/web/app/api/links/route.ts
index 2c0bcea308..b640a8cc31 100644
--- a/apps/web/app/api/links/route.ts
+++ b/apps/web/app/api/links/route.ts
@@ -59,7 +59,7 @@ export const POST = withAuth(
const { link, error, status } = await processLink({
payload: body,
project,
- userId: session.user.id,
+ ...(session && { userId: session.user.id }),
});
if (error) {
diff --git a/apps/web/scripts/hash-speed.ts b/apps/web/scripts/hash-speed.ts
new file mode 100644
index 0000000000..032630a2eb
--- /dev/null
+++ b/apps/web/scripts/hash-speed.ts
@@ -0,0 +1,12 @@
+import { hashStringSHA256 } from "@dub/utils";
+
+async function main() {
+ const text =
+ "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.";
+ console.time("hash");
+ const hash = await hashStringSHA256(text);
+ console.timeEnd("hash");
+ console.log(hash);
+}
+
+main();