#šŸ‘¾-core-development

1 messages Ā· Page 168 of 1

austere talon
#

just its waaayy cleaner and it will allow us to also use it in main process

#

and we will be able to listen to settings changes from renderer in the main process

#
// in main
VencordSettings.addChangeListener("idkSomeThing", () => console.log("changed"));

// in renderer
Settings.idkSomeThing = true;
limber skiff
#

idk how you did that

#

but I guess it's magic

#

I havent looked yet

austere talon
limber skiff
#

accessing an object from different context?

#

🤯

austere talon
#

no its via ipc

limber skiff
#

OH

#

okay now it makes sense

grave mangoBOT
limber skiff
#

you just made the proxy wrap the ipc

grave mangoBOT
austere talon
rugged spire
austere talon
#

it just sends the path that was changed via ipc and then it dispatches an update for that path in main too

#

well i havent implemented that in vencord yet

#

only vesktop

rugged spire
#

i fucking hate how discord implements popout windows

#

it is all controlled by the parent window

#

leading to that

austere talon
charred monolithBOT
limber skiff
#

that's crazy good

austere talon
#

now you can subscribe to settings changes of your plugin in your native.ts file as well

charred monolithBOT
limber skiff
#

can you somehow make settings not explode at first run

austere talon
#

uh?

#

wdym

#

explode how

#

btw i noticed a bug xd

limber skiff
#

like you cant access at the time the renderer script runs

austere talon
#

this should be && not ||

#

oooooh

#

well actually yeah we can fix that now but

#

the reason that happens is that it requires plugins to be initialised so it can auto fill default values

charred monolithBOT
austere talon
#

need to test that this works fully

austere talon
#

and then can merge

austere talon
limber skiff
#

i guess that's okay

austere talon
#
// api/index.ts

import Settings from "./Settings";
import "./addSettingsDefaultValueGetterSettingsStoreCallback";
#

then you can import from Settings freely without causing a circular import

#

seems to work flawlessly

#

can u guys also test that pr

#

oh wait

charred monolithBOT
austere talon
#

hmmm

#

actually this will still cause issues if

#

this will still error

#

Cannot access settings before plugin is initialized

#

so you cannot use store but you can use Settings global manually

#

well ready for review and testing

charred monolithBOT
rugged spire
#

will vencord ever go a day without someone suggesting/saying some stupid shit that makes no sense or is impossible

#

is that possible?

charred monolithBOT
austere talon
#

i wanna do more refactoring next

#

i wanna restructure the project a little

#

its bad that everything is in @utils and all processes import from it

#

i want to move everything that is shared across processes into the shared folder so its clearer

#

to make sure not to introduce dom usage in those files cause that happened in the past and bricked updater

#

optimally i'd want to move everything into a renderer folder for stronger isolation but that would ruin history

charred monolithBOT
charred monolithBOT
rugged spire
#

discord is a high quality app with no jank

#

code rot

limber skiff
#

lmao no way they used a attachment for that

rugged spire
#

real

limber skiff
#

they broke their own thing

#

lazy employee assets exist for a reason

rugged spire
#

just look for super-reactions-launch

#

its real

#

what the fuck

#

this code is actual dogshit

#

like the rest of discord code

idle meteor
#

Discord moment

rugged spire
#

nop

#

???

austere talon
#

you're using the function wrong

#

not even passing a channel id

#

your skill issue = discord code bad?

rugged spire
#

nop

verbal pumice
rugged spire
#

nvm

#

doesnt matter

#

I found what I was looking for

#

wasted 20 minutes stepping over shit in debugger

charred monolithBOT
rugged spire
#

It never got typed trolley

charred monolithBOT
rugged spire
#

i love github

#

totally useful commit!!!!

limber skiff
#

@austere talon I'm not sure if I see how updating a setting on the renderer updates it on the electron side too

#

when you change a setting it saves to the file

#

but you only read the file once, how does the electron side reflect the change

brazen bone
#

