DEV Community

Cover image for Why I let strangers control my lights and why you should too

Why I let strangers control my lights and why you should too

nobody5050 on January 07, 2021

The title photo features the website I built to let strangers annoy me. The website includes text to speech, YouTube audio playing, and even contro...
Collapse
 
trusktr profile image
Joe Pea

Would be sweet if you can add a camera feed so we can see the results!! :D

Collapse
 
rishitkhandelwal profile image
Rishit Khandelwal • Edited

Please, please, don't use XMLHttpRequest, instead use fetch, more mordern and prevents the callback hell

Collapse
 
nobody5050 profile image
nobody5050

Hey thanks for the comment, I chose xmlhttprequest for the discord code because I was more comfortable with the api, but I plan to change it out for fetch in the future when I have more experience

Collapse
 
rishitkhandelwal profile image
Rishit Khandelwal

Yeah sure, its just that I get vibes when I see XMLHttpRequest.

Thread Thread
 
nobody5050 profile image
nobody5050

Understandable. Can you recommend some resources for learning fetch?

Collapse
 
beginnercoder17 profile image
BeginnerCoder17

It sounds so stupid at first but it's fascinating! lol

Collapse
 
nobody5050 profile image
nobody5050

Thanks!

Collapse
 
beginnercoder17 profile image
BeginnerCoder17

Sorry if it sounds mean but it awesome!

Thread Thread
 
nobody5050 profile image
nobody5050

Doesn’t sound mean at all!

Collapse
 
steingabriel profile image
Gabriel Stein • Edited

Cool, I have LIFX lights here too and I'm creating a simple control panel to control all the smarts things in one place. They offer a very simple to use API.
I believe you posted the Discord snippet twice though.

Thanks for sharing this!

Collapse
 
nobody5050 profile image
nobody5050

Glad I could help! The only issue I had with the lifx api is the ratelimit, so I might switch to the lan api since that has no ratelimit.

I don’t see the discord snippet twice, does it still show up twice if you reload the page?

Collapse
 
anishdoesdev profile image
Anish A

Hey you've leaked your Discord webhook url which can be used to raid the server that the webhook is in. Would consider sending requests through a backend than a client-side post request.

Collapse
 
nobody5050 profile image
nobody5050

I use the discord channel as the intermediary, the actual tts stuff is handled by a discord bot that isn’t reachable from the site without going through the discord channel.

Collapse
 
anishdoesdev profile image
Anish A

I can nab that url and start mass @ everyone'ing.

Thread Thread
 
nobody5050 profile image
nobody5050

It’s a private server with only me and the bot, have fun

Collapse
 
eduplessis profile image
Edouard Duplessis

Funny... I just saw your house on reddit πŸ˜„

Collapse
 
fr3fou profile image
fr3fou

it'd be cool if we could see a livestream of it happening :D