#development
1 messages · Page 245 of 1
writes get stored in a buffer and get flushed if enough data gets written or if the handle closes
or you decide to read/write in a different location
sounds like youre using a self signed certificate
check what the certificates are showing up as
are you trying to access your thing directly without going through cloudflare?
like via ip instead of domain?
or did you turn off cloudflare proxy thing ?
fixed it somehow

the thing is
if I proxy it through cloudflare
thunderbird and such can't send emails
it refuses to
idk why
It's like it can't connect to the SMTP
To my knowledge it’s only possible with Cloudflares’ Enterprise plan, which starts at about 5000 per month (from what I’ve read like 3 years ago). With all other plans, you need to disable the proxy as it doesn’t passthrough SMTP/POP3/IMAP, needed for a mailserver, or mailcow in this case.

SMTP and such wont pass through cloudflare's proxy
yeah well you cant use CF origin cert for that then
CF origin cert only works for the CF proxy
Oh it’s more than that
💀
:)
why are you trying to pass smtp through cloudflare
unless youre using some dedicated cloudflare smtp thing it wont work
well it might it just wont work very well
if you want to hide your SMTP servers real IP you should use something like mailgun to receive the mail which forwards it to your servers SMTP server
the issue is
mail.vidcord.xyz has basically everything running through it
the ui, SMTP, IMAP/POP3, etc etc
If I don't proxy mail.vidcord.xyz then the ui will lose https because I use cloudflare origin ca certs
Im also too lazy to separate out the SMTP to its own subdomain so I can avoid proxying it through cloudflare and only do the ui
Anyone worked with telegram auth before?
Their login with telegram auth widget is ass and not customizable at all, trying to see if i can have my own button
you can have the smtp server listen under another subdomain
but since youre using cloudflare you probably dont want your servers ip exposed
what are you using smtp for?
sending, receiving or both?
all your mail will immediately go to spam lol
you have to have a static ip for your smtp server
I do
I do have a static ip
but you said youre passing the smtp server through cloudflare
not anymore
because it causes problems
it wont send or recieve mail when proxied through cloudflare
but then whats the point of using cloudflare if your ip is exposed through smtp anyways
If. you know any article on properly setting up SMTP lmk
until then im fucked cuz I suck at networking
i know how to set it up without hiding your ip
I'd rather set it up properly
but for your use case you need to either use cloudflares dedicated smtp thing or something like mailgun
if Im supposed to be hiding my ip then I shall
i believe mailgun has a free tier
you set your dns records to point to mailguns stuff
unless youre a mad man you probably wont need more
but I also dont know
as I will be having support emails run through my mailcow server
you then tell mailgun your servers ip and it will forward any emails it receives to your smtp server (or mailcow)
similar with sending, you send the emails to the mailgun smtp proxy and it will forward your mail on behalf of it
Are these my only options
Because while mailgun will help, I plan on having support emails run through my mailserver
and I don't want to cap it at 100 a day
💀
youre quite limited when it comes to not paying anything
i just wouldnt worry about exposing my servers ip honestly
Well, you made it sound like I should...
as long as your firewalls are setup correctly you should be fine
dos attacks are quite rare unless you piss someone off
even then host providers let you pay a tiny bit extra for dos protection
well
How can I proxy my ui through cloudflare but not my smtp part
Idk if that will be mailcow specific or not

I am using nginx
what port is your mailcow webui listening on
8080
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name mail.vidcord.xyz autoconfig.* autodiscover.*;
ssl_certificate /etc/ssl/certs/vidcord.xyz.pem;
ssl_certificate_key /etc/ssl/certs/vidcord.xyz.key;
ssl_client_certificate /etc/ssl/certs/cloudflare.crt;
ssl_verify_client on;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
ssl_session_tickets off;
ssl_protocols TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5:!SHA1:!kRSA;
ssl_prefer_server_ciphers off;
location /Microsoft-Server-ActiveSync {
proxy_pass http://127.0.0.1:8080/Microsoft-Server-ActiveSync;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_connect_timeout 75;
proxy_send_timeout 3650;
proxy_read_timeout 3650;
proxy_buffers 64 512k; # Needed since the 2022-04 Update for SOGo
client_body_buffer_size 512k;
client_max_body_size 0;
}
location / {
proxy_pass http://127.0.0.1:8080/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 0;
proxy_buffer_size 128k;
proxy_buffers 64 512k;
proxy_busy_buffers_size 512k;
}
}
I mean
then setup another subdomain specifically for your smtp server
and make it point to your real servers ip
not proxied
would I have to modify anything in nginx?
I guess I would have to have a 443 server block for smtp and route smtp.vidcord.xyz with location / proxy_pass to 127.0.0.1:465 (SMTPS port)

I suck with nginx tho so idk if I will need any proxy_set_header usage
isnt the point of email precisely not hiding your ip so you can be trusted?
ig
Ima try and do the nginx proxy pass thing
I will let you guys know if it works

wait, I can't use my cloudflare certs for smtp