I wonder why the lottie/bodymovin module is not name-mangled ```js
function(module,exports,webpack_require){module=webpack_require.nmd(module),webpack_require("854508"),...

limber skiff
#

lmao funny

brazen bone
#

It does still have all other minification stuff, just not name mangling

charred monolithBOT
#

hm, i didn't mean "default presets" i was really thinking more along the lines of "saveable presets" but that's still cool anyway

we can take the backup of the currect configuration and then use the backup file to reuse it another day.

That includes all of the other settings, and that doesn't sync, which could be annoying

Which other settings you mean though ?

nvm forget what i said i'm blind

charred monolithBOT
grave mangoBOT
# austere talon https://github.com/Vendicated/Vencord/blob/settingsStore/src/api/Settings.ts#L16...

**Settings.ts: **Lines 162-167

SettingsStore.addGlobalChangeListener((_, path) => {
    SettingsStore.plain.cloud.settingsSyncVersion = Date.now();
    localStorage.Vencord_settingsDirty = true;
    saveSettingsOnFrequentAction();
    VencordNative.settings.set(SettingsStore.plain, path);
});

**rendererSettings.ts: **Lines 35-37

ipcMain.handle(IpcEvents.SET_SETTINGS, (_, data: Settings, pathToNotify?: string) => {
    RendererSettings.setData(data, pathToNotify);
});

**SettingsStore.ts: **Lines 97-121

public setData(value: T, pathToNotify?: string) {
    if (this.readOnly) throw new Error("SettingsStore is read-only");

    this.plain = value;
    this.store = this.makeProxy(value);

    if (pathToNotify) {
        let v = value;

        const path = pathToNotify.split(".");
        for (const p of path) {
            if (!v) {
                console.warn(
                    `Settings#setData: Path ${pathToNotify} does not exist in new data. Not dispatching update`
                );
                return;
            }
            v = v[p];
        }

        this.pathListeners.get(pathToNotify)?.forEach(cb => cb(v));
    }

    this.markAsChanged();
}

**rendererSettings.ts: **Lines 28-30

RendererSettings.addGlobalChangeListener(() => {
    writeFileSync(SETTINGS_FILE, JSON.stringify(RendererSettings.plain, null, 4));
});
charred monolithBOT
limber skiff
#

and it updates both ways?

#

electron -> renderer and renderer electron

austere talon
#

no

#

changing it on main doesn't update renderer

#

there isn't much demand for changing settings on main side imo

limber skiff
#

yeah that's what I noticed

austere talon
#

what's a use case

#

i plan to add a second settings file: main settings

#

that are only accessible in main

#

this can be used for more security sensitive stuff like whitelisting url for csp, or whitelisting a folder that the renderer can read files from via ipc

limber skiff
#

but nothing that we need rn

austere talon
#

the way it currently works it's not really possible to update both ways

#

the settings store in renderer is read only because i export its .store member

grave mangoBOT
austere talon
#

setData changes the store so that will break

limber skiff
#

yeah

#

makes sense

#

I mean

#

store is a proxy

#

the inner object can change no?

#

somehow

austere talon
austere talon
limber skiff
#

cant we make the inner obj a dummy

#

and return values from another

#

so technically the proxy is empty but it has values

austere talon
#

that's very meh

limber skiff
#

lol

#

it is

austere talon
#

well actually

#

instead of changing the root object we could recursively merge the object

#

via Object.assign

limber skiff
#

that is true

austere talon
#

but uhhh

#

more limitations

limber skiff
#

do you have any idea why pindms break

#

like I don't even know how to even start debugging that

austere talon
#

cause it causes issues with the lazyscroller

limber skiff
#

well that's a start

#

but that seems like super hard to debug

#

and I would need to make it happen to me which idk how to

austere talon
#

close all dms that aren't pinned

limber skiff
#

might as well pin all lmao

austere talon
#

close all pinned dms

#

try on an alt :p

limber skiff
#

true

austere talon
#

tbh idc about PinDms

#

so i never bothered fixing it

#

i only made it because people wanted it and i was bored

#

btw there is a category pr

limber skiff
#

I would fix but it's a so weird bug

austere talon
#

take a look at it and work on that instead

austere talon
limber skiff
#

yeah

austere talon
#

working with discords lazy scrollers is a nightmare

#

i already had so many bugs when i wrote the plugin

#

that i took long to fix xd

limber skiff
#

horror

charred monolithBOT
austere talon
#

and introduce a native settings api

#

if there's ever demand to change renderer settings from main we can add it

limber skiff
#

sure

austere talon
#

id rather not overengineer it rn if there's no use case

limber skiff
#

yeye you are right

charred monolithBOT
sterile oak
#

but its so small, its not worth adding

#

so maybe add more features like channel/user/whatever is there

brazen bone
#

Having something like copy emoji id just like copy channel id and all that would make sense

grizzled halo
#

animated status?

#

selfbot/api abuse go brr

topaz spoke
#

||server ban husk ||

grizzled halo
#

sooner or later you'd get banned from discord too

brazen bone
#

It's even easier to not do things that get you banned in the first place

grizzled halo
#

the reason animated status is against the rules is because discord hates selfbots/api abuse

#

they do ban for api and selfbots

#

no

#

they still do

#

its not a matter of if, but when

#

it is actually

#

uses the (discord) api that it was not intended to be used for

#

they will see it (eventually) and will ban you for it

topaz spoke
#

tbh animated status is pretty useless

grizzled halo
#

weird flex

austere talon
#

follow the rules or you will be banned

#

vban 7 @woeful sable continuous discussion of banned plugins

manic root
#

i just loaded 20 alts in here, not hard

#

😭

#

you might wanna slow mode channels there is about to be a wave of spam

