> I generally wait about 5 seconds between checks of a profile
If you're scraping HN, please wait 30 seconds (https://news.ycombinator.com/robots.txt) - our app server still runs on a single core, so we don't have a lot of performance to spare. (Hopefully that will change this year.)
If you need to check more frequently, https://github.com/HackerNews/API works fine and you can get JSON that way anyhow.
Re:Show HN: Login with HN (Unofficially)
by hardwaresofton on Thursday January 13, 2022 @07:47PM
(#29929144)
Hey Dang, so actually I DO wait 30 seconds -- what actually happens is that I check on the frontend every 5, but the backend checks every 30 (that's the default) interval. If you can believe it the code looks something like this:
export const DEFAULT_HN_POLL_DELAY_MS = "30000";
export const DEFAULT_HN_POLL_MAX_CHECKS = 10;
The code isn't F/OSS but I hope you can take my word on this, worst case what happens is that someone launches two intervals (I don't have any locking on that side) due to hitting two different machines.I'll be switching to the API by the end today and worst case by the weekend.
[EDIT] Forgot to add this -- hope I didn't cause any disruption on your end. thanks for all the hard work as always.
That sounds fine!
> you can then use either TOTP or Email (if you specify both, it will default to using TOTP) to login thereafter to make things quicker (it can take up to a minute until profiles update).
I guess at this point it's more like login with loginwithhn?
Re:Show HN: Login with HN (Unofficially)
by hardwaresofton on Thursday January 13, 2022 @03:20PM
(#29926266)
Yup! LoginWithHN is the OAuth provider :) so the idea is if you have an app that you want people to use to login with HN, via LoginWithHN then you can use loginwithhn.com to make it happen
Re:Show HN: Login with HN (Unofficially)
by timoteostewart on Thursday January 13, 2022 @06:33PM
(#29928541)
Nice work! If there was a similar yet less efficient implementation of your idea, I guess we’d call it “nlogn with hn”!
Re:Show HN: Login with HN (Unofficially)
by shreddit on Thursday January 13, 2022 @01:47PM
(#29924872)
More like register with loginwithhn?
Re:Show HN: Login with HN (Unofficially)
by somishere on Thursday January 13, 2022 @06:55PM
(#29928728)
Rather than polling you can probably just subscribe (via Firebase[1] and the HN API) to changes to the user's profile e.g[2]
[1] https://firebase.google.com/docs/libraries#client-sdks
[2] https://hacker-news.firebaseio.com/v0/user/hardwaresofton/ab...
Re:Show HN: Login with HN (Unofficially)
by hardwaresofton on Thursday January 13, 2022 @09:27PM
(#29929918)
Hey thanks for the suggestion, I'll check this out as well -- I definitely don't mind having more ways to check so I can spread load and what not.
I wanted to be able to make apps that do social login with HN so I hacked it together.
It works like you would expect -- generating a code you can put in your profile. For convenience, you can then use either TOTP or Email (if you specify both, it will default to using TOTP) to login thereafter to make things quicker (it can take up to a minute until profiles update).
I generally wait about 5 seconds between checks of a profile, hopefully this isn't too much additional strain (especially since I expect most people to switch to something faster after the first login).
[EDIT] Also it's night time (well morning I guess) where I am so... spinning up some more instances and I'm going to sleep.
[EDIT2] My email is plastered all over the site, but please feel free to email me any bug reports!
[EDIT3] If you'd like to register an app, please check out https://mailing-list.vadosware.io/subscription/form ! Ignore all the other mailing list stuff and get on the "early adopters" list for LoginWithHN! Or just email me in my HN profile, whichever!