so uh, what is this virt thingy
virtual memory, nothing real
VIRT stands for the virtual size of a process, which is the sum of memory it is actually using, memory it has mapped into itself (for instance the video card’s RAM for the X server), files on disk that have been mapped into it (most notably shared libraries), and memory shared with other processes. VIRT represents how much memory the program is able to access at the present moment.
generate a letsencrypt free one
that should be good
idk how
its a bit annoying ngl
https://tecadmin.net/how-to-generate-lets-encrypt-ssl-using-certbot/ do certbot with nginx
Getting an SSL certificate for your website is important to keep your data safe and make visitors trust your site. Let’s Encrypt offers a free and easy way to get these certificates. Certbot is a tool that helps you get an SSL certificate from Let’s Encrypt without much hassle. In this guide, we’ll show you,
actually no not with nginx
do a standalone one
actually wont work either since youre using nginx

yea
this is why I use cloudflare
I looked at letsencrypt
andi t was too annoying
do it through dns
then your certificate should be somewhere in /var/letsencrypt/live/ and you can use that in your smtp thing
the cloudflare one you have is one that's self signed by cloudflare anyways
so its not a proper one
hmm, so it's using 70gb memory then 💀
nah it just thinks it is
ooooo
alright so another question, there are tons of sidekiq thingy with 10.5% mem, does it mean 10.5% each or the sum?
each is a thread
10.5% is all threads combined
since they are all 1 process
lmao
I don't need to know how much memory my program has mapped in the virtual address space
just give me physical memory usage, maybe swap, and cpu percentage
everyone's happy
lmao
windows task manager can be pretty obscure too
pink accent color supremacy 
automatic accent xD
Brazil national color
@frosty gale btw when setting up the dns record for the acme challenge do I proxy it or no?
no
acme challenge should be reachable on port 80

server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name smtp.vidcord.xyz;
ssl_certificate /etc/letsencrypt/vidcord.xyz/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/vidcord.xyz/privkey.pem;
location / {
proxy_pass http://127.0.0.1:465;
}
}
does this look correct?
Im not sure if I need to set any proxy_set_header stuff
hell nah blue on top
🤢
still pinkish
How do you determine if an Entitlement is active? I've cancelled a test one and it looks like nothing has changed on the Entitlement object in the provided interaction.
doesn't matter assuming you're using DNS verification it asks you to set a TXT record on acme challenge
that's for http verification not dns silly
certbot is very annoying so I prefer doing it with dns
it modifies your nginx/apache2 configs for auto renewal
and you can't do web server verification if you have anything else on port 80

I forgot
all I know is it worked
and generated a ssl cert
and now my smtp works
magnificent
It's because the subscription lasts the entire month even if cancelled. 🤦♂️
Hey, I just wanted to ask how does the bot listing work? Like to be no.1 on the search results do votes matter or not? Because my bot has 36 votes and when I search “study” on top.gg, random bots come on top that have like 7-15votes.
Votes probably count the most (except for auctions), but since it's the beginning of the month, top.gg always shows a strange "ranking" due to the fact that votes are reset at the beginning of the month
The website simply needs a few days for everything to settle down
@sharp geyser you use postfix for mailing server?
Oh understandable. Thanks buddy;)
uses mailcow which is some mail server wrapper with some additional features like webui
does appear to use postfix under the hood
as do most of them
i made my own smtp server and mail client just so i didnt have to deal with postfix
but using an all in one mail tool is probably better
not even joking that making your own smtp server is easier than configuring postfix properly from scratch
o
alright thank you very much for the suggestion
wtf someone is trying to break into my git ssh 💀
as expected, they're from china. idk the service said "vpn server"
standard for every machine getting brute force attempts
oh it's normal?
how do u mitigate this
is it like a AllowedUsers = ['myip'] thing
root login?
root@ip
login that gives root access?
and i disabled password login so unless they have my key, no one can login to my server
hm
based

