#development

1 messages Β· Page 268 of 1

proven lantern
#

yea, see that little spike? that was handled automatically

solemn latch
#

yeah, I think thats the part everyone forgets

prime cliff
#

200ms is on average what most apis handle

proven lantern
#

and those are the cold starts

solemn latch
#

(in terms of discord bots, thats 100k commands run per day free)

wooden ember
#

just calculated it and it costs about Β£5.39 a year

#

not as bad as i thought

prime cliff
#

My api averages at 150 ms with image gen around 400 - 500 ms

wooden ember
#

I used to run my bots and stuff on an actual pc but that was like 200 quid a couple years ago and I can't justify

proven lantern
wooden ember
#

indeed

proven lantern
#

when my lambda is warm it can respond in less than 2ms

wooden ember
#

my ping to the discord api is about 30ms lol

prime cliff
proven lantern
solemn latch
#

Mine was around 5ms on cf workers when it didn't have to hit the database, which was about 40% of the time.

prime cliff
#

I mean it wouldn't really take much to just send the interaction token then xD

solemn latch
#

serverless is fast

proven lantern
proven lantern
delicate zephyr
#

that and more scalable lol

#

docker has built in load balancing if you use hostnames and container networks properly

prime cliff
#

At that point though if you really need scaleability you would just go with AWS/GCP/DO

delicate zephyr
#

yea

#

self-managed is more fun tho

#

:^)

#

and way cheaper if you do it right

prime cliff
#

Working on a docker UI alternative similar to portainer, would this be a good permission set to use?

delicate zephyr
#

honestly once you have this semi stable I might use it for our topstats deployment for easy log access

#

portainer is fine but its a bitch sometimes

prime cliff
#

Yea it has its annoying issues and the permission system in it is fked and no 2FA either

delicate zephyr
#

yarp

#

we have 25 containers now (8 of which are github self-runners) but still

#

would be nice to see logs without using ssh

#

for mobile access etc

#

whats the frontend written in?

prime cliff
#

Pretty good for dashboard type applications and good for security and real-time stuff like this

delicate zephyr
#

Man making me wanna dust off my .NET experience just to contribute πŸ’€

#

I havent used .NET in like, 8 years lmao

prime cliff
#

Dang

delicate zephyr
#

not saying I couldnt it would just take me reading docs and trial and error and code review tbf

prime cliff
delicate zephyr
#

you got a notion or a public board of tickets of whats already planned?

prime cliff
#

Oh the demo is broken no team

delicate zephyr
#

im working on a replacement for ticketbot rn

#

lol

#

gonna be fun

prime cliff
#

Ah nice

delicate zephyr
#

nvm

#

UI is hella nice

#

if the background customizable? @prime cliff

prime cliff
#

Yup

#

For demo there is a specific preview for it with url

delicate zephyr
#

Oh noice

neon leaf
frosty gale
#

Is there a performance difference (if any) to instantiating a relatively simple object (class with get set members) and a struct in c#?

#

I know in compiled languages structs and simple classes get optimised down to a simple stack allocation with the members populated in compile time (assuming we are setting members compile time) but not sure how c# handles this

ivory kayak
#

there is. in c# sturcts are value types allocated on the stack (when they arent part of a ref type) avoiding garbage collection

#

while classes are ref types allocated on the heap, potencially leading to gc overhead

#

structs are faster for small objects because it doesnt require heap allocation or garbage collection

#

oversimplified

prime cliff
#

You don't really need to worry that deeply about performance when using C# it's pretty well optimized already :/

radiant kraken
#

chat is this real

#

my first ever model from scratch seems to spit out exponentially worse output in every iteration

neon leaf
radiant kraken
#

looks okay for a first rust project

#

could have some refactoring but overall looks good

neon leaf
#

thanks

craggy pine
#

@harsh nova

bitter granite
#

i amma try it

deft wolf
#

steamne moment

harsh nova
craggy pine
#

np

bitter granite
#

oh no i failed to get 50 usd

deft wolf
bitter granite
lyric mountain
radiant kraken
#

the thing is this is the dataset 😭

radiant kraken
#

chat is this real?

lyric mountain
#

given enough time it'll eventually print all digits of pi

radiant kraken
#

WAIT I THINK IT'S FINALLY LEARNING

#

left is expected result, right is predicted value

#

wait nevermind??

wheat mesa
radiant kraken
#

wdym by for springs?

wheat mesa
#

Like, force applied to the spring and the distance it stretches

#

For calculating the spring constant

radiant kraken
#

oh right yeah

#

"Given a dataset of the relationship between the extension of the spring (x) and the force given (F) in the Hooke's Law experiment is obtained as follows:"

wheat mesa
#

Yeah

#

Wdym by β€œmodel” here?

#

You can calculate this definitively using physics :p

radiant kraken
#

we were asked to optimize a model with gradient descent with that dataset for 4 iterations

wheat mesa
#

Oh this is ML stuff

radiant kraken
#

yeah

wheat mesa
#

Lucky

radiant kraken
#

not physics lol

wheat mesa
#

I haven’t had an ML class at all yet

radiant kraken
#

NOOOOOOOOOO

#

i'm screwed

wheat mesa
#

Never even done ML on my own

#

Although I’ll hopefully be doing it soon

#

Trying to get into a quant research program at my school run by a club here

radiant kraken
#

it kinda worked for the example dataset provided in the lecturer's presentation

#

this is with 1,000 iterations btw

wheat mesa
#

wish I had an ML class early on

#

I'm senior status this year and still haven't taken one

radiant kraken
#

i'm honestly unsure if it worked with this dataset

#

we were asked to perform only 4 iterations but even this 1,000th iteration doesn't even look good

#

😭

#

when i tweaked a single digit it suddenly becomes like this

#

perfect

radiant kraken
#

such a huge jump from programming basics

prime cliff
#

I've literally never touched any AI/machine learning programming, chatgpt or co-pilot
I'm a pure dev

wheat mesa
#

Actually nvm I’m stupid

radiant kraken
earnest phoenix
#

🧌

neon leaf
#

ci?

bitter granite
wheat rose
#

ive added the video meta tags, you can confirm that by viewing the page source

queen needle
#

Idk if it is much help, but these are all of the tags for a site which does embed videos correctly

wheat rose
#

thanks

vocal knot
wheat rose
#

does that matter

vocal knot
#

idk LOL

#

also try direct file url

#

with .mp4

wheat rose
#

