#🧩-plugin-development

1 messages · Page 7 of 1

dull magnet
#

something like this would be the simplest

deft hull
#

yes, but that requires reliabilty on the var names

trail ginkgo
#

not really

#

just the uh

dull magnet
#
// on ur plugin
Mention({ channelId, userId }, MentionComponent) {
  return <span>...</span>
}
trail ginkgo
#

overall signature

dull magnet
trail ginkgo
#

cus u can just regex capture

deft hull
#

oh

#

I see

#

you didn't change anything but the mention componemnt

trail ginkgo
#

maybe even better would be patching whatever that X component is

dull magnet
#

that could work too

#

since you have everything you need passed down to it

trail ginkgo
#

javascript defer when

#

maybe just this

dull magnet
#

@dull magnet

trail ginkgo
#

ya in X theres the @ part

dull magnet
#

why does it use concat instead of +

#

is that discords weird coding style

trail ginkgo
#

i'd like to think its their transpiller

dull magnet
#

theres also whatever this is

#

ah thats serializeText

trail ginkgo
#

is that the serialize

dull magnet
#

not useful

trail ginkgo
#

true

dull magnet
#
  • has perfect support and is shorter
trail ginkgo
#

i preferred blissful ignorance

dull magnet
#

im pretty sure the only reason the bundle would have .concat is discord explicitly using it

#

unless im missing something

deft hull
#

above and beyond?

#

oh no, it comes up three times in that file

trail ginkgo
#

wait

#

u could replace the (.)\.jsx

#

with ur own patched createElement

dull magnet
#

vapo was right btw

deft hull
#

for?

dull magnet
#

this is the part that renders the @a

deft hull
#

so we need to inject text? ugh

dull magnet
#

the function it calls is what renders all mentions

#

and it takes a color prop

#

so patching that would be really straight forward

deft hull
#

I hate swc btw

#

if it wasn't already known

trail ginkgo
#

/(.)\.jsx(?=\b.+?"@"\.concat)/

#

would this work

#

since .+? is non-greedy it should restart the capture at the (.)\.jsx right before it right

deft hull
#

it should

trail ginkgo
#

grr whgat

dull magnet
#

.+? does not mean match as little as possibly

#

it means find the smallest match starting from the first possible start

trail ginkgo
#

oh yea true

dull magnet
#

this is why I often use something like .{0,200}?

#

obviously change the 200 to smth more appropriate

trail ginkgo
#

yea in prod its 53 right now

#

so maybe just {0,75}

dull magnet
#

so 0,75 would work well probably

#

ye

trail ginkgo
#

nice

dull magnet
#

technically performance should be better if u do like {40,75}

#

but

deft hull
dull magnet
#

yes

#

i was showing that the ? which makes it non greedy might still match more than you want

trail ginkgo
#

yea i was confuysed about non lazy matching

deft hull
#

oh

dull magnet
#

non greedy* brainfart haha

trail ginkgo
#

i wanted to make sure it wouldnt replace the first React.createElement it saw just because the mention logic somewhere came after

#

lazy matching

deft hull
#

ok back to my sucky problem

dull magnet
#

in any case you can just match the children:"@".concat

#

and add color to that same object

#

and it will work

trail ginkgo
#

oh actually thats a lot truer and better

#

still need the context

#

hm

dull magnet
#
return (0,
r.jsx)(_.Z, q(z({
    className: t,
    onContextMenu: p
}, e), {
    children: "@".concat(y),
    color: getColorSomehow(e)
}))
deft hull
#

@deft hull

dull magnet
#
match: /user:(.),channelId:(.).{0,300}?"@".concat\(.+?\)/,
replace: "$&,color:Vencord.Plugins.plugins.RCE.getUserColor($1, $2)/
deft hull
#

wait

#

does this not work

#

Mention wasn't found

dull magnet
#

yeah works

deft hull
green vessel
#

remote code execution plugin

trail ginkgo
#

lmfao

trail ginkgo
dull magnet
deft hull
#

help?

deft hull
#

is that the same function

trail ginkgo
#

no

#

its a getUserColor(userId: string, channelId: string): string

#

to return something like '#ffffff'

#

u can probably use UserStore and ChannelStore for that i think

#

or just channelstore

#

some store idk

deft hull
#

i need both i think

#

where are those in the vencord path

#

but i meant same function as in same find: part

dull magnet
#

you need MemberStore, no?

deft hull
deft hull
dull magnet
#
const MemberStore = findByPropsLazy("getMember")
deft hull
#

i should keep that in start right

trail ginkgo
#

what is ChannelMemberStore

dull magnet
trail ginkgo
#

is that for group chats

#

prob

dull magnet
#

threads maybe?

#

or channel members = people with access to the channel

trail ginkgo
#

it has like

deft hull
#

uh where is findbypropslazy defined

trail ginkgo
#

no methods

dull magnet
deft hull
#

I used vscode search

#

isn't found

dull magnet
#

then you should update ur local checkout

deft hull
#

uh why isn't settings ignored

dull magnet
#

wha

#

those shouldn't be in ur clone

deft hull
#

lol idk

#

had to restart eslint

#

