#🪅-progaming

1 messages · Page 27 of 1

valid jetty
#

is this a cursed way to do it

local fn __internal_to_string<T, U>(i64 args, string fmt) {
    T arg = args.yield(U);

    i32 length = io::snprintf(nil, 0, fmt, arg);
    string res = (string)malloc(length);
    io::sprintf(res, fmt, arg);

    return res;
}

if ty.contains("*") {
    return __internal_to_string<i64>(args, "%p");
}

if ty.starts_with("i8") {
    return __internal_to_string<i8, i8>(args, "%d");
}

if ty.starts_with("i16") {
    return __internal_to_string<i16, i16>(args, "%d");
}

if ty.starts_with("i32") {
    return __internal_to_string<i32, i32>(args, "%d");
}

if ty.starts_with("i64") {
    return __internal_to_string<i64, i64>(args, "%ld");
}

if ty.starts_with("u8") {
    return __internal_to_string_split<i32, u8>(args, "%u");
}

if ty.starts_with("u16") {
    return __internal_to_string_split<i32, u16>(args, "%u");
}

if ty.starts_with("u32") {
    return __internal_to_string_split<i32, u32>(args, "%u");
}

if ty.starts_with("u64") {
    return __internal_to_string_split<i64, u64>(args, "%lu");
}

if ty.starts_with("f32") {
    return __internal_to_string_split<f64, f32>(args, "%f");
}

if ty.starts_with("f64") {
    return __internal_to_string<f64, f64>(args, "%f");
}

// ...
``` runtime primitive type to string
#

struct formats are made from primitive formats so

warped jackal
#
.headerContainer_e5a9ed {
    display: none;
}

removes this shit

#

useless discord bloat number 731

valid jetty
#

wouldnt it be better to make a wildcard match

#
[class*="headerContainer_"] {
    display: none;
}
#

that id will probably change throughout versions

viscid grove
#

well the id doesn't change very often
also i think that disappeared for me

#

i did have it but not any more

#

oh wait

#

i think you can just right click it and there's an option to turn it off

valid jetty
#

previously if you had an i32* that was invalid it would just segfault

viscid grove
valid jetty
#

this would segfault previously

#

because the formatter of __ptr__ recursively calls the formatter of the inner element

#

if the pointer is invalid it segfaults

#

i solved by making a check to see if its 0 or its not divisible by the width of the pointer

valid jetty
#

im thinking of doing something like this lol

use std/io;

struct ElleContext {
    fn(i32) -> void *global_allocator;
};

fn _main(i32 argc, string *argv) {
    Region *allocator = Region::new();
    defer allocator.clean();
    defer allocator.free();

    ElleContext __ctx__ = {
        global_allocator = allocator.alloc
    };

    Array<string> *args = Array::new(&__ctx__);

    for i32 i = 0; i < argc; i += 1 {
        args.push(argv[i]);
    }

    i32 res = main(args, &__ctx__);
    return res;
}

fn generate_array(i32 size, ElleContext *__ctx__) {
    // `i32 *elements = new i32[10];` could be syntactic sugar
    i32 *elements = __ctx__.global_allocator(#size(i32) * size);
    return elements;
}

fn main(Array<string> *args, ElleContext *__ctx__) {
    Array<i32 *> *arr = Array::new(__ctx__);

    for i32 i: 0..10 {
        arr.push(generate_array(i + 1, __ctx__));
    }

    io::dbg(arr);
}
#

ElleContext would be passed around everywhere automatically by the compiler

#

you can then just allocate things as you please and free it all at the end

#

at least the stdlib can

deft ivy
#

Snow plugin blobenjoysnow

fleet cedar
#

Does it lag

deft ivy
#

No why?

valid jetty
#

pr it to vencord,,,

deft ivy
#

Yes

nimble bone
#

all i want for christmas is you…

median root
#

how do I tell my friend he should stop using ternaries. He told me to check his code (i taught him about ternary operators literally 2 weeks ago)

op === "add" ? (foodCount[2] > 0 && parseInt(getNumber("hunger")) < 10 ? (setText("foodCount-10", foodCount[2]-1), setText("hunger", Math.min(10, current+10))): foodCount[1] > 0 && parseInt(getNumber("hunger")) < 10 ? (setText("foodCount-5", foodCount[1]-1), setText("hunger", Math.min(10, current+5))): foodCount[0] > 0 && parseInt(getNumber("hunger")) < 10 ? (setText("foodCount-2", foodCount[0]-1), setText("hunger", Math.min(10, current+2))) : null) : op === "take" ? (setText("hunger", current-3), parseInt(getText("hunger")) < 1 ? end(time, "Hunger") : null) : null;
#

this is ONE snippet of his monolithic code

valid jetty
#

LMAO

fleet cedar
#

Looks fine to me

dawn ledge
#

js devs when they meet ternary

#

the react horrors

#

parseInt(getNumber("hunger"))
parseInt(getText("hunger"))

#

mmmyes

ivory heath
#

What does that do

dawn ledge
#

also shouldnt getNumber do parseInt or parseFloat automatically
a function named getNumber returning a non number sounds like bad code

dawn ledge
ivory heath
#

God has forsaken us

dawn ledge
#

lmao

median root
#

so idk

#

my friend just pasted the code in going "does this look ok?"

placid cape
solar thistle
viscid grove
#

just would need to find/make a gif

#

or possibly video file would work

cerulean plover
median root
#

i dont know what he will come across in the future

agile crane
#

how can i get the message id in response to which the command was called?

median root
median root
#

all it does is check the foodCount array if there is any food and attempts to feed the most suitable food

deft ivy
# viscid grove how'd you do that? you could do that with just css
import definePlugin from "@utils/types";

export default definePlugin({
    name: "SnowEffect",
    description: "Adds a beautiful snow animation to Discord's interface.",
    authors: [{ name: "Seth_las", id: 410028714869653515n }],

    start() {
        if (document.getElementById('snow-effect-canvas')) return;

        const canvas = document.createElement('canvas');
        canvas.id = 'snow-effect-canvas';
        canvas.style.position = 'fixed';
        canvas.style.top = '0';
        canvas.style.left = '0';
        canvas.style.pointerEvents = 'none';
        canvas.style.zIndex = '9999';
        document.body.appendChild(canvas);

        canvas.width = window.innerWidth;
        canvas.height = window.innerHeight;
        const ctx = canvas.getContext('2d');
        if (!ctx) {
            /*console.error("Unable to get 2D context of canvas.");*/
            return;
        }

        class Snowflake {
            x: number;
            y: number;
            size: number;
            speed: number;
            opacity: number;

            constructor() {
                this.x = Math.random() * canvas.width;
                this.y = Math.random() * canvas.height;
                this.size = Math.random() * 3 + 2;
                this.speed = Math.random() * 1 + 0.5;
                this.opacity = Math.random();
            }

            update() {
                this.y += this.speed;
                if (this.y > canvas.height) {
                    this.y = -this.size;
                    this.x = Math.random() * canvas.width;
                }
            }

            draw() {
                ctx.globalAlpha = this.opacity;
                ctx.beginPath();
                ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);
                ctx.fillStyle = '#FFFFFF';
                ctx.fill();
            }
        }

        const snowflakes: Snowflake[] = [];
        for (let i = 0; i < 100; i++) {
            snowflakes.push(new Snowflake());
        }

        let animationFrameId: number;
        let lastFrameTime = performance.now();

        function animate() {
            const now = performance.now();
            const delta = now - lastFrameTime;

            if (delta > 16) {
                lastFrameTime = now;
                ctx.clearRect(0, 0, canvas.width, canvas.height);

                snowflakes.forEach((flake) => {
                    flake.update();
                    flake.draw();
                });
            }

            animationFrameId = requestAnimationFrame(animate);
        }

        window.addEventListener('resize', resizeCanvas);

        function resizeCanvas() {
            canvas.width = window.innerWidth;
            canvas.height = window.innerHeight;
        }

        animate();

        (canvas as any)._animationFrameId = animationFrameId;
    },

    stop() {
        const canvas = document.getElementById('snow-effect-canvas');
        if (canvas) {
            const animationFrameId = (canvas as any)._animationFrameId;
            if (animationFrameId) cancelAnimationFrame(animationFrameId);
            canvas.remove();
        }

        window.removeEventListener('resize', () => {});
    }
});```
viscid grove
#