got it

vocal knot
#

also there seems to also be twitter:player

wheat rose
#

ill check it out thanks

surreal sage
#

pls god dependabot never make this pull request ever again

quartz kindle
#

never bump dependencies without testing and reading changelog

pearl trail
violet flicker
#

where's the editing option on top.gg page

#

like i want to use css to change bg and stuff

#

where can i find it

bitter granite
#

I dont see a bot with your id approved
when the bot is approvedm there is an option to click edit on the bot page

violet flicker
#

i am on edit page

#

where can i use CSS

#

in description?

#

or anywhere else

deft wolf
#

-htmldesc Prayge

deft wolf
bitter granite
#

-htmldesc

gilded plankBOT
violet flicker
#

ohh thanks!!

bitter granite
#

been trying

violet flicker
#

i just edited and when i clicked on save it popped up!

Invalid CSRF Token. Please refresh the page and try again

#

i refreshed 3 times

bitter granite
#

wrong reply

violet flicker
#

😭

bitter granite
small tangle
deft wolf
#

I love this thrill when I do not know if my code will continue to work or lunch into space masnakappa

violet flicker
#

what can be the issue when i preview the code in vscode it's like this and quite opposite on top.gg

earnest phoenix
violet flicker
#

@earnest phoenix here it is

#

i want this to be on my bot's page

#

what type of link can i use in iframe

#

github is not supported

violet flicker
#

Anyone help!

earnest phoenix
earnest phoenix
#

top.gg's bot description is not a website, it's a description

#

markdown description with few supported html elements and attributes

#

so either work with the limitations

#

or host the html page using e.g. GitHub Pages and then use an iframe

earnest phoenix
violet flicker
#

@earnest phoenix Thanks for your help. I hosted it on github then took out iframe in long-description

#

can i do the same in shorter one?

deft wolf
#

No, the short description does not support HTML

earnest phoenix
#

horrible ux

violet flicker
#

πŸ’€

#

one last

#

ques

#

can i make it bigger?

lyric mountain
#

do note that the width is at its maximum in that screenshot

#

you cannot go over the sidebar

pearl trail
#

unless you do some css stylings trolley

lyric mountain
#

I mean, u still cant cuz you'll get banned off topgg lul

pearl trail
#

there's limitation on styling?

deft wolf
#

You can't do some things

#

Like blocking buttons or removing elements

pearl trail
#

nah, i didnt say anything about blocking buttons/removing elements

#

there's a way to make that full width, like display: block, but the buttons are at the very bottom (bottom of review). the other way is use flex-direction: column-reverse. that'll make the buttons on top, but need to style them to become row instead of column

solemn latch
#

TBH, I wouldn't make it bigger than that anyway.
I would change the styling on page like Mimu does.

#

Makes it look like the desc is much more incorporated

prime cliff
#

Bruh there's literally a button on there that just redirects to Discords own app directory z_kekBoom

#

Also the bot name is gone

vocal knot
#

@solemn latch

solemn latch
#

Its intresting because it just disapears for me

prime cliff
#

Wait what monkaS

vocal knot
#

it seems to be something with the "css-rd8i1m" class cuz without it the text shows up

solemn latch
#

anti mod code

solemn latch
vocal knot
#

oh

solemn latch
#

I mean, she explicitly set that, so Idk

deft wolf
#

Weird thing to do tbh

solemn latch
#

Reported it to iara, probably unintentional.

#

πŸ‘€ anyone want to review my sql schema?
I'm pretty bad at database structures, going to start learning a bit more proper approaches to table structure. Might be fun to get feedback before I really start learning.

prime cliff
#

Yup sql is fun to break

solemn latch
#

I'ma post the sql on pastebin, its long

#

Things like attachments, reactions are not included yet

lyric mountain
#

pastebin wtfBacon

solemn latch
#

yeah ikr

#

I havent used pastebin since highschool

neon leaf
lyric mountain
#

also what the hell is happening there

vocal knot
solemn latch
#

no moderation pastebin, woot

vocal knot
#

it's been awhile i think

#

i first saw theses quite awhile ago

lyric mountain
#

woo, you could use some not nulls there

#

content u can use a varchar column with size set to whatever is max discord length

#

same for other text columns

solemn latch
#

Should not nulls be used even when things may be empty strings?

vocal knot
#

people really post a review instead of join a discord server for help LOL

deft wolf
#

At least it's 4 star review kappalul

lyric mountain
#

well, not when it's a nullable field in discord, but when it's a required field

#

like username

vocal knot
#

yeah at least

solemn latch
#

username may be empty

#

or well null

lyric mountain
#

username cant be empty

solemn latch
#

private users will have null usernames

#

But yeah, some things are not null.
tag names should be filled.

lyric mountain
#

private users?

solemn latch
#

yeah, so on the website users by default wont show their actual username.

#

It will be generated per thread, randomized.

#

I dont need to track those users usernames

lyric mountain
#

ah, not private, anonymous then

solemn latch
#

yeah

#

Kind of private, since they wont have a profile on the site either

lyric mountain
#

you could still make it not null, just dont fill author_id on thread

#

a null column still takes space

solemn latch
#

alright, good ^-^

lyric mountain
#

the timestamps could also have a DEFAULT CURRENT_TIMESTAMP to reduce insert payload size

solemn latch
#

good point

lyric mountain
#

oh also, I saw answer_message_id BIGINT on threads

#

does this mean that they can only have one answer?

#

oh is it like stackoverflow?

solemn latch
#

Yeah, one marked answer. Figured it would be easiest

lyric mountain
#

yep, that's fine

#

well, the rest seems fine, just replace the text fields with a bounded varchar where possible

#

and if you plan on adding more flags in the future, you could use a bitfield instead

#

an int bitfield can hold 32 booleans at 1/8 the size of 32 bool columns

solemn latch
#

I've never worked with bitfields in a database. great thing to learn

lyric mountain
#

they're just boolean arrays but in a number

#

(bitfield >> n) & 1 == 1 is the same as doing array[n]

solemn latch
#

What about the circular fkey references?

Threads referencing messages, messages referencing threads.

Is that bad?

wheat mesa
#

That’s what mapping tables are for

#

Or maybe I’ve misunderstood your intent here

#

Many to many relationships?

lyric mountain
#

also it'll be impossible to insert data when it has circular FK (unless you bypass constraints, which u shouldn't)

wheat mesa
#

