Open jonodrew opened 3 years ago
Here is an alternative that be simpler, if it can work: in github we have a little csv that holds a table of {twitter list, url slug}, for example something like:
1358187814769287171, data_collective_members 1374362955635171329, EPDS_board
And then when a user goes to twitterlistfollower.com/url_slug, they follow the associated list. So in other words, there is a defined set of lists that work, and the admin (manually?) sets the callback URLs with Twitter.
User clicks a link --> server returns 200. HTML: "If you are not redirected in {n} seconds, click this link", potentially .js as well to automatically redirect user. Set a cookie to identify user. User authenticates, is redirected by twitter to /redirect.
Redirect examines cookie, matches up current with original request, and then kicks off list-following-process
Can we have something like "Click here to follow everyone in "[listname]" on Twitter" instead?
I've spent the week fighting with the web framework I'm using to return some HTML so that the user has something to click on. I'll keep working on it for now, I'm sure there's an easy way that I'm just missing.
Thank you for your perseverance 🙏
I think with the current architecture this isn't going to work. To get to something similar to https://megablock.xyz/, I am going to need to add a front-end application to deal with users. I'll put it in its own repo and name it appropriately, and it'll just be a small Flask app to manage the user session effectively. The Flask app will interact with this queueing system.
Users should be able to follow any list by hitting some endpoint, probably
api/list/{list_id}
Since the callback URL for Twitter authentication has to be registered with Twitter, we can't dynamically generate it. That means the flow will have to be homepage -> authenticate -> select list to follow (how?) -> process list as usual, unless I can pass some kind of context through the authentication process - ie, so that when Twitter returns the response, I know what list the user was trying to follow when they hit the authentication flow.
If I can't do that, there will have to be more of a frontend than there currently is, which represents a fairly chunky bit of work. Specifically, working out how a user selects which list they want to follow will be a tricky experience. There will also have to be a new bit of code at the backend.