No longer hard-coding the peekalink API key
This commit is contained in:
Vendored
+1
@@ -5,4 +5,5 @@ declare global {
|
||||
const SESSION_SECRET: string;
|
||||
const GRAPH_JSON_API_KEY: string;
|
||||
const GRAPH_JSON_COLLECTION: string;
|
||||
const PEEKALINK_API_KEY: string;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
export async function sendEvent(event: Record<string, any>): Promise<void> {
|
||||
if (!GRAPH_JSON_API_KEY || !GRAPH_JSON_COLLECTION) {
|
||||
return;
|
||||
}
|
||||
|
||||
const payload = {
|
||||
api_key: GRAPH_JSON_API_KEY,
|
||||
collection: GRAPH_JSON_COLLECTION,
|
||||
|
||||
@@ -40,10 +40,14 @@ export const loader: LoaderFunction = async ({ params, request }) => {
|
||||
});
|
||||
}
|
||||
|
||||
if (!PEEKALINK_API_KEY) {
|
||||
return json({ error: "No preview available for this URL" });
|
||||
}
|
||||
|
||||
const response = await fetch("https://api.peekalink.io/", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"X-API-Key": "516ec4cd-6ebd-43ce-bc6d-b0b927d79188",
|
||||
"X-API-Key": PEEKALINK_API_KEY,
|
||||
"content-type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({ link: decoded }),
|
||||
|
||||
@@ -36,3 +36,4 @@ GRAPH_JSON_COLLECTION = "jsonhero-prod"
|
||||
# Secrets
|
||||
# [SESSION_STORAGE]
|
||||
# [GRAPH_JSON_API_KEY]
|
||||
# [PEEKALINK_API_KEY]
|
||||
Reference in New Issue
Block a user