#development

1 messages ยท Page 232 of 1

frosty gale
#

thats mostly like a one time thing

quartz kindle
#

who came up with the whole jwt idea

#

so bulky and slow

frosty gale
#

my problem stems from generating them for every resource and storing them in database (crypto.randomUUID might be slow)

quartz kindle
frosty gale
#

it is supposed to be cryptographically secure i believe so yeah

#

at least would need to use a time based one

quartz kindle
#

if youre generating them for every single resource, it needs to be fast

#

any crypto secure one will be too slow for the job

#

do you really need it to be crypto secure?

frosty gale
#

i do not

#

but it might be something else

#

seems fast enough

#

and its not like im generating 50 a second

#

ill figure it out

quartz kindle
frosty gale
#

right now it takes like 60ms to insert a single message with basic text

#

to generate 9999999 uuids it took 478ms

quartz kindle
#

ye thats fine

frosty gale
#

ah wait i know why it took so long now

#

i forgot

#

the sqlite database is on a hard drive

#

and it waits for completion of the database write

#

so of course its going to take ages

#

since its random writes

quartz kindle
#

WAL mode + synchronous off

#

0.1ms writes

frosty gale
#

im going to keep it for now though

#

makes it easier to identify performance issues with the database since writes and reads are slower

#

although the OS will probably cache the entire database file anyways

#

not writes though

quartz kindle
#

but you're at least using WAL right?

#

thats like the most important setting for sqlite

frosty gale
frosty gale
quartz kindle
#

write ahead logging

#

writes to a separate append-only file instead of modifying the db directly

frosty gale
#

the sqlite database isnt permanent though its only until i port to a server database and for testing

frosty gale
quartz kindle
#

makes concurrent sqlite actually work well

#

otherwise sqlite has terrible write concurrency

frosty gale
#

i remember when my old discord bot used sqlite3 despite having 30k+ servers ๐Ÿคฆโ€โ™‚๏ธ

#

honestly it did incredibly well

#

worked perfectly and had acceptable performance

#

despite heavy reads and writes

#

only switched because it randomly corrupted presumably from multiple clusters accessing it

#

didnt know any better then

quartz kindle
#

rip

surreal sage
#

what int he fuck

pearl trail
sharp geyser
#

@pearl trail

#

how does this look

pearl trail
#

yep looks good

sharp geyser
#

:D

pearl trail
#

re-type if i'm not mistaken

sharp geyser
#

yea

#

I honestly wasn't trying to go this hard on it

#

I just wanted something to test sessions

#

๐Ÿ˜ญ

#

my OCD kicked in

pearl trail
#

๐Ÿ’€

sharp geyser
#
Access to fetch at 'http://localhost:3000/api/auth/join' from origin 'http://localhost:3001' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: 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.

I fucking hate my life

#

cors can die in a hole

pearl trail
#

app.use(cors({ origin: ["*"] }));

#

if you use react, add "proxy": "http://localhost:port" to your package.json

#

then restart

#

