darief
darief
TTCTheo's Typesafe Cult
Created by darief on 9/8/2023 in #questions
Cron jobs fetching gmail emails every 10 minutes
Hey everyone. I was wondering if it was possible to setup a cron job to fetch emails using the gmail api every 10 minutes? Does anyone have any experiences with it, and if so, what would be the best way to approach something like this? The reason that I’m asking, is because I’m working on making an email client, and I figured prefetching emails like this would initially make it way faster!
4 replies
TTCTheo's Typesafe Cult
Created by darief on 8/25/2023 in #questions
OpenAi vs Hugging Face
Hey everyone. I’m currently working on a project where I need to summarize entire texts of a few hundred words into one sentence. I have some experience using OpenAIs API now, but I was curious if it’s better to use Hugging Face. I heard it’s cheaper and more flexible, but I want to hear from someone with experience. Additionally, I was also curious about the use of LangChain. Why would I use LangChain if I can use the LLMs straight from their api? Thanks🙏
2 replies
TTCTheo's Typesafe Cult
Created by darief on 7/10/2023 in #questions
CORS nightmare
Hi everyone. I am currently developing a chrome extension, where I am fetching data from my nextjs api. The main problem here is that when I try to fetch data, I am getting a cors error, due to the extension’s origin being “null”. Does anyone know how to get the chrome extension to send its origin to the server?
Access to fetch at '(server endpoint)' (redirected from '(server endpoint)') from origin 'chrome-extension://(extension_id)' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Access to fetch at '(server endpoint)' (redirected from '(server endpoint)') from origin 'chrome-extension://(extension_id)' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Chrome extension:
const user = useQuery(["user"], async () => {
const response = await fetch("(server_endpoint)", {
credentials: "include",
});
return response.json();
});
const user = useQuery(["user"], async () => {
const response = await fetch("(server_endpoint)", {
credentials: "include",
});
return response.json();
});
Nextjs Middleware:
if (origin && !allowedOrigins.includes(origin)) {
console.log("Origin not allowed");
console.log(origin);
return new NextResponse(null, {
status: 400,
statusText: "Bad Request",
headers: {
"Content-Type": "text/plain",
},
});
}
if (origin && !allowedOrigins.includes(origin)) {
console.log("Origin not allowed");
console.log(origin);
return new NextResponse(null, {
status: 400,
statusText: "Bad Request",
headers: {
"Content-Type": "text/plain",
},
});
}
4 replies
TTCTheo's Typesafe Cult
Created by darief on 6/4/2023 in #questions
Chrome extension Google Auth
Hi everyone! I am trying to figure out how I can authenticate my users on my chrome extension using Google Auth. Does anyone have experience with this?
2 replies
TTCTheo's Typesafe Cult
Created by darief on 3/11/2023 in #questions
Omegle clone saving socket ids
Hi everyone. I’m currently trying to make an Omegle Clone using NodeJS and React. For this, it’s important that random people are being matched with each other. I’m doing this by just randomly selecting two socket ids and have them communicate with each other automatically to eventually establish a video connection (through WebRTC) One thing I was originally doing was having an array in my server.js to store all socket ids. However, if I were to deploy this application, what would be the best way to implement saving these socket ids? I was thinking about using Redis, but I’m not sure what that would look like in this case.
2 replies