-
- Life and Lineage's Privacy Policy
-
-
Last Updated: October 22, 2024
-
- Welcome to Life and Lineage ('We', 'Us',
- 'Our'). Your privacy is important to us. This privacy
- policy will help you understand our policies and procedures related
- to the collection, use, and storage of personal information from our
- users.
-
-
-
-
- 1. Personal Information
-
-
-
-
(a) Collection of Personal Data:
{" "}
- Life and Lineage collects and stores personal data only if
- users opt to use the remote saving feature. The information
- collected includes email address, and if using an OAuth
- provider - first name, and last name. This information is used
- solely for the purpose of providing and managing the remote
- saving feature. It is and never will be shared with a third
- party.
-
-
-
(b) Data Removal:
Users can
- request the removal of all information related to them by
- visiting{" "}
-
- this page
- {" "}
- and filling out the provided form.
-
-
-
-
-
-
- 2. Third-Party Access
-
-
-
(a) Limited Third-Party Access:
We
- do not share or sell user information to third parties. However,
- we do utilize third-party services for crash reporting and
- performance profiling. These services do not have access to
- personal user information and only receive anonymized data
- related to app performance and stability.
-
-
-
-
-
- 3. Security
-
-
-
(a) Data Protection:
Life and
- Lineage takes appropriate measures to protect the personal
- information of users who opt for the remote saving feature. We
- implement industry-standard security protocols to prevent
- unauthorized access, disclosure, alteration, or destruction of
- user data.
-
-
-
-
-
- 4. Changes to the Privacy
- Policy
-
-
-
(a) Updates:
We may update this
- privacy policy periodically. Any changes to this privacy policy
- will be posted on this page. We encourage users to review this
- policy regularly to stay informed about how we protect their
- information.
-
-
-
-
-
- 5. Contact Us
-
-
-
(a) Reaching Out:
If there are any
- questions or comments regarding this privacy policy, you can
- contact us{" "}
-
- here
-
- .
-
-
-
+
+
Life and Lineage's Privacy Policy
+
Last Updated: October 22, 2024
+
+ Welcome to Life and Lineage ('We', 'Us',
+ 'Our'). Your privacy is important to us. This privacy policy
+ will help you understand our policies and procedures related to the
+ collection, use, and storage of personal information from our users.
+
+
+
+ 1. Personal Information
+
+
+
+
(a) Collection of Personal Data:
Life and
+ Lineage collects and stores personal data only if users opt to use
+ the remote saving feature. The information collected includes
+ email address, and if using an OAuth provider - first name, and
+ last name. This information is used solely for the purpose of
+ providing and managing the remote saving feature. It is and never
+ will be shared with a third party.
+
+
+
(b) Data Removal:
Users can request the
+ removal of all information related to them by visiting{" "}
+
+ this page
+ {" "}
+ and filling out the provided form.
+
+
+
+
+
+
+ 2. Third-Party Access
+
+
+
(a) Limited Third-Party Access:
We do not
+ share or sell user information to third parties. However, we do
+ utilize third-party services for crash reporting and performance
+ profiling. These services do not have access to personal user
+ information and only receive anonymized data related to app
+ performance and stability.
+
+
+
+
+
+ 3. Security
+
+
+
(a) Data Protection:
Life and Lineage takes
+ appropriate measures to protect the personal information of users
+ who opt for the remote saving feature. We implement
+ industry-standard security protocols to prevent unauthorized access,
+ disclosure, alteration, or destruction of user data.
+
+
+
+
+
+ 4. Changes to the Privacy Policy
+
+
+
(a) Updates:
We may update this privacy
+ policy periodically. Any changes to this privacy policy will be
+ posted on this page. We encourage users to review this policy
+ regularly to stay informed about how we protect their information.
+
+
+
+
+
+ 5. Contact Us
+
+
+
(a) Reaching Out:
If there are any
+ questions or comments regarding this privacy policy, you can contact
+ us{" "}
+
+ here
+
+ .
+
+
+
);
}
diff --git a/src/server/api/routers/blog.ts b/src/server/api/routers/blog.ts
index 78087a2..b3aa3f2 100644
--- a/src/server/api/routers/blog.ts
+++ b/src/server/api/routers/blog.ts
@@ -24,6 +24,7 @@ export const blogRouter = createTRPCRouter({
p.published,
p.category,
p.author_id,
+ p.banner_photo,
p.reads,
COUNT(DISTINCT pl.user_id) as total_likes,
COUNT(DISTINCT c.id) as total_comments
diff --git a/src/server/api/routers/misc.ts b/src/server/api/routers/misc.ts
index 4bfddbf..a14f51c 100644
--- a/src/server/api/routers/misc.ts
+++ b/src/server/api/routers/misc.ts
@@ -1,6 +1,11 @@
import { createTRPCRouter, publicProcedure } from "../utils";
import { z } from "zod";
-import { S3Client, GetObjectCommand, PutObjectCommand, DeleteObjectCommand } from "@aws-sdk/client-s3";
+import {
+ S3Client,
+ GetObjectCommand,
+ PutObjectCommand,
+ DeleteObjectCommand
+} from "@aws-sdk/client-s3";
import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
import { env } from "~/env/server";
import { TRPCError } from "@trpc/server";
@@ -11,49 +16,51 @@ import { getCookie, setCookie } from "vinxi/http";
const assets: Record
= {
"shapes-with-abigail": "shapes-with-abigail.apk",
"magic-delve": "magic-delve.apk",
- cork: "Cork.zip",
+ cork: "Cork.zip"
};
export const miscRouter = createTRPCRouter({
// ============================================================
// Downloads endpoint
// ============================================================
-
+
getDownloadUrl: publicProcedure
.input(z.object({ asset_name: z.string() }))
.query(async ({ input }) => {
const bucket = "frenomedownloads";
const params = {
Bucket: bucket,
- Key: assets[input.asset_name],
+ Key: assets[input.asset_name]
};
-
+
if (!assets[input.asset_name]) {
throw new TRPCError({
code: "NOT_FOUND",
- message: "Asset not found",
+ message: "Asset not found"
});
}
const credentials = {
accessKeyId: env._AWS_ACCESS_KEY,
- secretAccessKey: env._AWS_SECRET_KEY,
+ secretAccessKey: env._AWS_SECRET_KEY
};
try {
const client = new S3Client({
region: env.AWS_REGION,
- credentials: credentials,
+ credentials: credentials
});
const command = new GetObjectCommand(params);
- const signedUrl = await getSignedUrl(client, command, { expiresIn: 120 });
+ const signedUrl = await getSignedUrl(client, command, {
+ expiresIn: 120
+ });
return { downloadURL: signedUrl };
} catch (error) {
console.error(error);
throw new TRPCError({
code: "INTERNAL_SERVER_ERROR",
- message: "Failed to generate download URL",
+ message: "Failed to generate download URL"
});
}
}),
@@ -63,21 +70,23 @@ export const miscRouter = createTRPCRouter({
// ============================================================
getPreSignedURL: publicProcedure
- .input(z.object({
- type: z.string(),
- title: z.string(),
- filename: z.string(),
- }))
+ .input(
+ z.object({
+ type: z.string(),
+ title: z.string(),
+ filename: z.string()
+ })
+ )
.mutation(async ({ input }) => {
const credentials = {
accessKeyId: env._AWS_ACCESS_KEY,
- secretAccessKey: env._AWS_SECRET_KEY,
+ secretAccessKey: env._AWS_SECRET_KEY
};
try {
const client = new S3Client({
region: env.AWS_REGION,
- credentials: credentials,
+ credentials: credentials
});
const Key = `${input.type}/${input.title}/${input.filename}`;
@@ -86,38 +95,42 @@ export const miscRouter = createTRPCRouter({
const s3params = {
Bucket: env.AWS_S3_BUCKET_NAME,
Key,
- ContentType: `image/${ext![1]}`,
+ ContentType: `image/${ext![1]}`
};
const command = new PutObjectCommand(s3params);
- const signedUrl = await getSignedUrl(client, command, { expiresIn: 120 });
-
+ const signedUrl = await getSignedUrl(client, command, {
+ expiresIn: 120
+ });
+
return { uploadURL: signedUrl, key: Key };
} catch (error) {
console.error(error);
throw new TRPCError({
code: "INTERNAL_SERVER_ERROR",
- message: "Failed to generate pre-signed URL",
+ message: "Failed to generate pre-signed URL"
});
}
}),
deleteImage: publicProcedure
- .input(z.object({
- key: z.string(),
- newAttachmentString: z.string(),
- type: z.string(),
- id: z.number(),
- }))
+ .input(
+ z.object({
+ key: z.string(),
+ newAttachmentString: z.string(),
+ type: z.string(),
+ id: z.number()
+ })
+ )
.mutation(async ({ input }) => {
try {
const s3params = {
Bucket: env.AWS_S3_BUCKET_NAME,
- Key: input.key,
+ Key: input.key
};
const client = new S3Client({
- region: env.AWS_REGION,
+ region: env.AWS_REGION
});
const command = new DeleteObjectCommand(s3params);
@@ -127,7 +140,7 @@ export const miscRouter = createTRPCRouter({
const query = `UPDATE ${input.type} SET attachments = ? WHERE id = ?`;
await conn.execute({
sql: query,
- args: [input.newAttachmentString, input.id],
+ args: [input.newAttachmentString, input.id]
});
return res;
@@ -135,7 +148,7 @@ export const miscRouter = createTRPCRouter({
console.error(error);
throw new TRPCError({
code: "INTERNAL_SERVER_ERROR",
- message: "Failed to delete image",
+ message: "Failed to delete image"
});
}
}),
@@ -146,22 +159,22 @@ export const miscRouter = createTRPCRouter({
try {
const s3params = {
Bucket: env.AWS_S3_BUCKET_NAME,
- Key: input.key,
+ Key: input.key
};
const client = new S3Client({
- region: env.AWS_REGION,
+ region: env.AWS_REGION
});
const command = new DeleteObjectCommand(s3params);
const res = await client.send(command);
-
+
return res;
} catch (error) {
console.error(error);
throw new TRPCError({
code: "INTERNAL_SERVER_ERROR",
- message: "Failed to delete image",
+ message: "Failed to delete image"
});
}
}),
@@ -181,16 +194,18 @@ export const miscRouter = createTRPCRouter({
} catch (error) {
throw new TRPCError({
code: "INTERNAL_SERVER_ERROR",
- message: "Failed to hash password",
+ message: "Failed to hash password"
});
}
}),
checkPassword: publicProcedure
- .input(z.object({
- password: z.string(),
- hash: z.string(),
- }))
+ .input(
+ z.object({
+ password: z.string(),
+ hash: z.string()
+ })
+ )
.mutation(async ({ input }) => {
try {
const match = await bcrypt.compare(input.password, input.hash);
@@ -198,7 +213,78 @@ export const miscRouter = createTRPCRouter({
} catch (error) {
throw new TRPCError({
code: "INTERNAL_SERVER_ERROR",
- message: "Failed to check password",
+ message: "Failed to check password"
+ });
+ }
+ }),
+
+ // ============================================================
+ // Contact Form
+ // ============================================================
+
+ sendContactRequest: publicProcedure
+ .input(
+ z.object({
+ name: z.string().min(1),
+ email: z.string().email(),
+ message: z.string().min(1).max(500)
+ })
+ )
+ .mutation(async ({ input }) => {
+ // Check if contact request was recently sent
+ const contactExp = getCookie("contactRequestSent");
+ let remaining = 0;
+
+ if (contactExp) {
+ const expires = new Date(contactExp);
+ remaining = expires.getTime() - Date.now();
+ }
+
+ if (remaining > 0) {
+ throw new TRPCError({
+ code: "TOO_MANY_REQUESTS",
+ message: "countdown not expired"
+ });
+ }
+
+ const apiKey = env.SENDINBLUE_KEY;
+ const apiUrl = "https://api.sendinblue.com/v3/smtp/email";
+
+ const sendinblueData = {
+ sender: {
+ name: "freno.me",
+ email: "michael@freno.me"
+ },
+ to: [{ email: "michael@freno.me" }],
+ htmlContent: `Request Name: ${input.name}
Request Email: ${input.email}
Request Message: ${input.message}
`,
+ subject: "freno.me Contact Request"
+ };
+
+ try {
+ await fetch(apiUrl, {
+ method: "POST",
+ headers: {
+ accept: "application/json",
+ "api-key": apiKey,
+ "content-type": "application/json"
+ },
+ body: JSON.stringify(sendinblueData)
+ });
+
+ // Set cookie to prevent spam (60 second cooldown)
+ const exp = new Date(Date.now() + 1 * 60 * 1000);
+ setCookie("contactRequestSent", exp.toUTCString(), {
+ expires: exp,
+ path: "/"
+ });
+
+ return { message: "email sent" };
+ } catch (error) {
+ console.error(error);
+ throw new TRPCError({
+ code: "INTERNAL_SERVER_ERROR",
+ message:
+ "SMTP server error: Sorry! You can reach me at michael@freno.me"
});
}
}),
@@ -213,7 +299,7 @@ export const miscRouter = createTRPCRouter({
// Check if deletion request was recently sent
const deletionExp = getCookie("deletionRequestSent");
let remaining = 0;
-
+
if (deletionExp) {
const expires = new Date(deletionExp);
remaining = expires.getTime() - Date.now();
@@ -222,7 +308,7 @@ export const miscRouter = createTRPCRouter({
if (remaining > 0) {
throw new TRPCError({
code: "TOO_MANY_REQUESTS",
- message: "countdown not expired",
+ message: "countdown not expired"
});
}
@@ -233,22 +319,22 @@ export const miscRouter = createTRPCRouter({
const sendinblueMyData = {
sender: {
name: "freno.me",
- email: "michael@freno.me",
+ email: "michael@freno.me"
},
to: [{ email: "michael@freno.me" }],
htmlContent: `Request Name: Life and Lineage Account Deletion
Request Email: ${input.email}
`,
- subject: "Life and Lineage Acct Deletion",
+ subject: "Life and Lineage Acct Deletion"
};
// Email to user
const sendinblueUserData = {
sender: {
name: "freno.me",
- email: "michael@freno.me",
+ email: "michael@freno.me"
},
to: [{ email: input.email }],
htmlContent: `Request Name: Life and Lineage Account Deletion
Account to delete: ${input.email}
You can email michael@freno.me in the next 24hrs to cancel the deletion, email with subject line "Account Deletion Cancellation"
`,
- subject: "Life and Lineage Acct Deletion",
+ subject: "Life and Lineage Acct Deletion"
};
try {
@@ -258,9 +344,9 @@ export const miscRouter = createTRPCRouter({
headers: {
accept: "application/json",
"api-key": apiKey,
- "content-type": "application/json",
+ "content-type": "application/json"
},
- body: JSON.stringify(sendinblueMyData),
+ body: JSON.stringify(sendinblueMyData)
});
await fetch(apiUrl, {
@@ -268,16 +354,16 @@ export const miscRouter = createTRPCRouter({
headers: {
accept: "application/json",
"api-key": apiKey,
- "content-type": "application/json",
+ "content-type": "application/json"
},
- body: JSON.stringify(sendinblueUserData),
+ body: JSON.stringify(sendinblueUserData)
});
// Set cookie to prevent spam (60 second cooldown)
const exp = new Date(Date.now() + 1 * 60 * 1000);
setCookie("deletionRequestSent", exp.toUTCString(), {
expires: exp,
- path: "/",
+ path: "/"
});
return { message: "request sent" };
@@ -285,8 +371,9 @@ export const miscRouter = createTRPCRouter({
console.error(error);
throw new TRPCError({
code: "INTERNAL_SERVER_ERROR",
- message: "SMTP server error: Sorry! You can reach me at michael@freno.me",
+ message:
+ "SMTP server error: Sorry! You can reach me at michael@freno.me"
});
}
- }),
+ })
});