#🧩-plugin-development

1 messages · Page 31 of 1

vapid latch
#

spotify has an api for controlling

#

simple as

#

basically ffmpeg cant do relative stream urls and i have no idea how to read hls files to turn entries into a singular readable stream

trail ginkgo
#

the problem is that doing key in obj has bad typings, you should try making a better version of Object.keys and use that like const key of objectKeys(request.query)

#

typescript is smart enough to infer the rest

#

could be like ts function objectKeys<T extends Record<any, any>>(obj: T) { return Object.keys(obj) as keyof T[]; }

grim hare
#

that would be a good idea

#

it is rather annoying that Object.keys and Object.entries don't already have those kinds of typings - I did try variations using them but there was no benefit and for ... in looks a bit cleaner imo

trail ginkgo
#

yea it is annoying

#

i think for ... in will enumerate enumerable keys in the prototype too

#

so i try to use it less

dull magnet
#

them having those typing would be wrong

trail ginkgo
#

true

#

it would return all the methods and stuff that isnt enumerable

dull magnet
#
const obj = {
    foo: "hi";
    bar: "hi";
} as { foo: string };

Object.keys(obj) // Array<"foo">  ???
#

no

trail ginkgo
#

oh yea true i ran into that issue

#

doing that

dull magnet
#

no

#

the as is just my preferred way of writing it

#

that object is perfectly assignable to { foo: string }

trail ginkgo
#

typescript's type system isnt like exact

#

{ foo: string } just means it has foo not that it only has foo

#

so an array with only foo elements would be an assumption

dull magnet
#

because that won't cause the issue?

trail ginkgo
#

ur too caught up on the as

#

imagine its like a parameter type

dull magnet
#
interface User {
    username: string;
}

function listUserDetails(user: User) {
    Object.keys(user) // "username"[]
}