gpg key?
ssh key
hm
i dont think gpg is used on ssh
passwordless auth 
they're probably from the people that hacked your github acc
i did that with my pi and its cool. together with the ssh config i can simply write ssh pi and im connecting to it
ikr, it's cool
and safe
ooo
that too yea 
then yea i can see that
okay at least in my case, i dont need to fear attacks since its not exposed to the internet 
oh and also ssh port 22 is being handled by gitlab (i changed the default port to login). so they will get nothing if they're able to login somehow
yeah
🛒
but is it really making things more secure 
cant you just scan which ports are opened and test them?
well yeah
cron.schedule(
"0 12 * * *",
async () => {
// some code here
},
{
scheduled: true,
timezone: "America/New_York",
}
);```
i am using node-cron, why is this not executing at 12 in the morning in est time
it just not executes at all
disallow root login, only enable the accounts you need, disable password logins and only use certificates, thats basically all you can do and its usually enough
its part of normal internet noise
these scanners only look for low hanging fruit like pre-set passwords to known user accounts or stupidly weak passwords
oooo
your cron is fine so its probably the library or your syntax
or timezone
ah, never did it via dns
some people also like to change their ssh port, gets rid of 99% of those attempts
but if you want top tier security, use ssh tunnels instead
did you test with a really small interval if its functioning at all?
that too but its really a false sense of security
im developing my own high tech solution for this
ssh via websocket? :^)
make ssh only listen locally and the only way to connect is to connect to a tunnel which is protected by my own oauth2 login gateway
ye ssh tunnels are top tier security
im a simple man tho, i use root login with ssh keys
:^)
all behind a passwordless windows laptop somewhere in brazil
yup
well the ssh key itself is password protected
it asks for password every time i connect
Got a pin on my pc and ssh keys for my servers on non root users
No pw based login on a different sshd port
lmfao
you can do that but theres no point
yeah true
otherwise the ws security is compromised 
basically the same, or maybe worse
Webhook integration for receiving vote data
@earnest phoenix turkish?
need some advice 👀
so i have my click war bot
and right now i have 3 versions of the game
and i want 1 of them to be a premium feature game
what would be the best way to go about that?
look into discord's premium systems i guess
no
where can i find this info?
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
thank you
why did you ask that
Ona açıklama yapacaktım türk olma ihtimaline karşi
I was going to explain to him in case he was Turkish.
nothing better than some testing in production 
thats the only way god intended
like is it really "testing" if its not in production
am i wrong
for not writing
declared callback functions
and anonymous functions
as callbacks
for react component events
<button onClick((event) => doStuff()) />```
instead of const onClickHandler = (event) => doStuff()
its fine
let account_details = query!(
r#"
SELECT a.*, l.license_id, s.* FROM accounts a
LEFT JOIN licenses l
ON a.account_id = l.account_id
LEFT JOIN seats s
ON l.license_id = s.license_id
WHERE a.account_id = $1
"#,
&session.get::<i64>("id").await.unwrap().unwrap(),
)
.fetch_one(&state.db)
.await?;
I have this sql query that won't work, mainly because of the duplicate values being returned. As both licenses & accounts will return an account_id and both licenses & seats will return an license_id
Is there anyway to do this without specifying each and every field I want back
or am I fucked
what does LEFT JOIN do? 
Good question
I barely know
I just know it works

I just realized, I don't even want to do it this way 
mui

X LEFT JOIN Y = "Get everything from X, and from Y if anything matches but not required"
As in, get LEFT side, RIGHT is optional
ooooooo
in puppeteer how can i emulate that my browser is in est timezone?
await page.emulateTimezone("America/New_York");```
tried doing this but shit aint working
A bot that is getring paid by discord to support nito
Goofy ass shit
bro thinks discord will give him a cut 😭
Fr
Is it normal that when emphermal is true that it doesn't work
Isn't it ephemeral?
Yeah but I tried spelling it off the top of my head lol
return interaction.editReply({ embeds: [isBlacklistedEmbed], ephemeral: true });
So this would be correct?
Oh wait
For it to work I would need to make the defer
Ephemeral
I think so
Sorry for wasting your time 😭
because you use editReply. you need to defer it first. unless you do reply, you dont need to defer it
ephemeral works on both method
I fixed it :>
:>
Visually it looks like this
discord has a new message type?
Maybe
PURCHASE_NOTIFICATION ? idk that looks new to me
well i havent touched discord message api in a while so dont blame me if it's wrong
doesn't seem to be it
ah wait, it's poll
or they called their bots premium "nitro"
if(checkBoostLog) {
const wasBoosting = !!oldMember.premiumSince;
const isBoosting = !!newMember.premiumSince;
const channel = await newMember.guild.channels.cache.get(checkBoostLog[0].boost_channel_id)
if (!wasBoosting && isBoosting) {
if(newMember.guild.premiumSubscriptionCount <= 14) {
const embed = client.quickEmbed(`${newMember.nickname ?? newMember.user.username} has boosted the server!`, `Thanks to ${newMember} We're now at **${newMember.guild.premiumSubscriptionCount} / 14 boosts!**`)
embed.setThumbnail(newMember.displayAvatarURL({dynamic: true}))
channel.send({embeds: [embed]})
} else if(newMember.guild.premiumSubscriptionCount > 14) {
const embed = client.quickEmbed(`${newMember.nickname ?? newMember.user.username} has boosted the server!`, `Thanks to ${newMember} We're now at **${newMember.guild.premiumSubscriptionCount} boosts!**`)
embed.setThumbnail(newMember.displayAvatarURL({dynamic: true}))
channel.send({embeds: [embed]})
}
} else if (wasBoosting && !isBoosting) {
const embed = client.quickEmbed(`${newMember.nickname ?? newMember.user.username} boost has expired!`, `We're now at **${newMember.guild.premiumSubscriptionCount} boosts!**`)
embed.setThumbnail(newMember.displayAvatarURL({dynamic: true}))
channel.send({embeds: [embed]})
}
}
Anyone notice any flaws or things I could do a bit differently with my boost log code? Sometimes my counts are a little inaccurate or they arn't logged at all. I don't get many boosts as it is so testing can be difficult sometimes. https://scs.twilightgamez.net/72IsC.png
check topgg api documentation
hey anyone know how i can load default emojis like 🏐 on node canvas
?
the icon is not appearing at all
or it shows some weird unicode
i tried Noto Color Emoji font but it isnt working
Doing a quick google search seems like emojis have been an issue in the past, not sure if preseant. But I noticed some npm canvas emoji extensions? That could work like canvas-emoji
im checking out twemoji, i read thats what discord uses
sad unmaintained
sad
wtf is that name
Why does that name sound so fammiliar