odd heath
manic root
#

you're kinda slow

verbal pumice
grizzled halo
#

oh no! anyways

odd heath
slim marsh
#

bros so tough

#

since when is this channel not locked to regulars/contribs

odd heath
glass jasper
odd heath
mint thistle
#

nooooo i’m a white name

mint thistle
patent flint
sterile oak
glass jasper
# mint thistle nooooo i’m a white name

OK, let’s bring back the programming role. so if a white name wants to talk and one of the channels, they can ask for permission, but if needed, it could be taken very easily.

gloomy atlas
#

maybe by adding linked role

charred monolithBOT
charred monolithBOT
limber skiff
#

don't mind about it

#

they can just disable if they dont want

#

I never receive any emails like that

mint thistle
#

I remember that one story where someone emailed every single epic games employee because of a Github Organization Teams mis-mention trolley

limber skiff
#

funny

charred monolithBOT
charred monolithBOT
mint thistle
#

i feel bad that this channel gets flooded with my PR comments

austere talon
#

don't worry

#

that's what it's for

brazen bone
#

Better than those new star notices

austere talon
#

clearly you haven't seen me flood it with 50 comments, commits and such

still wasp
austere talon
#

why not

#

new star go brrr

mint thistle
lime stone
#

sorry if i'm being annoying but wouldn't it be nice if the webhook thing auto-completed for channels where you have perm

mint thistle
lime stone
#

you know how there's a box which appears while you're typing the command, showing the possible values?

#

idk how easy it is though

mint thistle
#

or if it notices that you’re in a server that the webhook has the same serverid/channelid for it’ll automatically show something like ā€œSending message to ā€˜#test’ in Balls Serverā€

lime stone
#

like this thing

mint thistle
#

it might be really difficult

#

but i’ll keep it in the back of my mind if i can think of a way to do it

lime stone
#

well, discord already implements a way for the bot to respond with a list of strings

mint thistle
#

that makes it a little easier

#

but gathering the URLs is gonna be the difficult part

#

for one of the suggestions

#

is it just as easy as making the command name [webhook send]

#

or do i need to like

#

do other complicated stuff to achieve that

lime stone
#

i hope this is legal

glass jasper
lime stone
#

i didn't show any usernames in case anyone minds shrug

charred monolithBOT
mint thistle
glass jasper
# charred monolith

I’m a start taking a shot for every single time you submit a new comment

mint thistle
#

LMAO

#

i mean i don’t wanna be rude and just close comments without reasoning hanashrug

#

inb4 i could just respond here

yea i could idk why i’m not doing that

glass jasper
#

it’s fine i’m just messing with messing with you

mint thistle
austere talon
#

you dont have to reply

#

only reply if you disagree

#

if you do agree and implement it, just mark as resolved

mint thistle
#

ohhhhh

mint thistle
#

yippie i fixed everything i hope

charred monolithBOT
austere talon
#

Shouldn't this be SettingsStore.plain?
#2257 (files)

#

wdym? @limber skiff

sterile oak
# charred monolith

welp someone was faster than me and made a plugin. time to delete it from my todo list

mint thistle
#

oh that reminds me

sterile oak
mint thistle
#

what were some features ur plugin might have had

#

Think could use some inspiration

charred monolithBOT
sterile oak
#

you probably added the feature of deleting the webhook

mint thistle
sterile oak
mint thistle
#

Think once the plugin is in a stable state we might be able to work on that, i’ll still need to think about it

due to the nature of the plugin idk if it can be a button on the ui, instead you could input a url in settings and then typing ā€˜/webhook switch’ will make you type as it

sterile oak
mint thistle
charred monolithBOT
#

It's possible to save any arbitrary string of text inside of the favourited gif picker, instead of just URLs. This causes favGifSearch to fail with this error:

