osuka's votecounter + modtools

This forum is for discussion related to the game.
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13383
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀

Post Post #22 (isolation #0) » Tue Aug 29, 2023 11:10 pm

Post by JacksonVirgo »

Has been a month since the last post so I'm sorry for the useless bump but I am egoposting here from the depths of hell. I have arisen
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13383
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀

Post Post #28 (isolation #1) » Thu Aug 31, 2023 4:43 am

Post by JacksonVirgo »

In post 26, Psyche wrote: I've been trying to be careful not to invest in side projects too much again, but it'd be nice to close out my pre-existing work around all this. Should maybe sideline the question of improving the tool further and focus on maximizing accessibility for normal folk. I think we want to avoid a situation where people download things.

If we're committed to not having a persisting backend, a cleaned up colab notebook that anyone with a google account can execute seems like a usable substitute that can be spun up really quickly. At minimum it might give us ideas for what to do going forward. I'll have something before the weekend is over...
For normal folk it's probably better as a web app, or maybe a tampermonkey script (I found that Tampermonkey can fetch page data from a page you're not on).
As a desktop executable, I agree with Osuka that platform specific apps are probably bad. So why not just use Java or something that doesn't need a specific compilation. Java handles it.
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13383
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀

Post Post #29 (isolation #2) » Thu Aug 31, 2023 4:45 am

Post by JacksonVirgo »

I did do some experimenting with NextJS as a backend for this, have the client keep polling the server for each individual page fetch etc (as to not hit the serverless timeout) but the fetch seemed to take too long for the free-tier of Vercel + cold starts would probably fuck that up too but it was worth a shot.
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13383
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀

Post Post #31 (isolation #3) » Thu Aug 31, 2023 2:16 pm

Post by JacksonVirgo »

In post 30, Psyche wrote: Yeah a lot of options. I'm kind of skeptical of fully browser-based solutions like browser extensions because I expect they'd all manage the whole "votes are distributed across pages" thing really awkwardly. I'd love to know if I'm wrong!

On the other hand, the biggest downside of colab notebooks will probably be the fact that the entire execution environment has to be set up at each new use, slowing down performance. Also, UX won't quite be seamless, even if we can technically reduce interaction to filling a textbox or two and pressing "run".