oh you're actually drawing those snow particles

deft ivy
viscid grove
#

i think it would be possible with just css though

fleet cedar
# median root how do I tell my friend he should stop using ternaries. He told me to check his ...

Here's that code written halfway readably ||```js
op === "add" ? (
foodCount[2] > 0 && parseInt(getNumber("hunger")) < 10 ? (
setText("foodCount-10", foodCount[2]-1),
setText("hunger", Math.min(10, current+10))
) : foodCount[1] > 0 && parseInt(getNumber("hunger")) < 10 ? (
setText("foodCount-5", foodCount[1]-1),
setText("hunger", Math.min(10, current+5))
) : foodCount[0] > 0 && parseInt(getNumber("hunger")) < 10 ? (
setText("foodCount-2", foodCount[0]-1),
setText("hunger", Math.min(10, current+2))
) : null
) : op === "take" ? (
setText("hunger", current-3),
parseInt(getText("hunger")) < 1 ? (
end(time, "Hunger")
) : null
) : null;

median root
#

I couldn't even paste the code into Claude to beautify it

fleet cedar
#

Why would you need a llm for that

median root
#

Saves me time going through it

#

And trying to figure out what everything does

balmy lintel
#

prettier in shambles

viscid grove
median root
#

There is none

median root
#

:O

fleet cedar
viscid grove
#

what
yeah?

median root
#

I've only ever written code for myself

viscid grove
#

with prettier

median root
#

Please please please tell me there's a neovim plugin for this

viscid grove
#

probably

#

i don't use neovim

#

i like being able to use a mouse

median root
#

I've just started migrating off vscode

#

Don't pull me back into it 😭

viscid grove
median root
viscid grove
#

oh you can?

median root
#

I can yeah

viscid grove
#

i thought vim was keyboard only

#