Yeah if the thread has many messages, and the message has one thread, then the message table will have an ID to the thread row that owns it

solemn latch
#
CREATE TABLE threads (
    thread_id BIGINT PRIMARY KEY,
    channel_id BIGINT REFERENCES channels(channel_id),
    thread_name TEXT,
    answer_message_id BIGINT REFRENCES messages(message_id),  
    owner_id BIGINT,           
    guild_id BIGINT REFERENCES guilds(guild_id),
    last_active_at TIMESTAMPTZ,
    is_locked BOOLEAN DEFAULT FALSE
);

CREATE TABLE messages (
    message_id BIGINT PRIMARY KEY,
    thread_id BIGINT REFERENCES threads(thread_id),
    author_id BIGINT,
    guild_id BIGINT,
    content TEXT,
    timestamp TIMESTAMPTZ,
    edited_at TIMESTAMPTZ,
    deleted_at TIMESTAMPTZ
);

Thread has many messages

One message can be the answer in the thread

wheat mesa
#

This looks fine I think

#

I'm assuming that answer_message_id will be nullable?

solemn latch
#

yeah

wheat mesa
#

Yeah that should be fine then

lyric mountain
#

oh, right, in this case it's fine

wheat mesa
#

You could run into issues if it weren't nullable, since the message that answers the thread has to be created to reference it in the thread table, but the messages wouldn't exist before the thread

#

But since it's nullable this is fine

lyric mountain
#

oh, u forgot one thing btw

solemn latch
#

What about marking a message as the original post?

I'd mark that in the messages table right?

lyric mountain
#

status columns, to mark them as deleted (tho can use deleted_at for this)

wheat mesa
#

Hmmmm, I'd probably mark that in the threads table

#

Assuming that your threads work similarly to discord threads, right?

solemn latch
#

all of this is discord forums

solemn latch
wheat mesa
#

I would mark the original message in the threads table with a FK to a message row

#

Since the message exists before the thread is created

solemn latch
#

πŸ‘€ is that how it works in fourms?

#

I think both are passed in the thread create event, but I havent looked yet

wheat mesa
#

If possible, I'd do it this way bc otherwise you're just going to have a ton of conditional checks later on if you try to make this from the messages standpoint. Having a column for something like is_original_thread_message in my mind would be messy, since most of your rows are going to show false for this

#

Instead of just directly accessing the original thread message from the FK on the thread itself

solemn latch
#

I wonder how next does it, they dont mark this at all in their schema

lyric mountain
#

putting it in the header table is the best option

solemn latch
#

using the oldest message as the original?

lyric mountain
#

create thread -> create original message -> link both

solemn latch
#

I dont see any problems with this, since discord fourms require you to send a message when creating the thread.

wheat mesa
#

Ohhhh I was confused on how threads work

#

I was assuming that you HAD to have a message exist before creating a thread on it

solemn latch
#

yeah, its backwards in fourms

wheat mesa
#

thanks for the consistency, discord!

solemn latch
#

Much better method πŸ˜„

#

I got some good notes, thanks guys ^-^

wheat mesa
#

I used to be a big relational db hater

#

Now that I understand it, they're awesome

solemn latch
#

My issue is I don't really understand anything.
I can make them but I never know if its right.

wheat mesa
#

You'll get a hang of it pretty quickly

#

Or at least the basics

#

Optimizing is a little bit more difficult, like figuring out when to create db indexes, or how to optimize certain queries, but the structure is pretty intuitive after some practice

solemn latch
#

Yeah, indexs I'll do last. I'm not sure what I'll need indexed until then.

wheat mesa
#

I would be clueless if it weren't for the fact that I was forced into using relational DBs by my internship, which is something super valuable to have

#

If you ever make a web api, check out ASP.NET with EF Core

#

I love how structured it is, very intuitive to understand. Very easy to separate out your business logic from everything else

solemn latch
#

Just in whatever file handles the bitfield?

harsh nova
solemn latch
#

Its a fun side project πŸ˜„

wheat mesa
#

Honestly it's a pretty good idea

harsh nova
#

Yeah for sure! Kinda made a bot like that alr but it worked with GitHub issues

wheat mesa
#

I've been so busy with stuff that I haven't had time for side projects 😦

harsh nova
#

Do you can right click a message in a thread and press "add to GitHub issue"

wheat mesa
#

Going to try to get into ML stuff soon with financial models

#

But honestly no idea where to start

harsh nova
solemn latch
#

My issue with discord is nothing is indexed, so i cant just google things from a specific discord.
Discord search sucks 😭

wheat mesa
#

I have been watching a video series made by my school's quant finance club on the black scholes model and geometric brownian motion

#

Which I'm actually enjoying quite a bit

#

But still going to take a while to figure out, I'm thinking maybe I start with a project that tries to estimate values for drift and volatility given a stock's historical data

wheat mesa
#

I'll have some times where it works, and most times where it doesn't

solemn latch
#

It would be a great feature for discord to implement. restrict it to boost level 3 servers or something.

#

So, just implement it into a bot. Discord loves stealing bots ideas.

queen needle
solemn latch
#

Its just only for one guild.

wheat mesa
#

It would be probably somewhat expensive to host for multiple guilds, plus probably requires customization per-guild

solemn latch
#

Yeah, thats my target.

wheat mesa
#

But I could actually see something like this making some money, especially for bigger servers

solemn latch
#

hopefully ad supported, but I'll throw in a use your own domain feature to premium servers.

queen needle
#

Is what I was thinking of

wheat mesa
#

Either way, nice project to put on a resume πŸ˜‰

frosty gale
#

thanks for the help google

#

why do they even have this open if they dont answer to anyone but probably companies that make them money

deft wolf
#

They are working on this case tho

frosty gale
#

i'll check back in a year to see if they are still working on it

deft wolf
#

It must really be something serious that it takes them so much time

neon leaf
wheat mesa
#

this is sick

neon leaf
#

3 hours pain getting named pipes to work

#
use ipipe::Pipe;

pub fn status(pid: Option<usize>) -> bool {
    if pid.is_none() {
        return false;
    }

    let pid = sysinfo::Pid::from(pid.unwrap());
    let sys = sysinfo::System::new_all();

    let process = sys.process(pid);

    if process.is_none() {
        return false;
    }

    let process = process.unwrap();
    for value in process.environ() {
        if value
            .to_str()
            .as_deref()
            .unwrap()
            .contains("/.mcvcli/java/")
        {
            return true;
        }
    }

    false
}