@deft hull

#

oh yeah i don't have color

#

nope no color

#

testing something

#

i got the correct color in the object, but it made it black?

trail ginkgo
#

inspect element the color

deft hull
trail ginkgo
#

what does getUserColor look like

deft hull
#

the colorstring is correct btw

#

it returns hex tho

#

#331315

#

like that

dull magnet
#

should work

deft hull
#

got it

#

it needed to be an int

dull magnet
#

huh

deft hull
#

not string with #

#

time to make pr?

trail ginkgo
#

wait

deft hull
#

or later 😛

trail ginkgo
#

yea because its color

#

and not style.color

#

so its the component prop

dull magnet
trail ginkgo
#

funny that color existed there still

dull magnet
#

arent u gonna add other components too

#

like vc and stuffs idk where

deft hull
#

imma try slate mentions

#

idk why i'm doing that to myself but why not

deft hull
#

@deft hull

#

slate mentions are so hard funn

trail ginkgo
#

if anyone wants to try to help with my react issues

#

and this is when i refresh in #🤖-bot-commands

#

problem being: it doesnt call the effect when the theme id updates, so it doesnt generate tokens on theme updates

#

if u look at the first useInteractionEffect(deps) and the second one, the themeId goes from null to the theme loaded from settings

#

but the effect doesnt go off?

#

some leads: this is useEffect source code, and memoizedState is just { current: null } on the second call

proud parrotBOT
# trail ginkgo https://github.com/facebook/react/blob/9e3b772b8cabbd8cadc7522ebe3dde3279e79d9e/...

**ReactFiberHooks.old.js: **Lines 1680-1690