you can simply do /api/* request instead of full url on development while redirecting it to your http://localhost:port/api/*

sharp geyser
#

figured it out

#

I am using rust anyway

#

so its different than app.use

#

๐Ÿ’€

pearl trail
#

oh yeah my bad

sharp geyser
#

Im just even more confused now

#

apparently my api isn't recieving the email

#

{"email":"someemail@example.com","password":"12345678"} this is exactly what im sending

#

"Failed to deserialize form body: missing field `email`"

#

๐Ÿ’€

past field
#

i just want to say

#

that you guys are the best

sharp geyser
#

cause I swear I set it up

#

but now i am getting a cors error when my api tries to redirect me back to the homepage of my frontend

#
Access to fetch at 'http://localhost:3001/' (redirected from 'http://localhost:3000/api/auth/join') from origin 'http://localhost:3001' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: 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.
pearl trail
sharp geyser
#

yea

pearl trail
#

well not the app.use , but the cors origin

sharp geyser
#

yes

pearl trail
#

yes

lilac horizon
#

guys any idea for my application bot

pearl trail
#

so uh, port 3000 is your api, 3001 is your front end right?

sharp geyser
#

yes

#

3000 is my axum api

#

3001 is my nextjs app

#

im bout to just say fuck it and test all this on the prod domain

#

๐Ÿ’€

#

that way their origin is 100% the same

#

and just use nginx to tie it all together

#

matter of fact

pearl trail
pearl trail
#

never got that when i do development. the only thing is set cors in server, and set proxy

#

you don't need to redirect on the server to nextjs' route

sharp geyser
#

wym

pearl trail
sharp geyser
#

yes

#

when they successfully join and there are no errors

#

it redirects back to the frontend

#

Actually wait

#

no

pearl trail
#

yes dont redirect it

sharp geyser
#

Im dumb

pearl trail
#

hm

sharp geyser
#

I dont need to redirect

#

let the frontend handle it

#

if there is a 200 status

pearl trail
#

that also works

#

my idea is just make the server to redirect to /

#

because at the end, the front end will in the same origin with the api right?

sharp geyser
#

oh sure yet

#

but for now its not

#

so that would be weird

pearl trail
sharp geyser
#

Im sure there is a way I can make the backend and frontend "appear" on the same origin while local testing

#

but idk how

neon flicker
#

<div style = {{'top':0,'width': '100%',padding:0}}>
It doesn't cover the whole X axis, even tho I have set <body>'s padding and margin to 0 as well as HTML's

neon leaf
#

try width 100vw

sharp geyser
#

if you want it to be set to the view port width then do what 0x7d8 said

neon flicker
#

It worked, however there's space between the top and the div, even tho it's top property is 0

neon leaf
#

top does not matter, your position isnt absolute or relative

#

set position to absolute

neon flicker
#

Wow, it worked

#

Thank you really much, I highly appreciate it

sharp geyser
#

๐Ÿ‘

neon flicker
#

Is there a way to fix document is not defined?

surreal sage
#

in react?

quartz kindle
surreal sage
#

oh yeah

#

React.useEffect

#

put client code in there

#

can't wait for the time when JavaScript becomes fully natively compilable

neon flicker
surreal sage
neon flicker
#

Oh, is it what I would use for any client changes?

sharp geyser
#

useEffect is only when you want to listen to outside data afaik

neon flicker
#

Well, I don't even know how to create a client-side script

#

Oh, literally just 'use client'

frosty gale
#

you have to do hacks like this otherwise the framework tries to server side render your code which is supposed to be client side only

#

although most have functions or components which specifically mark code/components as client side only

harsh nova
#

"use client"

#

Oh nvm

neon flicker
#

I'll need to write data over a database once they click on a button, but it's a client event so I don't really know how I will handle it

frosty gale
#

i am excellent

deft wolf
#

Search on Fiverr weirdsip

#

Then you won't find one here either, we're not looking for a job here

sharp geyser
#

Well no

#

Its now allowed to ask that here

#

If you are looking for devs, go to fiverr or freelancer

frosty gale
#

your client and server are separated

#

to send data from the client side to the server you need to send it over a request

#

usually a fetch request

neon flicker
#

Would my client be able to use fetch?

sharp geyser
#

indeed

#

clients can fetch

neon flicker
#

Oh thank you

#

How may I host the connection for the fetch? Sorry I'm not experienced with creating API

surreal sage
#

struggling with typescript rn for some reason

#

doesn't show all possible keys...

neon leaf
#

yes thats what you set it to

#

string, map record

#

if you want autocomplete send the full definition of that please

#

I dont want to retype it all

surreal sage
neon leaf
#

send the code

surreal sage
neon leaf
surreal sage
#

first one actually does it

neon leaf
#

well nice

surreal sage
#

extra as const

#

tysm though

neon leaf
#

put the const first

surreal sage
#

yea

neon leaf
#

i would also not recommend naming your interface map

surreal sage
#

what would you suggest

neon leaf
#

since typescript loves breaking when using js keywords / classes as interface names

neon leaf
frosty gale
#

you need to make an API route first so that it can accept your data on the server

#

after you do that, you can then focus on sending it from the client to that server route

neon flicker
#

Thank you

#

God, it will be hard to set up Discord OAuth2

surreal sage
#

should use a different server for api tbh

neon flicker
#

Would it matter much?

surreal sage
#

mm easier imo

sharp geyser
#

It will be easier for you

#

if you eventually find its too limiting, you can easily switch to a dedicated framework like express

neon flicker
#

Thank you

#

Making the position of a li 50vw makes it's left edge stay on that position, it doesn't make it centered on 50vw, how may I fix that?

#

Okay, I fixed it though

frosty gale
#

i agree its easier but might be a bit more complicated having a separate instance for someone that hasnt done this before

#

its a mess building an actual backend api alongside these frameworks

#

ive had one also leak confidential server only data doing that since the framework thought what i imported was client side

solemn latch
neon flicker
#

In order to let people login with their Discord accounts right?

frosty gale
neon flicker
#

Oh thank you

sharp geyser
#

nextauth supports every auth provider under the sun

#

any they dont have a provider for I think they expose a generic one that lets you set the props yourself

solemn latch
#

It supports anything tbh.
anyone can add their own

#

yeah

#

My discord one is modified

sharp geyser
#

I dont use next auth simply because my api isn't in js

solemn latch
#

Their default discord one is kinda meh, not refreshing user data properly.

sharp geyser
#

I plan on using a state management library instead

neon flicker
#

Is it possible to insert a button inside a ul?

sharp geyser
#

yes

neon flicker
#

Oh thanks

surreal sage
#

swr my beloved?

ornate hare
neon leaf
#

@covert gale when create 1.21

#

yes

#

is it because of the neoforge split so create non fabric doesnt get updates rn

#

thats my amazing theory

#

is there no public branch for that

#

why

frosty gale
#

regex is a curse on planet earth

#

its actually so easy to accidentally miss a single case and introduce a bug or vulnerability

#

as well as how easy it is to do a regex ddos if youre not careful about how you construct your expression

lament rock
#

String pattern matching is tough though

#

Regex is a good solution, just it can backtrack a lot

spark pebble
#

Any reasons why I might be getting Error: NotFound: 404 Not Found (error code: 10062): Unknown interaction in like 1 or 2 servers, but not the other 700?

lyric mountain
#

you're taking too long to answer an interaction

#

if your error margin is too tight, any fluctuation in your response time will make that error appear

#

either defer your interactions or reduce your processing before answering

lament rock
#

If you're receiving interactions over the gateway, I'd recommend avoiding that if possible since once that shard goes down, any interactions received while it's down are more than likely going to be expired by the time you can resume and Discord can push the missed events based off the seq

#

And the shard can be disconnected by Discord at intervals for no reason

quartz kindle
#

guys guys

#

:^)

lyric mountain
#

Unless u were answering something else

quartz kindle
lyric mountain
#

ah, yeah that's why I recommend to defer the moment you receive the event

radiant kraken
tawny lava
#

erm that would not compile in rust!!

radiant kraken
#

but it's valid rust syntax!!

neon flicker
#

If a messageComponentCollector's max property is set to 1, and it collects an event fire whilst the time property of it, will it still fire end event?

lyric mountain
#

uhhh

#

what?

#

like, if you're talking about d.js, it'll end when the target number of messages is reached or the time expired, whatever comes first

neon flicker
#

Ah yes, d.js

#

So it will eventually fire collector.on('end'), right?

lyric mountain
#

I believe so, since that's supposed to be the post-execution event

neon flicker
#

Okay thanks

surreal sage
#

pls

#

wtf

#

im copying my user dir

#

how does this make sense

neon flicker
#

LOL

surreal sage
#

dude what

#

inflation......

neon flicker
#

29 days left

lyric mountain
surreal sage
#

from where though....

#

what the hell

lyric mountain
#

like, if it had a hard link, it might make windows loop trying to find total size

#

idk if this is still a thing tho

surreal sage
#

dont know what to back up on my c: disk so im just gonna copy everything in my user folder but appdata

green kestrel
sharp geyser
#

Hey guys, once again asking what kind of algorithm should I make for showing popular videos to people's front page

#

My thing is, I dont want to require an account for using the service, so the algorithm should show them videos that are most popular (liked) and if they are subscribed to people (meaning they have an account) it should show them the videos of the people the are subscribed to and any similar content after the fact

lyric mountain
#

use their ip

#

it's the only thing u can use to link their taste to

#

just make sure to put banner mentioning it

quartz kindle
#

ah i got the patched version from apt upgrade, all good i guess

sharp geyser
#

I am asking what kind of algorithm should I use for deciding this?

#

or how should I decide this

#

This has to work for not only people not logged in, but if you are logged in, and are subscribed to people, you obv want to see their content first, and then recieve any similar content

lyric mountain
#

there are people who're paid 6 figures to get that right at youtube

sharp geyser
#

๐Ÿ˜”

frosty gale
#

ah nevermind

#

my server appears to be vulnerable though

#

8.9p

#

not easily exploitable though

#

a couple of things need to go wrong

quartz kindle
#

mine did (debian)

#

i got it with apt

frosty gale
#

yeah it probably does im running ubuntu

#

if i understood the paper correctly this allows you to run shellcode as root if the attacker has at least some access to the system

#

whether its using a non-root user shell or non-root program

#

so you cant just break in from the outside that would be extremely bad

quartz kindle
#

ye

frosty gale
#

basically a privilege escalation

quartz kindle
frosty gale
#

twenty two point zero four

#

there is indeed updates

sharp geyser
#

you couldn't just say 21.04.0

#

or whatever

quartz kindle
frosty gale
#

to the person that may have access to my server with a non-root user: please wait im updating

sharp geyser
#

๐Ÿ’€

quartz kindle
#

hides hacks

sharp geyser
#

Get em next time

#

Just wait until you guys find out about the backdoor I have in nasa

frosty gale
#

if we learned anything from the xz attack

#

i could be installing an update that has a backdoor right now

#

we dont know

quartz kindle
#

indeed

sharp geyser
#

I have plenty of backdoors

#

in zobs mom

frosty gale
#

i would if i were you

remote mango
#

Hi guys, i got a small question, how can i change the Profile Pic of my Bot on top.gg? i thought it changes cuz i changed the Pic on developer portal?.

Best regards,
Brejax

quartz kindle
frosty gale
#

@quartz kindle huh?

#

still the same version

quartz kindle
#

refresh or something

quartz kindle
remote mango
#

Just the descriptions etc

frosty gale
green kestrel
remote mango
#

omfg... i am blind af haha, sry mate! - i refreshed it now, but still same pic as before. does it takes a bit?

quartz kindle
#

from 8.9 ubuntu0.7
to 8.9 ubuntu0.10

remote mango
#

@quartz kindle

quartz kindle
#

or try with a different browser

frosty gale
#

unless the patch specifically fixes the vuln for that specific version

quartz kindle
frosty gale
#

ah okay now i understand

quartz kindle
#

distros dont upgrade ssh versions because they may break stuff

#

instead they keep patching it whenever needed

#

they only upgrade it in new major releases

#

same thing on debian for me
from 1:9.2p1-2+deb12u2
to 1:9.2p1-2+deb12u3

frosty gale
shell tundra
remote mango
#

But that isnt the Main Token of my Bot im right or? (Which i have in the developer portal) ?

#

@quartz kindle sry for the ping ๐Ÿ˜„

quartz kindle
remote mango
#

yea got it. sry for asking haha ๐Ÿ˜„

sharp geyser
#

DONT EXPOSE ME

#

SHES SETTING MY SERVER UP RN

#

๐Ÿ˜ญ

#

Now ima have a backdoor in my server

eternal osprey
#
client.on(Events.MessageReactionAdd, async (reaction, user) => {
  console.log(reaction);
});```
why is this not firing?
my gatewayIntents:
```js
const client = new Client({
  intents: Object.keys(GatewayIntentBits).map((a) => {
    return GatewayIntentBits[a];
  }),
});```
frosty gale
#

you are doing this in the weirdest way possible

eternal osprey
#

๐Ÿ—ฃ๏ธ

frosty gale
#

im pretty sure you can set the intents a lot easier

#

and why are you doing Events.MessageReactionAdd

#

cant you just do messageReactionAdd?

eternal osprey
#

I use the Events enum

#

it's giving me a lot more code readability

frosty gale
#

right

#

anyhow the event handler looks fine so youre probably not setting the reactions intent correctly

frosty gale
#

just do something like

const client = new Client({
  intents: [GatewayIntentBits.DirectMessageReactions, GatewayIntentBits.GuildMessageReactions],
});

paired with whatever intents you need

#

that intent should give you events for reactions

quartz kindle
#

i mean

#

if you are doing Object.keys(x).map(y => x[y])
just do Object.values(x)

frosty gale
#

of course you find a way to simplify this confusing code

#

but yeah thats much easier

quartz kindle
#

or

solemn latch
#

Or just use the proper intents ๐Ÿ™‚

#

It takes like 5 minutes

quartz kindle
#

intents: 2 ** Object.keys(GatewayIntentBits).length - 1

frosty gale
#

no

quartz kindle
#

:^)

frosty gale
#

we are sticking with object.values thanks

solemn latch
frosty gale
#

tim shenanigans dont mind it

quartz kindle
solemn latch
#

Oh

quartz kindle
#

get the number of intents, set the value to 2 ** number

#

then -1 to make it all enabled

frosty gale
#

"1".repeat(40)

#

or just

#

0xFFFFFFFFFFFFFFFFF

solemn latch
#

Or just set the proper intents

quartz kindle
#

i mean, you get the number

#

the string was just for illustrative purposes

#

:^)

frosty gale
quartz kindle
#

for future proof

frosty gale
#

or 0b1111111111111111111111111111111111111111

#

i want to do it in the least maintainable way possible

quartz kindle
#

if you want cursed code, here you go

Number("0x" + "F".repeat(Object.keys(bits).length))
sharp geyser
#

How the fuck does state management work in react

neon flicker
#

Is it possible to provide an object such as {{name:"1",value:"1"}, {name:"2", value:"2"}} for .addFields() function? (discord.js)

sharp geyser
neon flicker
#

I mean array, not an object sorry

sharp geyser
#

you would use an array of objects

#
[
  {
    "name": "asdasd",
    "value": "adsasda",
    "inline": true // optional
  }
]
neon flicker
#

So it's possible to provide [{name:"1",value:"1"}, {name:"2", value:"2"}], right?

#

Thank you

sharp geyser
#

๐Ÿ‘

quartz kindle
#

can be done in both ways actually

sharp geyser
#

Right so who here has worked with global state managers like redux or zustand

sharp geyser
#

Hey tim

sharp geyser
#

you might be able ot help

#

Im trying to figure out when I should put the user into state

#

Obviously at some point during either logging in or when they get redirected

#

idk

neon flicker
#

So it's technically possible for actionRow.addComponents() as well right?

#

I think I should check the documents

quartz kindle
#

if trhe method name is in plural, it should accept multiple items

sharp geyser
#

๐Ÿ˜”

sharp geyser
#

So I should make a function that handles posting to my login endpoint manually

#

rather than using action + method on the form itself

quartz kindle
#

probably yeah

sharp geyser
#

great

quartz kindle
#

i mean whatever you prefer

#

but action+method is pretty limited

sharp geyser
#

I mean it seems most logical

#

I have to add the user to the state somehow

quartz kindle
#

js gives tyou more flexibility

quartz kindle
#

like session?

frosty gale
#

then i can just do

import { sessionUserStore } from "../something.ts";
...
<p>{$sessionUserStore.username}</p>
#

im not sure if react has stores and if you would need to use "redux"

sharp geyser
quartz kindle
#

btw stores are not needed anymore in svelte 5

sharp geyser
#

basically

frosty gale
#

i hate having to create stores for multiple files

sharp geyser
#

User logs in
Session cookie is made for them
I need to then fetch their user data
Attach this to a global state inside of react so all pages now have this user data

quartz kindle
#

im not sure how exaclty it works yet, but i glossed over the svelte 5 changes and they said byebye stores

frosty gale
#

i know mutations to objects and arrays with .push or .shift also causes a re-render instead of having to reassign objects

sharp geyser
#

I wanted to check out svelte but theres not any component libs for it

#

and I dont feel like making all the components myself

quartz kindle
frosty gale
sharp geyser
#

like

quartz kindle
sharp geyser
sharp geyser
#

That would get rid of my @me endpoint

frosty gale
#

oh this

#

fair enough

quartz kindle
#

if the data is going to be used everywhere in the website, just get it at login

frosty gale
#

i prefer to build everything from scratch so svelte suits me

quartz kindle
#

but i mean sure

#

you still need an endpoint to get it regardless

#

when a user who is already logged in opens the page without having the state

sharp geyser
sharp geyser
frosty gale
#

i have mine open a websocket on the layout component and assign it to the user store once the hello comes

sharp geyser
#

A logged in user always has state right?

quartz kindle
sharp geyser
quartz kindle
#

if they are stored in two different places, then a desync can occur

#

if the user deletes website data/cache but not cookies

sharp geyser
#

wdym in different places?

quartz kindle
#

or vice versa

sharp geyser
#

ah ok

#

right

quartz kindle
frosty gale
#

this is where JWTs can help also, the user data is basically your session token

#

but they can be annoying

quartz kindle
#

i dont know how this react state works

#

but im assuming its like a js variable no?

#

or is the state stored locally?

sharp geyser
#

asking the wrong person mate

#

I dont understand it myself

#

๐Ÿ’€

frosty gale
#

i have a feeling if it were this easy they would just add it to react itself

#

so its probably more advanced

quartz kindle
#

i mean

sharp geyser
#

I know it doesn't walk it down the entire comp tree

#

it only gives the state to what reads it

quartz kindle
#

just make this state whatever, then check browser dev tools to see if its anywhere local

sharp geyser
#

Honestly

#

do you guys think svelte would be easier to use?

#

I kind of went with react cuz thats what I used in 2019

#

but new year new me, I kind of don't want to use react ngl

frosty gale
#

personally after using react then trying svelte it is much better

#

you immediately notice how less bloated and overwhelming it is

sharp geyser
#

Well

#

I can give it a try

#

ima keep my react build just in case

#

Oh btw chloe while you are here

#

I have a question regarding how to do dev with a frontend + backend

frosty gale
#

none of this useState bullshit to have a reactive variable you just define any odd js variable and that is reactive

sharp geyser
#

I was doing it locally at first but I was suffering cors issues

#

so reluctently I moved it to my prod enviornment

#

I need my api to be able to redirect to my frontend (as when in prod it will be on the same domain/origin), but the problem is locally it wont allow that

#

because its on two different ports (3001 (frontend) 3000 (backend))

quartz kindle
sharp geyser
#

oh yea I saw that

frosty gale
#

staying in svelte 4 then

sharp geyser
#

why

#

thats not bad

frosty gale
#

id ont like it

sharp geyser
#

I assume you can still use it normally

#

its literally just

#

$state(0)

#

and im sure you can use it normally

#

count + 1

frosty gale
#

unless theres a good reason for it im going to be grumpy

sharp geyser
#

how exactly does shared state work tho in svelte

#

Like I need to store user data when they log in

#

is that going to be global?

#

so I can use it anywhere

frosty gale
sharp geyser
#

idk

#

I mean

#

All I know is when I was doing it locally, I was suffering cors issues

#

because my backend needs to redirect to a page on the frontend when tis successfully done something

#

e.g when you login you dont want to stay on the auth page

#

You want to redirect back to the home page

quartz kindle
# frosty gale unless theres a good reason for it im going to be grumpy

there is:

before:

import { writable } from 'svelte/store';

export function createCounter() {
    const { subscribe, update } = writable(0);

    return {
        subscribe,
        increment: () => update((n) => n + 1)
    };
}

after:

export function createCounter() {
    let count = $state(0);
    return {
        get count() { return count },
        increment: () => count += 1
   };
}
#

byebye stores

sharp geyser
#

I assume it works by

const counter = createCounter();

counter.increment()```
#

?

quartz kindle
#

yup

sharp geyser
#

sorry

#

js code looks foreign to me

#

its a stupid question

#

๐Ÿ˜ญ

#

right

#

I guess ima use svelte

#

since my vid player works on svelte to

quartz kindle
#
<button on:click={counter.increment}>
    clicks: {counter.count}
</button>
sharp geyser
#

oh btw

sharp geyser
#

does $state() store it globally

#

or only in the context createCounter is used

#

and then its dropped

#

for example say one page uses createCounter increments, another page uses it will it be updated on both pages

#

or only one

frosty gale
quartz kindle
frosty gale
#

reason is apparently because it can be hard to know which variables are reactive or not but why do you need to know that anyways

sharp geyser
#

so does global state not exist in svelte?

quartz kindle
#

but if you use one createCounter and use it in two different places, then it will be the same

quartz kindle
#

Suppose we wanted to encapsulate our counter logic in a way that could be reused between components. Today, you would use a custom store in a .js or .ts file:

frosty gale
#

oh yeah that example wouldnt work anwyays

quartz kindle
#

Runes are an additive feature, but they make a whole bunch of existing concepts obsolete:

the difference between let at the top level of a component and everywhere else
export let
$:, with all its attendant quirks
different behaviour between <script> and <script context="module">
$$props and $$restProps
lifecycle functions (things like afterUpdate can just be $effect functions)
the store API and $ store prefix (while stores are no longer necessary, they are not being deprecated)

#

thats all the stuff that the new "runes" thing make obsolete

frosty gale
#

i guess i can live having to do $state when defining a variable

#

id rather make a component in place of a snippet

#

im worried theyre making svelte 5 a lot more complicated

#

going against the initial motto

quartz kindle
#

probably

#

its probably because a bunch of people are going around asking for features they want but dont need

#

and devs are like, yea lets add this to make people happy

#

there is also a thing that i've seen happen a lot

#

an entire project is designed with a certain idea in mind

eternal osprey
#

why does reaction.count return me null?

quartz kindle
#

but then are you start using this project in complex applications, you sometimes discover things where the project simply doesnt work

#

sometimes you encounter specific situations and use cases that the project never accounted for

eternal osprey
#
 const emojis = Array.from(reaction.message.reactions.cache);
    console.log(emojis);
    let z = reaction.message.reactions.cache.get(emojis[0][0]).count;
    console.log(z);```
quartz kindle
#

then you need to add these features to the project that will make it possible/easier to work with your complex use case, but for a lot of other people will seem like bloat and unnecessary

sharp geyser
#

Ima be real

#

svelte is already amazing just by looking at it

#

its basically like ejs

#

but fully featured

#

and has stuff that nextjs brings into play like routing

#

layouts

quartz kindle
sharp geyser
#

@quartz kindle

#

Like 1h of messing around

#

:D

#

I got a navbar

pearl trail
#

oh you're moving to svelte?

sharp geyser
#

Ye

#

Im trying to figure out tailwind tho

#

do you know how to use it takiyo?

pearl trail
#

nope ๐Ÿ˜”

sharp geyser
#

damn

queen needle
#

what about it is confusing?/are you having trouble with?

sharp geyser
#

Like setting all text to white if dark mode is enabled

queen needle
#

im not sure how the svelte layout looks but in next.js you would do the dark mode thing in the layout.tsx like the "dark" class

pearl trail
#

yes yes

sharp geyser
queen needle
#

You could probably try to do a custom solution

#

i know i made a custom functino for situations where several classes have the same prefix, like hover: or stuff, i just made it so i could do hover:(text-white-500 bg-red-500) etc

sharp geyser
queen needle
#

You could do a similar thing so that you could have dark:(...)

sharp geyser
#

well

#

idk how to do that

#

soooooo

#

:D

#

we ballin

queen needle
#

I just made a function so my classes were like className={fix("")} and that function went through and "unwrapped" it all so hover:(text-white-500 bg-red-500) would become hover:text-white-500 hover:bg-red-500

sharp geyser
#

I could indeed make something like that

#

idk how that'd work in svelte

sharp geyser
#

well it works

#

๐Ÿ’€

#

ty for the idea

#

this will make it a lot cleaner on my end while still producing the same result in the final build

#

:)

queen needle
#

Im glad you found something that works for you!!

sharp geyser
#

I think

#

I can even nest them

#

like have a hover function that takes in a string, and then i can use dark inside it

#

so it becomes hover:dark:text-blue-50

sharp geyser
#

what you guys thinking of my join page?

radiant kraken
# sharp geyser

i feel like you should make the background color of the input boxes darker

sharp geyser
#

Light vs Dark

#

I honestly quite like it

#

maybe the join button could be a bit lighter on the light version

#

but yknow

#

Little lighter

#

updated dark version

civic scroll
sharp geyser
#

:c

#

I tried

civic scroll
#

or shorten them

#

that would fix

#

also notice bad contrast ratio between text color and bg of join buton

sharp geyser
#

I am trying to find a way to nicely display any form validation errors

#

but yea

#

I fixed the button

#

and made it not so wide

#

I was going to leave displaying form validation errors to later, but my OCD is kicking in

#

Right, so this is what I came up with

#

honestly do not care anymore

earnest phoenix
#

error texts shouldnt be in white but red so monke brain activates when red

sharp geyser
#

The border is already red

#

๐Ÿ’€

earnest phoenix
#

still

sharp geyser
#

why do I have to conform to people's stupidity ๐Ÿ˜”

#

@earnest phoenix better?

earnest phoenix
#

also UX

earnest phoenix
#

also did you mean at least 8 chars?

sharp geyser
#

yea what else

#

oh

#

shit

#

๐Ÿ˜ญ

#

bro

#

thanks

#

Im not sure how I like the background of the forms in light mode

#

my eyes are terrible looking at that bright picture

civic scroll
#

also recommend to put error message right next to the input field label

#

thus you can shorten the error messagr

#

eg. Password At least 8 characters long

sharp geyser
#

As in put them to the left of the box instead of on top?

civic scroll
#

eg.
Label
|Input |

sharp geyser
#

I can try

#

hm

#

For some reason it wont

sharp geyser
#

How bout this?

civic scroll
#

yes

#

now

#

put the error message right next to the label

sharp geyser
#

gg

#

im done

civic scroll
#

NO

#

do it noe

sharp geyser
civic scroll
sharp geyser
#

IDK HOW

#

WITHOUT DOING IT POORLY

civic scroll
#

i swear it will look good

sharp geyser
#

I mean

#

I can do it the broke back mountain way

#

and just

civic scroll
#

we can optimize later

sharp geyser
#

label={`First Name ${$errors.firstName ?? ''}`}

civic scroll
#

oh

#

hmmmm

#

there should be a way

#

actually, there is a way

surreal sage
#

RangeError: Invalid string length
at JSON.stringify (<anonymous>)

#

what even is this error

civic scroll
civic scroll
surreal sage
#

i dont know the object

civic scroll
#

you do

surreal sage
#

im merging like 4000 files of json objects

#

and then json stringify

#

back into a single file

civic scroll
#

did you merge correctly

surreal sage
#

this worked before

civic scroll
#

actually no sotry

#

search the error up and see what are possible reasons to trigger this error

sharp geyser
#

@civic scroll

civic scroll
#

damn you don't have sayu-ui-pseudocode plugin installed

sharp geyser
#

ofc not

#

your pseudocode isn't normal

civic scroll
#

read it as-is

sharp geyser
#

ima be real

#

this works

civic scroll
#

you will compile one in yout head

#

yes

sharp geyser
#

im too tired to try and optimize it rn

#

you are not wrong it looks better

civic scroll
#

also

#

shorten the error message

sharp geyser
#

im alt f4

#

I can't be arsed its 4am

civic scroll
#

"Password comfirmation doesn't match"

#

JEEZ

#

go sleep

sharp geyser
#

right time to take you literally and underline the error messages

#

:)

#

yknow sayu

#

it looks better

#

thanks

#

quite honestly tho, it works so im not going to bother trying to optimize it for now

#

I have more important things to cover

#

Do you think I should add anything else?

#

to me it looks out of place just being there in the center

#

So much empty space around it

#

I just thought of an idea

civic scroll
sharp geyser
#

Instead of making a dedicated page

#

why not just make it a modal

#

On home page, you see Join click it, this pops up as a modal

civic scroll
#

then you will have to pack extra logic for each page

sharp geyser
#

true

civic scroll
#

remember, conditionally rendered or not, it has to be present

#

would be better as a dedicated page imo

sharp geyser
#

ew wtf

#

why did my navbar go like that

civic scroll
#

search bar was fixed width

#

you can use a clamping function along with flex

#

and additional media query to convert the search bar into an icon when screen gets small

sharp geyser
#

Well it does

#

ew form is not responsive

#

oh well

#

fuck mobile users /j

civic scroll
#

tip: don't use fixed width

sharp geyser
#

I used rem

#

I thought that scaled with screen

civic scroll
#

rem is fixed

sharp geyser
#

wtf

#

I swear it scaled based on viewport

civic scroll
#

it technically scales, it scales with root font size

#

but font size is independent of viewport

#

in devtools, top left do you see the 2nd left most icon?

#

click on it

#

you can now preview the website in different device templates

sharp geyser
#

thats what im doing rn

#

honestly

civic scroll
#

go sleep

sharp geyser
#

I wish I had someone else to help with the frontend, so I can push it onto them to make it responsive

#

๐Ÿ’€

sharp geyser
# civic scroll go sleep

I am soonโ„ข๏ธ I just feel terrible because this join page is the only thing i've gotten semi done

#

and i've been working on it for like 7h

#

I am terrible frontend dev

civic scroll
sharp geyser
#

Id rather do flutter than this shit

#

matter of fact, who needs a web page

#

mobile only baby

#

no media breakpoints for me

#

rahhhh

pearl trail
#

mobile web design trollStare

#

you haven't go into responsive web yet trollStare

sharp geyser
#

I will give someone my left nut to do the responsive portion of my page

#

I swear to god i'd rather swallow nails than do anything responsive

pearl trail
sharp geyser
#

im tempted to say fuck mobile users

#

its a vod platform

#

Ima make a mobile app eventually

civic scroll
#

but, debugging dart2js interop is a pain in the ass

surreal sage
#

what the fuck are story points

civic scroll
#

same question

pearl trail
#

@civic scroll wdyt of this Troll [REDACTED]

civic scroll
sharp geyser
#

I can give you the lint out of my pockets

#

and a pat on the back

civic scroll
#

it is impressive

#

though

pearl trail
sharp geyser
#

listen man

pearl trail
civic scroll
#

taki

sharp geyser
#

times are tough

pearl trail
civic scroll
#

i'recommend making the preview flat instead of 3d

civic scroll
#

or making it larger

pearl trail
#

oh yeah the discord place holder is just temp

#

imma make smth with bigger content in it later

civic scroll
#

as for the next section, left align the heading

#

as i think the eye would move from the animation on the left to the text on the right

#

center-aligned text on a left-aligned block seems a bit off to me

civic scroll
pearl trail
civic scroll
#

dw about height

#

but about the alignment

#

(i'm talking about the section in which the card pops out from the left)

pearl trail
#

ohh

#

dm

civic scroll
#

yes

pearl trail
#

next auth discord doesn't support custom scope? ๐Ÿ’€

#

nvm they do

#

they put it far from root ๐Ÿ˜ฉ authorization: {params: {scope: ""}}

sharp geyser
#

svelte isnt the problem

#

its css

#

I hate css

#

even with tailwind helping me

quartz kindle
pearl trail
#

im the first one who will use that

#

also aww why they didn't do the functions too

#

for (i in range(num_of_times)) {}

#

if (__name__ == "__main") {}

#

โญ blurplestar blurplestar blurplestar blurplestar

quartz kindle
#

lmao

neon flicker
#

How to check the IP adress of where the request has come via Next.js API routing?

#

In case it would be bad if everybody could send valid requests to the API, they would've been able to grief the database

lyric mountain
#

well for one you're supposed to have a token system for write/delete ops

#

IP is very weak for authentication purposes because it can be faked easily

neon flicker
#

Oh thank you it's such a good idea

frosty gale
#

x-real-ip must be real

lyric mountain
#

real yes, but not necessarily the actual ip

spark flint
#

thats my go to

neon flicker
#

Is x-real-ip manuplatable?

#

Like it's fine as long as they manuplate it to be the IP adress of my VPS

spark pebble
#

call me lazy for not just simply โœจ checking โœจ but can you use custom emojis in dropdowns?

dusk horizon
#

||craig||

#

:craig:,joil:
:craig:,leaniv:

#

:craig:,joil:
:craig:,leaniv:

lyric mountain
#

but as I said, it ain't reliable enough as changing one's IP is easy

#

dont rely on it for any authentication purposes

surreal sage
#

padding-left: unset

tardy girder
#

yes

earnest phoenix
#

its all mantine components

solemn latch
neon leaf
eternal osprey
#

@quartz kindle do you remember the 7.6 million entries coming down to 18tb?
i reduced it to 2tb ๐Ÿ˜›

sharp geyser
eternal osprey
surreal sage
#

so uhh

surreal sage
#

dutch citizen so ig i won

sharp geyser
eternal osprey
#

cry or no cry

#

i dont know onionpray

surreal sage
#

dont rlly care abt football anyways

sharp geyser
#

bro can play for both teams

surreal sage
#

fr

eternal osprey
#

i am going bald guys what should i do

#

mann fuck all this it's too early to go bald bro

#

๐Ÿ˜ญ

sharp geyser
#

embrace it

#

Shave it all off

#

be the bald man

eternal osprey
#

me fr

sharp geyser
#

ong

scenic kelp
eternal osprey
#

everyone is talking off topic why tf you targeting me brev

scenic kelp
#

i'm joking

#

anyways minoxidil + finasteride will be your two best friends good luck brother ๐Ÿซก

wheat mesa
#

Only option

eternal osprey
#

lemme finish my masters first then i am coming for itt

wheat mesa
#

That way you can claim it was the doctorate that made you lose the hair instead of bad genetics

eternal osprey
#

๐Ÿ˜ญ that's a good one

#

i would still be bald tho

wheat mesa
#

You could try growing a goatee and cooking very pure meth

#

It might be illegal but at least youโ€™d be cool and rich

surreal sage
#

using this in my dockerfile but it isn't getting cached between builds...

#

not that important but it's a few seconds of build time that can be minimized

quartz kindle
#

--mount=type=cache what kind of cursed cli is this

surreal sage
#

probably should use the multilayer thing

#

does not work

sharp geyser
#

welcome to docker

surreal sage
#

shit does not want to cache any dependencies

#

hold on i think i did it

#

had to set the PNPM_HOME env var smhhhh

#

double checking rn

#

i think it works

#

who even needs to rebuild anyways

#

(it reinstalls without cache when files changed)

#

figured it out

#
RUN --mount=type=cache,id=pnpm,target=/root/.local/share/pnpm/store pnpm fetch --frozen-lockfile
RUN --mount=type=cache,id=pnpm,target=/root/.local/share/pnpm/store pnpm install --frozen-lockfile```
surreal sage
#

docker try to actually save space by reusing layers (impossible)

lament rock
#

Debating if I should try making my own file server that can hook into Windows. The default Windows server software sucks

#

I need to remove my dependence on Google cloud, as good as it is. I have a server PC where I can stripe a few hard drives together and raid 1. Or might spring for SSDs and also allow steam games to be saved on it since my brother and I both share some games so can save those on LAN

lyric mountain
#

Can't u just setup a filezilla server?

lament rock
#

There's a lot of ambitious things I wanna do like be able to tag my photos/videos like booru and have custom software integration like an image LOD generator and waifu2x. Also support audio with a built in player that can adjust pitch and playback rate

pearl trail
#

anyone here have used nextauth for discord? ๐Ÿ’€

sharp geyser
#

I havent but I might still be able to help

pearl trail
sharp geyser
#

ah yea

#

thats the issue with nextauth