Uncaught TypeError: Failed to construct 'URL': Invalid URL
    at Sb (index.tsx:203:17)
    at index.tsx:163:67
    at Array.map ()
    at index.tsx:162:18
    at handleOnChange (29062.2bb468e49a2eee40cded.js:1:2798047)
    at Object.eI (2541.b44fafd1acac6bd12301.js:1:797772)
    at eU (2541.b44fafd1acac6bd12301.js:1:79792...
sterile oak
#

ah ight

mint thistle
#

and then maybe add more things to the /webhook send

#

i think it’s good for now

charred monolithBOT
charred monolithBOT
charred monolithBOT
#

This plugin lets you select a message and jump to the earliest message afterwards that replies to it. There's 2 settings to also include:

  1. Messages that @ the author directly
  2. Messages that reply to the author (not necessarily the exact message selected).

The main use case of this plugin is to make it easier to follow conversations that already passed. It's also useful if you frequently Ctrl+F in Q&A channels and you want to instantly jump to the answer to a question.

Jumping...

charred monolithBOT
mint thistle
charred monolithBOT
#

One more possible thing: channel followers webhooks can have source_guild and source_channel objects, would be cool to have those too

I really like this idea, although I can't seem to find a way to get a webhook url that's also a channel announcement (type 2 according to the API). If you can DM me a webhook that works, I'll add that feature in the next commit

at /webhook info doesn't work. content is not property on type Embed. I pretty sure you meant description but I sug...

austere talon
#

wrong channel

mint thistle
#

oh oops

charred monolithBOT
#

i don't think the URL option is a good idea. users will enter wrong (non direct) urls, try to put stuff like youtube urls, etc. and CSP / CORS will also pose issues

so i suggest removing it and only supporting uploads. then you can also store them as raw blobs instead of having to differentiate and using a data url

mint thistle
charred monolithBOT
lime stone
austere talon
mint thistle
charred monolithBOT
still wasp
#

😭

lime stone
#

oh or createObjectURL?

austere talon
#

yep

charred monolithBOT
lime stone
#

@austere talon why not just validate the data url or remove the custom input

#

it's so much easier

austere talon
#

?

#

wdym

lime stone
#

which part?

charred monolithBOT
austere talon
lime stone
#

lol

#

why not check that the url is a data url and not http

charred monolithBOT
lime stone
#

it's easier than using a blob url

#

and idk how else i'd get the file mime type

austere talon
lime stone
#

you remember what you just said, right?

austere talon
#

yes

#

i said remove url input and only accept uploads

lime stone
#

and use createObjectURL?

austere talon
#

for example

lime stone
#

can i just keep it the same but only accept uploads though

#

i think the user knows what they're doing if they edit config

austere talon
lime stone
#

well it needs to be serialised in some way

#

wait, the mime type can be infered (right?)

austere talon
#

you can dump raw blobs in indexeddb

lime stone
#

and i could just use base64 ig

#

ah

#

yeah that's better

#

stuffing everything in json felt bad

austere talon
#

tbh ur current logic seems a bit overengineered

#

why do u need all those properties like enabled and such

lime stone
#

...so you can quickly disable your override?

charred monolithBOT
lime stone
#

it feels like better ux than removing the file and having to find it again

austere talon
#

hmm fair ig

#

well then youd still need to store json

lime stone
#

yeah it does

lime stone
austere talon
#

true

#

makes sense

lime stone
#

how should i cache the blobs

#

hmm

austere talon
#

wdym

lime stone
#

well it's bad to call createObjectURL(await DataStore.get(KEY)) every time discord makes an <audio> obviously

charred monolithBOT
lime stone
#

ohh i was getting confused
you don't need to worry about cache invalidation

#

i guess just const soundBlobs

lime stone
#

well, you can just set the value in the cache object when you upload

austere talon
#

yea

lime stone
#

it's not hard

#

i was getting scared

austere talon
#

:p

charred monolithBOT
austere talon
#

i mean even then

const cache = new Map();

// invalidate
cache.clear();
lime stone
#

lol

#

would be slightly inefficient to do it on every upload

austere talon
#
const cache = new Map<string, [Blob, number]>;

async function getSound(id) {
  let cached = cache.get(id);
  if (!cached) {
    const data = await DataStore.get("..." + id);
    if (!data) return null;
    cached = [data, 0];
  }
  clearTimeout(cached[1]);
  cached[1] = setTimeout(() => cache.delete(id), 1000 * 60 * 5);
  cache.set(id, cached);
  return cached[0];
}
lime stone
#

cool

austere talon
#

but dont need to use that tbh

#

storing like 20 audios in memory is fine

lime stone
#

not really yea

austere talon
#

if there were hundreds of possible sounds then that would be a good idea

lime stone
#

my brain tells me it's not thread safe

#

jsā„¢

austere talon
#

this is js...

#

single threaded

lime stone
#

ye

#

lmao

austere talon
#

there could technically be a race but it wouldnt matter much

#

if you call it twice in a row with the same id

lime stone
#

what if there's no sound data

#

it would keep requesting it

austere talon
#
const cache = new Map<string, [Blob, number]>;

async function getSound(id) {
  let cached = cache.get(id);
  if (!cached) {
    const data = await DataStore.get("..." + id);
    if (!data) return null;
    // prevent racism
    if (cache.has(id)) return data;
    cached = [data, 0];
  }
  clearTimeout(cached[1]);
  cached[1] = setTimeout(() => cache.delete(id), 1000 * 60 * 5);
  cache.set(id, cached);
  return cached[0];
}
lime stone
#

racism

#

is it dumb to do hasSoundData on SoundOverride just to make it a bit faster

median rapids
#

racism

lime stone
#

:/ getSound needs to be async

#

just released (this won't be compatible with where it's used i don't think)

#

i guess don't lazily load

#

load everything

#

evil laugh

#

doesn't that make the performance basically the same

#

or were concerns not only of startup time

#

oh ig the browser needs to atob the url every time

#

i love microoptimisations

charred monolithBOT
frail skyBOT
#
Bad Patches

None

Bad Webpack Finds

None

Bad Starts

None

Discord Errors

None

#
Bad Patches

None

Bad Webpack Finds

None

Bad Starts

None

Discord Errors

None

lime stone
#

done the first set of changes

#

i think the changes to storage will just make everything too complicated tbh

#

doesn't the browser load the audio file very fast, and also in the background

#

works case 4ms delay to the sound xd

brazen bone
glass jasper
brazen bone
#

Wait what

austere talon
#

based on wrong branch so it also had my recent dev commits :p

brazen bone
#

Oh

somber ginkgo
#

cant wait for merge ngl

somber ginkgo
#

tried making the menu sorting with pure css a few days ago, looked alright but fucked with the button highlighting

charred monolithBOT
brazen bone
#

Is there an autoformatter setup or do I just imitate the style by hand?

austere talon
#

there is semi auto formatting set up

#

but its not very aggressive

brazen bone
#

I noticed that eslint is loud about indentation

#

But not things like trailing comma or space after if

charred monolithBOT
brazen bone
#

It's inside a local function scope so it shouldn't have any effect here

#

But in general you are correct

jagged reef
charred monolithBOT
#

why not integrate with the ShowMeYourName plugin instead? would allow customisation

won't it create issues with TypingTweak plugin? like ShowMeYourName plugin will try to change the typing style while TypingTweak will do the same My plan was to add it in ShowMeYourName plugin but thinking of this I added it in TypingTweaks

Or can integrate in both of them. Will depend upon the user which one they choose

inland musk
#

I'm not a developer (so hopefully this isn't the wrong channel) but make themes. Have you ever considered building a debug dump button in settings or something that copies the discord versioning, release stream, enabled plugins, and enabled themes to clipboard for support reasons? I know pc had one (rip) and fielding support questions from pc users back then was really convenient because i could ask them to just dump what they were using and see version and conflicts immediately.

This isn't an expectation (no other client has ever done this afaik) but wondering if you had considered it

austere talon
#

/vencord-debug in #šŸ¤–-bot-commands :p

inland musk
#

oh i see that's quite convenient

austere talon
#

neko_R_nodders added it because intereviewing people in support was always a nightmare

inland musk
#

would you ever consider that making a global command so that other support servers can ask for it

austere talon
#

especially when they dont know what platform theyre on

austere talon
inland musk
#

yeah

austere talon
#

would that actually be useful? most of the info contained there is irrelevant to you

inland musk
#

my server gets like 10 tickets a week at minimum and half of them could be cut down from 20 minutes to 5 with this

austere talon
#

the reason its only enabled here is to not pollute your slash command list with a feature u cant turn off

inland musk
#

i see

inland musk
#

it's really helpful to be able to get a user's discord versioning, OS, and enabled themes (since the coverage of a theme depends heavily on the first 2 and the 3rd causes conflicts out the wazoo)

rugged spire
#

add an option to settings for it

inland musk
#

enabled plugins aren't nearly as useful but are sometimes the issue when i get a bug report that turns out to be a conflict and i spend half an hour looking for it to no avail

austere talon
#

yeah plugins are useless for u but very useful for us

austere talon
#

but i might just enable it globally cause ig it shouldnt be too much of anuisance

rugged spire
#

make it detect /vencord-debug in the topic of the channel

#

or something like that

inland musk
#

i'd like if it still works in forums though

#

so if you do that if you could also check the post guidelines (closest thing to a desc a forums channel has ig) that would be cool but i won't ask for too much

austere talon
#

ig ill globally enable it with an option to turn it off in settings

inland musk
#

to be honest wouldn't the easiest thing be just to replicate powercord and make it a button in settings

#

or maybe that's too much effort for some people to find

austere talon
#

slash command is more convenient

inland musk
#

yeah

austere talon
#

and the people are retarded yeah

#

they already dont find the quickcss button

rugged spire
inland musk
#

ah i see

#

typical theme developer ignorance, doesn't know anything useful

#

i need to convince old man zere to add something similar

austere talon
#

well you can get stable 274388 (865dbf6) by clicking the debug info in discord settings

#

thats a start

inland musk
#

yeah this is really useful and i've asked people to do it almost every time

rugged spire
austere talon
#

gonna add a remote access trojan to vencord so you can run code on the discord of people asking for support

inland musk
#

real

austere talon
#

see ive thought about smth like that before

limber skiff
#

I suggested that lmao

#

it's not a bad idea tbf

austere talon
#

maybe not full remote access but like some way for us to make people run code

#

like a button in chat

inland musk
#

then you can write code to dump the theme file too and watch them use \]* instead of a semicolon after they claim they set it up correctly and you look for a possible mac background reroll for 40 minutes