This leaves me preferring a backend solution where we find a really cheap way to host a server that monitors various threads and provides an API for retrieving vote counts. From there, any arbitrary frontend UX becomes doable -- chrome extensions, web pages, etc. And these frontends would in turn be compatible with any votecounter implementation that provides the same API.
Considering Tampermonkey allows fetching across the site (which in-page JS rejects), I'm almost certain that it's possible to make a Tampermonkey userscript to integrate it directly into the site itself which would literally be the best user experience we could get here. I'd use a library like Cheerio to parse the data which I'm not sure works in Tampermonkey, but if not a custom browser extension is the next best thing (it's a little awkward for users to set up though).

I am not too experienced with Colab notebooks so I don't have any input on that.

Backend solutions isn't a super long-lasting approach, there's a few issues that come with that including when the site changes and breaks the code etc if the person who manages the server is no longer working on it, the tool is as good as dead.

I do believe we should be focusing on a browser extension (either as a userscript or a whole extension) OR a Java app which users download as both make the user experience simple, and also it should work regardless of the users device or setup
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13383
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀

Post Post #32 (isolation #4) » Thu Aug 31, 2023 3:00 pm

Post by JacksonVirgo »

https://github.com/JacksonVirgo/mafia-engine-browser

I just made an example browser extension (Typescript) to really outline how it would work.

The main script runs jQuery (I know, gives me the shivers) on the main page so it can add buttons and the like *in* the website. But the main script cannot fetch data from other pages, so that's where you use the background script. Send the request there, the BG script gets it all done and sends back the response.

It's pretty straightforward, and is probably the most user friendly way we could handle this entire thing imo (without having a backend server)

EDIT: I've made the extension specifically for Chrome but realistically you'd make it cross-browser to work on all browsers that allow extensions.

EDIT 2: I've made it cross-browser but I haven't tested on anything but Chrome
Last edited by JacksonVirgo on Thu Aug 31, 2023 3:19 pm, edited 1 time in total.
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13383
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀

Post Post #34 (isolation #5) » Thu Aug 31, 2023 3:21 pm

Post by JacksonVirgo »

In post 33, yessiree wrote: Edit: yeah, I'm with JacksonVirgo, many advantages of using browser extensions for vote scraping
  • Everyone knows how to add browser extensions -> low barrier to entry
  • Ability to add UI to the web page (buttons, results of vote scraping) -> good UX
  • Everything can be ran on the client, no need to maintain any backends (why do we need any backend at all? we don't need to store any data, we're just pulling data from mafiascum) -> low complexity/maintenance
time to brush up on JavaScript folks!
Exactly, it's the most user friendly option and to me that's the most important thing.
Second only to MS implementing their own vote counter solution into the site itself.

Javascript is overrated, use Typescript :cool:
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13383
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀

Post Post #36 (isolation #6) » Thu Aug 31, 2023 4:32 pm

Post by JacksonVirgo »

In post 35, Psyche wrote: okay cool. have always wanted to get good at making extensions
I'm working on fleshing out what I wrote just because I'm hooked on the idea now. If you wanted to help work on that one instead, lemme know. But if you do make your own, I'd be interested to see how you'd do it.
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13383
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀

Post Post #38 (isolation #7) » Thu Aug 31, 2023 4:48 pm

Post by JacksonVirgo »

I've updated the code, it now creates a "VC" button on each message. Clicking it fetches the page data for now, but it will start the logic to fetch the vote-count.

Just to make it super clear how you'd do it if you were unsure.
In post 37, Random Nurse wrote: If costs are involved I am able and willing to donate, if it means Mafiascum gets an easy-to-use automatic votecounter.
I doubt we're gonna be dealing with any costs at all.
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13383
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀

Post Post #39 (isolation #8) » Thu Aug 31, 2023 5:58 pm

Post by JacksonVirgo »

I got no idea how to shrink an image here so I've put it in spoilers but a quick visual display that you can very much fetch from other pages using a browser extension.

In the screenshot it demonstrates
  • You can place custom HTML elements in the page (my VC button on the left, ugly rn but design isn't a priority)
  • You can fetch from other pages, as seen in the console on the right.
  • You can't see the "users" value but it's a list of all the usernames to demonstrate fetching data from each post.
  • The extension will only work on "forum.mafiascum.net/*" sites
Take from this what you will, I believe this is the best route to go and I believe it counters all of Osuka's downsides (for servers/executable) and upsides (for CLI). And non-technical users will be able to use this without much issue at all.

EDIT: I think it's fairly easy to get onto the web store of every browser except Safari (I ain't regularly payin' like 99USD for a dev account).


Spoiler:

Image
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13383
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀

Post Post #41 (isolation #9) » Fri Sep 01, 2023 1:22 am

Post by JacksonVirgo »

In post 40, Psyche wrote: Nahh I don't have the time to go my own way on this.
I see I see, that's probably for the best either way. No use wasting time and effort to both do the same thing ahaha
In post 40, Psyche wrote:I do suspect that this should maybe be a different thread since the codebase will probably be mostly distinct.
Hmm, yeah right. Unless Osuka wants otherwise, I'll get the core finished tomorrow and then make it's own thread.
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13383
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀

Post Post #45 (isolation #10) » Sat Sep 02, 2023 4:12 am

Post by JacksonVirgo »

In post 42, osuka wrote: i didn't write a browser extension originally because i honestly couldn't be bothered to write and maintain a userscript. i hate javascript and it's just about the last language i'd choose for any personal project, honestly.

for what it's worth, i wonder why this isn't a part of the actual forum in the form of a phpbb extension. would that suck a lot?
The sites devs are kinda overloaded aorn with other priorities than a vote-counter that people make scripts for anyway.
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13383
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀

Post Post #46 (isolation #11) » Sat Sep 02, 2023 4:37 am

Post by JacksonVirgo »

Yo Osuka, how does your script deal with hammers and the like?
And also like new days etc.

I don't see anything that would signify that in the game definition file example.
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13383
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀

Post Post #47 (isolation #12) » Sat Sep 02, 2023 4:41 am

Post by JacksonVirgo »

Nevermind, read the README like I probably should have before asking.
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13383
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀

Post Post #48 (isolation #13) » Sat Sep 02, 2023 5:51 am

Post by JacksonVirgo »

Yo so I made a post about my browser extension based VC. If you wanna peek, here viewtopic.php?t=91528
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13383
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀

Post Post #52 (isolation #14) » Sun Sep 03, 2023 4:19 pm

Post by JacksonVirgo »

Honestly, having a page-topper sounds fairly dangerous to have easily accessible.
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13383
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀

Post Post #54 (isolation #15) » Sun Sep 03, 2023 4:22 pm

Post by JacksonVirgo »

In post 53, Random Nurse wrote:
In post 52, JacksonVirgo wrote: Honestly, having a page-topper sounds fairly dangerous to have easily accessible.
How so?
Because there would be no restrictions as to who can use it.
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13383
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀

Post Post #56 (isolation #16) » Sun Sep 03, 2023 9:30 pm

Post by JacksonVirgo »

In post 55, Random Nurse wrote:
In post 54, JacksonVirgo wrote:
In post 53, Random Nurse wrote:
In post 52, JacksonVirgo wrote: Honestly, having a page-topper sounds fairly dangerous to have easily accessible.
How so?
Because there would be no restrictions as to who can use it.

Could it be limited to just game mods per site rules?
I am slightly exaggerating the danger in my head, I am aware but it still makes me uncomfortable.
And there's no way to limit it that can't just be removed from the code to abuse it, as it's client-side and not on a designated server or anything.
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13383
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀

Post Post #63 (isolation #17) » Mon Sep 04, 2023 10:45 pm

Post by JacksonVirgo »

I agree with Osuka, it shouldn't be made imo
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13383
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀

Post Post #67 (isolation #18) » Tue Sep 05, 2023 10:44 am

Post by JacksonVirgo »

In post 66, osuka wrote: let’s see what the admins have to say - if there is an actual phpbb api?l, i’d be much more comfortable shipping the pagetopper since we’d be able to talk about things like rate limiting and api key revocation in case shit goes sideways
Yeah I'd only be comfortable if we had a backend doing it but having a backend is not sustainable unless it's directly in the site itself.
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13383
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀

Post Post #72 (isolation #19) » Tue Sep 05, 2023 11:16 pm

Post by JacksonVirgo »

In post 68, yessiree wrote: echo what others have said about pagetopper, I don't think a centralized backend solution is a good idea. Having to manage user credentials and auth cookies sounds like a security disaster waiting to happen
Auth isn't the issue as you can use a service like Clerk to manage the entire thing for you (for web technologies anyway, for that specific example)
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13383
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀

Post Post #73 (isolation #20) » Tue Sep 05, 2023 11:25 pm

Post by JacksonVirgo »

I'd be okay with expanding on my mafia engine servers (which rn is a discord bot + attached site) if you wanted a reliable backend for anything.
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13383
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀

Post Post #75 (isolation #21) » Wed Sep 06, 2023 5:16 am

Post by JacksonVirgo »

In post 74, yessiree wrote:
In post 72, JacksonVirgo wrote:
In post 68, yessiree wrote: echo what others have said about pagetopper, I don't think a centralized backend solution is a good idea. Having to manage user credentials and auth cookies sounds like a security disaster waiting to happen
Auth isn't the issue as you can use a service like Clerk to manage the entire thing for you (for web technologies anyway, for that specific example)
Can Clerk manage third party auth credentials? (I'm talking about logging in to ms and storing the session cookie)
No, although I’m never doing that even if there were. There are other ways to authenticate an MS account and you can just use a bot account to do the pagetops. I am not super comfortable using a tool that takes my auth credentials and does what they want with it.

This is again server only which is probably not the way to go anyway but Psyche wants specific functionality that is best for a server so eh
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS

Return to “Mafia Discussion”