function updateEffectImpl(fiberFlags, hookFlags, create, deps): void {
  const hook = updateWorkInProgressHook();
  const nextDeps = deps === undefined ? null : deps;
  let destroy = undefined;

  if (currentHook !== null) {
    const prevEffect = currentHook.memoizedState;
    destroy = prevEffect.destroy;
    if (nextDeps !== null) {
      const prevDeps = prevEffect.deps;
      if (areHookInputsEqual(nextDeps, prevDeps)) {
trail ginkgo
#

ok im gonnat try and remove useEffect in that way and use callback refs

#

@dull magnet check this out

trail ginkgo
#

i feel like a god after that fix

#

these hooks i wrote are cool i feel like they could be moved up to something like @hooks

dull magnet
#

I wrote something similar to that for settings listeners

#

(and noone ever used them trolley)

regal rune
#

who writes the best TS code

dull magnet
#

I love cursed ts

proud parrotBOT
silver cave
#

love

heavy garden
trail ginkgo
#

i think its codesnap

dull magnet
#

Codesnap

trail ginkgo
#

but i stole it from twitter

dull magnet
#

that's really awesome btw but don't u load strings from a json or network or similar at runtime

#

so not that useful in the end animePensive

#

unless you include English strings in the code by default

trail ginkgo
#

oh yea i was just sending it because its cool

#

forgot this chat isnt general development

#

devhub instincts

dull magnet
#

it basically it

#

u can talk about anything here

#

just keep nerd corner on topic

slow charm
#

what color r ur thigh highs

granite vault
#

Explod

trail ginkgo
#

Ok

granite vault
heavy garden
granite vault
#

You will

heavy garden
#

gib nitro and i will send the sticker

granite vault
#

Screenshot the sticker

heavy garden
#

cant. its animated

granite vault
#

I'm too broke for nitrodogsmirkreverse

dull magnet
heavy garden
#

lol

granite vault
#

Fr fr

gloomy sage
#

okay

unkempt swift
granite vault
sudden adder
#

How would I get addReaction? findByProps doesn't find it and it and i get this error when i try using it through findByCode

dull magnet
#

cause you can't use the method on the prototype

#

you need the instance lol

#

find(m => m.prototype?.addReaction)

sudden adder
dull magnet
sudden adder
#

no

deft hull
#

does vencord trim the newlines when looking/matching code?

dull magnet
#

yes

proud parrotBOT
# dull magnet https://github.com/Vendicated/Vencord/blob/main/src/webpack/patchWebpack.ts#L53-...

**patchWebpack.ts: **Lines 53-65

// Discords Webpack chunks for some ungodly reason contain random
// newlines. Cyn recommended this workaround and it seems to work fine,
// however this could potentially break code, so if anything goes weird,
// this is probably why.
// Additionally, `[actual newline]` is one less char than "\n", so if Discord
// ever targets newer browsers, the minifier could potentially use this trick and
// cause issues.
let code: string = mod.toString().replaceAll("\n", "");
// a very small minority of modules use function() instead of arrow functions,
// but, unnamed toplevel functions aren't valid. However 0, function() makes it a statement
if (code.startsWith("function(")) {
    code = "0," + code;
}
austere gulch
#

the random newline stuff is horror

#

when they first added it, it broke dsale

deft hull
#

ooh we should implement that into pylon

#

anyway, when discord uses a custom function to trim the length of an array

dull magnet
#

?

distant shard
#

idk

deft hull
#

owgeogewhweo omg

#

this tho

dull magnet
#

0

slow charm
#

right this moment

#

push

deft hull
#

ahhhh better

#

only problem is that it's not i18n

dull magnet
#

why are you changing the text?

#

is the original one just one single text element?

deft hull
#

yeah

#

it uses ** to bold it

#

so

deft hull
dull magnet
#

btw for i18n

#

can't u hijack discords string

#

but there's also intl which maybe can do this?

deft hull
#

I could, but I have no doubt that certain languages will mess it up

dull magnet
#

use intl

#

the thing I just linked

deft hull
#

ok

#

WHY THE FUCK DID I NOT NOW ABOUT THAT UNTIL NOW

#

HWEGUWHEGUW

dull magnet
#

intl is underrated

cinder wigeon
dull magnet
#

discord has some weird plugin for their build tool that keeps lines short

#

it inserts random newlines everywhere

deft hull
#

short being 1000000000 characters

#

or smth

dull magnet
#

Well yeah it certainly doesn't fit ur screen

#

I think it's 1k characters or smth

#

idk why they do it lmao

deft hull
#

lol no

#

it's random

#

some are 1K

granite vault
#

Discord moment bleh

deft hull
#

biggest line in the file I selected

#

find: Messages.ONE_USER_TYPING this one

dull magnet
#

discord actually uses Intl in some places

granite vault
#

Discord is inconsistent guhhh

dull magnet
#

discord when they polyfill ancient apis with bloated probably way worse performing apis then use recent apis like Intl

granite vault
#

They're braindamaged

dull magnet
#

I highly doubt they polyfill intl cause intl is like mega bloated

#

it's like >1mb

granite vault
#

Check and find outtonguecat

cinder wigeon
#

Web devs try to not target browsers last touched 5 zillion years ago challenge (impossible)

dull magnet
#

NONONONO

granite vault
#

Love

cinder wigeon
#

You love

deft hull
#

lol

dull magnet
#

oh

#

their intl polyfill is pretty small

#

45kb or so

#

so they just polyfill a small part ig

#

treeshake moment

simple folio
#

probably only what they need

granite vault
#

Discord insane

deft hull
#

no duh

dull magnet
#

🤏

deft hull
#

uh so does that mean intl.listformat is there

granite vault
#

It means explod

dull magnet
#

yes, people should hop off ancient browsers or cope

#

my ass will never support old browsers

granite vault
#

But I want to use internet explorer with vencord 🥺

dull magnet
#

wait i switched to German and whoreacted broke

deft hull
#

L

#

how do i get the two char i18n code thingie

dull magnet
#

findByProps("getLocale").getLocale() i think

#

returns "de" for me

granite vault
deft hull
#

mine is en-US

#

lol

#

hopefully that doesn't makea difference

granite vault
#

Nop

#

It's supposed to be like that

deft hull
#

ik,

granite vault
#

There's also en-GB iirc

deft hull
#

yeah

#

when switching i18n, discord refreshes right

granite vault
#

Check trolley

deft hull
#

no

dull magnet
#

oxford comma

granite vault
dull magnet
#

@deft hull i think this is what u want

#

if u didnt see yet

deft hull
#

hm

dull magnet
#

like

const parts = fmt.formatToParts(users.map(u => u.id));
const components = parts.map(({ type, value }) => {
  if (type === "element") return <ColorUser id={value} />
  return <span>{value}</span>
});
granite vault
#

Oxford will explod

dull magnet
#

should work well tonguecat

deft hull
#

weird

carmine nexus
#

weird

deft hull
#

fyi @dull magnet i18n problems

#

also my other i18n problem continues with this

#

did it just disable role color everywhere

#

now what

dull magnet
#

but also who care i18n

trail ginkgo
deft hull
deft hull
dull magnet
#

context?

deft hull
#

I just reverted my changes to what it was when I pushed pr

#

and got this

dull magnet
#

context?

#

what's the code

deft hull
#

oh got it

#

roleColorEverywhere vs RoleColorEverywhere

dull magnet
trail ginkgo
deft hull
#

there will be some strings that just won't follow the same rules

dull magnet
#

how would you do that

#

what if somebody is named and, what if everyone typing has the same name, etc

deft hull
#

hm?

#

no?

trail ginkgo
#

I don't understand

dull magnet
#

what

deft hull
#

wonderful

dull magnet
#

you're suggesting to parse discords string, no?

trail ginkgo
#

No not the rendered string

#

The strings it uses to render

#

Before it interpolates the users

dull magnet
#

I tried looking for that one earlier but I couldn't find it lol

#

I searched for "und" and found nothing

deft hull
dull magnet
#

what

#

how did i not find that

#

weird

#

in any case that doesn't do anything for us because Intl does the same

deft hull
#

not the is typing...

dull magnet
dull magnet
trail ginkgo
#

Plurality

dull magnet
#

yeah use discords strings then

trail ginkgo
#

Intl does have a plurality thing

#

Idk the scope of it tho

deft hull
#

is there a way to parse a string that returns a react object

dull magnet
#

in any case i18n isn't really a priority, only if it's easy to do

trail ginkgo
#

Ok phone is at 1% on road

deft hull
#

you should go charge it

dull magnet
deft hull
#

not sure why it's like that

dull magnet
#

instead of like {a}, {b} and {c} are typing

deft hull
#

I assume the !! help clarify that it's an actual placeholder rather than plaintext

#

and the ** automatically makes the text bold

#

how do I get these messages

dull magnet
#

findLazy(m => m.Messages?.ACCOUNT && m.getLanguages)

#

I think

deft hull
#

why isn't it a module in common already

dull magnet
#

cause noone ever needed it

deft hull
#

add it now

#

👿

dull magnet
#

u will add

deft hull
#

in this pr?!?!

dull magnet
#

sure

granite vault
#

Cope dogsmirkreverse

opal fern
#

You're right, it is the most useless bug

dull magnet
#

has anyone ever used that menu

simple folio
#

i forgot it was a thing

fierce tendon
cinder wigeon
#

I never knew that existed huh

deft hull
#

People actually used vizality??

dull magnet
#

yeah sadly

#

people love garbage

regal rune
#

lol

granite vault
#

Wtf is that

dull magnet
#

yeah already tested, thank you!

#

lol

granite wharf
#

@dull magnet will make tauri installer troller

austere gulch
#

trol

dull magnet
#

tauri is so bad

granite wharf
#

nop

#

you can make pretty ui

dull magnet
#

pretty uiand eat three terabyte ram

mossy hazel
#

which tauri?

#

rust one?

granite wharf
#

ye

mossy hazel
#

😭

green vessel
austere gulch
dull magnet
heavy garden
#

why flatpak

austere gulch
#

flatpak horror

heavy garden
#

can somebody explain

#

on vscode works like a charm but on discordapp it doesnt

dull magnet
#

probably needs to explicitly states which things it wants to spawn

heavy garden
#

i did?

dull magnet
#

flatpak override com.packagename.App --talk-name=org.freedesktop.Flatpak

#

apparently you should do this

heavy garden
#

apparently it worked

#

now i just need to see how will i detect if the app is running as a flatpak

dull magnet
heavy garden
#

looks like a horrible solution but this might gonna work if i use PS1

granite wharf
#

flatpack deez nuts

heavy garden
#

used a different method that uses the env var SANDBOX_TMPDIR to identify if it is sandboxed

dull magnet
#

btw my system doesnt have flatpak-spawn

#

its not part of flatpak?

#

so i just checked flatpak env

#

and it contains all of my host env variables?????

#

wtf flatpak

heavy garden
#

lol

dull magnet
#

anyway theres so many vars u could check

#

i would just use

const isFlatpak = process.env.FLATPAK_ID?.includes("discordapp");
heavy garden
#

oh lol

#

lemme just fix it

heavy garden
#

i will admit that idk nothing about flatpak

#

lmfao

heavy garden
#

@dull magnet check now

deft hull
#

i think i fixed the typing color bug

dull magnet
#

pog

deft hull
#

doesn't really work very well

#

it only works if someone else is typing

#

the function doesn't get called when you're typoing and no one else is

trail ginkgo
#

is it supposed to?

#

you'd have to patch whatever discord function filters you out from the typing indicator

deft hull
#

yeah, but that probably should be a different plugin

#

fuck my keyboard broke

trail ginkgo
#

somehow i read it though

#

and yea i think i agree

deft hull
#

I don't even remember what I typed though

#

huhh

#

oh got it

#

I need to make copy raw, lemme just rq do that

#

that can definitely be merged before role color everywhere

#

is tooltip a common webpack thing

#

yes it is

#

huh

deft hull
#

oh got it

trail ginkgo
#

u could remove the need for a constructor

#

and just do state = { copied: false }

#

since u arent doing anything with props

deft hull
#

yeah i realized

#

I also realized that using functional copmonents are a lot easier than i remember

#

which i'm now using

#

oopsies

#

wrong message thing

#

uh how do i put a button ehre

dull magnet
#

been using functional ones for ages now, never looked back

deft hull
#

i'm looking at hideattachments for it rn

deft hull
#

oh shit that was a pr'

#

uh

#

@dull magnet

dull magnet
#

oh yeah

#

I forgot about that pr

#

it does some hacky stuff and doesn't use modals properly which needs fixing

deft hull
#

what should I do with my copy raw pr

dull magnet
#

uhhh

#

your prs way to make the menu is way cleaner so I prefer that

#

would be cool to port the modal to your pr

#

just steal modal from jubys plugin xd

deft hull
#

yeessss

#

lol

dull magnet
#

have u tried if there's context menu yet

deft hull
#

i actually might just make the api later

dull magnet
#

on the icons

deft hull
#

not yet

dull magnet
deft hull
#

when I have time

#

which i don't

obsidian sorrel
#

@dull magnet hello i just made v2 manifest stuff and i was thinking about adding a github action artifact so that i can directly download a .xpi from github actions instead of having to do that myself for now

dull magnet
#

btw there's an open Firefox support pr too but it's been kinda stale

obsidian sorrel
#

i added it to the release

dull magnet
#

I saw

#

btw kinda too late now but there was already a manifest v2

#

before this commit

#

I honestly wasn't aware Firefox didn't support v3 when I did that

#

because their Roadmap proclaims they support v3 since early 2022

#

??

obsidian sorrel
noble surge
#

"ItS NoT ReAdY YeT"

obsidian sorrel
#

i think its in firefox developer version, but it isnt in stable and i dont wanna update twice a day

obsidian sorrel
#

it wasnt ready when chrome pushed it out either, but they did it anyway

noble surge
#

fuckin

#

YEET TO PROD

#

the way

#

@dull magnet superh

#

what if

#

I was to redo the installer

#

to make it look better(er)

dull magnet
#

redo how

#

if you redesign and it looks good then sure

#

but don't make it an electron app

noble surge
#

why

#

electron good for ui library

obsidian sorrel
#

oh right i still wanted to do loading of user plugins form localstorage

dull magnet
noble surge
#

how big is bd's 💀

dull magnet
#

100mb

noble surge
#

💀

dull magnet
#

any electron app is ~100mb

viral roost
#

its 65mb

dull magnet
#

that's compressed lol

viral roost
#

do not ask why i have the bd installer

dull magnet
#

now try making a single binary electron app on Linux

noble surge
#

nah

#

im good

dull magnet
#

just don't use electron bleh

noble surge
#

what else tho

#

idk what js has

obsidian sorrel
#

oh yeah ven do i also need to add docs to my pr or is it fine like this

noble surge
#

besides electron

deft hull
#

I don't think you can use js for this without a huge filesize

noble surge
dull magnet
#

just don't switch the framework

#

current one is nice

noble surge
#

I don't know go 💀

dull magnet
#

the way the gui framework works is pretty similar to flutter if you've ever worked with that

#

or using react create element manually

dull magnet
obsidian sorrel
#

yes

dull magnet
#

uhh

#

since there's now multiple builds maybe make like those browser buttons extensions usually have

obsidian sorrel
#

okay so

dull magnet
#

Also do you have any idea about updating / publishing to store?

obsidian sorrel
#

it generates a random name

dull magnet
obsidian sorrel
#

yeah

#

i will do that

dull magnet
#

mv *.xpi Vencord.xpi

obsidian sorrel
#

mhmm

#

yes, bash

dull magnet
#

would be cool to have

obsidian sorrel
#

cant imagine it being too hard, but ive never done it personally

dull magnet
#

and cool to automate

obsidian sorrel
#

i can look into that tho

#

it fits quite nice into my pr, ig

#

i think to start i could clean up the release files, like half of the stuff in there isnt really needed (like do we need browser.js as a raw file in there?)

dull magnet
#

yes

#

Armcord uses it

obsidian sorrel
#

oki so nvm im just renaming that .xpi and looking into publishing to firefox addons (or just adding a badge)

dull magnet
#

chrome would be cool too but that costs like 5 bucks blobcatfearful

dull magnet
obsidian sorrel
dull magnet
#

maps are nice to have, the legal txts we could probably just put at the bottom/top of the bundles though

obsidian sorrel
#

also i think if we auto publish to firefox we would need to increment version numbers

dull magnet
#

we could remove the patcher and preload maps cause they're pretty obsolete

obsidian sorrel
#

ig we could use github run numbers for that, but still

dull magnet
#

in the userscript we just append the current Unix timestamp which will obviously always increment

#

semver shenanigans

obsidian sorrel
#

1.0.0+r.<runnumber>

dull magnet
#

other option would be git revision count

obsidian sorrel
#

or that yeah

dull magnet
#

would also be cool to include the hash in the version

#

1.0.0+r516-2af65b

obsidian sorrel
#

ill check if that is allowed on firefox addons and try uploading vencord then

#

i think semver wants you to use . to concat multiple build infos

dull magnet
#

I don't know the full semver spec

obsidian sorrel
#

i had to implement it for an update checker

#

ig r516-2af65b would also be a valid singular build meta

austere gulch
#

this seems fine trolley

dull magnet
#

it considers that a pre release

#

is there like a "check if this semver is newer than this semver"

#

1.0.0+r516-2af65b
1.0.0+r517-ff6a7b

#

see if the second one is considered newer

#

wait

#

you can't even use semver

obsidian sorrel
#
  • makes that a pre release
#
  • is a build meta
dull magnet
#

pain

#

so we could do 1.0.REVISION_NUMBER

#

?

obsidian sorrel
#

probably what we would need to do

#

(or actual versioning but lets not)

dull magnet
#

The Chrome Web Store requires numbers between 0 and 65535

#

do you reckon we will ever get to 65535 commits

#

I don't think so

obsidian sorrel
dull magnet
#

if we somehow did we would need to rethink versioning at that point

dull magnet
# obsidian sorrel bruh

if you tried vencord<@&1015072428843601962>endicated.dev, smart @granite wharf already claimed that I think

obsidian sorrel
#

oh shit

dull magnet
#

why is it there 5 times lmaoo

obsidian sorrel
#

i deleted my dist folder

#

while trying out the github action

austere gulch
#

i will delete system32

obsidian sorrel
#

ig i would need to like either claim my own id, or let you (or someone else) handle this

#

this isnt really something i can do a workflow for, so i think ill just make it into the release and add a badge, and somebody who owns that id can eventually make it a published plugin

austere gulch
#

you'd think it'd check for spaces or something

dull magnet
#

what exactly does one need to run to make a release

obsidian sorrel
#

nah it already should publish to the release i just want to rename it

#

and if i want to push it to the mozilla addons store i would need to reserve a name in the codebase

#

which i dont want to do because someone else already did it

#

(and if i dont have access to that name i cant really test sooo)

dull magnet
#

yeah makes sense xd

green vessel
#

husk
why does this single change cause the userscript not to load

- // @grant none
+ // @grant GM.xmlHttpRequest
dull magnet
#

cause as soon as you grant a permission it doesn't run in page context anymore

#

which means you now have to use unsafeWindow

green vessel
#

oh i see

#

so wrap everything in unsafeWindow.setTimeout(()=> {}, 1) trolley

dull magnet
#
with ({ window: unsafeWindow }) {
   // code here
}```
#

try this trolley

#

absolutely no reason to use with here I just think it's funny

green vessel
#

nop

#

oh wait

obsidian sorrel
austere gulch
#

friendliness* trolley

obsidian sorrel
#

do manifest v3 extensions work for edge and chrome or am i just making stuff up

dull magnet
#

should

obsidian sorrel
#

i will skin you alive

dull magnet
#

it's all chromium

green vessel
dull magnet
#

why are u even granting that permission

#

do u wanna fix csp issue

#

cause the issue isn't in xml http req it's in dynamic imports and script tags

obsidian sorrel
#

i think that would be it with my pr

green vessel
dull magnet
green vessel
dull magnet
#

i forgot to include it in the included folders

obsidian sorrel
#

uhhh

#

how do i do that

#

i dont know js

dull magnet
#

Also gonna shower now so gonna take a look later bleh thank u

dull magnet
#

and use the lint fix command but on browser

dull magnet
#

yeah but did u have to edit source code for that

green vessel
#

nop

granite vault
dull magnet
#

huh

#

how did u do it then

granite vault
#

Devtools overrides go brrr

green vessel
# dull magnet how did u do it then
// @grant           GM_xmlhttpRequest
// @require         https://greasyfork.org/scripts/421384-gm-fetch/code/GM_fetch.js?version=898562
// ==/UserScript==

unsafeWindow.fetch = GM_fetch
// this is a compiled and minified version of Vencord. For the source code, visit the GitHub repo
with ({ window: unsafeWindow }) {
granite vault
#

Oh wait Firefox doesn't have them

green vessel
granite vault
#

It works dogsmirkreverse

#

If it works, it works

dull magnet
#

does that bypass cors

green vessel
#

yop

dull magnet
#

if yes then do not

#

does it fix quick css or nah

green vessel
dull magnet
#

can't

#

inline scripts and styles aren't allowed

granite vault
#

You will do it anyways

green vessel
dull magnet
#

yes there is

#

GM_addScript

green vessel
#

whats the issue then

dull magnet
#

but looks like it's not portable

#

Tampermonkey only

granite vault
#

Tampermonkey will exploddogsmirkreverse

dull magnet
#

this might be portable

green vessel
dull magnet
#

yes

green vessel
#

well ill pr the csp thing anyway trolley

#

as it fixes all the plugins that fetch some api

#

although ill make it less retarded i promise

dull magnet
dull magnet
#

did you use that one from npm that clearly states its untested and unsafe

green vessel
austere gulch
#

garry's mod fetch

dull magnet
#
function GM_fetch(url, opt){
	function blobTo(to, blob) {
		if (to == "arrayBuffer" && blob.arrayBuffer) return blob.arrayBuffer()
		return new Promise((resolve, reject) => {
			var fileReader = new FileReader()
			fileReader.onload = function (event) { if (to == "base64") resolve(event.target.result); else resolve(event.target.result) }
			if (to == "arrayBuffer") fileReader.readAsArrayBuffer(blob)
			else if (to == "base64") fileReader.readAsDataURL(blob) // "data:*/*;base64,......"
			else if (to == "text") fileReader.readAsText(blob, "utf-8")
			else reject("unknown to")
		})
	}
	return new Promise((resolve, reject)=>{
		// https://www.tampermonkey.net/documentation.php?ext=dhdg#GM_xmlhttpRequest
		opt = opt || {}
		opt.url = url
		opt.data = opt.body
		opt.responseType = "blob"
		opt.onload = (resp)=>{
			var blob = resp.response
			resp.blob = ()=>Promise.resolve(blob)
			resp.arrayBuffer = ()=>blobTo("arrayBuffer", blob)
			resp.text = ()=>blobTo("text", blob)
			resp.json = async ()=>JSON.parse(await blobTo("text", blob))
			resolve(resp)
		}
		opt.ontimeout = ()=>reject("fetch timeout")
		opt.onerror   = ()=>reject("fetch error")
		opt.onabort   = ()=>reject("fetch abort")
		GM_xmlhttpRequest(opt)
	})
}
green vessel
#

ye

dull magnet
#

looks okay but I don't like that it bypasses cors

#

would be cool if you could somehow make it fail on cors error

vocal pivot
#

Whats blob

obsidian sorrel
#

binary large object

green vessel
#

i dont get it

#

isnt it literally the point that it bypasses cors

dull magnet
#

csp

green vessel
#

so u can fetch from github etc

dull magnet
#

not cors

dull magnet
vocal pivot
#

O

dull magnet
#

csp = own site restricts what resources can be used
cors = other sites restrict what sites can fetch them

green vessel
#

oh yea

dull magnet
#

without cors random sites could just embed possibly sensitive sites

granite vault
#

Gooddogsmirkreverse

green vessel
#

yeah true i forgor

dull magnet
#

cors is really annoying but it's there for a good reason

granite vault
#

RCE v2

dull magnet
green vessel
#

yeah ik

dull magnet
#

obviously pretty harmless in this case but you see the possibilities trolley

green vessel
dull magnet
#

not HEAD

#

OPTIONS

#

that's exactly how cors works actually

#

if you add that and only overwrite fetch for vencord and not for the entire page I'm fine with it

granite wharf
#

i didnt know private extentions had global ids

austere gulch
#

im surprised they dont make u confirm ownership of domain

noble surge
#

@dull magnet 💡

#

installer but

#

flutter + dart

dull magnet
#

why

noble surge
#

I do it for a job

dull magnet
#

the library I currently use is very similar to flutter

green vessel
noble surge
#

my brain cannot understand go lol

green vessel
#

go explod

austere gulch
#

you will explod

noble surge
deft hull
noble surge
#

yes

dull magnet
#

Flutter is a framework for Dart yes

#

While writing and debugging an application, Flutter runs in the Dart virtual machine, which features a just-in-time execution engine. This allows for fast compilation times as well as "hot reload", with which modifications to source files can be injected into a running application. Flutter extends this further with support for stateful hot reload, where in most cases changes to source code are reflected immediately in the running app without requiring a restart or any loss of state.[18]

#

this is actualy really col

deft hull
#

No ik

#

I'm wondering why it was +

noble surge
#
String? deviceIdentifier = 'Press the button to get the device identifier';

// Add to state
setState(() {
    deviceIdentifier = tempDeviceId;
});

// On init
@override
void initState() {
  super.initState();
}```
modest yacht
#

i have exploded

wraith carbon
silver cave
#

can confirm

#

it is very col

deft hull
#

wtf this is accurate regex

#

huh

dull magnet
#

use watch

#

then it shows you the patch diff

#

pnpm build --watch

trail ginkgo
#

can someone test if latest desktop stable supports regex lookbehind

#
{
  match: /(?<="Spotify"===\w+\.provider\.name?\(0,.\.jsx\)\()\w+(?=,)/,
  replace: "Vencord.Plugins.plugins.SpotiMbed.SpotifyEmbed",
}```
would b nice
dull magnet
#

it does

#

lookbehind has been in js for ages

#

forever

#

oh wait thats lookahead my b

#

but yeah lookbehind also has really good support

trail ginkgo
#

ya i knew they were diff support moments

#

but sick

trail ginkgo
#

diff amounts of support?

#

is that caniuse lemme check

dull magnet
#

yes it's caniuse

#

Oh you mean why it has multiple green rows

trail ginkgo
#

Ya

deft hull
dull magnet
#

to show what your code changed

#

useful so you can understand why it errored

deft hull
#

I didnt change any thing tho

#

The regex is valid

#

So idk why it errored

dull magnet
#

cause the resulting code isn't valid syntax

deft hull
#

Only errored when i pasted that rege

dull magnet
#

again use dev build and it'll show you diff

deft hull
#

Ok

#

I'm not sure tho

#

I'll see when i get home

dull magnet
#

dev build gud

#

dev build has a lot of extra things

#

like tracking how long certain actions like webpack search and loading plugins takes, code diffs in patcher errors, patchhelper, non minified code for easier debugging, warnings for not applied patches, strict errors for failed webpack searches

trail ginkgo
#
type AwaiterRes<T> = [T, any, boolean]
type Token = { content: string }
type TokenizerRes = Token[][] | null

const doSmthWithTokens = (tokens: TokenizerRes) => {
    console.log(tokens)
}

doSmthWithTokens([null, null, false] as AwaiterRes<TokenizerRes>)
#

literally why does ts allow this

#

im so confused

dull magnet
#

but this should be enabled in Vencord

trail ginkgo
#

not sure if this is why

#

if u copy paste this in the typescript playground

#

it slides, and playground has all the strict options enabled by default im p sure

dull magnet
#

wait

#

that makes sense to work I think

#

wait nvm lol

trail ginkgo
#

the thing that confirms my confuse it is the boolean element

#

boolean has NO overlap with Token[]

#

i hope

#

reduced weirdness to a oneliner
const a: { prop: number }[] = [null, null] as [null, any]

#

and it seems to only arise when one of the tuple elements is any

dull magnet
#

oh

#

that makes a lot of sense

#

Once one of the types is any, the union of all the types is automatically any

#

so the entire array is just any[]

trail ginkgo
#

but its a tuple why is it casting to array when typechecking

dull magnet
#

cause the type you're assigning to isn't a tuple

#

so it's flattening it to a regular array

trail ginkgo
#

oh that is interesting

dull magnet
#

change the type you're assigning to to [number, number, number]

#

should error then

#

(im not 100% sure this is true its just my educated guess)

trail ginkgo
#

yes

#

it does

#

[number, number] also errors in the oneliner

#

so the explanation makes sense

#

typescript moment

near aurora
#

will the font reversion snippet work for long enough? i see it uses actual discord's assets, and they might and probably will remove them eventually

#

also neither the snippet to revert font or the snippet to fix kerning work for me

granite vault
trail ginkgo
#

so i can imagine they dont care that much

#

i imagine their static assets are really cheap relative to their db costs

granite vault
wanton sierra
#

@green vessel SARADA

#

ur username in romaji xd

near aurora
#

okay

#

well it works now i had to restart openasar

granite vault
#

OA skill issue perhaps?

obsidian sorrel
#

@dull magnet in the current release it says that the source zip cant be updated, but im pretty sure you can update the source zip by just updating the tag (devbuild):

git fetch origin
git reset --hard origin/main
git tag devbuild -f # Force overwrite the tag locally
git push -f origin devbuild # Force push the remote tag to the same commit as the local tag
#

on second thought im not sure why i pinged you

granite vault
#

Insane

silver cave
#

INSANE

#

@potent fox you use source zip

potent fox
#

ONLY INSANE PEOPLE USE SOURCE ZIP

#

I HAVENT SEEN SINGLE PERSON THAT USE IT

obsidian sorrel
silver cave
#

explosion

potent fox
silver cave
#

i don't think I have in years

opal fern
trail ginkgo
opal fern
trail ginkgo
#

i did because ur solution is in the channel

cedar olive
#

I don't know what's wrong (Ignore the weird function return)

trail ginkgo
#

u cant just calle the component with props

#

it has to be initialized by jsx (react runtime)

cedar olive
#

I'm doing it like to that to be able to access it through Vencord.Plugins blabla

trail ginkgo
#

one fix would be: make ur index.ts into a index.tsx and return <ToggleGameBla props={...props}/>

#

i do a similar thing in shikiCodeblocks/index.ts

#

but i use createHighlighter which is an export in my components/Highlighter.tsx

cedar olive
#

I think I understood what you meant

#

let me try one solution

vast prawn
#

is it easy to turn a bd plugin into a vencord plugin?

deft hull
#

depends on the plugin

#

but it's harder than you think

heavy garden
#

did some UI

green vessel
weary heath
#

i love bananas

rapid verge
#

i want bananas

trail ginkgo
#

@austere gulch fresh phish

#

🐟 🍴 😛

austere gulch
#

ty

opal fern
#

@dull magnet how can I grab the contents of a text file after it is uploaded via a command?

dull magnet
#

look at petpet / corrupt mp4s

opal fern
#

I get this, which idk what to do with

green vessel
green vessel
#

guh!?

opal fern
#

to bait people like you

green vessel
#

sure

dull magnet
#

you can turn it into an url, text, byte array, etc

opal fern
#

rn got it as a blob, gonna use FileReader to make it something

dull magnet
#

what

#

you don't need that really

opal fern
dull magnet
#

file.arrayBuffer() -> byte array
file.text() -> string

#
const bytes = new Uint8Array(await file.arrayBuffer());
green vessel
#

so lets try this

#

:3

#

gone

#

lets see what happens

#

:3

green vessel
#

and it failed

keen bear
#

Is there a way I can get rid of the minimum discord window size on vencord?

austere gulch
#

you can set it in discord's settings.json

#

if you're on windows it's in %appdata%/discord/settings.json
where it is on linux depends on a bunch of things bleh

green vessel
#

on linux it's at ~/.config/discord/settings.json and if it isn't you know why

austere gulch
#

you underestimate discord users trolley

green vessel
#

perhaps

keen bear
#

is it WINDOW_BOUNDS?

austere gulch
#

yeah

#

add keys MIN_WIDTH and MIN_HEIGHT to it

#

and you can set whatever min px you want

keen bear
#

ty

austere gulch
#

np

opal fern
#

is it possible to upload to clipboard?

civic elk
#

or if you want web support i think its possible through navigator.clipboard.write

opal fern
#

Didnt know DiscordNative was a thing

civic elk
#

yeah

#

only on desktop client tho

#

all the ipc stuff and native modules like voice

opal fern
#

Right right right

#

No, I deleted it because I was testing clipboard and didnt realize I was in development

trail ginkgo
#

theres a clipboard module in @webpack/common i think

opal fern
#

wow there is

proud parrotBOT
trail ginkgo
#

just make sure u use it inside a user triggered event

opal fern
#

Is a command a user triggered event?

trail ginkgo
#

the pressing enter part is

#

the command execution prob still happens in the keyboard event

#

so ur prob good

opal fern
#

It workie

dull magnet
austere gulch
#

owo

#

yea

#

another thing to add to my adhd list trolley

cedar olive
#

which is the correct way instead of using DiscordNative

opal fern
#

yeah ik