pub fn get_pipes(identifier: &str) -> (Pipe, Pipe, Pipe) {
    let stdin = Pipe::with_name(&format!("{}_stdin", identifier)).unwrap();
    let stdout = Pipe::with_name(&format!("{}_stdout", identifier)).unwrap();
    let stderr = Pipe::with_name(&format!("{}_stderr", identifier)).unwrap();

    (stdin, stdout, stderr)
}

this ended up being the entire thing

pine willow
solemn latch
#

Thats boring

#

πŸ˜„

covert gale
#

ah, someone posted answeroverflow already

solemn latch
#

Yep

amber quiver
#

I need ideas to add into my ticket bot, any ideas?
I’ve switched it up entirely and gone for the use of forum threads instead of multiple text channels and it’s working relatively smoothly

pearl trail
radiant kraken
pearl trail
delicate zephyr
#

it's like the easiest language to read if you're just starting out

#

because most of the time it just makes sense lmao

#

and yea the 19xx threats are the best

pearl trail
#

yeah KEKW

radiant kraken
#

they were in the form of emails

#

that shows how old they are

spark hawk
#

good luck

rigid maple
#

Hello, I created such a background, but when the resolution changes, the curved lines shift and the triangular shapes in the background are distorted.

#

When the resolution changes:

#

No matter what, I want the triangular shapes in the back to remain intact.

wheat mesa
long marsh
#

The only way you wouldn't care too is if you already have money and/or are complacent with your position in life

spark hawk
#

but I come from an upper middle class family and haven't really struggled for money

long marsh
spark hawk
#

alr bro

#

we'll see where I end up

long marsh
sturdy depot
#

does anyone know how to do so when you type a command in the discord server it saves it in a code?

pearl trail
#

i don't quite get what you meant. save what? is it like command tracking, to track which commands is used etc?

sturdy depot
pearl trail
#

ah, it's better to use database, a very simple one can do the job, like better-sqlite3. i'm pretty much sure it's not recommended to edit code in runtime, by that i mean like you update const badwords = [a, b, c, d] to const badwords = [a, b, c, d, e, f]. if better-sqlite3 is still too much, the very very simple way is to use txt files and play with it. like