austere talon
#

but also do i sometimes wish i had access to peoples pcs when they run into obscuire issues that need proper debugging

austere talon
#

like also copy vencord info

rugged spire
#

this will be brought up when "is vencord a rat" mentioned

inland musk
austere talon
austere talon
#

even the dumbest people know how to run slash commands

inland musk
#

surely

#

ok well thanks for answering my message so quickly with a positive response, debug dumps make life ten times easier for support and i kind of wish i had this all the time because goading people into doing things correctly is sooo annoying

austere talon
#

ya

#

i also added #theme-support to maybe make theme devs life a little easier cause they get less dumb support requests

#

noone does this tho sadge

rugged spire
#

requires effort

rugged spire
inland musk
#

ok ill stop pretending like i have a purpose for being in this channel and go back to trying not to fail my exam; once again thanks for quick response <3

austere talon
#

ooo hope ur exam goes well

jagged reef
#

Hey Vee, you were talking about a new api for contexts, is that accessible somewhere so I can try and implement it?

austere talon
#

"plan to add [...] very soon"

#

not yet

gloomy atlas
#

Any way to change the settings of one plugin from another plugin? (found)

jagged reef
limber skiff
#

@austere talon what if we changed all lazy finds to waitFors

#

technically we don't have to recurse over the webpack cache that way