listUserDetails({
    username: "epic",
    realname: "gamer"
})```
#

this is perfectly valid ts with no casts

trail ginkgo
#

good example

dull magnet
#

there are tons of cases like this in real code where the actual js object passed contains way more props

#

think privates, passing a plain HTMLImageElement node to smth that only cares about a src, etc

grim hare
#

bleh that makes sense why they're typed like that then

#

UnsafeKeys util function time sunglossess

dull magnet
#

true

#

nothing is casted ryan

dull magnet
#

there is no cast

#

ts is structurally typed

if it has a quack method it's a duck, it doesn't matter if it also has a woof method

#

yes that's why it returns string[] and not (keyof T)[]

#

absolutely not, no

#

it would be very unsafe to do so for type checking

dull magnet
#

pretty sure that's some compiler rule when you enable strict mode

grim hare
#

if it helps at all, think of it like class inheritance

class Kemomimi {}
class Shiggy extends Kemomimi {
  shig = true
}

function kemoKeys (instance: Kemomimi) {
  return Object.keys(instance)
}

kemoKeys(new Kemomimi) // []
kemoKeys(new Shiggy)   // ["shig"]

It's perfectly valid to pass an instance of Shiggy to kemoKeys, but it will change the output

grim hare
#

but if you do Object.keys() on it password will still be there

dull magnet
#

it contains extra keys

#

ts playground is unusable on mobile

#

the editor is so scuffed

grim hare
#

yes that is the point ;w;

dull magnet
#

so what does Object.keys return for it

#

spoiler: not keyof T[]

grim hare
#

but that isn't accurate

#

you Will get keys outside that set

dull magnet
#

I love how storing it in a variable works

#

but not inline

#

yes, and that's why it returns string[]

#

because it's correct

#

keyof T[] would be incorrect

trail ginkgo
#

yes thats part of assignability in type theory

#

and its baked into the type system because its structural

dull magnet
#

whar

#

someone complained about Object.keys returning string[] and I just said it makes sense to do that

#

that's all

trail ginkgo
#

structural type system moment

grim hare
#

if it worked as the keyof type then this would throw an error at runtime (maybe a contrived example sure but it illustrates the point)

interface Datapoints {
  height: number
  distance: number
}
interface ExtendedDatapoints extends Datapoints {
  mass: number
}

const handlers: { [K in keyof Datapoints]: (val: Datapoints[K]) => void } = {
    height: v => console.log(`${v} meters tall`),
    distance: v => console.log(`${v} meters away`)
}

function printData (datapoints: Datapoints) {
    Object.keys(datapoints).forEach(key => handlers[key](datapoints[key]))
}

const data: ExtendedDatapoints = {
    height: 45,
    distance: 233,
    mass: 43
}
printData(data)
grim hare
grim hare
dull magnet
#

yeah lmao

#

keyof T[] should just give u array keys lmao

#

(keyof T)[]

oblique lark
#

why does rust randomly change whether it shows the file or line number in this error

oblique lark
#

god if only there was an easier way of doing this

austere mauve
#

yes go in discord's nitro tab and click purchase

#

no

oblique lark
#

lol

wooden dragon
#

would make it more concise

#

and use 2 enums for Axis and Direction

oblique lark
#

yeah ive done that already

austere mauve
#

why is it saturating

oblique lark
#

this was just me copying the ratatui scrollbar example thingy

oblique lark
austere mauve
#

um

#

no

#

saturating would prevent overflowing the int

#

and wrap

oblique lark
#

no saturating doesnt wrap

#

it saturates

wooden dragon
#

wrapping_add wraps

austere mauve
#

i was thinkin of clamp but ik

oblique lark
#

why does rust have so many add functions

austere mauve
#

why would you have 4294967295 items though

oblique lark
#

iunno

#

as i said earlier this was from directly copying the ratatui example

wooden dragon
oblique lark
#

oh yeah and also it needs to saturate on subtraction so it doesnt underflow

dry patio
#

is there like an api ref for third party plugins

amber basin
#

read docs

#

and read other plugins

dry patio
#

ok cool good🙏

#

if i have any time in the world i might do some things

fringe ivy
#

Genuinely curious about the rpc plugin, how is it presetting the Game Name

dull magnet
#

wdym

fringe ivy
#

The customRPC plug-in, it allows any Application Name to be set as long as you provide an Application ID, I’m trying to replicate it for my non-vc script but I’m baffled on how it’s done 😂

dull magnet
#

not possible probably

#

being in client gives you free access

#

if youre outside you need to work with their apis

#

similarly, listening and such normally wouldnt be possible

fringe ivy
#

Ahh, that’s bummer 😂

dry patio
#

can't seem them on the website unlees im blind

dry patio
#

yay

dire horizon
#

How do I get the user id?

wooden dragon
#

silly goober luna forgor to cache deps properly

#

now it's fast

#

also gh actions make my brain go mushy

amber basin
#

oooo

#

i fucking love doing ci

wooden dragon
#

Same but these config files make me go insane

gentle jay
#

Id like to make a plugin that would allow me to fav any media not only gifs. Are there any good tutorials/documentation that would allow me to even start from somewhere?

amber basin
#

already made, its in review now

gentle jay
#

can I at least see how it works then cuz I wanted to learn something new

#

like a github repo or something

gentle jay
#

maybe one day ill get response on this server

oblique lark
#

you can fav images if you put ?.gif after the link

gentle jay
#

but how do I even start, I dont have extensive knowledge about js let alone making plugins for discord mods, all Im asking for is a good place to start (documentation will do)

grim hare
gentle jay
#

ok

wooden dragon
#

do a js/ts course

#

there are plenty online

#

watch yt vids

#

idk

gentle jay
#

g

#

im learning regex rn

austere mauve
#

there is already a pull request for that plugin

gentle jay
#

so from what I understand the plugin finds links with .gif extension and replaces it with other media extensions

#

or does it replace something else with those extensions?

honest walrus
#

can someone please please please make a watch os app so I can use discord without massive lag on my watch (Samsung galaxy watch 4)

#

I have a sideloaded aliucord atm but it's laggy af

grim hare
#

it's a pretty simple patch overall

gentle jay
#

ok

#

but how can I know that find: "/\.gif($|\?|#)/i" is linked to the part of the code that looks for extensions

grim hare
#

that's a regular expression that does a search on discord's source code to find the portion that needs to be replaced

#

in discord's dev tools, you can use the search tool to search around discord's source code in a similar way

gentle jay
#

i know

grim hare
#

if you install vencord from source, you'll also have additional tools like the patch tester available in settings to be able to test patches like that

wide parrot
#

would also use react dev tools

gentle jay
#

but I dont understand how that regex part refers only to one specific part of code and some random .gif part

#

so it grabs only the first one

#

but how do I know that the first appearance of this is correct

#

(im using this website to see how exactly regex works)

wide parrot
#

its not matching using regex

#

its matching using string

gentle jay
#

oh

#

so I misunderstood

#

the docs

wide parrot
#

it would be matching using regex if it was surrounded by /.../

#

intead of "..."

austere mauve
#

its a bit confusing cuz its basically matching a regex in discord's own code

#

but yea

gentle jay
#

makes sense

wide parrot
#

but since theres no unknown/minified variables u can just use string instead

gentle jay
#

so find: "/\.gif($|\?|#)/i", just look for string /\.gif($|\?|#)/i

#

in code

wide parrot
#

yeah

gentle jay
#

ok

#

that regex part confused me

cedar olive
#

only one discord file has that exact string on it

gentle jay
#

ok

#

so now everything make perfect sense

#

damn

cedar olive
#

so once it finds the correct, then it applies the match regex to select and replace the appropriate code in that file

gentle jay
#

its not that hard after all

gentle jay
cedar olive
#

no lol

gentle jay
#

but since it just looks for string its all g

cedar olive
#

some discord file has that .gif regex in it

gentle jay
cedar olive
#

we just select the one that does to then apply the patches on it

gentle jay
#

yeah

cedar olive
#

find only exists to make it more efficient

gentle jay
#

know I understand

#

its just that my mistake confused me even more

cedar olive
#

it's way faster to check for strings than run a regex on every file

#

yeye

gentle jay
#

its all g now, thanks for explanation

green vessel
#

can someone help me with this? i want to round this controls but its getting gray background that i dont wanna have

#

ok i find it its ```css
.panels-3wFtMD {
-webkit-box-flex: 0;
-ms-flex: 0 0 auto;
flex: 0 0 auto;
/* background-color: var(--background-secondary-alt); */
z-index: 1;
}

dire fern
shrewd tundraBOT
shrewd tundraBOT
#

owo