a
b
c
```. tho using file "db" like txt/json is not recommended
sturdy depot
#

oh ok

#

thans

#

ima tell u if it dosent work

pearl trail
#

oke

wheat mesa
#

JSON/text DB is a bad idea

#

Use a proper database for this

pearl trail
#

yeah, i said that at the end of msg

wheat mesa
#

Just wanted to emphasize

sturdy depot
#

is text risky?

wheat mesa
#

Yes

sturdy depot
#

well why

wheat mesa
#

One concurrent write and it’s going to fuck up your file

#

It’s also slower than using a database that’s optimized for exactly this purpose

sturdy depot
#

oh ok

wheat mesa
#

Plus learning a relational database is always a good thing πŸ™‚

sturdy depot
wheat mesa
#

If you actually want to learn, using AI is detrimental. If you don’t care about that though, go for it

#

It’ll be difficult to get very far with it though, I must warn you

sage bobcat
#

One message removed from a suspended account.

sharp geyser
#

I use ai to code waifus for my lonely heart

sturdy depot
#

nah its just a little project i dont plan to make it smth important

frosty gale
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

sturdy depot
#

uhm...

fast marsh
#

I havn't used SQLite as a database in years

frosty gale
sage bobcat
#

One message removed from a suspended account.

neon leaf
frosty gale
#

a lot of people unnecessarily use huge server databases like postgresql when a sqlite database will work

fast marsh
wheat mesa
#

I’m not a huge fan of nosql databases

small tangle
wheat mesa
neon leaf
#

docker compose is a life saver

#

everything deployed through docker

#

not gonna look back

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

pearl trail
#

@modern sable

frosty gale
#

its one of these that opens up a fake popup window

#

these are clever

modern sable
pearl trail
sturdy depot
frosty gale
sturdy depot
#

ohhh

pearl trail
#

scary indeed

frosty gale
#

actually in this case its a fake popup but ive seen it done with real ones

#

if you viewed this on linux it would still show the windows UI on the popup which wouldnt make sense

pearl trail
#

actually, a lot

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

sturdy depot
#

isnt linux just an cmd?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

solemn latch
#

android ;p

sturdy depot
#

that penguin reminds me of this

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

sturdy depot
sage bobcat
#

One message removed from a suspended account.

sturdy depot
#

wdym

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

sturdy depot
#

yeah the database just fucked up the bot

#

WHY DID I DO IT UGH

sage bobcat
#

One message removed from a suspended account.

sturdy depot
#

imaa just remove the saving thing

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

sturdy depot
sage bobcat
#

One message removed from a suspended account.

sturdy depot
#

ima just remove all mentions of the database and pray that it will work

solemn latch
#

generally best to make sure you understand the error message before making a choice on what to do

sturdy depot
#

pls work pls work

#

YESSSS

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

sturdy depot
#

ok

sage bobcat
#

One message removed from a suspended account.

sturdy depot
#

thanks

sturdy depot
sage bobcat
#

One message removed from a suspended account.

sturdy depot
#

anyway atleast my bot aint broken now

#

btw is this risky to keep or should i try to remove it?

solemn latch
#

probably using discordjs, latest version has 3 moderate vulnerabilities

sturdy depot
#

so is it safe?

#

and yes im using js

solemn latch
#

discordjs suggests they don't affect bots, but its up to you to determine if its okay for you, or if you want to fix them.

sturdy depot
#

oh ok then idgaf

frosty gale
frosty gale
#

but not trivial to exploit

lyric mountain
#

if it's only 3 I'd try to solve it

#

those things tend to snowball fast if you ignore

frosty gale
#

yeah chances are there are no breaking changes so everything should still work

sharp elbow
pearl trail
#

i'm curious, if you use github actions, how do you test it? because sometimes it won't work the first time it got created, so fix and fixes are being made. if we want to fix it, a commit need to be made and actions will re-run. that'll clutter commit with "fix: workflow" etc

digital swan
#

I make a lot of commits with very angry commit messages

lament rock
earnest phoenix
#

cc @solemn latch

solemn latch
#

cool

pearl trail
#

interesting… thank you guys! πŸ™

#

ill try them

prime cliff
sharp geyser
#

Anything CI/CD related is beyond me

#

especially when it coems to actions

#

Props to you guys who know how it works

#

When it comes to access management, especially when related to role based access management, how do you guys handle it from an api standpoint to protect resources?

My idea was, my auth server allows me to designate roles, which is attached to user info when they introspect to verify the access token. I can then check the roles based off the required roles for the resource being requested. I'd use some sort of enum on my api, since I also want to be able to give access to resources if they are of a higher role, like a moderator or developer.

#

Something like
if granted_role >= required_role then give access else return unauthorized

#

I'd need to make some wrappers to parse the introspected data into proper format, and make sure the roles are typed properly so I can do the whole greather than or equal to check

wheat mesa
sharp geyser
#

How so?

wheat mesa
sharp geyser
#

Also no im not

wheat mesa
#

Ah nvm then

sharp geyser
#

Not for the backend

#

The backend receives an access token in the Authorization header

#

Its easier just to parse it myself

wheat mesa
#

What backend are you using?

sharp geyser
#

Im still using aspnet

wheat mesa
#

Use identity with it

#

It’ll save you a ton of time

sharp geyser
#

Why?

wheat mesa
#

Doing auth by hand is a PITA

sharp geyser
#

Im not implementing a full auth in the backend

#

the frontend is where most of the auth is

wheat mesa
#

You can set up a middleware to parse the auth token

sharp geyser
#

the backend only handles giving out resources if they are authorized based off an access token

wheat mesa
#

Also your frontend should never ever handle auth

sharp geyser
wheat mesa
#

It should store an access token that is given to it and associate it with every request, but other than that, your backend should never trust your frontend

sharp geyser
#

Thats how 90% of people do it

#

At least when they are doing SSR

sharp geyser
#

Which is why it takes the access token given and introspects

#

It will only ever give out resources if the token is validated via the introspect endpoint

#

Otherwise its 403

wheat mesa
#

OAuth2 grants an auth token -> frontend stores the auth token -> sends it with each request -> backend finds the user that this token is associated with and it’s roles (or you can use JWT claims if that’s how you’re doing it)

sharp geyser
#

Correct

#

Which is what im already proposing doing

wheat mesa
#

Since the JWT is signed with a secret key from the server, the client can’t maliciously fake the data

sharp geyser
#

Right

wheat mesa
#

Ok I misunderstood what you were saying

#

You said frontend handles the auth

sharp geyser
#

Well technically yes

wheat mesa
#

I was under the impression that was your only layer of security there

sharp geyser
#

Its initiated on the frontend, but its done server side in nextjs

wheat mesa
#

Yeah then the backend is handling auth

sharp geyser
#

I guess yea

#

I consider anything nextjs related frontend πŸ’€

wheat mesa
#

Frontend handling auth would mean like β€œIf the roles don’t match, I don’t allow them to make a request to endpoint [x]”

sharp geyser
#

My aspnet api will take the access token and introspect it before allowing any resource to be given out

#

But resources are also role based

wheat mesa
#

And why not use asp.net identity? It handles stuff like role based auth for you

sharp geyser
#

Because I don't see a viable way to do it with how we currently do things

#

Right now the process is

#

Login on nextjs app -> server side of the app will redirect to auth page -> get redirected back to the nextjs app on successful login -> tokens saved to localStorage

wheat mesa
#

Why so many steps? You’re running two different servers?

sharp geyser
#

We have the nextjs app and then the aspnet api

wheat mesa
#

And why is it a nextjs app and not just plain react

#

Nextjs is a server

sharp geyser
#

null recommended using nextjs

wheat mesa
#

You don’t need nextjs unless you plan on doing SSR or something like that

sharp geyser
#

Ima keep it a buck with you, frontend is not my specialty

#

so idk what we need

#

Im a backend nerd

harsh nova
#

Im right there with you. Also using nextjs for frontend with a rust backend

sharp geyser
#

I simply went nextjs because easy route stuff

harsh nova
#

Yeah same and the css / js bundler

sharp geyser
#

yup

wheat mesa
#

Nextjs is server side rendering/api backend. Use something like React Router if you want routes

sharp geyser
harsh nova
#

Yeah I'm a bit silly

sharp geyser
#

Bro at this rate we ain't doin shit

wheat mesa
#

I think you CAN do a static site gen with nextjs, but it’s not what it’s intended for fully

sharp geyser
#

I dont even want to swap rn

#

I don't know if we need nextjs fully or not yet

#

since I barely know what SSR is

wheat mesa
#

SSR is when your client makes a request to the server, and the server renders the HTML before sending it back to the client

sharp geyser
#

See idk if we need that or not

#

Im not a frontend guy so I can't make the call

wheat mesa
#

This is different from a SPA like base React because the client makes a request, and the server responds with all of the javascript that then gets run on the browser to render the HTML

#

SSR is good for SEO because it renders entirely server side and the client needs to do basically no work

#

But most web crawlers now can handle SPAs for indexing

harsh nova
#

Oh really? Only reason I used nextjs was so that it would be crawlable

#

Probably switching to just regular old react then as I've never gotten nextjs self hosting working right on my server

wheat mesa
#

Not all web crawlers will run the js but major indexers like Google will absolutely do it

sharp geyser
#

Google is the only one that really matters

#

its what 90% of the world uses

#

πŸ’€

harsh nova
#

Google and Bing imo

#

I think ddg gets their results via bing if I don't have stupid

wheat mesa
#

Otherwise it’ll be annoying to run two servers if you don’t need SSR

sharp geyser
#

Right

#

but I still dont know if we need SSR

#

I'll have to talk to null

#

Which is a conversation im not excited about since we've swapped frontend stuff like 5 times now

wheat mesa
sharp geyser
#

I mean

#

chances are we may make use of it

#

especially for a marketplace app

wheat mesa
#

For most apps an SPA + REST API is more than enough

#

You’ll also have to host this nextjs server :^)

sharp geyser
#

@wheat mesa if im am using React + my aspnet backend

#

How do you recommend I handle auth?

#

I know using the Identity package

#

but the only time I ever used it was but once and even that was handled in blazor SSR

#

I think I have an idea on how to use it but im not certain

pearl trail
#

you fully rely on the backend

sharp geyser
#

Would my frontend just make a call to a backend endpoint that handles calling ChallengeAsync or whatever

#

that would then redirect to my auth provider?

queen needle
#

Personally I always implement auth horribly

sharp geyser
#

I also do so

queen needle
#

So valid

sharp geyser
#

but for a project at this scale I really have to fucking try hard

#

😭

#

Money involved = security needs to be TIGHT

pearl trail
#

i stopped understand after reading ChallengeAsync, as i havent used aspnet that hardcore

sharp geyser
#

Well

#

Theres like 40 fucking ways to log someone in with Identity

#

ChallengeAsync is one of em

cinder lily
sharp geyser
#

Dang

#

shots fired

queen needle
#

It's because me and him are working on a project where he does the backend, but he hosts on a url and frontend is localhost rn so we had to do it a really hacky way to get it working

sharp geyser
#

Lmao

cinder lily
#

just develop on prod and the cookie issues go away

pearl trail
#

cors?

queen needle
#

Idk if it's any help, but the way I did auth on one of my recent projects with a separate backend, the server had a cookie that was shared, and I had a middleware which checked said cookie, and then I also had a auth provider with a "useAuth" hook

sharp geyser
#

Well, thats not really the case for me persay

queen needle
sharp geyser
#

A cookie will be used

queen needle
#

Oops wrong reply my bad

queen needle
sharp geyser
#

Every day I get closer and closer to throwing my pc out the window

queen needle
#

So valid

sharp geyser
#

This project has been going on for a year and sadly we aren't even close to getting naything viably working

#

We've had so many bumps

pearl trail
#

nextjs is totally fine, i use it. but that may need a lot cpu + ram juice when it starts to gain a lot of visitors

queen needle
queen needle
sharp geyser
#

Thanks discord, I requested my data and its empty πŸ™‚

#

They gave me an empty zip file

pearl trail
#

πŸ’€

#

you sure it's not corrupted while downloading?

sharp geyser
#

Well it downloads fine

#

but extracting it wont because its "empty"

#

It says it has 9kb of data in it

pearl trail
#

πŸ’€

queen needle
#

Discord just magically stores no data for you

deft wolf
#

They sold it already

sharp geyser
#

Well shucks

#

I want my 9cents

#

Clicking the link actually does nothing

#

I have to click "Open in new tab" for it to download anything

pearl trail
#

oh yeah that might be a problem

sharp geyser
#

Opening the link in incognito downloads a 231mb file

#

Theres all my juicy data

#

anyways

#

I guess I will just figure it out

harsh nova
#

So far any with I've made have been decently solid afaik awkvard_blush Passwords are always encrypted and all that

queen needle
#

My last full auth system I used supabase

prime cliff
#

Hmm thinking of a good way to have secure websocket server and client.

The server will be an asp.net app with an open port for incoming websocket connections.

The client will then connect to the server with a secret auth key that is hashed on the server so only that specific key and ip can connect and only the client knows it.

Maybe the client could also request some kind of session id to use or something.

This also means that clients can also be air gapped or firewall blocked on incoming connections without any issue.

The asp.net app (server) will be able to send websocket events to the client so it can manage docker containers on that client.

Currently using C# https://github.com/chronoxor/NetCoreServer

uncut nexus
pearl trail
#

i have yet see any site with that method

#

tho, that’s theoretically capable of doing requests, but ig it’ll inefficient(?)

prime cliff
#

Would make the client more secure and lightweight and the server itself only has the hashed version of the key that only the client knows but the server can verify and also better management of what ips can connect to the server too.

pearl trail
humble gyro
sharp geyser
#

you dont know a lot of things

#

but its okay

#

here we dont judge

#

we teach :3

frosty gale
delicate zephyr
#

people just forget

pearl trail
#

is there any difference between INT and INTEGER in sqlite?
❌ id INT PRIMARY KEY AUTOINCREMENT NOT NULL
βœ… id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
error is [SQLITE_ERROR] SQL error or missing database (AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY)

harsh nova
#

I don't think INT actually is a data type in SQLite

delicate zephyr
frosty gale
#

its also reduced load on the server so thats a nice thing about it

#

i think discord might be one of them

#

but then they do have a desktop client with electron so its reasonable

#

and its not the app that actually needs good SEO

lyric mountain
#

if you define INTEGER PRIMARY KEY it'll replace implicit id_seq column

#

but if you INT PRIMARY KEY it'll keep the other

#

and well, autoincrement is finicky

pearl trail
pearl trail
lyric mountain
#

yep, sqlite has a lot of weird rules

#

for example you should not make an autoincrement pk unless you have a very specific need for it

#

since all tables inherently have id_seq

pearl trail
#

oh

delicate zephyr
#

cant remember the exact expression

#

Either way autoincrement is normally advised against

pearl trail
wheat mesa
# frosty gale for some reason we live in a world where some people have completely shifted awa...

It really depends on your use case. 99% of the time SSR is overkill. If you have a client app that is somewhat complex, SSR might be a better option, but there is trade offs to consider. Working with SSR can suck for numerous reasons (such as timezones, I have personal experience in this hellhole), and it also costs the host more. If you are building a startup or even just an app that you don’t want to pay for hosting for, SPAs are the better way to go. They get you 90% of the same functionality for a lot less of a hassle

quartz kindle
#

each thing has its own hellhole xD

#

static html > *

wheat mesa
#

SPAs aren’t bad for SEO anymore

#

Google and the major web crawlers support most SPAs

delicate zephyr
quartz kindle
lyric mountain
delicate zephyr
pearl trail
delicate zephyr
#

use base64 if you have to lmao

lyric mountain
radiant kraken
#

interesting

pearl trail
#

noted i use sqlite because it’s light and for my quick 2 hours project so i don’t know much about it. thank you guys for the explanation πŸ™

quartz kindle
#

sqlite internally has a rowid column as well

#

you can manually disable it for a table as long as you have a primary key

radiant kraken
#

rowid?

quartz kindle
#

By default, every row in SQLite has a special column, usually called the "rowid", that uniquely identifies that row within the table. However if the phrase "WITHOUT ROWID" is added to the end of a CREATE TABLE statement, then the special "rowid" column is omitted. There are sometimes space and performance advantages to omitting the rowid.

A WITHOUT ROWID table is a table that uses a Clustered Index as the primary key.

radiant kraken
#

huh weird

#

what about id_seq?

#

that one puzzles me

quartz kindle
#

is it another name for rowid?

#

In an ordinary table, "INTEGER PRIMARY KEY" means that the column is an alias for the rowid.

pearl trail
#

its for postgres i believe

quartz kindle
#

yeah thats rowid

delicate zephyr
quartz kindle
#

rowid is an sqlite specific thing

prime cliff
quartz kindle
#

:^)

pearl trail
#

@solemn latch

wheat mesa
#

It's a PITA to integrate into an application that uses SSR but didn't account for this to begin with

#

Not to mention dealing with localizing input data that the user sends (e.g., should this date field be in the user's timezone or someone else's, or the server's?), then converting it back to show to the user based on their info

prime cliff
#

Even the bot devs are falling for these dumb scams kek

wheat mesa
#

dev is an overstatement

finite shore
#

Wtf

wheat mesa
#

90% of people with the funny green role either used ai to make a bot or just spent 30 minutes copying someone else's bot on github or a tutorial

rugged dawn
#

def

empty quail
#

i have a question since i am having a hard time creating/ coding a bot for our server.. and i was trying to find a bot that is similar to the one that is already existing but that bot is no longer active.. is there any bot that is Wild Rift related?

deft wolf
#

You can search on top.gg, that's what this site is for

empty quail
deft wolf
#

In that case, this sounds like the perfect option to make your own bot. If there is no public bot like it, we won't create it

frosty gale
#

i just use intl+date api in browsers and it all just falls into place

empty quail
deft wolf
#

Depends on the language/library you use

#

Most of the popular libraries rather have a "guide" that will lead you through the basics of creating a bot on discord but you have to learn the rest with the help of documentation and practice

empty quail
#

Thanks!

quartz kindle
frosty gale
quartz kindle
delicate zephyr
#

A website in the 100BC?

quartz kindle
#

lmao

delicate zephyr
#

ah fair

neon leaf
#

got this cursed shit working πŸ™ https://github.com/0x7d8/bad-lang-2

    let a = 0
    let b = 1
    let temp = 0

    if (#eq(n, 0)) {
        return a
    }

    let i = 2
    loop {
        if (#gt(i, n)) {
            break
        }

        temp = a
        a = b
        b = math#eval(string#format("{} + {}", temp, b))

        i = math#eval(string#format("{} + 1", i))
    }

    return b
}

let users = []

fn add_user(name) {
    array#push(users, name)
}

io#println(users)

add_user("Arnaud")

io#println(array#get(users, 0))```
wheat mesa
#

