Theo's Typesafe Cult

TTC

Theo's Typesafe Cult

Join the community to ask questions about Theo's Typesafe Cult and get answers from other members.

Join

Using cookie authentication with Uploadthing?

Hey, I'm using Fastify and React and I am using cookies for authentication. But it the UploadButton from Uploadthing does not include credentials with fetch. I saw a comment in #uploadthing saying to change fetch but this is a uploadthing/server thing, not a client option. Is this possible using @uploadthing/react? If so, how?...
Solution:
I found the answer here: https://discord.com/channels/966627436387266600/1102510616326967306/1320770031155413042 tldr: wait until the next update 😅...

tRPC findUnique problem

I am having this issue with tRPC which driving me crazy
No description

Poimandres w/ Cursor composer bar window opacity bug

Can anyone help me out with using the Poimandres theme within Cursor? Whenever I have poimandres enabled, the Cursor Composer windows has like < 50% opacity. No changes to my Cursor settings.json have resolved this... tried editing the theme colors but not sure which color Cursor is using to control the Composer bar background color

How to properly generate a PeerId/infohash and encode them in a url query string parameter?

Hello, I'm building a bittorrent client for the command line (https://github.com/reinaldorauch/bt) in Rust and I got as far as the metadata dealt with but when I try to reach a tracker server and announce my peer, they error back saying that my peer id/infohash are invalid. I'm pretty sure that is a encoding to the url problem as i created them in a way like with UInt8Array byte buffers, but the problem is that they can be any byte values and may not fall into ascii range. So I would have to use percent encoding and even using that converting back to raw bytes the result wouldnt be correct. I know this could be not the best place to ask but who knows, haha Thanks in advance....

niche ghostty question...

I want to make a keybind to open my dev environment on ghostty (without tmux) so far i've figured out how to do all my keybinds and even set a keybind to display text however I can't figure out how to escape text to add another command after the text.... here's what I mean
keybind = ctrl+space>n=text:nvim .
keybind = ctrl+space>n=text:nvim .
after nvim . I want to escape the text sequence press enter then enter more commands, for me personally persistent environments would be nice but aren't necessary required for what I want. as you can see the goal is, if ghostty gets close in my cmd+q spree I can simply press the keybind to launch nvim again as well as open my necessary splits....

JWT with long-lived Refresh Tokens

I've been struggling to understand the purpose of short-lived access tokens and long-lived refresh tokens for a while now. I haven't been able to find many in-depth writeups about why the pattern is recommended and less so about how to use it in a meaningful way. I understood the gist of it - you'd want short-lived access tokens so if it's compromised, the bad actor only has a limited timeframe to cause damage. What I didn't understand is how that would prevent the same issue from happening with a long-lived refresh token. I did some digging and this is what I concluded: https://medium.com/@getintheshell/finally-understanding-the-benefits-of-a-long-lived-refresh-token-bf021176a9d1 Basically:...
Solution:
if u have an access token valid for 5 mins, and a refresh token valid for 365 days blacklisting the refresh token, u gotta store the blacklisted value for an entire year.. by which time a lotta blacklists could've happened, so storing it in an in memory database isnt really possible On the flip side, blacklisting the access token is only necessary for 5 mins, which IS possible in an in memory database.. AND u get the added benefit of instant token revokability.. A Redis lookup isnt really all that time consuming when u really consider things ...

transparency in Ghostty

how do I make Ghostty window transparent?
Solution:
solved by restarting the terminal entirely, hotreload doesn't load the transparency apparently

Coding from a non-Mac PC while building on a Mac

I started using XCode to make an iOS app from my Macbook, and I have been trying to find a way to write code from my Linux PC, as I prefer coding there. I spent some time looking for ways I could remotely write code to my laptop, and build my app there, but I haven't found a good solution yet. If anyone knows a way to achieve this I would appreciate it Here are some things I tried:...