twin phoenix
#

THAT BOT IS UGLY

#

It just says

#

OWO

cedar marsh
#

No

#

It's based

shrewd tundraBOT
#

owo

oblique lark
#

venbot W

dire horizon
#

How do I find users by id?

oblique lark
#

you can use Vencord.Util.openUserProfile(id) in the console or send <@[id]> to get a clickable mention

austere mauve
#

invalid user jumpscare

viral roost
#

the ValidUser plugin in question:

dire horizon
#

How do i get the banner url from users in code?

dull magnet
#

look at other plugins that do the same

blissful reef
#

Currently I have disabled the "Active Now" column with CSS which hides completely all my contacts' activities. However, it seems that 5 years ago it was possible to hide contacts' activities on a per-user basis: https://www.reddit.com/r/discordapp/comments/ak51tb/is_there_a_way_to_turn_off_game_history_of/. Is it a feature that I could bring back with programming? Not sure how to get started with that.

Reddit

Explore this post and more from the discordapp community

hybrid dune
blissful reef
#

Woah, that's a fast response 😮 Testing it right away, tysm!!

#

Perfect, it did the trick!! Thank you so much for this code snippet, it's going to improve my Discord quality of life significantly 😄 Much appreciated!

dire fern
#

salternator more like cssdestroyer

shrewd tundraBOT
#

owo

dull magnet
#

it errors here as well

#

this is so confusing

dull magnet
#

FUCK YOUUU

dull magnet
#

i love having to monkey patch globals

green vessel
#

/unban

grand haven
#

any plugins to disable webp's until discord updates chromium?

#

c:

wooden dragon
#

is anyon here a rust pro who could help me pwease?

wooden dragon
#

aware of this, but the scope kinda too large and keep it in dms

#

don't wanna post a huge code wall

covert nimbus
#

just do it™️

dull magnet
#

and in what contexts disable

#

vulnerability how

#

oh yeah I just found this

#

Vesktop has recent enough chromium

#

no?

#

yeah ofc

grand haven
#

discord is 2x.x.12

#

and it needs .24

dull magnet
#

just use vesktop :3

grand haven
#

its meh

dull magnet
#

why

#

is it even exploitable in discord

grand haven
#

the titlebar implementation is lazy as fuck and looks ugly to me

grand haven
#

I couldn't find any specific implementation details as to how the vuln is executed

#

from what i understand is a webp just needs to be loaded

#

which means you should be safe as long as you dont click on any images to open them in the full preview

grand haven
#

but again, i could find very little details as to how the exploit works

dull magnet
#

preview would also use webp

grand haven
grand haven
#

and the exploit is in the huffman tree compression

dull magnet
#

we have discords native titlebar

dull magnet
#

it's opt in and that screenshot is ancient

#

discords titlebar sucks so i don't get why people like it but I ported it

grand haven
#

oh it does defo

#

but not as much as windows's titlebar sucks

#

so you know, pick the less sucky

dull magnet
#

i prefer the windows native one

#

issues of the discord one are that snapping to maximise isn't consistent and it doesn't show while discord is loading

#

the windows one works better in terms of functionality

grand haven
#

like i did before GM died

dull magnet
grand haven
#

yeh, the extension

#

i meant a plugin for vencord

dull magnet
#

ohhh

grand haven
#

ya get me, get me?

dull magnet
#

yeah then it works

grand haven
#

its like a 4/10 idea at best

#

but i like PWA's

dull magnet
grand haven
#

yeh already was looke-ing

#

the issue is the manifest

dull magnet
#

PWAs are pretty cool yeah

grand haven
#

cuz it might not be possible to modify the CSP and headers in the way i need it for the extensions v2 chrome did

dull magnet
#

huh

#

vencord has manifest for that already

#

it removes csp

grand haven
#

last time i did:


const manifest = {
  name: 'Discord',
  short_name: 'Discord',
  start_url: 'https://discord.com/channels/@me', // URL when PWA launches
  display: 'fullscreen',
  display_override: ['window-controls-overlay'],
  lang: 'en-US',
  background_color: '#202225',
  theme_color: '#202225',
  scope: 'https://discord.com', // scope of all possible URL's
  description: 'Imagine a place...',
  orientation: 'landscape',
  icons: [
    {
      src: ''
      sizes: '256x256',
      type: 'image/png'
    }
  ]
}

const url = URL.createObjectURL(new Blob([JSON.stringify(manifest)], { type: 'application/json' }))

this.manifest = document.createElement('link')
this.manifest.rel = 'manifest'
this.manifest.href = url
document.head.prepend(this.manifest)
grand haven
#

GM didnt want to do it iirc

dull magnet
#

removing csp is kinda bad for security but it is what it is

#

i mean vencord doesn't need to remove csp but then some features won't work and users cry

grand haven
#

the main issue with PWA discord is the screenshare

dull magnet
#

cause limited to 720p 30fps?

#

or doesn't work at all

#

oh yeah

#

Vesktop also has patches for that

#

it took me hours to find out how to do it

grand haven
#

same

#

this was GM days tho

#

now its like x10 harder to do

dull magnet
grand haven
#

there was that PR for the screenshare plugin

#

never got merged tho

grand haven
#

ah u still use electrons picker

#

so it would need to be re-written anyways

#

shame

dull magnet
#

yes

#

it's specifically for vesktop

#

but it could be rewritten for web

grand haven
#

I'd do it if i had the time haha

dull magnet
#

you just need to remove the screen picker and rely entirely on getUserMedia

dull magnet
#

I personally don't use it in the browser

#

most web plugins i only made cause they are also used in vesktop

#

since vesktop is just discord web with extra stuff

grand haven
#

well

#

almost

dull magnet
#

a lot of the web plugins are kinda cursed cause we just reactivate their desktop code (discord does not know how to codesplit) and then replace all references to desktlp only things like DiscordNative

grand haven
#

I like to PWA discord because of well... the PWA benefits, shared http and media cache between websites, less processes etc

dull magnet
#

what benefits does it have

grand haven
#

oh bro im writing a paper on this shit

#

so this convo is long

#

but TLDR a lot of shared internal processes

#

so in theory less memory usage

#

in practice we're talking about discord XD

#

and shared caches is simple, if you load something on discord, the same media is then cached for whatever headers specified it for, so if you re-open it in something else it doesnt need to re-download

#

its small, we're talking like a second of saved time most, but its nice UX

#

especially if your other media apps on your PC are also PWA's

#

because you're critically unhinged like me

dull magnet
grand haven
#

i'm fairly sure i'm gonna add mkv support to firefox and safari before they add it

dull magnet
#

i like that u added that last part

grand haven
#

nope

#

only chrome does

dull magnet
#

oh huh

grand haven
#

so what did i do?

dull magnet
#

I didnt know that

#

now add opus support to chrome

grand haven
#

it supports opus tho

grand haven
#

which means you can fully stream mkv files, with no upper filesize limits 🙂

#

well "I"

#

the mp4 encoding is done by a friend of mine

#

im doing the EBML and MSE shit

grand haven
#

tho this is a bit inaccurate because chrome actually supports AC3 EAC3 and DTS, but only on specific devices and profiles like chromecast and limited android devices

dull magnet
#

not decode

grand haven
dull magnet
#

chrome can't record opus

#

I want to be able to record opus audio

#

but it doesn't support it

dull magnet
#

couldn't u use ffmpeg wasm or smth

grand haven
dull magnet
#

that's what I'd try

dull magnet
grand haven
#

my limit is ~20TB

#

🙂

#

also ffmpeg couldnt stream it

#

i can

dull magnet
#

oh i see

grand haven
#

with ffmpeg you'd need to first DL all of it, then re-encode the entire video

#

and then u can play

dull magnet
grand haven
#

with my solution its instant streaming

grand haven
#

haha

#

no.

dull magnet
#

webm voice messages don't play on ios

#

wdym no

grand haven
#

fuck that shit bro

dull magnet
#

but kinda meh

#

it should really just have native oggopus support

grand haven
#

web codecs do support opus tho

grand haven
#

thats media recoder

#

not web codec

dull magnet
#

yes I need media recorder

grand haven
grand haven
#

is what you mean

dull magnet
#

idk what it is

grand haven
#

but abstracted in js

#

with codecs and containers limited to what the browser supports

dull magnet
#

oh it's just very low level video and audio stuff

#

oh also experimental and not supported in furry browser

grand haven
#

i mean

dull magnet
#

nor safari

grand haven
#

if you use furry browser thats on you

#

i mean if you use safari thats on you

dull magnet
#

it's still a pretty large part of the userbase you can't just say sorry guys not supported

grand haven
#

i mean

#

does it matter

#

vesktop is chrome anyways

#

discord is chrome anyways

dull magnet
#

yes but this code also runs in the extension

#

which supports all* browsers

grand haven
#

XD

#

i personally hate web codecs

dull magnet
#

so i might give it a try and if it works I'll add it with a fallback to the old code for browsers that don't support it

#

thanks for pointing it out stalalaNotes

dull magnet
#

first time im learning about this feature

#

probably cause its experimental and not well supported so people don't talk about it often

grand haven
#

wait till you learn that u can use service workers to create a nodejs-like http server in browser

#

x)

dull magnet
#

there are so many cool new browser apis that are basically "unusable" cause they don't have great support

dull magnet
#

compression streams for example

#

:has until recently

#

Firefox soooo slow

grand haven
#

for zipping

#

and unzipping

dull magnet
#

compression streams are cool yeah

#

we just bundle fflate into vencord

#

it's like 10kb

grand haven
dull magnet
#

are they tho

grand haven
#

"compression streams"

#

read that again....

#

slowly....

#

anything web streams is slow

dull magnet
#

simply make them faster

#

?

#

yes

#

elaborate

grand haven
#

HOW

#

how do you elaborate more than that?!

dull magnet
#

why do you think it's bad, what would you do instead, etc

#

that's how you elaborate

dull magnet
#

also you should talk to lewi who wrote that code

#

sending deflated might just be to save work on the server

#

cloud sync has some other issues anyway

#

sometimes when you enable a plugin and immediately restart it disables the plugin again

grand haven
#

again

#

just bencode

#

marginally better than json

dull magnet
#

this i don't get, shouldn't compression basically nullify this

grand haven
#

compression has intiial overhead

#

if ur data is small enough compression will make it bigger

#

x)

dull magnet
#

wel ofc

dull magnet
#

real ones simply don't use compression ever

#

i use vpak instead of zip

grand haven
#

compression? just buy a bigger drive

dull magnet
#

whar

#

how do less indents = bigger size

dull magnet
#

so that's not an issue

#

why

grand haven
#

the fuck

#

is setting sync

#

KB

#

????????????????

#

bro if that shit is over 1kb you're doing smth wrong

dull magnet
#

cause it contains settings for every single plugin including whether they are enabled or not

grand haven
#

DO BENCODE

oblique lark
#

magic

dull magnet
#

anyway it contains all possible settings for all ~140 plugins

grand haven
#

even... disabled ones?

dull magnet
#

yeah

grand haven
#

nooo

#

nitro strickers broke

dull magnet
#

it initialises all settings deliberately

grand haven
#

cant send skull sticker

dull magnet
#

it's so you can edit settings json easily if you're into that for some reason

#

and there's no reason not to

grand haven
#

oh also

#

if u want more video codecs in vensktop

dull magnet
#

just open ur settings.json and you'll see

grand haven
#

use my custom build of electron

dull magnet
#

cursed

#

your pc loves you

grand haven
#

y?

#

cuz everything on it is custom made by me? XD

proud cargo
#

i use arch btw

grand haven
grand haven
# proud cargo i use arch btw

i enjoy playing games and not spending 10 hours a day fixing network and config issues so i simply use windows 🙂

proud cargo
#

oh.

grand haven
#

LTSC IoT ofc

#

because any other version simply is unusable

dull magnet
#

🥴

grand haven
#

if you dont use CI for compiling chromium

#

then you're fucking unhinged

#

and that comes from some1 as unhinged as me

dull magnet
#

oh fair

#

how do you test your changes

#

make change
push to github
wait 10 hours
uh oh you forgot something
repeat

#

nah its probably way better with build cache but god idk how people work on shit that takes this long to compile

grand haven
#

simply use mold for linking

#

so linking goes down to like 2 hours

#

and then recompiling is like 5 minutes

#

its not bad at all

#

needs ssd tho

#

meanwhile my subtitle rendering library for browsers takes 30 minutes to build

dull magnet
#

why so long

#

what is it in

grand haven
#

C

#

so WASM

dull magnet
#

do you like embed the subtitles into the video data

grand haven
#

no lol

#

that's way too slow

#

and not streamable

dull magnet
#

then what

grand haven
#

build image data, paint it on canvas

dull magnet
#

so why do you need C for that

#

can't you do that with raw js

#

maybe with a worker

grand haven
#

because it would take me 2 years to write a renderer thats spec compatible

dull magnet
#

ah, do you just use a library

grand haven
#

thats like saying "oh just re-write vulkan in js"

dull magnet
#

i mean... drawing text on an image is easy enough

grand haven
#

HAHA

#

HAHAHAH

dull magnet
#

idk what sort of features subtitles have tho

grand haven
#

GAGAG

dull magnet
#

what's so funny

grand haven
#

he doesnt know

#

here

#

try not to crash ur phone tho

#

~20GB of subtitle image data rendered per second there btw

dull magnet
#

ah cause you have to be able to write to things in the video too

proud cargo
dull magnet
#

it doesn't lag

#

please fix

grand haven
#

rotate Ur phone 😉

grand haven
dull magnet
#

it doesn't crash or lag

#

just the video is kinda laggy

proud cargo
#

negative fps ASlaugh

grand haven
#

that's the subtitles

#

not video

dull magnet
#

lol how did it get negative fps lmao

#

I think it doesn't like being backgrounded

grand haven
#

it does 1/timedifferencefromlastframe

#

so if you loop the video it goes negative

dull magnet
#

anyway reimplement it in js :3

grand haven
#

go commit die!

dull magnet
#

mean

#

banned

grand haven
#

anyways

#

that lib is batshit crazy

oblique lark
grand haven
#

it supports SIMD enabled CPUs, non SIMD enabled CPUs, and engines which dont even have WASM

#

all in a single worker

grand haven
#

the painting logic is insane

#

all the wasm does is output uint8data

dull magnet
grand haven
#

then actually displaying that in a very fast way without lagging the browser

#

is just insane

dull magnet
#

what uint8data

#

image data? what format?

grand haven
#

the wasm lib only exposes pointers in memory to bitmaps, from that single color bitmap i need to construct a single RGB image, then paint it on a canvas

#

and when you have say, 300 1080p bitmaps per frame

#

which comes out to like what...

#

622_080_000 bytes

dull magnet
#

why 300

#

wouldn't 24 be enough

grand haven
#

a single bitmap

#

is a single color

#

so if a single scene has say 2 gradients

#

all of a sudden

#

thats gonna be 300 different colors

#

thats what happens in the video i linked

grand haven
dull magnet
#

why does it do it that way

grand haven
#

thats what generated by the WASM

dull magnet
#

goofy ahh

grand haven
#

then *4 that to convert it to RGBA

grand haven
#

but yeah

grand haven
#

so you do a

#
const read_ = (url, ab) => {
  const xhr = new XMLHttpRequest()
  xhr.open('GET', url, false)
  xhr.responseType = ab ? 'arraybuffer' : 'text'
  xhr.send(null)
  return xhr.response
}

try {
  const module = new WebAssembly.Module(Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00))
  if (!(module instanceof WebAssembly.Module) || !(new WebAssembly.Instance(module) instanceof WebAssembly.Instance)) throw new Error('WASM not supported')
} catch (e) {
  console.warn(e)
  // load WASM2JS code if WASM is unsupported
  // eslint-disable-next-line no-eval
  eval(read_(data.legacyWasmUrl))
}
dull magnet
#

wouldn't that have horrible performance

#

way worse than normal js

grand haven
#

like 40% slower than WASM?

#

which in itself is like 40% slower than native?

#

do you really care?

#

if your CPU/browser doesnt support wasm, even if running in wasm, you wouldnt get good perf anyways

#

so at most you'll be rendering only basic subtitles

#

and with this my browser coverage is 99.9%

grand haven
# dull magnet way worse than normal js

the WASM itself is likely slower than normal JS, but noone is crazy enough to rewrite a 3d rendering library in another language while keeping it 1:1 compatible

dull magnet
#

fair

#

simply be the crazy one

#

crazy? I was crazy once

grand haven
grand haven
#

the entire lib is like what.... 10MB?

#

8?

#

cuz i have 2 WASM workers, one with SIMD and one without

dull magnet
grand haven
#

and then the fake wasmjs worker

#

i dont recommend trying to compile wasm with SIMD

#

you'll fucking go insane

dull magnet
#

I never compiled wasm in my life lolol

trail ginkgo
#

what are these subtitles holy shit

#

these are not subtitles

#

these are like overlays

grand haven
grand haven
#

they are for translating shit like signs, text etc

#

they arent captions

#

they are subtitles 🙂

#

vtt is simple captions

#

if you want to support non-vtt subtitles in browser, jassub is pretty much the best way nowdays

#

thats how my app renders all subtitles known to man

trail ginkgo
#

damn they turned subtitles into insane

dull magnet
grand haven
dull magnet
trail ginkgo
#

it looks like google translate camera

dull magnet
#

but it'd be easier and acceptable to me personally to just include such info in the normal subtitles

#

ig for bigger things like letters it's meh

grand haven
trail ginkgo
#

good

dull magnet
#

it does

dull magnet
#

yeah that

dull magnet
grand haven
#

i bet you wont realise that the ||absolute demonic font: babylonia|| text is even a subtitle the first time u watch it

trail ginkgo
#

i only noticed cus the movement was off

#

but yea htats insane

dull magnet
grand haven
#

on chrome its frame perfect

trail ginkgo
#

chrome

grand haven
#

wtf

#

bro i'm rendering this at 4k without dropping a single frame

trail ginkgo
#

its not that off

trail ginkgo
#

i just have a good eye

grand haven
#

you just have a shit cpu XD

trail ginkgo
#

dropped frames: 0

grand haven
#

thats video frames

#

not subtitle frames

#

the subtitle rendering is async

#

so it in itself doesnt have a concept of dropped frames

#

sicne it doesnt actually have a playback state

trail ginkgo
#

oh nice

#

probably cpu then yea

#

this subtitle format is cool

#

is this the format that youtube supports

grand haven
#

nope

#

yt has vtt

#

lol

trail ginkgo
#

it has more than vtt i think

grand haven
#

not anymore

#

they had their own custom overlay stuff

#

but they dropepd it

trail ginkgo
#

they had something that a friend of mine used to make twitch chat as subtitles

#

ohh i think its realtext

#

a lot simpler than ass lol

grand haven
#

some1 did try making ASS inside css/js but its honestly not doing that good

minor jolt
#

Anybody have any idea how I would go about setting the "Playing" status ? The "RunningGame" store (or something along those lines) didn't have any helpful methods for manipulating that

#

And the events it fires when I open a game didn't do the trick either

dull magnet
#

look at other plugins doing it

minor jolt
#

Oh there's a plugin that does it ?

#

Ignore activities maybe let's see

proud cargo
proud cargo
#

maybe to make it clear that its a bitfield?

dull magnet
grand haven
#

not internal?

dull magnet
#

no

grand haven
#

cuz i cant seem to get it to work D:

dull magnet
#

only internal

grand haven
#

br0

dull magnet
#

watching is only for like discord streams and maybe more

proud cargo
#

huh? i thought premid used to do it for youtube

#

or was that playing

minor jolt
dull magnet
#

you need to make a companion plugin to use all types

dull magnet
minor jolt
#

Just to be clear I don't care about rich presence just a simple "playing" status

#

The old type

dull magnet
#

what do u wanna do

dull magnet
# grand haven btw can u do watching status with external RPC?

we used to have a companion plugin for cider that would change the activity type to listening

but it was removed because it was too niche and also some concerns about cider

a good way to bring it back would be to make a generic plugin that lets you override presence type for arbitrary presences

#

something like you provide an app id and the type you want that app to be overwritten to

grand haven
#

or remove sanitisation from the rpc in the client?

dull magnet
#

i honestly don't exactly know how it even works

#

i never read that code

#

you could do that too maybe

trail ginkgo
#

i looked at it recently for gameshigeon because i didnt realize there was a simple flux event for it lol

dull magnet
#

lmao

trail ginkgo
#

its not very sane i never want to see it again

minor jolt
# dull magnet what do u wanna do

I have a plugin for the steam deck that runs web discord+vencord in a separate tab on the steam deck and allows ya to open it quickly and offers some remote control from the quick access for muting/leaving vc + notification pop ups in game mode

#

And I wanna add this functionality to get what game you're playing and show it as playing status

trail ginkgo
#

thats neat

minor jolt
#

I'll probably put it on the testing store tonight

dull magnet
#

do u use decky

#

aagamer reference

minor jolt
#

Yes I'm one of the original developers of decky lol

dull magnet
#

ohhh

#

i see

#

ur github pfp is cute

#

no way ur status is hating javascript

#

do u prefer python 😭

grand haven
dull magnet
#

okay but it's gonna be way faster on desktop hardware

#

actions sloow

trail ginkgo
#

I LOVE YOU

potent fox
#

aagamer working with great people

pure temple
#

JavaScript is a great language

console.log(typeof(document.all));
console.log(document.all);
dull magnet
#

whar

austere mauve
#

typeof document.all === "undefined" && document.all !== undefined

#

its an htmlcollection

dull magnet
pure temple
#

oops, typeof is an operator and not a function it seems

dull magnet
#

yes

#

but u can call it as function

pure temple
#

well

#

it's more the case that you are calling it with an expression wrapped in parentheses?

dull magnet
oblique lark
#

WHY IS THE DOCUMENT FALSY

silk sorrel
#

why 💀

minor jolt
wild crystal
#

discord uses chromium 91.0 does it not

#

technically canary would be 98 bc electron 17 but yea

dull magnet
#

discord has been on electron 22 for ages now

minor jolt
#

hmm sessions_replace seems to show me a playing status, but others can't see it

#

that's with "all" as sessionid

#

also opening discord on phone seems to remove it

minor jolt
#

Man this is impossible I tell ya, I fire all the events that go to the flux dispatcher

#

But none of them will set the damned status

clear parcel
#

the all session is supposed to represent your overall presence as shown to others

#

if it's even there bleh

wooden dragon
#

yippee I wrote a >200kb lexer in rust without using any allocations

minor jolt
#

Yea but for some reason it doesn't propagate to other devices if I just dispatch the event on the flux dispatcher. Like it doesn't fire through the websocket, so the other devices never receive it, so when they push their own state replace it just overwrites it, and removes the status

#

And it's not visible to anyone else

#

Not sure how discord does it under the hood

#

How it remote syncs the states

#

I guess maybe I could fire the websocket event directly ? Not sure if vencord has any provisions for this

minor jolt
#

I wonder how discord does it under the hood

#

When discord does it itself, I think the mobile devices on the session list also return the same activities

#

Not sure though

proud cargo
minor jolt
#

Yes I can fire it there, and it does cause an activity to show for me on my profile but noone else can see it

#

And if I open discord on phone it disappears on pc

proud cargo
#

dispatch is not what gets sent through ws

#

you can only receive sessions replace on ws

minor jolt
#

Hmmm, so it doesn't sync remote if it gets session replace on the flux dispatcher

#

So how do I make it fire in the WS ?

proud cargo
#

its a layer of abstraction over ws

#

you do not want to use raw ws

minor jolt
#

I'll give it a try when I get home

#

Again I don't want rich presence, I don't want to create an application and I don't want it to say "Playing {application name}"

#

I just want a simple non-rich "Playing {thing}" status

chrome elbow
#

then give it only the name

clear parcel
#

you're looking for the update presence op

dull magnet
#

most flux dispatches only have local effect

#

like the gateway gets sent some event and then dispatches it to update local stuff

#

only very few flux dispatches actually do a request

proud cargo
minor jolt
#

I kneel

minor jolt
#

Btw can I use the createActivity and setRPC methods directly from Vencord.Plugins somehow or should I just reimplement

wispy night
#

anyone know how to jump to a message? i tried changing the window href, but it just restarts discord

minor jolt
#

works great, another functionality done

#

a last thing i want to do now, is to add a button for posting the last steam screenshot

ember crag
#

i cannot find this

#

wait

chrome elbow
ember crag
#

oh

#

i was confuned cos it was a google extension

#

what is the function name for setting a nnickname

#

ok then

#

im confuse

#

how do i set a breakpoint

#

if i edit this to include debugger and then save it discord crashes

#

wait im not sure if it crashes

#

i think it just takes like 200 years to load it

cedar olive
#

click the {} button in the bottom left to prettify

tropic yew
ember crag
dull magnet
#

or better yet go into devtools settings > experimental > always pretty print

dire fern
ember crag
junior cove
#

DevilBro works for Discord?

pure temple
#

yes

viral roost
#

yeah he got hired recently

dire fern
#

this is why they changed usernames

tropic yew
minor jolt
#

once i have a function pinned down on the debugger and extracted via breakpoint how do i go about finding it via findByProps or findByCode ?

pure temple
#

you just need to find a unique string in the function

dull magnet
#

check the exports of the module it's in

#

and write a filter for them

#

assuming the func is even exported

minor jolt
#

it's this one

#

and the one below it _createMessage

#

nvm i guess ill just do it how the VoiceMessage plugin does it

#

oh it even has a filter for CloudUpload

#

based

#

i should start consulting the existing plugins more lmao

nocturne dragon
#