raw src code -> tokens -> AST -> eval/other IRs

neon leaf
#

well, yes

#

however this was a blind try for fun, didnt google anything for this project

#

its decent I think

frosty gale
neon leaf
#

πŸ™

frosty gale
#

thats cool though

prime cliff
#

Why the heck is there # in the code monkaS

scenic kelp
#

it's not that unreasonable of a decision considering how widely used it is in documentation

#

the hanging #gt and #eq is a little cursed though

#

very interesting concept of a language not having arithmetic operators and requiring you to eval them lol

eternal osprey
#

hey guys, i have a regular typewriter effect for my text.
Though my text is very long, and adding a max-width just cuts my message of...

 .intro-text {
    font-size: 18px;
    color: #333;
    text-align: center;
    margin-bottom: 30px;
    max-width: 450px; 
    white-space: nowrap;
    overflow: hidden;
    border-right: 4px solid #333;
    animation: typing 5s steps(50) 1s forwards, blink 0.75s step-end infinite;
}```

how would i make the text wrap down instead of just cutting off at the max-width
lyric mountain
#

word-wrap: wrap or smth

#

go into inspect element and type wrap into styles to see what pops

solemn latch
#

nowrap means dont break right? πŸ‘€

#

yeah, you're specifying dont wrap in the css right now

prime cliff
quartz kindle
#

LOL

lyric mountain
humble gyro
proven lantern
#

zig 0.14 was supposed to release today

delicate zephyr
#

:^)

lament rock
#

In my JS jank adventures I've been on, my npm module to hot reload JS files recently added the ability to reload all class instances' methods of classes specially marked as reloadable. This is already quite jank and has some draw backs like you cannot reload the constructor/add missing properties that would come from the constructor. You also cannot make it so that deep class hierarchies can also be reloaded. Classes must directly extend a special class that makes the magic happen.

A co dev also found an incredibly cursed way of making it work.

class ThisCanReload extends sync.reloadClassMethods(() => ThisCanReload) {
  constructor() {}
  magic() { console.log("1"); }
}

The return value of a function can be a constructor function and extends has no complaints about it. In this case, the function returns the base ReloadableClass. The callback with the return value of the class is to get a reference to the class that's doing the extending to update stored instances' prototypes. Finally had an excuse to also make use of WeakRef so that the old class prototypes can get garbage collected. There was a challenge though and it's that you can't iterate over a WeakSet, so we opted for a regular Set and used this cool thing called a FinalizationRegistry that runs a callback when something gets garbage collected so we can clean up entries of the Set.

There's also a thing where it can "remember" variables you want it to with a key (scope locked to files for security). If you don't pass a key manually, it reads the source file calling the function to get the variable name. How it does it is kinda brilliant, but not always possible to extract the variable name. Useful for having Maps or Sets you add to you don't wanna rebuild or store elsewhere

neon leaf
lament rock
neon leaf
#

πŸ”₯ faster than python```root@remotedev:~/projects/0x7d8/bad-lang-2# time python3 testing/fib.py