charred monolithBOT
limber skiff
#

@rustic nova how did you fix it?

#

I was going to try to fix

jagged cloak
#

woiah

rustic nova
grave mangoBOT
# rustic nova i fixed it by passing chunkSize to the row list. https://github.com/Syncxv/Venc...

**index.tsx: **Lines 200-210

getChunkSize() {
    // the chunk size is the amount of rows (measured in pixels) that are rendered at once (probably)
    // the higher the chunk size, the more rows are rendered at once
    // also if the chunk size is 0 it will render everything at once

    const sections = this.getSections();
    const sectionHeaderSizePx = sections.length * 40;
    // (header heights + DM heights + DEFAULT_CHUNK_SIZE) * 1.5
    // we multiply everything by 1.5 so it only gets unmounted after the entire list is off screen
    return (sectionHeaderSizePx + sections.reduce((acc, v) => acc += v + 44, 0) + DEFAULT_CHUNK_SIZE) * 1.5;
},
jagged reef
#

Nvm

charred monolithBOT
#

This plugin extends @Vendicated's QuickReactFrequents (available in the Vencord #third-party-plugins channel) with more options for the quick reactions in the message context menu

Options

  • Use top frecency emojis instead of favourite emojis
  • Rows of emojis
  • Columns of emojis

Also contains CSS to fix up the spacing and make the rows/columns work properly.

@zt64 I'd also like you to try this as you mentioned you wanted this functionality

rugged spire
#

horror

charred monolithBOT
charred monolithBOT
brazen bone
#

Would a plugin that makes html and svg attachments show as iframes instead of code have security problems?

jagged reef
#

Phsh nah

austere talon
#

you can safely embed svg in an image tag

#

but embedding arbitrary html is stupid

#

much can go wrong and stuff like ip grabbers could happen

brazen bone
#

True

livid heath
#

even with iframe sandboxing, it wont be secure to say the least

austere talon
#

it would be secure as in can't steal your discord token

#

but still insecure as in it can load malicious (such as phishing) content, grab your ip, etc

#

you could turn off javascript but it would still be able to load external resources

topaz spoke
#

svg embedding would be pretty nice tbh

lime stone
#

yeah

lime stone
#

actually nah that would result in very broken previews

#

i was thinking about if you were using html for message formatting for some reason

#

nobody does that

austere talon
#

svg embedding is easy just put it in an img tag

lime stone
#

how would you get it to behave like other images

#

like with mosaic, modal etc.

brazen bone
#

Just find what function checks for png/jpg/whatever and add svg to that list, I guess

lime stone
#

hm does discord recognise the mime type

brazen bone
#

Pretty sure it just looks at the extension

lime stone
#

i've no idea what this file is btw

brazen bone
#

Whether it does that directly or if it guesses the mime from the extension and uses that, I don't know

lime stone
#

well it's cat sprite from scratch 😭

#

but idk where it came from

#

good

topaz spoke
#

just changing the extension doesn't work

lime stone
#

no surprise lol

topaz spoke
#

yeah

#

if that would work it would be very easy

lime stone
#

hmm

#

