increpare / PuzzleScript

Open Source HTML5 Puzzle Game Engine
MIT License
903 stars 159 forks source link

gist updating // pointer to gist in share log #625

Closed minotalen closed 3 years ago

minotalen commented 3 years ago

Every time a user clicks on SHARE, a new gist is created. Would it be feasible to optionally update the gist instead? In the UI, you could create an additional button UPDATE right next to SHARE after the gist has been created.

In case there are reasons against updating a single gist (maybe you want the gists to function as version control) you could still add an output to the console log (which already logs a play and edit link) that links directly to the gist.

I know you have some basic documentation on updateable PS urls (oh wow haven't been rickrolled in a while), but it still happens quite regularly (on some discords I frequent) that creators share a bunch of links before someone explains to them how to update gists. In an ideal world people would just rtfm, but since updating gists is supported by the github API I thought I'd suggest it.

increpare commented 3 years ago

Hi, thanks for the issue.

That's a fair suggestion. Modifying files on a user's account requires extra permissions from the user to modify their account stuff (which I'd prefer to not be trusted with if necessary), and...the interface flow would be more complicated. It complicates things a bit basically, even if it might take weight of explanation off communities of people working with puzzlescript. I feel like that's a step in the direction of having a whole filesystem (browsable file list), which would be the desired endpoint of that trajectory, and I don't want to set down it.

Also the more random backup copies of a game someone has the less likely they are to accidentally lose it ^^.
Also it would bind me even more tightly to github, which I'm not sold on as a long-term solution for game-sharing for puzzlescript (with a strong note that I never ever ever want puzzlescript urls to break, so whatever I may do in the future will be compatible with current ones)

minotalen commented 3 years ago

Hi. You could still consider adding the gist link to console output :)

increpare commented 3 years ago

sure https://github.com/increpare/PuzzleScript/issues/626

ClementSparrow commented 3 years ago

I think I've implemented in my fork what @minotalen asked in the first comment. I can't lead you to a specific commit that implements that but if you look at the files js/toolbar.js, js/editor.js, js/addlisteners_editor.js and editor.html, you should see that the changes are not that big.

In particular, GitHub has only one type of rights for gists, so PuzzleScript has already the rights to create/update/fork/delete gists on behalf of the user.

One thing that I still need to do is to manage forking gists: it would be nice, when you hack someone else's game and save it, that it actually forks the gist (so that the original authors can know their game has been forked, and so that there are less ambiguity about the work being stolen or derived). Currently the GitHub API only allows to fork a public gist into another public gist, and I use private gists for "save on cloud" and public ones for "share" (as does vanilla puzzlescript). So I need to register somewhere that the gist is forked from another one when "saving on cloud", and actually fork the original gist only when "sharing" the modified version publicly...

Another thing that is needed is the possibility to get the URL of the game for a specific commit so that authors can share a specific version of their game. Appending the commit id to the gist id should work fine for that, but an interface is needed to give the URL (could be a simple console prompt).