@dull magnet hiiii how would I open discord settings page programmatically?

#

I mean in Vesktop

#

I'm adding some macOS menu bar support

dull magnet
#

check out other code that does

#

like notifications

nocturne dragon
#

couldn't find any

nocturne dragon
dull magnet
#

index.ts

#

Vencord.ts actually

nocturne dragon
#

this works fine but it's giving me an error when building

amber basin
#

how are u building

nocturne dragon
#

pnpm build --dev

amber basin
#

oh is that vesktop

nocturne dragon
#

I'm in Vesktop, not Vencord

amber basin
#

you need to install dependencies

nocturne dragon
#

I did

amber basin
#

show the output of the install command

nocturne dragon
amber basin
#

because

#

is @vencord in your node_modules

nocturne dragon
#

hm I'm importing types only

#

maybe it's because of that?

amber basin
#

send code

amber basin
#

i thought u were building without any changes awa

#

no i mean full file

nocturne dragon
#

import { SettingsRouter } from "@vencord/types/webpack/common";

#

hm okay

nocturne dragon
nocturne dragon
#

hold on

amber basin
dull magnet
amber basin
#

oh nvm

dull magnet
#

mainWindow is main process

#

it doesn't have access to renderer

#

you can only use webpack stuff in the renderer

nocturne dragon
#

well I need to bind a click listener in the menu bar that opens settings

dull magnet
#

the proper way would be to use electron IPC but that's very ugly

#

so I recommend just evaling script in the renderer

nocturne dragon
#

very guh

#

but works fine

dull magnet
#

like this

#

you can just executeJavascript("Vencord.Webpack.Common.SettingsRouter.blah()")

nocturne dragon
#

javascript can gargle my nuts

dull magnet
nocturne dragon
#

vendy loves

dull magnet
#

why not just use the ctrl , shortcut

#

instead of menu item

amber basin
#

it fits with other macos app standards

nocturne dragon
#

macOS apps have settings in the menu bar

#

I'm just aligning it with other apps

nocturne dragon
dull magnet
#

the shortcut already exists without that tho

nocturne dragon
#

ven

#

I am merely adding the entry to the menu bar

#

and only on macOS

dull magnet
#

im just confused :p

nocturne dragon
#

well I'm just saying that other macOS apps have the settings entry in the menu bar and I'm updating vesktop to follow that guideline

#

either way executeJavascript worked

dull magnet
nocturne dragon
#

@dull magnet you will review NOW

oblique lark
#
pub fn turn_left(&mut self) {
    std::mem::swap(&mut self.0, &mut self.1);
    self.1 *= -1;
}

least overengineered rust code

austere mauve
#

mem::swap goes hard

#

but ints are copy

#

no reason to

minor jolt
#

Anyone have any idea as to why the googleapis request for attachment upload might be returning 404 ?

#

Maybe a header issue ?

#

The same url when ran in aiohttp returns 404, but when I run the put request on curl (with no headers) it returns 200

real hollow
#

Heyo. I wanted to try to make a patch to the BlurNSFW plugin so that you have a Setting to only enbale the blurring when the Streamer Mode is enabled. I already tried to analyze the source code via the React Dev Tools what happens when enabling the "Streamer Mode" setting to understand which property to check for in the plugin but I honestly have no clue what happens and where I can find out if the streamer mode is currently engaged or not. Do you have some Ideas how to solve this problem?

oblique lark
wooden dragon
#

oh

proud cargo
#

*counterclockwise

oblique lark
#

*widdershins

silk sorrel
real hollow
#

I'll do. Thank you very much!

inner pendant
#

This is a bit off topic but I have been trying to make Vencord work with my JS injector or my unblocking site and well it’s not working if you want to view what I have so far here’s my script it’s based on the user script: https://cdn.z1g-project.repl.co/sodium/plugins/vencord.js

#

I can upload console logs on just not on my pc rn

pure temple
#

although, I would have to check other options

stuck falcon
#

funny macro™️

wooden dragon
#

Should I use a Vec, or HashSet for generating an AST node for enums, I mean the enum Variants

pure temple
stuck falcon
#

nop

stuck falcon
#

I'm doing research

#

it's the bad stack omgggg😲⚡

wooden dragon
#

depends if you want it on the heap or stack

topaz crest
#
print("🧀")
#

such complex

stuck falcon
#

I made the most basic implementation of a Linked List

wooden dragon
#

this looks like some Ruby addict wrote this

stuck falcon
#

It isn't necessarily the worst in the world but it could get better

#

I love micro-optimizations

austere mauve
#

you make an enum

#

n if it has children u use a vec in the variant

dull magnet
#

RUST TALK

wooden dragon
dull magnet
#

HORROR

wooden dragon
stuck falcon
#

perhaps

wooden dragon
stuck falcon
#

I will read through everything first

stuck falcon
#

RUST IS AMAZING

wooden dragon
austere mauve
#

whar

#

u work with the enum

#

its ur ast

wooden dragon
#

Yeah but I have to parse the fields and put them into a growable container

#

rn I use Vec

austere mauve
#

what the hell are you cooking

wooden dragon
#

I just dunno which is better cuz the rust docs confuse me

wooden dragon
#

custom toy lang

#

me so stupid

#

I couldn't even use a HashSet

dull magnet