if the type is image/png why is the client not rendering it as an image (even if it's broken)

brazen bone
#

Looks like discord figures out whether it's a valid image server-side

charred monolithBOT
brazen bone
#
let AUDIO_EXTENSIONS = /\.(mp3|m4a|ogg|wav|flac)$/i;
export function getAttachmentKind(attachment, inlineMedia) {
    let { filename, width, height } = attachment;
    if (inlineMedia && width != null && width > 0 && height != null && height > 0)
        if (isImageFile(filename)) return "IMAGE";
        else if (isVideoFile(filename) && attachment.proxy_url != null) return "VIDEO";
        else return "INVALID";
    if (inlineMedia != null && AUDIO_EXTENSIONS.test(filename) && attachment.url != null) return "AUDIO";
    if (attachment.url != null && isPlaintextPreviewableFile(filename)) return "PLAINTEXT_PREVIEW";
    return "OTHER";
}
#

Note the check for width and height, which are set by the server

mint thistle
# charred monolith

@median rapids don’t know if you were able to see my reply to this (sry for ping)

lime stone
#

i was testing gif renamed as png

#

it just made it freeze

#

isn't gif a totally different format

brazen bone
#

Yeah must be some transcoding going on

lime stone
#

trans coding club

charred monolithBOT
sterile oak
# lime stone

I couldn't beat my curiosity, its just scratch cat

lime stone
#

but it says Generated with Sketch 52.5 so idk where i got it from

charred monolithBOT
charred monolithBOT
limber skiff
#

@stark kiln copy the find and paste into the search in the devtools

limber skiff
#

find the WebpackModule it patches using it and look where the added code is

stark kiln
#

i already did it btw

#

it's a datamining repository i'm using

limber skiff
#

that's the wrong

stark kiln
#

šŸ’€

limber skiff
#

go into discord devtools

stark kiln
#

ok

limber skiff
#

ctrl shift f

stark kiln
#

isnt that same as discord src

limber skiff
#

paste the find

#

and you will find it

stark kiln
#

ty

limber skiff
stark kiln
#

ohh

#

ty a lot

limber skiff
#

yep

stark kiln
#

you are a life saver

charred monolithBOT
brazen bone
#

Was that code written by gpt

spark pivot
#

looks like it tbh

brazen bone
#

Even changed the name in the header, lol

spark pivot
#

nvm chatgpt has no clue how to make a vencord plugin

austere talon
charred monolithBOT
mint thistle
#

i mean i kinda guesstimated the code using the docs so hopefully it works

charred monolithBOT
spark pivot
austere talon
#

did that guy feed vencord code base into ai and ask it to write a plugin

lime stone
#

idk

#

why would you do this.thing = function in start

#

WHAATTT this is like c++ but js

#

manual memory management

#

wait $self looks like something an ai would invent

rugged spire
#

Wtf is this shit???

charred monolithBOT
spark pivot
#

it has to be

#

no real person would program like this

jagged reef
#

I need to save that file before Vee nukes the pr

rugged spire
#

found this on their profile

#

those should be one single PR

#

ok i translated the profile
this looks like ai

lime stone
#

yea

#

i'd close

jagged reef
jagged reef
#

I used to think that one of the benefits of no documentation is that you can’t really use AI to help actually make it

brazen bone
#

Well, they did correct most of the issues before closing it

jagged reef
#

(It can still clean up, but its impact is minimal)

brazen bone
#

So that's something

spark pivot
jagged reef
#

It probably was, then they ā€œfixedā€ it

lime stone
#

it couldn't see discord's code which is why it was a stub

charred monolithBOT
sterile oak
#

anyone knows where I can find rust regex engine written in js/ts?

#

I want to bundle it into my plugin

brazen bone
#

Uh what

lime stone
#

ask chatgpt

#

/s

brazen bone
#

Js has builtin regex

sterile oak
lime stone
#

i think rust's engine behaves differently

#

ye

austere talon
lime stone
#

you cannot... but it exists what

turbid hatch
#

i think they meant a port of it in ts

brazen bone
sterile oak
lime stone
#

you cannot find it but it exists

#

😭

#

or does it use native stuff / wasm

turbid hatch
#

it uses rust natives

brazen bone
lime stone
#

yeah

#

but it's an npm package

#

npm being a site with a searchbar you can use to access any package

sterile oak
turbid hatch
#

the packages are autogenerated

sterile oak
turbid hatch
#

it uses napi-rs to autogenerate everything

sterile oak
turbid hatch
#

no

#

it's a library to build node native modules in rust

sterile oak
turbid hatch
#

the other big one is neon, but i didnt like it for a few reasons

#

mainly the API, you have to wrap everything in Js* types

#

and i just thought well if napi.rs can do it for me why should i use neon

spark pivot
sterile oak
spark pivot
sterile oak
proud ermine
livid heath
lime stone
#

i thought that's what it was

livid heath
#

i mean you cannot write rust in js :^)

#

unless wasm/napi

brazen bone
#

I think what they want is something that implements the same regex flavor as rust's regex crate

#

In order to match serverside automod matching behavior

livid heath
#

do not run automod locally šŸ™