real 0m2.975s
user 0m2.975s
sys 0m0.001s
root@remotedev:~/projects/0x7d8/bad-lang-2# time node testing/fib.js

real 0m0.084s
user 0m0.074s
sys 0m0.013s
root@remotedev:~/projects/0x7d8/bad-lang-2# time cargo run -r
Finished release profile [optimized] target(s) in 0.00s
warning: the following packages contain code that will be rejected by a future version of Rust: nom v1.2.4
note: to see what the problems were, use the option --future-incompat-report, or run cargo report future-incompatibilities --id 1
Running target/release/bad-lang-2

real 0m0.470s
user 0m0.465s
sys 0m0.005s
root@remotedev:~/projects/0x7d8/bad-lang-2# ```

frosty gale
pearl trail
#

facts πŸ—£οΈ πŸ”₯

bitter granite
earnest phoenix
#

fish faster than snake

#

ez

bitter granite
solemn latch
#

unless theres snakes on a plane

#

but that would never happen

lament rock
#

Time to import snakes from around the world

#

it is the year of the snake after all

bitter granite
#

my old fav movie

solemn latch
#

great movie

bitter granite
radiant kraken
bitter granite
radiant kraken
#

wdym?

bitter granite
radiant kraken
#

i dont have vpn

bitter granite
#