(i've never tried vim/neovim)

median root
#

Oh?

#

Plugins really do make it better tho

viscid grove
median root
#

Well there's some work for a Friday night

fleet cedar
#

You can use mouse in n/vim but I don't like it

median root
#

Is it just the jank or?

median root
fleet cedar
#

Mouse in terminal is janky yeah

median root
#

Yeah can't really fix the jank

viscid grove
#

also isn't the whole reason for using vim/neovim to not ever use your mouse because it's "slow"

median root
#

Well it takes a bit of experience to get to that point

fleet cedar
#

I would hardly say the whole reason, but one part of it

median root
#

You have to get command mode insert mode and visual mode and most of the functions there to match the efficency of the mouse

#

Oh and normal mode

#

Also it is quite the transition

#

It goes from ctrl a to highlight all to escape ggVG to highlight all

#

"+y to copy to clipboard

#

I haven't gotten around to changing these yet

fleet cedar
#

Change them to what

median root
#

Ctrl a and ctrl c

#

With so many keys it is less efficient for such commonly used functions

fleet cedar
#

But I like incrementing numbers

median root
#

Fr?

#

I think incrementing numbers should be done by my subconscious

deft ivy
viscid grove
#

(yours looks way better)

deft ivy
#

i have create sleigh animation too 🛷

deft ivy
#
import definePlugin from "@utils/types";

export default definePlugin({
    name: "SleighEffect",
    description: "Adds a beautiful sleigh animation to Discord's interface with falling gifts on hover.",
    authors: [{ name: "Seth_las", id: 410028714869653515n }],

    start() {
        console.log("[SantaSleigh] Plugin activé !");
        this.addSleigh();
        setInterval(() => this.addSleigh(), 10 * 60 * 1000);
    },

    stop() {
        console.log("[SantaSleigh] Plugin désactivé !");
        const sleigh = document.getElementById("santa-sleigh");
        if (sleigh) sleigh.remove();
    },

    addSleigh() {
        const sleighId = "santa-sleigh";
        const cooldownTime = 2000;
        let lastGiftTime = 0;

        const oldSleigh = document.getElementById(sleighId);
        if (oldSleigh) oldSleigh.remove();

        const sleigh = document.createElement("div");
        sleigh.id = sleighId;
        sleigh.style.position = "fixed";
        sleigh.style.top = "100px";
        sleigh.style.left = "-200px";
        /*sleigh.style.pointerEvents = "none";*/
        sleigh.style.zIndex = "9999";
        sleigh.style.width = "200px";
        sleigh.style.height = "100px";
        sleigh.style.backgroundImage = "url('https://www.pngall.com/wp-content/uploads/5/Santa-Sleigh-PNG.png')";
        sleigh.style.backgroundSize = "contain";
        sleigh.style.backgroundRepeat = "no-repeat";
        document.body.appendChild(sleigh);

        let position = -200;
        const interval = setInterval(() => {
            position += 10;
            sleigh.style.left = `${position}px`;

            if (position > window.innerWidth) {
                clearInterval(interval);
                sleigh.remove();
            }
        }, 50);

        sleigh.addEventListener("mouseenter", (event) => {
            const currentTime = Date.now();
            if (currentTime - lastGiftTime >= cooldownTime) {
                this.createFallingGifts();
                lastGiftTime = currentTime;
            }
        });
    },

    createFallingGifts() {
        const giftCount = 20;

        for (let i = 0; i < giftCount; i++) {
            const gift = document.createElement("div");
            gift.style.position = "absolute";
            gift.style.left = `${Math.random() * window.innerWidth}px`;
            gift.style.top = `-${Math.random() * 100}px`;
            gift.style.width = "30px";
            gift.style.height = "30px";
            gift.style.backgroundImage = "url('https://www.pngall.com/wp-content/uploads/2016/03/Gift.png')";
            gift.style.backgroundSize = "contain";
            gift.style.backgroundRepeat = "no-repeat";
            gift.style.zIndex = "9999";
            gift.style.pointerEvents = "none";
            document.body.appendChild(gift);

            const fallDuration = 2000 + Math.random() * 1000;

            const fallInterval = setInterval(() => {
                const currentTop = parseFloat(gift.style.top);
                gift.style.top = `${currentTop + 5}px`;

                if (currentTop > window.innerHeight) {
                    clearInterval(fallInterval);
                    gift.remove();
                }
            }, 16);
        }
    }
});```
dawn ledge
#

look up conform

dawn ledge
#

never had to use "+y

#

y itself puts in my clipboard

fleet cedar
#

There's some option for that yeah

agile crane
#

how can i get the message id in reply to which i use command?

#

that is, in this example, I should somehow get id 1317079913936982047 in the code

fleet cedar
#

Find where the replying-to component gets it from

agile crane
median root
dawn ledge
#

do you have something like xclip or wl-clipboard running

#

do a health check

#

it copied to only the register for me when i didnt have wl-clipboard (given im on wayland)

#

:checkhealth and look for clipboard

winged mantle
#
if [[ -n "${VSCODE_INJECTION}" ]]; then
    export VSCODE_PROJECT_HOME="$PWD"
    alias vshome='cd "${VSCODE_PROJECT_HOME}"'
else
    alias vshome='echo "Terminal not opened inside Visual Studio Code!"'
fi
#

for when i used the visual studio terminal for other stuff

median root
#

which one would you say works better in general?

dawn ledge
#

null ls is when youre too lazy to set up lspconfig and stuff by yourself

#

i like managing things by myself

median root
#

what kind of things are there to manage by yourself?

median root
#

when i first had the issue i was told i needed to yank into the "+" group

#

which is why

dawn ledge
#

are you on wayland

median root
#

running asahi (mac m1 version) if that makes a diffrence

dawn ledge
dawn ledge
#

and simply selecting and y doesnt copy to system clipboard?

median root
#

nope

#

it copies it to neovims own little clipboard

#

where i can only use it inside neovim

fleet cedar
#

There's :set clipboard=unnamedplus to make it use system clipboard for everything

median root
fleet cedar
#

As permanent as any other setting

autumn sigil
#

zig so good

supple whale
#

vencord IWA when

#

I love we're finally getting IWA's

#

but shit's so insanely broken its unfunny

#

still a bit early

ornate quiver
#

what's an IWA

fleet cedar
#

Insufferable Web App I imagine

dawn ledge
#

insufferable

#

LOL

supple whale
#

yes!

#

like holy fucking shit

#

the pain of trying to get one to work

supple whale
#

its a website, with chromeapp-like API's, that's signed like mobile apps

#

so far the only difference between IWAs and PWAs is that they need to be signed, [yes a website that's signed], have WAY stricter CSP requirements, and have a few extra api's: direct sockets [tcp, udp], better media recording api's, and frame controlling api's

#

microsoft and google have been collabing on this for like 4 years now, they are pretty much trying to replace electron kinda?

#

its like the next chromeapp, except it doesnt have an identity crisis like chromeapps did

#

they didnt know if they were apps, websites or extensions

supple whale
#

yeaaah.... ? kinda???

#

its hopeful

#

its like so far the best competition to electron we've had since NWjs came out

#

that actually has a lot of upsides

#

it's kinda what PWA's promised to be, then never delivered

#

it doesnt help, that google's own showcase IWA has 0 actually working features

#

not a single one works correctly, so that's fun

#

but you're allowed to embed shit with a new iframe, aka controlledframe

#

and actually interact with the shit in there

#

supposedly because it doesnt actually work at all XD

dawn ledge
#

we have convoluted the web too much

#

go back to writing native apps

supple whale
supple whale
supple whale
#

and it fucking pains me because of how bad it looks

dawn ledge
#

you can get equally bad ui on the web too tho

supple whale
#

yeah but its easier to make really good ui

#

wereas on native its x100 harder to make really good UI

#

its not impossible ofc

#

but iz hard

dawn ledge
#

true true

supple whale
#

i think.... plex is mostly in QT?

#

I think because its hard to check

#

they have a webview in there too

#

so i dont know which parts are web and which parts are QT....

#

but yeah plex is in QT and looks good [assuming it is all QT, and not QT embedded chromium]

#

but that's where my examples end XD

dawn ledge
#

its like carcinization
except instead of turning into crabs every app eventually turns into electron/tauri webview

supple whale
#

I mean some apps really should be electron

#

like vscode

#

but fuck discord has 0 place being electron based

autumn sigil
supple whale
#

a..... website...?

autumn sigil
#

it is a website?

supple whale
#

yeah, except for some reason they run it in electron

#

because fuck u

autumn sigil
#

shockingly enough, you dont have to use the electron client!

#

🤯

dawn ledge
#

lol literally

supple whale
#

like electron gives you what, global keybinds and overlay

supple whale
#

so the forced neutering discord made for 0 reason

#

ends up being a problem

autumn sigil
supple whale
supple whale
#

i think u also get screenshare previews thumbnails

#

that's it

autumn sigil
#

clips trolley

supple whale
#

dont need electron for that

autumn sigil
#

? do you not need some sort of gpu facing native module and storage access for that

supple whale
#

not really no

autumn sigil
#

oka blobcatcozystars

dawn ledge
#

native voice and video

supple whale
#

you could simply write clips to local storage and download them, or ask for FSA access on chromium

supple whale
frosty obsidian
#

thats not what they mean

#

they have an entire native library for audio and video processing

supple whale
#

discord?

#

no? they just use electron's shit

#

which exposes the winAPI for the most part?

frosty obsidian
#

they do

#

libdiscord

dawn ledge
#

discord has native modules for voice and video

#

i have had some horrible experience reverse engineering them in the past

supple whale
#

why lol

dawn ledge
#

its gotten easier since dave came out

autumn sigil
#

wtf dave is gay now?

supple whale
#

straight up whats the use of it

frosty obsidian
#

dave is for encryption

#

the other audio stuff is for background noise reduction among other things

dawn ledge
viscid grove
#

who is dave

dawn ledge
supple whale
#

and really, works like shit

#

both in browser and on discord

viscid grove
dawn ledge
#

they have a krisp module for niose reduction

frosty obsidian
#

famously no

supple whale
#

i end up using crips/boardcast

frosty obsidian
#

discord uses krisp

supple whale
#

and crips exists in browser

#

so

#

no fucking way

#

that she's working for discord now

dawn ledge
#

also youre forgetting that on top of supporting webrtc discord has their own smaller protocol for voice and video

ornate quiver
#

who signs IWAs

supple whale
#

and which you can implement on web too actually

#

because webrtc streams support processors

ornate quiver
frosty obsidian
#

bots also use the proprietary protocol

#

just only for speaking

cerulean plover
frosty obsidian
#

i think so

dawn ledge
cerulean plover
supple whale
#

anyways neither of those things are necessary for web or actually break discord

dawn ledge
#

no way in hell im gonna use a bot library that pulls in webrtc just for voice

supple whale
#

crisp works on web, i assume they compiled it to js or wasm

#

and if u want webrtc postprocessing use worklets

dawn ledge
#

anyways using the electron app is a choice

#

you can be like me and use the website

#

or slap it in something like ftwa

frosty obsidian
#

dismissing the overlay and global keybinds is also arbitrary

#

people really like those features

supple whale
#

global keybinds are indeed an F

#

to use overlay you'd have to be crazy, i'd never risk the game bans

#

ignoring the mad fps drops it causes

autumn sigil
#

id use overlay if it vencord loaded spotifycrack into it xd

supple whale
#

the global keybind shit i've only managed to implement via MediaSession keybinds, but it fucks with other media keybinds if ur also listening to shit at the same time, which is a no-go

autumn sigil
#

they really made the overlay pause your music if you speak too much..

supple whale
#

since it injects a dll into the game ur running and renders on top of it

supple whale
#

ah, they changed it?

autumn sigil
#

idk if they changed it but im 100% on overlay being web

supple whale
supple whale
#

chrome went back on this????????

#

they no longer support it

#

and here i was worried about adding supprot for it to my node webrtc lib

supple whale
#

actually

#

hm

#

chrome://extensions/shortcuts

#

HMMMMMMM

#

well time to fix my vencord PWA PR

supple whale
#

killmepls

frosty obsidian
#

the actual reason of course is just that its the version being pushed

supple whale
#

hm

#

feels like you dont know the original topic

#

so cba

ornate quiver
supple whale
#

yep

#

which is why its a pain

ornate quiver
#

thats not bad tbh

supple whale
#

because u need to compile ur js, then bundle it

#

then sign it

#

so development kinda sux

#

compared to what we have in web

ornate quiver
#

at least its not like on windows
pay $3000/yr for an EV certificate

supple whale
#

TRU

#

anyways

#

TIL onclick bubbling doesnt work on svgs

agile crane
#

How can I set a reaction to a message?

dense sand
#

no instance(s) of type variable(s) A exist so that A[] conforms to Class<?> inference variable R has incompatible bounds: equality constraints: Class<?> lower bounds: A55686[]
i love java

vestal hedge
#

I vaguely understand what this is saying, of course this fails to explain why its happening and especially where

dawn ledge
#

the problem is java

dense sand
#

what even is A55686

ornate quiver
#

some cursed class name

autumn sigil
#

the ai wants me to implement pointer wraps

autumn sigil
#

chat is this readable

dawn ledge
#

please turn off the whitespace dots

#

you psychopath

fleet cedar
#

Why

dawn ledge
#

visual noise

fleet cedar
#

Turn down the opacity a bit, sure, but it's good to have them

autumn sigil
fleet cedar
#

Don't you dare disrespect the whitespace dots

dawn ledge
fleet cedar
#

Is that first switch like, the type?

autumn sigil
autumn sigil
fleet cedar
#

I'm sure that's reasonable if you're used to the language

autumn sigil
#

Its removing const from a slice ie []const u8 => []u8 so i can write to it

fleet cedar
#

That sounds illegal

autumn sigil
#

Its not

#

I initialize it as writable, its just cast to const again in return

autumn sigil
autumn sigil
wintry oracle
#

hey i know this is random but i downloaded ur cyan theme and something appears to have broken it and im just wondering if you can help me

#

ignore this im blind

royal nymph
#

so awful

median root
#

welp back to this old question again. whats the new method for adding reactions to messages

#

my plugin broke and i want to use it 😦

#

this function dont seem to work no more

nimble bone
#

try

median root
#

and the bit specifying the reaction, channel id is the same?

nimble bone
#

try it and see

#

trolley

median root
#

shopping cart

#

it does work

#

!

#

tysm

cerulean plover
# nimble bone

#{intl::EMOJI_PICKER_DOUBLE_REACTION_SUPER_ERROR_TITLE} is one of the finds of all time

cerulean plover
nimble bone
#

@cerulean plover you love

(i used restapi to react)

cerulean plover
#

awesome

cerulean plover
#

idk just shove it in somehow

nimble bone
#

@cerulean plover i had another plugin idea

viscid grove
#

whoa those are glorious arts

nimble bone
#

nin0chat client in discord

viscid grove
#

web browser in discord when

nimble bone
#

but instead of making proper ui i send fake flux events to inject a server, channels and messages

nimble bone
viscid grove
#

i want to be able to open tabs and watch youtube and do my school quizes all in discord!!

cerulean plover
viscid grove
#

add chromium extension support too

viscid grove
autumn sigil
# dawn ledge why how

^^

pub fn getValueArray(ctx: *const Ctx, comptime T: type, value: n.napi_value, comptime allocator: ?std.mem.Allocator) !T {
    const ti = @typeInfo(T);
    const len = switch (ti) {
        inline .array, .vector => |t| t.len,
        .@"struct" => |s| if (s.is_tuple) comptime std.meta.fields(T).len else @compileError("Can only create arrays from structs that are tuples"),
        .pointer => |p| if (p.size == .Slice) try ctx.getArrayLength(value) else @compileError("Can only create arrays from pointers of type slice"),
        else => @compileError("Can only create arrays from slices, arrays, vectors and tuple structs"),
    };

    var ret: switch (ti) {
        .pointer => |p| @Type(.{ .pointer = .{
            .size = p.size,
            .is_volatile = p.is_volatile,
            .alignment = p.alignment,
            .child = p.child,
            .sentinel = p.sentinel,
            .is_allowzero = p.is_allowzero,
            .address_space = p.address_space,

            .is_const = false,
        } }),
        else => T,
    } = switch (ti) {
        .array, .vector, .@"struct" => undefined,
        .pointer => |p| if (allocator) |a| switch (p.sentinel == null) {
            true => try a.alloc(p.child, len),
            false => try a.allocSentinel(p.child, len, @as(*const p.child, @ptrCast(p.sentinel)).*),
        } else @compileError("Converting a napi_value to a slice requires an allocator"),
        else => @compileError("How did we get here?"),
    };

    if (ti == .@"struct") {
        var nvs: [len]n.napi_value = undefined;
        inline for (0..len) |i| nvs[i] = try ctx.getElement(value, i);
        inline for (0..len) |i| ret[i] = try ctx.getValue(ti.@"struct".fields[i].type, nvs[i], allocator);

        return ret;
    }

    const child = switch (ti) {
        inline else => |t| t.child,
    };

    if (ti == .vector or (ti == .array and len <= 16)) {
        var nvs: [len]n.napi_value = undefined;
        inline for (0..len) |i| nvs[i] = try ctx.getElement(value, i);
        inline for (0..len) |i| ret[i] = try ctx.getValue(child, nvs[i], allocator);
    } else {
        for (0..len) |i| ret[i] = try ctx.getValue(child, try ctx.getElement(value, i), allocator);
    }

    return ret;
}
#

allocator is comptime nullable because i dont want to require passing an allocator for something that doesnt need one

#

has to be comptime so i can compileError force it in case i get a slice type ^^

#

zig is so fun

dawn ledge
autumn sigil
#

man fuck codeburger though

#

just host your shit on gh like everyone esle

nimble bone
#

nin0git even better

dawn ledge
nimble bone
pearl vine
#

vfjd?

elder yarrowBOT
pseudo sierra
#

@nimble bone fix ur shit blobcatcozy

deep mulch
#

@royal nymph

royal nymph
# deep mulch <@343383572805058560>

just to make sure I understand correctly

on pc you want image and text to be next to each other horizontally?

on phone you want the image and text to be stacked vertically?

deep mulch
#

yes

dense sand
#

Bro sm: selector in tailwind

#

Done

#

Whats yall problem with tw

deep mulch
#

tailwing

royal nymph
#

that's like telling an entry level C programmer to just start working on the Linux kernel as their first project

dense sand
#

Its the same thing as every linux user should use arch

deep mulch
#

i added padding

#

so it doesnt touch

#

whys there a scrollbar now

royal nymph
#

trol

#

you probably used 100% somewhere

dense sand
#

Just get rid of the compose jesus

deep mulch
#

no

royal nymph
#

add * { box-sizing: border-box; }

deep mulch
#

when i fix this mobile stuff im done touching for months

deep mulch
#

wait

#

i see if i remove 100 vh from the container height
it fixes the scrollbar but then the content isnt centered

dense sand
royal nymph
#

it might fix

deep mulch
#

it didnt

royal nymph
#

dimensions don't factor in padding so if you set dimensions to 100% and add padding it will overflow

#

instead of using padding, just put a margin on the body

royal nymph
# deep mulch yes

so i assume you use flex and change the flex direction with a media query?

#

you can just change width to 100% or smth like that in the mobile screen query

#

so it uses 30% on desktop and 100% on phone

dawn ledge
#

hol up

#

supports-[min-height:100cqh]:min-h-[100cqh] supports-[min-height:100svh]:min-h-[100svh]

deep mulch
#

even with margin i get scroll bar

deep mulch
dawn ledge
#
body {
  min-height: 100vh;
}

@supports (min-height: 100cqh) {
  body {
    min-height: 100cqh;
  }
}

@supports (min-height: 100svh) {
  body {
    min-height: 100svh;
  }
}
deep mulch
#

yay ok scrollbar is gone

#

i just need to fix the image

#

@royal nymph vender

ornate quiver
#

hop on tailwind

deep mulch
#

tailwing

#

in 57 years i will consider

dense sand
#

Yea and stop using compose in favor of react native

deep mulch
#

thats even worse

#

id rather die

dense sand
dawn ledge
#

the only reason why i used react native once was i didnt wanna learn kotlin or java for a project i'll never end up completing

autumn sigil
#

They should just make solid but in zig for mobile

agile crane
#

how can i set reaction by code?

autumn sigil
#

sane

royal nymph
#

damn daniel

#

BD finally getting decent DX without having to use 3 libraries?

#

fire

cerulean plover
#

i think vencord should totally have settings categories

#

file and especially keybind settings should also be implemented over here

agile crane
dawn ledge
#

i just want someone to make a zig + rust lang

dense sand
#

society if Class.forName returned null instead of throwing an exception:

dense sand
#

or like how is this even possible

long marten
dense sand
#

no tailwind?

royal nymph
dense sand
# royal nymph

I mean, when youre using react and not plain html, you could atleast consider it...

autumn sigil
#

Yeah you can do comptime verification of struct shapes but guh

#

And the wrappers with .allocator etc arent great i guess

dense sand
#

Is trait in rust same as in php

autumn sigil
#

Idk never used php

#

Its just java interface

dense sand
#

Ok

ionic lake
#

cargo when my target/ is 67gb

autumn sigil
#

Just dont target

dawn ledge
#

horrible im already at 1gb

ionic lake
#

i utilize multiple features like different profiles with multiple different settings, opt levels, etc which blows it up

dawn ledge
#

i too do that

#

they learnt nothing from node_modules

autumn sigil
#

So true

#

Why isnt this shit symlinked somewhere

ionic lake
#

my compliation speed story hasn't been so bad now that i use mold

#

some suggest using zig for linker but ehh

ivory heath
#

Zig uses llvm

pseudo sierra
#

aren't they working on their own compiler backend?

ivory heath
#

Yes but it’s not finish and will take a long time.

dawn ledge
#

mold is good enough

#

i have a reference config that i copy paste in every rust project so i dont have to wait for unbearable compile times

#

pretty much a rite of passage atp

autumn sigil
#

Rust so bad

#

Compile slower than js code take to run

dense sand
#

guys what prettier alternative

valid jetty
dense sand
#

no

#

it will end as half of imports with " and half of code with '

#

i can see it

autumn sigil
dawn ledge
#

i use biome

fleet cedar
#

Not using js is a pretty good alternative imo

still jolt
dawn ledge
#

nushell overrides a bunch of commands, its nice and annoying at the same time

still jolt
#

oh it's that horror

#

it's like Powershell but actually not the worst execution

#

(still pretty bad imo)

autumn sigil
#

i have a half broken eslint config thats fucked up with the new eslint config but i also need some obscure stuff

dawn ledge
#

biome has worked pretty well for me

ivory heath
dawn ledge
#

i gave up on eslint after their shitty config change

#

(it broke almost every plugin)

runic sundial
#

zig good, rust bad

#

simple as

dawn ledge
#

nuh uh

#

i love both

#

well i like rust more

ionic lake
dawn ledge
#

i would prefer not having to copy configs through systems when i clone the same repo on another machine

dense sand
autumn sigil
#

redis logo sucks now i liked the stack

placid cape
dense sand
#

Lol

placid cape
#

Ohh

#

npm install is slow anyways heh

dense sand
#

So im just sticking to bun install -y and using yarn

placid cape
dense sand
#

I dont remember its been like gazillion days since then

#

Does it even have a docker container?

placid cape
#

Yea

autumn sigil
#

Try pnpm

dawn ledge
#

pnpm ftw

dense sand
#

oh wow this cool

dawn ledge
#

did yaml issue templates get a new ui

dense sand
#

Probably

ivory heath
#

Can someone explain backwards propagation for a large statical model k thanks /j

fleet cedar
#

It's witchcraft

ivory heath
#

YEAH

#

I wanted to write my own transformation for converting some numbers into a different “format” but honestly just throwing a mini neural network for the problem seems easier

autumn sigil
#

Chat you heard it here first

viscid grove
#

whoa seniors willnt make mistakes!??!

#

how can i partake in this glorious future?
I found an old nail outside, is that useful!!

#

it's orange

#

some may even call it rusty

dawn ledge
#

rust shills when they realize using a memory safe language wont fix your logic errors

valid jetty
#

rust shills when they realise they code will now forever look ugly

dawn ledge
#

rust is beautiful

ivory heath
#

Rust shills when they learn that refactoring with lifetime management is a nightmare

dawn ledge
#

its NOT

fleet cedar
#

No way to tell what owns what

ivory heath
jade stone
#

lmao tsx is just an esbuild wrapper

placid cape
#

lmao

autumn sigil
fleet cedar
#

That's what c++ said

#

And look where that got us

autumn sigil
#

got us quite far

dawn ledge
#

quite far into the void

royal nymph
#

duh xd

#

did you really think they'd implement their own compiler

jade stone
royal nymph
#

ts-node uses tsc and it's slow as fuck

#

tsx uses esbuild so it's speedy

jade stone
#

tbh whenever ive used any of them they've never worked

ive just been writing mjs with //@ts-check

royal nymph
#

insane

digital dawn
#

Hey, is there a guide or something to start a dev instance of vencord ? I'm getting an error with dependencies upon npm i :x

jade stone
placid cape
#

good job copilot

#

i hope nobody from the aoc cheaters don't use copilot blobcatcozy

royal nymph
#

since when do they have a free tier

placid cape
#

i have gh student pack lol

royal nymph
#

ohhh student

#

ig they give limited access to students

#

I have full for free blobcatcozy

placid cape
#

idk it looks like an issue i didnt use copilot for like a month lol

#

and all my friends got the message suddenly

royal nymph
#

funny

digital dawn
#

A few mins ago

valid jetty
#

ai models are really that cheap to run now that you can run them for free?

dense sand
#

ARE YOU DUCKING KIDDING ME

placid cape
autumn sigil
eternal wigeon
#

guys i just learned that setting css 'pointer-events: none;' on an image element prevents web browser from saving an image. epic

viscid grove
#

well right click is a pointer event

eternal wigeon
#

also before chatgpt i didnt know how to make a file download without the browser opening a new tab

#

now i asked it and it provided me the href.click() hack and im mind blown

#

i couldnt find this shit on google/stackoverflow a few months ago

#

makes no sense either like wtf

pearl stagBOT
dawn ledge
#

me when inspect element

elder yarrowBOT
#

The cozy of the day is champagne! (#faeccc)

cerulean plover
#

You mean your school/uni does not dox you to Microsoft for you?

royal nymph
#

who cares doe

#

they already know anyway

viscid grove
#

that can be easily fixed lol

calm ruin
#

100% worth

#

I get free github pro bunch of perks and free copilot all models

valid jetty
calm ruin
#

Privacy people going insane when they ask questions to them in job application (they want all of their private information)

placid cape
#

nah i just sent them picture of my school portal website blobcatcozy

placid cape
winged mantle
fleet cedar
tranquil raptor
#

husk i finally made an anti-crash loop extension to crashhandler for myself

past osprey
#

is this good world generation

viscid grove
#

i'd guess it's a (possibly terraria inspired) thing they made considering it's in #🪅-progaming?

placid cape
#

vcotd

elder yarrowBOT
high valley
#

I desperately need someone to make a css snippet to make that when changing themes 😭

dawn ledge
#

no

brittle mango
#

sorry, a css snippet

#

that does allat

#

cooked as

viscid grove
#

I'm pretty certain doing that with css wouldn't be possible

fleet cedar
#

The fancy magic fade would probably be possible with svg filters somehow, the issue is getting the before and after images to fade between

viscid grove
#

can you detect when the theme gets changed?

fleet cedar
#

No

#

You'd need some js to detect when it changes, take a screenshot, and apply the effect

#

And at that point you might just as well use canvas instead of svg bullshit

viscid grove
#

I had a thought while i was in the shower
if you had transparent animated images made in an editing software using something similar to the unloaded discord thing with the top left being transparent, and bottom right being the unloaded, and maybe some opacity changes, it might look semi decent

#

but seems like the class doesn't change between different themes

#

only light/dark

#

and also it's an incredibly stupid thing to do

#

for multiple reasons

valid jetty
#

what is the point like are you gonna change your theme every 2 seconds

viscid grove
#

yeah

#

that's one of the main reasons

echo elm
#

hi

exotic kelp
#

so like i did everything i could and its Still not registering any modules

calm wigeon
nimble bone
#

not src

#

not plugins

#

not your plugin folder

exotic kelp
#

cant chat there though

nimble bone
normal totem
calm wigeon
#

oop

#

forgot

calm wigeon
exotic kelp
#

oh thank

normal totem
#

oh i thought u had to contribute or something to get perms for that

exotic kelp
#

ill go there now

normal totem
calm wigeon
#

i think so?

exotic kelp
#

so ill reopen

dense sand
#

Whats the best way to store files in my api? Should i just plot them as a byte array in one column?

past osprey
cobalt ledge
#

pog

cerulean plover
#

very CRUNCHY

severe python
#

vctod

#

vcotd

elder yarrowBOT
formal belfry
#

80 line of css for this

#

did i code too much?

formal belfry
normal totem
dense sand
tranquil raptor
#

@native spruce The main reason I went with that approach is because the Vencord settings menu is a plugin in itself, so if I disabled all plugins, then it'd be impossible to disable any faulty plugins

#

(sorry for the ping but i wanted to give clarification!)

formal belfry
tranquil raptor
native spruce
#

you should add an indicator saying that it was disabled due to it being faulty and broken with a discord update@tranquil raptor

#

would cause less confusion on why it was disabled in the first place unexpectedly

tranquil raptor
tranquil raptor
native spruce
woven mesa
#

looks cool

past osprey
woven mesa
past osprey
#

2025

valid jetty
#

ur collision checks may be silly

#

oh and uh

#

i can just kinda

past osprey
#

i tried to fix the collision in 1.6 and i ended up breaking it even more

valid jetty
#

i love how you can stick to walls

#

is that intentional

past osprey
#

but I could call it a feature

valid jetty
#

you should its silly

placid cape
past osprey
#

cause it would be way too easy if the player could just climb over everything

cerulean plover
past osprey
#

although it probably is a good idea

cerulean plover
#

how tall does the world go up?

#

is there a limit?

past osprey
#

infinity

#

cause the world is just stored in a Map

ionic lake
#

game plays great, what did you use to build it

past osprey
#

javascript

dense sand
#

i need some file storage api lol

#

like how to effectively store binary files

#

in backend

#

S3 buckets could be an option, but idk how to setup

royal nymph
fleet cedar
#

Fat32

dense sand
#

whoever used nextauth here, can you somehow get the images for the providers lol

ionic lake
dense sand
ionic lake
#

just use the newer apis

dense sand
#

okay it has a docker image

#

nice

stoic helm
#

crab time it is

nimble bone
#

C

gray heron
#

chat how tf do i optimize this

const snowball = document.createElement("div");
        snowball.setAttribute("class", "snowball");
        const body = document.querySelector("body");
        const viewportWidth = window.innerWidth;
        const viewportHeight = window.innerHeight;

        snowball.style.position = "absolute";
        snowball.style.top = "-2%";
        snowball.style.left = `${Math.floor(Math.random() * viewportWidth)}px`;
        snowball.style.transform = "translate(-50%, -50%)";
        body.appendChild(snowball);

        let snowballTop = -2;
        const fallSpeed = speed;

        function fall() {
          snowballTop += fallSpeed;
          snowball.style.top = `${snowballTop}%`;

          if (snowballTop > 100) {
            snowball.remove();
          }
        }

        setInterval(fall, 16);
      }

      setInterval(() => {
        for (let i = 0; i < 16; i++) {
          snow(Math.random() * 0.54);
        }
      }, Math.random() * 1000);
#

oh im an idiot

#

snowflakes never get removed

#

wait no they do

#

then what is lagging

valid jetty
#

maybe try with requestAnimationFrame?

gray heron
#

..ima be honest i have no idea what that is or how to use it

#

i've rarely used animation stuff

#

gonna take a break and try to learn that when i come back i guess :p

valid jetty
#

a much simpler thing you can try is turning top: x% into transform: translateY(x%)

solar thistle
viscid grove
#

python

placid cape
austere idol
austere idol
viscid grove
#

I did

#

very briefly

#

idrk
looks a bit cursed, but I'm on mobile and I'm not very good at c

austere idol
viscid grove
#

yeah but it's not python

austere idol
#
"\n".join([f"{k}={v}" for k, v in {"a": "b", "c": "d"}.items()])
#
{s[:s.find("=")].strip(): s[s.find("=")+1:].strip() for s in "a=b cd e\nc test =d\ntest = meow".split("\n")}
#

i like oneliners

dense sand
#

yo im so glad for usetransition

#

such an epic hook

desert girder
#

@vale geode

dense sand
#

anyone knowledged in makefiles enough to help me? Any idea why this job is being ran every time i run the make command? No dependencies are being ran and this is kinda annyoing lol

$(ISO_OUTPUT): $(DEPS)/limine/limine kernel
    rm -rf $(BUILD)/iso_root
    mkdir -p $(BUILD)/iso_root/boot
    cp -v $(BIN_OUTPUT) $(BUILD)/iso_root/boot/
    mkdir -p $(BUILD)/iso_root/boot/limine
    cp -v limine.conf $(BUILD)/iso_root/boot/limine/
    mkdir -p $(BUILD)/iso_root/EFI/BOOT
    cp -v $(DEPS)/limine/limine-bios.sys $(DEPS)/limine/limine-bios-cd.bin $(DEPS)/limine/limine-uefi-cd.bin $(BUILD)/iso_root/boot/limine/
    cp -v $(DEPS)/limine/BOOTX64.EFI $(BUILD)/iso_root/EFI/BOOT/
    cp -v $(DEPS)/limine/BOOTIA32.EFI $(BUILD)/iso_root/EFI/BOOT/
    xorriso -as mkisofs -R -r -J -b boot/limine/limine-bios-cd.bin \
        -no-emul-boot -boot-load-size 4 -boot-info-table -hfsplus \
        -apm-block-size 2048 --efi-boot boot/limine/limine-uefi-cd.bin \
        -efi-boot-part --efi-boot-image --protective-msdos-label \
        $(BUILD)/iso_root -o $(ISO_OUTPUT)
    ./$(DEPS)/limine/limine bios-install $(ISO_OUTPUT)
austere idol
#

or, at least, $(DEPS)/limine/limine and kernel are actual filenames or just target names?

dense sand
#

hm

dense sand
#

i suppose getting rid of the kernel and moving the deps to the iso_output job could fix it?

#

i mean it seems to be working this way

sly shoal
#

this is probably stupid but i've got a minecraft server hosted for friends on my pc and a domain attached to it, my power often cuts out and my router changes ip address every time it turns off for some reason. is there any way to make cloudflare automatically update the dns records with my ip address?

#

WOAH

#

it's a thing!!!

cerulean plover
jade stone
cerulean plover
#

this is probably what you need more specifically

jade stone
#

ddns is a pain in the ass

sly shoal
ornate quiver
sly shoal
#

my computer knowledge extends to running a bat file and changing things in the windows firewall 🙏

jade stone
cerulean plover
#

also make sure you set static DHCP lease on your router and forwarding rule already if you haven't already

jade stone
#

google tailscale (its one of my favorite services ever)

sly shoal
#

oh yeah

#

i've done that!

#

my pc is always .1.7

ornate quiver
#

there's not really a reason to get a vps unless you're behind a cgnat and can't port forward
maybe ddns is a bit more of a hassle but at least free

jade stone
#

vps allows for a MOTD if your server is offline

sly shoal
cerulean plover
#

if you and your friends can do ipv6 then use that blobcatcozy

jade stone
#
  • just handy
cerulean plover
#

thats just software config

jade stone
#

+ddns

cerulean plover
# sly shoal thank u gang i'll look at this rn and hope to make sense of it 🙏

i mean you can also look at the original page for some existing software https://developers.cloudflare.com/dns/manage-dns-records/how-to/managing-dynamic-ip-addresses/

Cloudflare Docs

Most Internet service providers and some hosting providers dynamically update their customer's IP addresses. If this situation applies to you, you need an automated solution to dynamically update your DNS records in Cloudflare.

cerulean plover
ornate quiver
cerulean plover
#

it's still software config and not a vps thing

autumn sigil
#

Is always worth

past osprey
#

what does this even mean

#

i do NOT want to have to fix this

dawn ledge
#

dont?

dense sand
#

No jsx

past osprey
#

this is from the same file

ornate quiver
royal nymph
dawn ledge
#

can i get one without having to have a credit card

nimble bone
#

if i ever get one i will move nin0git to it and only use my pi for backing it up

still jolt
#

actually good uptime? ​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​

#

imagine

autumn sigil
# nimble bone teach me the ways

Upgrade to paid account, it tries to charge you for 100 bucks or so as a test but you still get the free tier services for free except youre guaranteed a slot now

dense sand
#

if i have apk file, can i make somehow modifications to the final application?

#

like patch it

#

or something

#

i know vee or someone had a discord mod based on old java-based discord mobile client?

ionic lake
#

aliucord

#

it's more complicated than what you'd want to do though

placid cape
dense sand
fleet cedar
#

You're a stack

past osprey
cerulean plover
viscid grove
#

how scuffed is this?
(turns numberword into bigint and vice versa, e.g. one billion two thousand three hundred forty -> 1_002_340)

valid jetty
#

looks reasonable

viscid grove
#

I don't really like having reversedSmall
ig i could use a normal for loop with j-- instead of for (const [amount, name] of reversedSmall

#

oh and the .push(... || "UNDEFINED") at the end of toNumberWord() is just so I know when the input is too big that i don't have words for it anymore (above 10^101)

viscid grove
dense sand
#

Given i want to host wireguard on my pc on port 51820 and i have dns record bound to my public ip, how can i make it work without disabling the proxying?

#

Afaik wg uses udp

ornate quiver
#

just port forward UDP 51280 in router

#

also it'd be better if you just picked a random port instead

dense sand
#

Then made A record in my cloudflare domain settings

#

But i dont really want to expose my public ip

#

So if i keep proxying enabled, the public ip should be hidden behind some cloudflare server

ornate quiver
#

i don't believe that will work

#

afaik cf proxying only works for http

dense sand
#

:(

#

So i will need to disable it

#

Can i atleast somehow hide the subdomain

ornate quiver
#

not really
what you can do instead is

  • if your public ip is stable enough then just connect directly and fix when it changes
  • use a dynamic ip dns service with a random subdomain that doesn't identify you
    like duckdns
dense sand
#

I believe my public ip is dynamic, i have setup a dynamic dns client to automatically change the record when my public ip updates

ornate quiver
#

well as long as the domain isn't publicly tied to you then there's not really an issue if theres a DNS record to your ip

ornate quiver
dense sand
ornate quiver
#

how so

dense sand
#

Well

#

In the router

ornate quiver
#

i mean pick a random port and use that instead of 51280
not changing it all the time

dense sand
#

Oh

dawn ledge
viscid grove
dawn ledge
still jolt
dense sand
#

okay my wireguard vpn is not owrking i cant reach outer internet lol

[Interface]
Address = 10.0.0.1/24
SaveConfig = true
PostUp = iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE; ip6tables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
PostDown = iptables -t nat -D POSTROUTING -o wlan0 -j MASQUERADE; ip6tables -t nat -D POSTROUTING -o wlan0 -j MASQUERADE
ListenPort = 51820
PrivateKey = pkey

[Peer]
PublicKey = peer1_pubkey
AllowedIPs = 10.0.0.2/32

is there anything wrong with the config?

#

the client looks like this:

[Interface]
PrivateKey = peer1_pkey
Address = 10.0.0.2/24

[Peer]
PublicKey = server_pubkey
Endpoint = 192.168.0.69:51820
AllowedIPs = 0.0.0.0/0, ::/0

the server is hosted on local ip address, thats correct i just want to test it lol

ornate quiver
#

im trying to patch an electron app
i need to intercept a request initiated by loadURL but electron's protocol.handle() API doesn't seem to work for the first few requests

#

anyone know how to intercept requests properly

ornate quiver
#

patch away an auth check

#

electron main -> loadURL -> html loads main.js -> main.js loads some other webpack modules
i need to patch main.js before it runs

royal nymph
#

how can achieve that by intercepting the request?

#

do mean to edit the Javascript bundle response?

ornate quiver
#

yeah

royal nymph
#

it would probably be easier to monkeypatch with js

#

by running code in the renderer

#

anyway if you really want to rewrite the response, you can use protocol.handle("https", req => {})

ornate quiver
#

yeah that's what i tried
and for some reason it doesn't capture the initial html request nor main.js
after that it works though

#

really odd

royal nymph
#

well it might be that loadURL bypasses it lol

#

cause electron opens the browser with that

ornate quiver
#

ugh

royal nymph
#

probably passes it as launch arg to chromium

#

monkey patch loadUrl :P

ornate quiver
#

that'd be funny
load random page and then navigate to original one?

royal nymph
#

make it load html that just instantly redirects yeah

#

it's possible that you won't be able to monkey patch loadURL because it might be frozen

#

if that's the case, you can extend the BrowserWindow class and monkey patch the electron module to use your subclass (see how vencord does it in patcher.ts)

ornate quiver
#

monkey patching seems to work

#

one sec

#

oh i think i found why its still not intercepting lol

#

its because a service worker caches it first lmao
i dont monkeypatching loadURL is even necessary

ornate quiver
#

i need to patch service worker to patch main.js

dense sand
#

highest grade error handling

valid jetty
#
  1. compile self[i]
    2. compile self -> the type is Array<Array> -> (where is the T part of the inner Array gone???)
    3. compile i -> the type is i32 -> all is good
  2. the type of self[i] is Array -> where is T????????????????????????????????????????????????
  3. the compiler panics because it cant resolve T when T = Array
  4. no wonder but why wtf
#

self should resolve to Array.0.2.Array.0.11.1.1 (0 is the start of a generic scope, 2 is ptr of the parts afterwards, Array is a nested array, 0 is a new generic scope, 11 is i32, 1 is to end both)

valid jetty
#

ok @hoary sluice i figured out how to make it work

#

i just need to rewrite the whole generic match system for turning generics from their encoded string form into the struct + the inner parts

#

ie HashMap.0.11.2.Array.0.11.1.1 needs to map to HashMap, [i32, Pointer(Array.0.11.1)] then Array.0.11.1 will map to Array<i32> later

#

yeah it works

#

holy fuck nested generics finally !!!!!!!!!!!!!!!!!!!

#

keep in mind the syntax for tuples isnt nice yet

#

but yeah at least you can type them

#

ok i gave them some nicer formatting in the output

placid cape
#

insane

valid jetty
#

i want tuple syntax to look like this

use std/collections/array;
use std/collections/tuple;
use std/io;

fn main() {
    (i32, string)[] grid = [(1, "hi"), (2, ":3")];
    io::dbg(grid);
}
``` evetually
#

instead of the current

use std/collections/array;
use std/collections/tuple;
use std/io;

fn main() {
    Tuple<i32, string> *[] grid = [
        Tuple::new(1, "hi"),
        Tuple::new(2, ":3"),
    ];

    io::dbg(grid);
}
placid cape
#

and if you don't import tuples it'll not compile?

valid jetty
#

ill make data structures like Array and Tuple be implicitly imported

#

like std/string

placid cape
#

👍

valid jetty
#

and then i can turn the flag from -nsm (no string module) to -nim (no implicit imports)

#

to disable that behavior

#

the only issue now tho is i need to figure out how to parse X<Y<i32>>

#

because >> is lexed as shift right and it fails lol

#

you have to do X<Y<i32> >

#

atm

fleet cedar
#

Classic C++ fail

valid jetty
#

why what does c++ do

fleet cedar
#

Just allow rshift token to close two generics

valid jetty
#

holy shit wait good point

fleet cedar
#

I'm not sure if that's what c++ does in practice but I've seen it mentioned somewhere

placid cape
#

but don't forget to consider X<Y<Z<i32>>> etc

#

X<Y<Z<A<i32>>>>

fleet cedar
#

That's a rshift and a >

placid cape
#

Yea

placid cape
valid jetty
#

this is crazy i think

#

im having way too much fun with this

#

is having any a good idea

#

currently any exists as a typealias to void *

placid cape
valid jetty
#

finally this is a thing you can do

#

before you couldnt just do x[y][z] because the compiler didnt know the type of the inner array because you had to erase it to just void *

placid cape
valid jetty
#

yes

#

but the old way was this:

autumn sigil
#

Whats a string

valid jetty
#
use std/collections/array;
use std/io;

fn main() {
    Array<void *> *x = Array::new(
        Array::new<string>("a", "b", "c"), // have to explicitly specify <string> because it cant infer it
        Array::new<string>("d", "e", "f"),
        Array::new<string>("g", "h", "i")
    );

    Array<string> *inner = x[0]; /// un-erase the type so the compiler can actually work
    io::dbg(inner[2]); // to get the same result
}
valid jetty
#

but now that arrays are nice to use i can work towards making it char[]

autumn sigil
#

Oh. So you kept the terribleness of strlen?

valid jetty
#

yes technically

#

but this isnt C

#

you can do "x".len() and get 1

#

it being O(n) is a huge downside

autumn sigil
valid jetty
#

thats one of the primary reasons i wanna go for char[]

#

and the fact that you cant have a string view very easily

#

with char[] you can just return an offset pointer with a different length

#

with char* you must clone because theres no size attached

autumn sigil
#

You should just make elle into zig blobCatCozy

#

I truly feel like zig is almost perfect

valid jetty
#

i wanna make x..y syntax soon

#

then i can make arr[x..y]

#

x..y can just be an alias for Array::range(x, y) which already exists

#
// from is inclusive, to is exclusive
//
// example:
// Array::range(0, 4) -> [0, 1, 2, 3]
// Array::range(0, 0) -> []
// Array::range(2, 5) -> [2, 3, 4]
fn Array::range(i32 from, i32 to) -> i32[] {
    i32[] array = Array::with_capacity(to);

    for i32 i = from; i < to; i += 1 {
        array.push(i);
    }

    return array;
}
#

if i make that i can do

use std/collections/array;
use std/io;

fn main() {
    for i32 x in 1..10 {
        io::dbg(x);
    }
}
``` instead of ```rs
use std/collections/array;
use std/io;

fn main() {
    for i32 x in Array::range(1, 10) {
        io::dbg(x);
    }
}
#

(literally rust atp)

#

and array slicing is possible because the indexing syntax is implementation defined

#

currently its this for arrays

fn Array::__load__<T>(ElleMeta meta, T[] self, i64 i) {
    __internal_array_bounds_check(meta.file, meta.line, meta.column, i, self.len());
    return self.elements[i];
}

and this for hashmaps

fn HashMap::__load__<T, U>(ElleMeta meta, HashMap<T, U> *self, T key) {
    __internal_key_exists_check(self, key, meta);
    return self.get(key);
}
``` for example
#

so you could make Array::__load__ take a generic i and if i is of type Array and not i64 then return Array::slice(i.first(), i.last()) instead of self.elements[i]

hoary sluice
hoary sluice