how do you create something like background removal!!!!

I tried to use segmentation models to extract out the human out of the pic; but I am not sure if this will scale; + segmentation has a max-size problem which make it hard to create a 1:1 image; to extract out the object! I am trying to create a segmentation image which I will use to subtract out the background;

NextAuth Type 'typeof import("next-auth")' has no call signatures.

I am trying to use next 15 and next auth 5.0.0 but when im doing this
export const { auth, handlers, signIn, signOut } = NextAuth({
export const { auth, handlers, signIn, signOut } = NextAuth({
I get the error in the title. When looking at the docs this is the correct way to do this, https://authjs.dev/getting-started/authentication/credentials, any advice as this is stopping my
npm run build
npm run build

use(props.params) vs useParams() in Client Component in Next.js

What is better and more ideal in Next.js 15? Does using a different one make any difference? On Server Components the await props.params seems to be the way to go but on Client Components... I kinda tend on using useParams() to save a render but I'm not so sure about that....
Solution:
Unless you dig into the implementation details of “useParams()” you’ll see if it saves a render or not, maybe it’s implementing the same logic under the hood and they literally work the same, but who knows. Also, a rerender isn’t much of a problem, it’ll just commit once which is the heavy duty for the browser most of the time, re-render doesn’t mean “re-create the DOM elements” it means “just read the component logic again and decide whether or not to commit again”, and it might not commit again since it’s the same tree… unless it’s not the same tree due to the implementation details of the “useParams()” hook...

how to pass searchParams around in next app server components?

Hey guys, as the title says, how do you guys pass around searchParams without an incredible amount of prop drilling? I'm in a position where most of my app and fetches lives in server component land, which feels pretty ideal. The only thing is that with trees of server components, I'm forced to prop drill my params and searchParams into every component, which would've been fine, if it wasn't for the fact that there is already a solved pattern in client side react with context and stores. Does anyone else feel this way too and/or how do you go about this?...

can't get ghostty to open tmux on launch

Hey just installed ghostty and I freakin' love it BUT i can't get it to launch tmux on launch. from my understanding if I have tmux installed threw brew... which I did. but for some reason it doesn't auto launch. i've tried looking up the config add in to make it work but I can't find anything... any help would be great
Solution:
try running the exact executable of tmux: command=/usr/bin/tmux

Create a safe action middleware to fetch data

I actually created this and we are using it in out company's codebase and I thought I could share it with you guys, you can tell me next-safe-action does this and I'll tell you this is for fetching without having to call your getUserId() crap, and instead pass it as a middleware and return only the data you need and none of that validation errors crap, cause you only care about the returned data in fetching
No description

client - uploadthing architecture

https://docs.uploadthing.com/getting-started/appdir I am new to uploadthing, want upload large video files directly from client's broswer to uploadthing, without first uploading from client to server then UT, so i was reading this docs and i am curious that are we uploading the whole file to the nextjs backend and then to UT or else we are only using nextjs API routes to authenticate. i want some DB interactions in the middleware before user ables to upload....

Custom Credentials Login page.

I want to use a custom credentials login page. I am new to t3 and nextAuth. can anyone help me with it. I have already added credentials log in as I added the picture. I made some research but nothing i found actually helped.
No description

Is there an on-premises version of uploadthing?

Hi, I am interested in uploadthing and want to know if it can be hosted on prem?

When is transcoding coming?

I am very excited that transcoding appears to be on the UT roadmap. Any idea when this might be?

shadcn Dialog - "submit" vs "cancel"

I am working with a shadcn dialog and I want to execute different functionality when different actions happen. Specifically, I have a form in the modal and I have a save button, which I obviously want to make an API call. However, you can also close the modal by clicking on the backdrop and the built in close button. I want to be able to reset my form when I select the backdrop/close button and execute the API call on click of the save button. As far as I know, theres no way to distinguish between the method of closing the Dialog, any ideas?...