this post was submitted on 20 Jun 2023
8 points (100.0% liked)

Programming

17313 readers
726 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 2 years ago
MODERATORS
 

I'm a programmer, but mostly C in my job. I've played with PHP5 (yeah, a long time ago), dabbled in HTML5 when it was new, touched upon some ancient version of Javascript, etc. etc. I have done bare-bone system administrator work but only enough for test instances.

My web-knowledge is therefore lacking. So I'm seeking the discussion with more experienced peers (especially in web and/or administrator sides) to brainstorm this idea. I'm probably not going to ever implement this idea, but... I feel like discussion may help me solidify the work needed to build future communities.


Lets say I want to make a Competitive Tetris community akin to HardDrop.com. Among the most important features of Tetris is the Web-Application "Fumen" Javascript application, created by Japanese programmers.

The web-gui isn't the most intuitive, but you all can demo it here: https://harddrop.com/fumen/ . The code has all sorts of Japanese comments that I can't read, but presumably with enough copy/paste and effort, I could get it off of Github (or whever it originated from) and copy/paste it into my own server somehow.

When the HardDrop forums were open, people would discuss Tetris Strategies by crafting them on a Fumen, and then discussing them. I made such a post long ago here, on the TKI3 strategy if you want to see it: https://harddrop.com/forums/index.php?showtopic=7889


Now lets say I want to import my old Fumen for my own discussion purposes, somewhere in Lemmy. What's the best way to present it?

I'm assuming I'll need:

  1. Copying the Fumen renderer into my own Javascript/HTML

  2. A friendly administrator who is willing to give me Javascript-import (or hosting the Javascript locally on the server). This presumably would be myself making my own server, but alternatively another admin who is aligned with me could do this too.

  3. Ideally a local copy of Fumen running. (I wouldn't want to hammer HardDrop's webGUI too hard)

  4. Some kind of Lemmy plugin that allows people to post text of the form: (v115@BhilFeAtglR4Beg0RpBtR4Ceg0RpAtzhAeh0JeAgWW?AURVSASYNuEw488AQr78AwKY5DkoBAAvhBtsuAAlsBzgQ4I?eR4CeRpwhBeglQ4CeRpwhAeAtglFewhBthlEewhAtKeAAPX?AS1STAS4kcDnoo2AMoo2AQieeEFcxCA), which coincides with the Fumen I wrote. Upon recognizing a string of this form (or maybe of form: [[fumen@v115...]]), render such a Fumen inline with the post.

  5. Obviously, it would only render correctly on my "local instance" with my "local users". Assume this is sufficient for my personal community. But if anyone can think of how this can be solved "Cross-Lemmy", I'd also be interested in that. Are there ways to maybe... make a "Trusted Bot" running on someone else's instance that has permissions from the administrator to publish an iframe? Is there a way to do this without pissing off all the security-minded webfolks?

  6. Is a renderer an option? Can I publish a mp4 file that has frame-by-frame rendering of a Fumen to other instances that don't have a Javascript-fumen of their own. I know other groups publish .gif files but has more standard options to different users (play, rewind, etc. etc.). I don't know how widespread a frame-by-frame video render is across frontends (Android, iPhone, Firefox, Chrome, Edge) is however.

I'm not sure if the Tetris community is in a state where this is worthwhile pushing. But I can see "future video games", especially competitive ones, needing other online GUIs, calculators, and other such web-application support to help discussion.

Any web-experts out there wanna muse on this subject with me?

you are viewing a single comment's thread
view the rest of the comments
[–] faboosh 1 points 1 year ago* (last edited 1 year ago) (5 children)

Just spitballing, but you might not even need to inject much JS on the lemmy side. This sounds like something that could load in an iframe, pointed to a server that can render the Fumen sequence. The injected Lemmy JS could then identify the Fumen sequence, and inject the iframe. Main issue I see with this is mobile users, where you can't really inject code at runtime.

EDIT: Saw that you mentioned using iframes already, I'm seconding that option. I also think it could be neat to use something like code blocks with tags, say !#fumen [insert fumen string here]

[–] dragontamer 1 points 1 year ago* (last edited 1 year ago) (3 children)

Ah yes, I was editing #5 and #6 in as you posted this.

IIRC, remote iframe renderings is a big security no-no. Or at least... it was in the PHP5 days like 10+ years ago. Is that still a security problem today?

Nominally, "information" is what needs to be published, and in a form that has maximum compatibility with as many browsers as possible. A crazy Fumen->.mp4 -> x264-encoded thingy could be the answer, assuming that there's a cross-platform way to provide frame-by-frame click GUIs.

The thing is a bit of a longshot. But that could in practice be solved with a bot that listens for particular strings in a !tetris_community.

I think the iframe thing makes sense technically to my brain, but I foresee security concerns... concerns that I honestly don't fully understand due my lack of web-experience.

[–] faboosh 1 points 1 year ago

Also worth mentioning, iframes have a sandbox attribute which can be used to lock down which browser APIs it has access to (they can't access much out of the box anyway, but this allows further locking down).

Say you have a webserver rendering the Fumen sequence, you could have the step buttons just be links to the next/previous steps. This would require no JS to run within the iframe, which is a great step to harden security even further.

load more comments (2 replies)
load more comments (3 replies)