ikr
im just surprised nobody has tried to load emojis on node canvas
i dont have a choice but to manually parse the string and load the detected twemojis
not worth the effort tbh
probably cause discord uses twemojis
Nah not that
Its becouse its prob @mention edit
aaa
Oh left
Thats why i cant tag
sad
i was gonna ask the dude to maintain it 
it works but the url is broken since it was left unmaintained for 3 years
he needs to update with the new twemoji url
Welp still in friendlist thoy
tbh im thinking of take his code and making changes

and pushing it in my repo
is that bad
Maybe forking from the thing?
yeah but like i dont think he active
Rip almost accdently call flaze
i just need to change the url to make it work idk tbh havent tried yet
lmaooo

anyway i started learning rust
gonna start
I'm confused, I don't understand, that's why I asked
The docs seem to cover autoposting
https://topggpy.readthedocs.io/en/stable/api.html?highlight=autopost#topgg.DBLClient
@lyric mountain can you help me with an sql query?
I am trying to get data on 3 tables, but when I am joining I am getting duplicates, and quite honestly I want to basically make a map of data where its like
{
"account": {AcountData},
"licenses": {LicenseData},
"seats": {SeatsData}
}
I almost had it last night, but I forgot what I did

Account < - Licenses <- Seats
Licneses has a fk to Account, Seats has an Fk to Licenses
okok, calm down
what are the relationships?
^^^
an account can have many licenses, and a license can have many seats?
An account can have 1 license, and a license can have many seats
create table accounts (
account_id int8 not null primary key unique,
email varchar(65358) not null unique,
password varchar(255) not null
);
create table licenses (
license_id int8 not null primary key unique,
account_id int8 not null unique,
license_key varchar(255) not null unique,
expiratation int8 not null,
paid boolean not null default false,
seats int not null default 0,
constraint fk_account foreign key (account_id) references accounts(account_id)
);
create table seats (
seat_id int8 not null primary key unique,
license_id int8 not null,
invitee_license varchar(255) not null,
invitee_account_id int8 not null,
constraint fk_seat_license foreign key (license_id) references licenses(license_id)
);
if you are curious these are the tables
ok, so it is account --1-> license --N-> seats?
Your account can have 1 license, BUT you should also be able to be invited as a "seat" for another license
by --X-> I mean "can have X"
hard to draw an uml with text so I resort to it
ok, so an account can have many licenses, and a license can have many seats
doesn't matter if the account is the owner or not, if it can be invited then it can have
yea
this is a case where you can technically do in a single select, but it's better not to
The way it works is, an account can register for a license, and that license can have sub-licenses (seats) that other accounts can use
because it will have duplicates no matter what you do, account will repeat for every license it's part of
Though im thinking of just removing the whole sub-licneses and just using an invite system
that way seats are only tracking account_id & license_id 

I see
well, if you're using postgres you can use a jsonb field for seat occupants
instead of a 2-column table
it'd have to be an array right?
jsonb covers both object and array
so i can do
{
"account_id": 1234,
"license_id": 12345
},
{
"account_id": 12345,
"license_id: 12345
}
]```?
sometimes it's fine to have a lazy field, you dont need to load all at once
[1234, 1234]
Oh wait right
it'll already be a column of license, u dont need the id
its on the license
no need to do the id

I see
So what would the sql query look like for this
because I am making an @me endpoint that will return all their information
SELECT * FROM licenses WHERE seats ? :account_id
Account, Licenses and Seats if they are part of any
? is "has" operator for jsonb
gotcha
there are a handful of operators you'll eventually use, json is well integrated into postgres
you can get all licenses too, just dont create a new account entry for every repetition
but separate selects is probably the best option, this way you avoid loading all licenses everytime u get an account
make a lazy acessor that loads the data only if used
public List<Licenses> getLicenses() {
if (licenses == null) {
licenses = SQL.get("...");
}
return licenses;
}
``` or smth
it returns None or (similarly) null in other languages
so I dont have to worry bout that :p
Also
will that licenses select query return only if they exist in the seat jsonb
or if they also have a license?
cause they can own a license too
honestly might do 1 more select
SELECT * FROM licenses WHERE account_id = :account OR seats ? :account
and just return an extra field
Because i'd rather be able to more easily tell if they own it or if they are a part of it
aight
3 queries but not always
since it's only if it's accessed
and u can cache the result
yuh fair
I should 100% cache it if sqlx doesn't do it for me
Since I already use redis I will just cache it here
:p
Thanks a lot haku!
yw
I will have to find a way to write helper methods now :p
How the fuck do people implement openid 2.0 when majority of the libs out there no longer support it
Like, rust has 0 libs that support openid 2.0 let alone any other libs in another language
but steam uses openid 2.0 for some god damn reason
I have to be a partner to use oauth2 
I guess I will have to do it myself
who is openid 2.0
closedid 2.0 when
hold on, buying the domain
Right so rust is officially fucking gay
bro rust's been gay hello
is this the same openid?
?
OIDC is the newer protocol
openid 2.0 is a legacy protocol that hardly anyone uses anymore
except steam is one of those that do
sad times
?
least addictive rust user
fs promise api in nodejs is not thread safe so if you modify the same file in 2 different places for example the behaviour is not defined and may corrupt your file by writing at the same time which is undefined behaviour categorically
Rust™️ on the other hand would've detected this via the borrow checker and forced you to use a mutex
i think this is why json databases tend to corrupt
but if you implement it properly your json database will never corrupt
you just need to ensure theres only one write at a time
Ah
you shouldnt use a json database anyways
why not
for simple projects its a great way to store data
low traffic ones as well
the corrupt only happen if something other than the node process itself write into the file right?
that can be one way it happens but no, it can happen if you do it in the same process multiple times using async fs, i dont think the OS would even let multiple processes have write access to the same file unless you explicitly allow it
if you do it with the normal blocking fs it wont happen since it blocks the event loop so its guaranteed to only write to it one at a time
this is because async nodejs is actually multithreaded despite popular belief (libuv thread pool) as well as async tasks having the ability to be pre-empted at any time
i believe writing/reading from the FS would count as a blocking task so it would likely run in the thread pool
anyways this is getting deeply into the nodejs and asynchronous programming internals but in basic sense fs.writeFile can happen at the same time in the same program which can lead to corruption
there are much better formats for this that dont require a full rewrite on each save
you wouldnt use this for performance reasons to begin with
you can bet some people would
that's why it's a general rule against json dbs, people like it and try to use everywhere
if you only have 1 node process, using writeFileSync is enough
otherwise file renaming is an OS-level atomic operation
create file with random name, write to it, rename it overwriting the original file
there's your atomically safe write, and thats how you do "safe json"
but you'd still need some sort of versioning system or in-memory copy, otherwise one write may accidentally delete/rollback another write
cant confirm
tried rewriting my C++ app in Rust and decided to re-rewrite it back to C++