netflix allow it

bitter granite
radiant kraken
#

free vpn = scam

bitter granite
#

they have free ver

sharp elbow
#

Free VPNs do exist, it’s just that you are paying with your data privacy instead of money weirdsip

earnest phoenix
frosty gale
#

i wonder how vpns went from this mostly corporate, niche thing to access private networks remotely to a million dollar industry under the guise of "privacy"

#

This makes it harder for websites, advertisers, and even your internet service provider (ISP) to track where you are and what you do online.
i hate this argument because you are basically shifting the trust model from your ISP to your VPN, not like it matters anyways

earnest phoenix
#

nordvpn had probably the worst advertising campaign

#

spreading fake and unrelated information and unnecessarily trying to scare people off

#

probably the funniest one is when they advertise their encryption as "military-grade". it's just aes...

sharp geyser
#

Thats military grade encryption right there

lyric mountain
#

it's funny when products are sold as military-grade

#

that just means they're the cheapest shit on the market that somewhat works

wheat mesa
#

"Military grade" means overpaying for an inferior product

#

πŸ˜‰

wheat escarp
#

What to do if I cant open top.gg on my safari browser send me a dm if u can help

delicate zephyr
#

is because its a publically accessibly encryption method

#

its even less likely that the military use it

earnest phoenix
#

nah tbh it's used a lot

#

but it's not really something special

#

all https websites use it

zinc wasp
quartz kindle
sage bobcat
neon leaf
quartz kindle
neon leaf
deft wolf
#

ok

quartz kindle
pearl trail
#

ok

neon leaf
quartz kindle
#

thats @solemn latch

solemn latch
#

Don't taze me 😦

#

It hurts

bitter granite
neon leaf
#

yes

#

and awp double kills

bitter granite
neon leaf
#

no ace tho devious

#

last clip is my fav one so far

bitter granite
#

let me find my op clip

bitter granite
neon leaf
#

lol wtf

bitter granite
#

We should duo sometimes

neon leaf
#

no

#

im not that good

#

perma silver 3 on office

#

and perma gold nova 2 on wingman

earnest phoenix
#

me when dev channel freerealestate

bitter granite
green kestrel
#

who's excited for components v2?!

neon leaf
#

🧐

green kestrel
#

i mean look what you can do with it

neon leaf
#

wtf

green kestrel
#

i mean how cool is that

#

we still get embeds and stuff, but we also get this!

limpid onyx
#

What, it's so cool

vocal knot
#

i need more info on that

prime cliff
#

Ah yes announcing who's ready for a secret experiment that only about 20-30 people know xD

deft wolf
#

Now we have 10 more people knowing about it

vocal knot
#

LOL

prime cliff
#

This server has more than 10 people in it

neon leaf
deft wolf
#

This channel is Tim's basement, it can't hold more than 10 people (don't ask how I know)

green kestrel
green kestrel
#

its far from secret πŸ˜„

#

this is the D++ example for it

vocal knot
#

so finally video support lol

green kestrel
#

yup!

queen needle
#

I saw these a while ago and was waiting for more updates so I assume if now they've gone to library developers that they're getting closer

#

oh wait I misread your message but most of mine still stands

neon leaf
#

lets say I have a stream of 9-byte messages that contain u8 (type) u16 (x) u16 (y) u8 (height) u8 (r) u8 (g) u8 (b), how would I trim them so that overlaying pixels dont get stored multiple times, currently its stored as a simple u8 array, where each message is appended

wheat mesa
#

Or are you intending to have a specific ordering, e.g. intending to send layer data in the future

neon leaf
#

basically I dont want pixels in the same spot to take up memory

wheat mesa
#

Why not represent each pixel as an rgb value and just change it to the new value when they overlap? Too much data?

neon leaf
#

too many pixels

#

i mean

#

atp that may be the only performant solution

#

2d array of pixels with a predefined res

#

2.7MB to store 720p

#

6.2MB for 1080p

#

yeah okay this seems fine enough

wheat mesa
#

Yeah, trying to handle compression and such might be a pain in the ass just to save a few bytes

neon leaf
quartz kindle
neon leaf
#

in my mind that sounds very cpu and memory intensive

quartz kindle
#

well

#

how about this

#

store xy as a 24bit int, which gives you 12 bits per dimension, or 4096x4096

#

and index them somewhere

#

so you can easily look it up if its occupied or not

quartz kindle
#

currently its quite laggy due to to many messages when you draw

#

you can set a timer to join messages together and send them in chunks every 100ms or so

#

or even better, every requestanimationframe

#

id make it like this: when drawing, add messages to array, every requestanimationframe send all messages in array in a single ws message and clear array

neon leaf
quartz kindle
neon leaf
#

hmm

quartz kindle
#

you are not storing empty pixels right?

#

you want to store only actually drawn areas

neon leaf
#

well

#

im currently storing the entire history

quartz kindle
#

well, storing the entire history is also interesting since you can replay it later

#

you can keep it as a feature if you want

#

how do you make history_2.raw?

#

do you read the history on the server side every time before sending it? or do you have a snapshot you can send right away?

neon leaf
quartz kindle
#

the hashmap is for both quickly loading the current state of the image, as well as for deduplicating pixels

#

the message history is only if you want it to be replayable later

neon leaf
#

hm hm

quartz kindle
#

and yeah, try chunking together websocket messages, it should drastically improve drawing performance

neon leaf
#

yeah, that shouldnt be too hard

neon leaf
#

the problem is only 1 thread can access the data at once, and it blocks all other threads in the meanwhile

quartz kindle
neon leaf
#

yes

lyric mountain
#

waddya doin?

quartz kindle
#

well, it shouldnt be a problem, with message chunking plus a hashmap is should be plenty of fast enough

#

with message chunking you wont get too spammed on the server side, and im pretty sure an int-key hashmap should be capable of millions of ops

#

tbh not a hashmap, something that doesnt hash is better

#

since your keys are ints

neon leaf
#

array trol

quartz kindle
#

sure

#

sparse array

#

or holey array

#

xD

#

you can also offload the data saving to another thread

#

so it doesnt block the server thread

neon leaf
#

well there is no server thread

#

I mean there is but nothing is on it

quartz kindle
#

i mean the websocket server

neon leaf
#

ye

#

each ws is a seperate thread

#

3 actually (+1)

quartz kindle
#

ah then its fine

#

wait why 3 lmao