turbid hatch
#

i wouldnt use mine, mine is specialised

#

and its not very optimised for generic use

jagged reef
austere talon
#

^

spark pivot
rugged spire
#

Yeah but the plugin would be super inaccurate unless prefed or API abuse

austere talon
#

the plugin will be useless if you also use discord on phone

spark pivot
#

What if you could import your data package to make it accurate then just listen to flux events

#

True

#

Didn’t think about that

charred monolithBOT
pure pulsar
#

wha

jagged reef
# spark pivot Didn’t think about that

Just loop through every message in every server and based on an average typing time, you can find their online time and messages sent number, also you can just subtract the sent messages from the total to get the received total/j

real flower
#

random question
if i wanted to update a plugin to work across more platforms, would it be more preferred if i rewrote the original source for the plugin or just made a new one

brazen bone
#

What do you mean platforms

#

Plugins are not compatible between different mods

real flower
#

well, the one im thinking of working on is volume booster

#

it only really works on desktop because it uses discord_voice

real flower
#

i use vesktop and not having that plugin is killing me lol

rugged spire
#

you would have to rewrite that entirely from scratch properly

brazen bone
#

If you can rewrite that plugin to not use discord_voice that would probably be pretty cool

rugged spire
#

yeah

real flower
#

its just

#

idk if i should make a new plugin

#

or just delete and rewrite the existing one

#

i dont know what's more preferred in the way vencord's source is structured

brazen bone
#

If it has exactly the same features but better, there's no reason to have both

real flower
#

that's what im thinking

spark pivot
#

we determined that doing anything voice-related on the app would be impossible but im not sure why

limber skiff
#

I'm gonna experiment with merging proxyLazy with waitFor

austere talon
#

in any case, the way i would go about it is to make a separate web only plugin that ports the 200% volume feature and then possibly integrate the plugin

real flower
#

i saw someone mention using part of the webaudio API and i decided its worth a shot

real flower
#

actually, quick question

#

the only thing i noticed as different between different platform plugins was the .desktop or .web in the folder name
is there anything else?

limber skiff
#

you can't use native stuff on them

#

obviously

real flower
#

tru

limber skiff
#

the .web is just to include only in browser build

real flower
#

i jus mean is that all that's checked when building it?-

#

oki

#

tyy

limber skiff
#

yes

austere talon
#

yes

real flower
#

that's cool tbh

#

my rust ass is remembering why webdev is interesting

limber skiff
#

ven did a super nice job with the build script

#

esbuild is nice

limber skiff
real flower
#

nah in general

#

ive done a fair bit

#

its just a whole different world

#

my ass made the worst command line argument parser in a project for shits and giggles and its nothing compared to the shit you can make on the web

sterile oak
charred monolithBOT
limber skiff
#

show hidden channels needs a huge cleanup anyways

brazen bone
#

No width and height, and more importantly it tried to load media.discord instead of cdn.discord

real flower
#

okay so uhhh dumb question how the hell do you test vencord web userplugins

rugged spire
#

use a dev install like normal and use pnpm buildWeb

#

extension files are in ./dist/

real flower
#

o so its basically the same you just cant really do pnpm watch?

rugged spire
#

chromium at least needs a manual reload from extensions page anyway

real flower
#

oki

#

ty

rugged spire
#

Vencord is compiled into one big script

#

Go to the github (link in channel topic) if you wanna read the source

#

bot dont work here husk

charred monolithBOT
rugged spire
austere talon
#

AI MADE

NUCLEAR BOMB

real flower
#

WHAT

charred monolithBOT
real flower
#

TF DID I MISS WITH THIS PR LMAO

austere talon
#

kaitlyn

#

why did u zoom ur pfp in

#

its uncanny

#

the stare

real flower
#

cat ears

#

LMAO

#

HAHAHHA

austere talon
#

staring in my soul

rugged spire
austere talon
rugged spire
#

read from there

still wasp
#

Might be wrong tho

real flower
real flower
#

i dropped the $7 as soon as i saw the car ears

austere talon
#

the support commands are only enabled in the support channel (and bot channel for testing), to discourage people from breaking rule 5

rugged spire
#

true

real flower
#

:)

#

good plan

austere talon
real flower
charred monolithBOT
rugged spire
#

skull emoji

charred monolithBOT
brazen bone
#

But it requires reloading the page twice for changes to take effect, which is rather inconvenient

austere talon
#

its the easiest

real flower
#

okay yeah that's

austere talon
#

i dont recommend developing on browser

real flower
#

thats a fair point

austere talon
#

its rather inconvenient

real flower
#

im a lil silly brained

rugged spire
#

vouch

real flower
#

wait wait wait

rugged spire
#

dev on vesktop is the easiest

real flower
#

to install vencord locally on vesktop

#

is it the same as disbocord

#

i feel like i should know that

austere talon