damn
i gotta be possesssed by brain
might as well use that database that stores data using networks relying on the fact that nodes bounce messages between each other
import topgg
class Owner(Cog):
def __init__(self, bot: Evelina):
self.bot = bot
self.cash = "💵"
topgg_token = 'key'
self.dbl_client = topgg.DBLClient(bot, topgg_token, autopost=True)
@command()
@is_owner()
async def post_guild_count(self, ctx: EvelinaContext):
try:
await self.dbl_client.post_guild_count()
await ctx.send("Successfully posted guild count to Top.gg")
except Exception as e:
await ctx.send(f"Failed to post guild count: {e}")
async def setup(bot: Evelina) -> None:
await bot.add_cog(Owner(bot))
Can some help me why its not working? It says successfuly posted but on top.gg there are no server stats
did you try pressing Ctrl + F5?
to clear cache
otherwise try an anonymous tab
are posts within this ⬇️ type of channel called threads?
I guess so
i need to know whenever one is created with discord.js
Also it's called forum channel iirc
yes
you can notice by how the "channels" are shown in the client
Hey, when i use nodemailer to connect to my hotmail and send enails to customers i sometimes get ratelimited for suspicious activities..
Any way to get that fixed? Any different library? Any certbot certifcates to setup and fix this issue?
if you send too fast for too many people you'll be flagged
especially if the target is gmail
automatic emails is complicated
you only solution would be to have your targets add you as a contact
yeah these apis that hotmail and gmail allow arent really meant to be used for anything other than personal use like extensions or custom email clients
if you start sending lots of emails to different addresses with them it wont like it
youd need to get an enterprise account or make your own mail server
or use some email platform that gives you an email under their domain and lets you send whatever you need with it
a lot of businesses choose that route
you likely have free tiers too
hiya
question for mongoosers
when should I use index in a schema?
I'm working on statistics for a game where we have 2 branches, dev/staging and production
And the statistics in question is vehicle kill/death ratio
placeId is basically the branch name
name is the vehicle name
version is basically git HEAD
just not sure if this is proper
Going with this for now unless someone has suggestions ❤️
as a general rule of thumb you should only index fields that:
- you are going to be using that field to look up specific documents in your collection in your program
- the collection it is in has many documents, otherwise indexing will likely have adverse returns
- the field will be one of the main deciders on filtering your documents when querying (e.g. if im looking for exact matches for placeId and i know i wont get more than a handful of documents after that filter is applied, theres no point for me indexing other fields as the database can comfortably sort through the remaining documents anyways)
if you dont really understand those requirements, you should just stick to only indexing ID fields or fields that often appear in your find queries
if you dont know what indexing is, indexing a field lets the database find documents based on conditions relating to that field in an o(log n) fashion instead of scanning the entire collection for the documents
indexing is quite an expensive process so you should only index the fields you need to
yeah okay, there wont be thousands of documents
will make more documents every new version
so i'll just remove the index on name
yeah i really wouldnt bother indexing anything in that collection in that case
because there wont be more than 100 documents per version
and should I index placeId if it's only 2?
there are other schemas where a new document gets created like 6x every hour
so not sure
what do you mean
basically undisclosed enum of 2 distinct values
if you use it frequently to look up documents and theres a lot of documents in that collection or expected to have a lot, then yes
unless that field is always the same value you should index it
you want to index thing you'll frequently be using to retrieve values basically
this is the same for all dbs
i think in mongodb your threshold for "lots of documents" should be lower as well since the schema is dynamic so the database cant perform certain assumptions a relational database can
this hurts to look at
I thought you meant sky-high pricing 
10$ a month
ehhhhhhhhhh 
not bad
hello i will authenticate for my discord bot but i don't know the requirements example how old do i have to be
18
why should I clear cache, its my discord bot code?
it's because your browser doesn't load the page again everytime you visit it
it stores a "snapshot" called cache
so you wont see new changes unless you force it to do a clean load
Ah, now I understand what you mean. I had already tried it but after a few hours it is now displayed.
You got some good ones?
I have ran into a critical error in testing my backend api
- I am required to login via steam oidc
- To generate a license I need to be logged in, creating a license is done via a post request (tho ig I can do a get request as I am not sending any data over, mearly "requesting" a license to be generated)
I can't login via postman, which means I also can't generate a license 
Should I just make generating a license a get request?
does anyone use google cloud to host a bot?
What is your question
Its better to ask your question then to ask if anyone has used x
@sharp geyserI faced a similar question and successfully solved it by researching online. Regrettably, I can't share direct links here. Feel free to message me, and I can share some helpful resources with you.
Postman has support for webhooks
So u can set the redirect url to localhost and have Postman receive the response
I suppose thats true. The issue ive ran into is that when i run my bot from my pc it works fine, but when trying to upload it to the VM i get a timeout issue when its trying to connect to mongo (or from what i can tell), so was more wondering if anyone was aware of some setting that needs to be adjusted or any other suggestions for this to be solved. Just to reiterate it runs perfectly from my pc which makes me believe its an issue with the google cloud stuff
Make sure the port mongo uses is open on the VPS? Your timeout error message should explain more?
Ill take a look and check it
generate
should be POST
nah, PUT /s
can someone help
how do i load gif on node-canvas?
idk why its doing this
const { createCanvas, ImageData } = require('canvas');
const GIFEncoder = require('gif-encoder-2');
const GIFDecoder = require('gifuct-js');
const fetch = require('node-fetch');
async function loadGif(filePath) {
const resp = await fetch("https://i.ibb.co/NjFLXG3/test.gif")
const buff = await resp.buffer();
const gif = GIFDecoder.parseGIF(buff);
return GIFDecoder.decompressFrames(gif, true);
}
async function createAnimatedGif(gifPath, outputFilePath) {
const frames = await loadGif(gifPath);
const w = 688, h = 196;
const canvas = createCanvas(w, h);
const ctx = canvas.getContext('2d');
const gifEncoder = new GIFEncoder(w, h, 'neuquant', true);
// gifEncoder.setQuality(50); // 1 - 30
// gifEncoder.setDelay(50); // You can adjust the delay
gifEncoder.setRepeat(0); // 0 for repeat, -1 for no-repeat
gifEncoder.start();
// Draw each frame of the GIF
for (let i = 0; i < frames.length; i++) {
ctx.clearRect(0, 0, w, h);
const frame = frames[i];
const frameData = frame.patch;
const imgData = new ImageData(
new Uint8ClampedArray(frameData),
frame.dims.width,
frame.dims.height
);
ctx.putImageData(imgData, frame.dims.left, frame.dims.top);
// Add additional drawings if necessary
// e.g., draw some text or other images on top of each frame
gifEncoder.addFrame(ctx);
}
// Continue with the rest of the drawings if any
// For example, you can draw some static content on the last frame or any additional graphics
ctx.fillStyle = "white"
ctx.fillText("Some Text", 10, 10); // Example: adding text
gifEncoder.finish();
// Write the GIF to a file
const buffer = gifEncoder.out.getData();
await fs.promises.writeFile(outputFilePath, buffer);
console.log(`GIF created at ${outputFilePath}`);
}
// Usage
const gifPath = './profile.gif'; // Path to the input GIF
const outputFilePath = './profile.gif'; // Path to the output GIF
createAnimatedGif(gifPath, outputFilePath);
Ive followed the base boilerplate
that is cursed
fr
there's more cursed
idk what is doing that fr
im literally just using the methods shown on the packages
this is shit
can make a meme outa this
with Tyler 1 screaming "help"
yeah
epilepsy user when seeing the first gif:
you need to unoptimize the gif first
i got it to work
but now im stuck in the delimma to understand how the save and resotre works. and see if its relevant for me.
const { createCanvas } = require('canvas')
const { writeFile } = require('fs')
const path = require('path')
const size = 200
const half = size / 2
const canvas = createCanvas(size, size)
const ctx = canvas.getContext('2d')
const drawBackground = () => {
ctx.clearRect(0, 0, canvas.width, canvas.height)
ctx.fillStyle = "white"
ctx.fillText("Some Text", 10, 10); // Example: adding text
ctx.globalCompositeOperation = "destination-over";
ctx.fillStyle = "pink";
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.globalCompositeOperation = "source-over"
}
drawBackground()
ctx.save();
const encoder = new GIFEncoder(size, size)
encoder.setDelay(500)
encoder.start()
ctx.fillStyle = '#ff0000'
ctx.fillRect(0, 0, half, half)
encoder.addFrame(ctx)
ctx.restore()
ctx.fillStyle = '#00ff00'
ctx.fillRect(half, 0, half, half)
encoder.addFrame(ctx)
ctx.restore()
// drawBackground()
// ctx.fillStyle = '#0000ff'
// ctx.fillRect(half, half, half, half)
// encoder.addFrame(ctx)
// drawBackground()
// ctx.fillStyle = '#ffff00'
// ctx.fillRect(0, half, half, half)
// encoder.addFrame(ctx)
encoder.finish()
const buffer = encoder.out.getData()
writeFile('profile.gif', buffer, error => {
// gif drawn or error
console.log(error)
})```
save and restore?
so like here
i want to see the bg
but i dont want to keep redrawing it. i want the red rect to dipp
is the red square in the first frame?
yeah
that's your issue
first frame in gif is called "background" frame
no
it'll be constant in every frame
yes, then additional frames will either add to it or replace
the encoder will likely use add, cuz it's better size-wise
see what I said about add and replace
im adding new frames
if you want to hide the square after, you need to have the green square frame have a pink bg
not transparent
but can i not remove it entirely?
clearRect
i mean clearRect to clear that position
it'll draw a black square with CLEAR blend mode
which technically erases, but it's not actually erasing, just drawing over
it should be this
however, you're supposed to use replace disposition there if every frame is supposed to be only bg + frame
so every time i add a new frame i need to redraw the previous state
which is why i thought i could like use "save" to save the current state then restore
to redraw it?
idk what the restore function does, but gifs arent that intuitive
these are the 2 available disposition modes
you currently have combine disposition
hmm
replace will "restore" to the background layer before adding the next
so it'll do what u want
logicaly i was thinking more like use ctx.save() when you first draw the bg add to frame then after you draw frame 1 which is the red square you restore it to the bg state, and so on
thats what i thought too but it isnt
wait
I dont see you setting the disposition mode anywhere in that code
idc about disposition
like
what i mean is
a state where there are no squares
frame1
i use ctx.save to save a state where no squares exist
fram2 i draw 1 square, and go back to state where there are no squares
makes sense?
hmmm

thing is, you're not using vanilla canvas, I'm unsure if it'll even work with gifencoder
cuz gifs work differently
right
i supposed i can save the prev state as an image and load it on each frame
which is basically drawing it gain
"I don't care" kekw
like in this example
he keeps calling "drawbackground" on each frame
i wanted to avoid that but ig you cant
I mean, in either case you'd be redrawing again
save probably saves a snapshot of the canvas, then restore redraws it over everything
cuz image operations are atomic, no layerrs or whatsoever, once drawn, it's drawn
but it didnt do that
i was expecting the green rect to disappear since save was called before it
but all it did was reset the fillStyle to black
from green
oh wait, then that would make sense
how
not really
for example, lets say you fiddled with metrics and changed rotation of the canvas
restore would reset the coordinates to the last save
the description isnt clearn, it needs to be better
yeah

that makes more sense
cant you draw a canvas on a canvas?
but ye its misleading i thought it would save the whole canvas
if so u can just clone the instance
thats the same as toDataUrl and then loading it again
but ig thats all you can do
btw set this to true
yeah it is true
idk why they made it false by default
ikr
anyway i have this idea "twitter for devs" with collaborative capabilities. what do you think? today, if someone needs help with code, you are having to keep sending jsfiddle links or jsbin linnks where you make changes
what if there's a space where you can click collaborate and edit the code on the same platform
solves the problem faster
and avoids people having to go back and forth
isn't that github?
nah its diff
for example in our case just now
i shared some code here
you had to copy paste it somewhere etc to try it for me
what if we could just turn on collaborative mode
and you give your insights on what i need to fix and we see the changes
live
without leavingf the platform
i feel like it would be nice to have
no, like, I meant github already has a "social media" mode
lol
Just to make sure, if you're country isn't in the eligible country list, then you're not forced to switch your subscription to Discord, right?
Until they add this country
The same applies to annual subscriptions. For now, Discord doesn't have them, but they will probably add them in the future
So you probably won't escape it
Do I do something at this moment or am I fine? 😂 oops ping
Yup, no changes needed: https://cdn.hamoodihajjiri.com/1It1HPNmdL
my fucking face when vsc doesnt record me deleting a folder and not being unable to undo it
Check the recycling bin
Made a bot that breaks down crash logs for mc
Stuff like mod list or mod loader detection is iffy, but is for the most part accurate
no idea what that is but cool
is it like a custom furnace or something?
It's a computer running lua
oh lmao
but its working like an item "upgrader"?
or is it like a command block that you can customize
Well yes thats what my code makes it do
No, just giant lua interpreter with APIs for interacting with the world
does the interpreter itself run inside the game? like a redstone computer?
It runs inside the game
Yesnt
show the cpu
Well the only block in this case is that computer
It can just fully interact with the world
No, it's a mod
thats cool tho
I'm using this scummy project because I'm too lazy to write actual lua though https://typescripttolua.github.io/
xD
Did you see the guy that made a machine learning model in minecraft?
💀 💀 💀
@lyric mountain you around? I got some weird glitch. ok so when draw shapes on gif with soem opacity, its glitching for some reason
the rect i drew has a globalAlpha .7 and then after drawing the rect i reset it to 1
const { createCanvas, ImageData, loadImage, Image } = require('canvas');
const GIFEncoder = require('gif-encoder-2');
const GIFDecoder = require('gifuct-js');
const fetch = require('node-fetch');
async function loadGif(filePath) {
const resp = await fetch("https://i.ibb.co/NjFLXG3/test.gif")
const buff = await resp.buffer();
const gif = GIFDecoder.parseGIF(buff);
return GIFDecoder.decompressFrames(gif, true);
}
async function createAnimatedGif(gifPath, outputFilePath) {
const frames = await loadGif(gifPath);
// const w = 688, h = 196;
const w = 708, h = 550;
const canvas = createCanvas(w, h);
const ctx = canvas.getContext('2d');
const gifEncoder = new GIFEncoder(w, h, 'neuquant', true);
// gifEncoder.setQuality(50); // 1 - 30
// gifEncoder.setDelay(50); // You can adjust the delay
gifEncoder.setRepeat(0); // 0 for repeat, -1 for no-repeat
gifEncoder.start();
gifEncoder.setDelay(frames[0].delay)
// Draw each frame of the GIF
// Continue with the rest of the drawings if any
// For example, you can draw some static content on the last frame or any additional graphics
for (let i = 0; i < frames.length; i++) {
const frame = frames[i];
const imgData = new ImageData(
frame.patch,
frame.dims.width,
frame.dims.height
);
const temp = createCanvas(frame.dims.width, frame.dims.height)
const tempCtx = temp.getContext("2d")
tempCtx.putImageData(imgData, 0, 0)
const img = new Image()
img.src = temp.toDataURL()
ctx.drawImage(img, 0, 0);
ctx.fillStyle = "black"
ctx.globalAlpha = .7
ctx.rect(10, 10, 100, 200)
ctx.fill();
ctx.globalAlpha = 1;
// Add additional drawings if necessary
// e.g., draw some text or other images on top of each frame
gifEncoder.addFrame(ctx);
}
gifEncoder.finish();
// Write the GIF to a file
const buffer = gifEncoder.out.getData();
await fs.promises.writeFile(outputFilePath, buffer);
console.log(`GIF created at ${outputFilePath}`);
}
// Usage
const gifPath = './test.gif'; // Path to the input GIF
const outputFilePath = './profile.gif'; // Path to the output GIF
createAnimatedGif(gifPath, outputFilePath);
im not understanding something here
there we go

Guys i found a bug on discord
Where do I get hired
I just downloaded this gif on google, but when i send it on discord it glitches
lmao
its the gif itself tho, no? when i open it in the browser its the same thing
now I am
that's normal
you REALLY dont want to work with opacity on gifs
reason for this is wrong disposition mode

nop, the gif is not the way it is shown on discord. see the image i sent before. it loaded properly on my canvas
maybe try apng
yeah i fixed it
sadly apng doesnt work on discord
anyway now for some reason next build isnt working
like it just stops after it runs eslint
with no errors
thing is, you're limited to 254 + 1 colors if using transparency
or 255 without transp
semitransparent overlays will effectively cut your allowed color count by half
ye
anyway do you know how to fix this weird next build issue ;-;
its so stupid
its working on my local machine
but on ubuntu next build simply stops
u sure there are no errors?
yeah lemme send ss
it just randomly stopped
usually it shows the bundle size
if it successfully built
u should really not ignore those warnings
but it works on local machine, it builds properly
it just says failed to compile
this didnt work
hm, you'll need tim then
but running this worked
no
like it showed some debug logs
and it says compile error like wtf
thats it
do you have any muted exception?
try {
} catch (e) {
// forgot to log here
}
``` like this
also, what font are u using on that profile card?
ah ok
what did u change?
there was a random console.log without semicolon lol
but now back to original issue. for some fkin reason its not logging in but everything else works
like wtf man
it says 502
but when i go check the service it is running correctly
like wtf i never faced this issue before at all
webserver issue
it just randomly popper up
but the gateway is fkin workin
like wtf
wait wtf
typo
like
nothing makes sense
I suppose ur using nginx
yeah
everything is loading for fk sake
but when you click login
it fails
for no reason at all and then says its 502
but i can see the logs on my backend
i see no errors
it says success
like wtf
no like actually login
follow through
itll take you back to website
and then fail
nop
my end points are all correct
i see the request in my backend and i also see the success on set session
isn't it supposed to be api.?
https%253A%252F%252Fizzi-xenex.xyz%252Fauth
fine
this is the redirect url
yeah ik
it's sending to base url
i set it that way
i set it up that way
i handle the inc request
it was working fine
all these days
for years
liek wtf happened now
why am i getting a 502
are u using nginx?
open /var/log/nginx/access
go to the bottom and look for any 502
it'll tell you the issue there
might want to use an editor without auto-refresh btw
i just see this
thats my route
i dont see any error
but i do see 502 on that route
[08/Aug/2024:07:22:49 -0500] "GET /api/v1/ums/auth/discord?code=4hM3Zt9iJcYAS9r8TZ6e9PxOE1rMUO HTTP/1.1" 502 166 "-" "axios/0.27.2"









