Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
cruft

Vei posted:

alright, newbie, *tucks icon away*, in order to truly be welcomed to this forum in which i am definitely an OG in, you must do my work for me

https://pastebin.com/JGs4kz4z

here is my code

im trying to call the 2 functions at the same time (so http requests go out at the same time), but function 2 shouldnt output its response unless function 1 is already finished running...


the problem is, i have no idea how Promises work, and apparently i've just made it so function 2 doesnt get called at all until function 1 is done*


*i feel bad already pls dont worry about my bugs**

**unless... haha....

Would it be okay if I showed you how to do this without jQuery?

It's very simple.

Adbot
ADBOT LOVES YOU

cruft

Vei posted:

! most definitely would be appreciated

Here you go, fellow nerd

https://jsfiddle.net/36x9aonw/

I think of promises of sort of like how callbacks were used: when the thing is done, it executes the ".then()".

"async" makes it really easy to follow the flow of stuff, so you don't need ".then()" all over the place and your code isn't all ugly.

Let me know if you have questions!

cruft

Vei posted:

holy poo poo thank you, gonna give this a shot! i haven't used "await" either before but this definitely looks like good stuff

and vanilla js is always ftw :^}

Yeah, async/await are neato. I don't use them all the time because they're a bit more limited, but in a lot of cases they're just fine and make your code a lot easier to follow. Here's two ways to do the same thing:


JavaScript code:

function bar() {
  foo()
  .then((a) => {
    console.log(a)
  })
}


JavaScript code:

async function bar() {
  let a = await foo()
  console.log(a)
}

cruft fucked around with this message at 23:25 on Feb 14, 2021

cruft

Plant MONSTER. posted:

this nerd stuff is making me MAD

you're all about to get it big time

*sigh* okay, here's the lunch money I bring specifically to give you when you're mad, and I'll meet you behind the gym after school for another beating.

cruft

Plant MONSTER. posted:

Oh thank you. I'll go get us some lunch. Is everyone okay with paninis?

Paninis sound awesome!

cruft

hbag posted:

the script goes well
far from done but at the moment all thats really left to do is cosmetic poo poo so it doesnt just vomit the raw quote list at you



gonna add some interactivity too so you can filter quotes (maybe even add a way for users to log in with their credentials instead of having to supply their cookies, idk, ill figure it out)

Good lord, when you log in it just issues you a cookie with your username and password? I thought it was bad enough that we didn't have HTTPS until like 2 years ago.

Have you looked into using pandoc to convert from HTML into Markdown?

Looks like a fun project.

cruft

hbag posted:

oh thank christ it is a hash

Yeah, so, sending a hash of the password as the authorization token is Rookie Authentication Mistake #1, on account of you can replay the hash.

Like, all the hash is doing for you is turning this conversation:

quote:

:o: I would like web page 58, and the password is sexy123
:) Okay, great, here's the web page.
:o: Now I would like web page 59, and the password is sexy123
:) Here ya go.
:classiclol: I would also like a web page, number 43, and the password is sexy123. Please ignore the obvious disguise, I am the real user.
:) Okay, here it is.

into this conversation:

quote:

:o: I would like web page 58, and the password is sexy123
:) Right, could you come back again, except this time say the password is 28b10cac5a09b9e2d8dda57372bc9ba5
:o: Okay... I would like web page 58, and the password is 28b10cac5a09b9e2d8dda57372bc9ba5
:) Great, thanks, here's the web page.
:o: Now I would like web page 59, and the password is 28b10cac5a09b9e2d8dda57372bc9ba5
:) Here ya go.
:classiclol: I would also like web page, number 43, and the password is 28b10cac5a09b9e2d8dda57372bc9ba5. I am actually the user in question.
:) Great to see you again, here it is.

You see how in either case, :classiclol: was able to grab the authentication token and use it to gain access as :o:. In the first case the token was the password. In the second case, the token was the hash of the password. They're both replayable.

Pretty much the only thing that passing around hashes does is if a person uses the same password on every site, then getting their authentication token doesn't reveal their password. This wound up not being something any attacker exploited, other than the "vengeful ex-spouse" attack scenario, which honestly wasn't going to be obtaining the password from unencrypted plaintext HTTP in the first place.

cruft

hbag posted:

will begin work on the fart button once the main script is complete
ill probably have to develop that on my local hardware though because im pretty sure SDF doesnt have audio capabilities

If you're running PulseAudio locally, you can have it listen for TCP connections and then set up a reverse tunnel when you ssh out.

It all depends on how much effort you're willing to put into a text mode fart button.

Adbot
ADBOT LOVES YOU

cruft

Here, OP, I made a fart button so you can focus on your kiboze script.

https://jsfiddle.net/zg5bqptx/

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply