Versions & Diffs for a userscript

Subscribe to Versions & Diffs for a userscript 34 posts, 19 voices

 
Jesse Andrews Admin

An initial stab at storing previous versions (for various uses). You can see an example here. I'm currently creating the diffs via:


diff -u old_version new_version | tail -n +3

Revising the uploading process for new versions asking for a short description of what changed is planned.

Ideas for improvements?

 
Johan Sundström Scriptwright

I think e g http://userscripts.org/scripts/diff/30750/28294 would look better if you ran diff -wu instead; whitespace changes (newline ending style) aren't that interesting to show.

 
Johan Sundström Scriptwright

Also, linking the versions index (http://userscripts.org/scripts/versions/30750), next and prior diffs (when they exist) from the top and bottom portions of the diff page would be neat improvements.

I'd love to hack up some features for live clickage to fold/unfold the common sections into/out of view, but that is better done client side than server side. Is there any query parameter I can pass the install link, so xhr's don't count towards the installation counter?

 
Johan Sundström Scriptwright

Awesome; Henrik dug up that I can pass any query parameter to opt out of the install countage. :-)

 
Jesse Andrews Admin

I upgraded to using diff -wu.

Still thinking about how to link at top/bottom... (what text should be shown)

 
Jesse Andrews Admin

Johan asked in IM for:


JSON for the versions overview page would rock -- http://userscripts.org/scripts/versions/30750 for instance, i e mapping to something like [{"ctime":1217728800, "url":"/scripts/version/30750/28654.user.js", "diff":"/scripts/diff/30750/28654" }, ...] or so.

 
vBm Scriptwright

IMO would be nice to have "next diff" on diff page if there's newer upgrade for script.
Something like revision numbers on Google code pages.

Hope i was clear enough on my thoughts.

 
ScroogeMcPump Scriptwright

When this is fully ready, will it go back to all older versions (including those uploaded before this facility to review them was installed), or do you no longer have access to those? (My scripts all say "1 version", which is 100% untrue.)

 
znerp Scriptwright

On the whole this seems very useful, and it's looking really good at the moment though. One quick question though - would it be possible for script authors to remove (or have removed) a version of a script?

I ask this simply because sometimes when I've been very tired or not very with it, I've made some howlers in my update process. I've accidentally uploaded the wrong script (by copying the code for the wrong script and hit save before realising) before, and I've also accidentally left in a line for debugging whereby users would be redirected to one of my friend's photo albums on facebook rather than whoever they've clicked the link for.

These are just examples of things that I personally wouldn't necessarily want saved, and I'm sure it would be just as easy to accidentally paste any number of things in the update script box.

 
Jesse Andrews Admin

@ScroogeMcPump - I have backups of the database every 12 hours for the last year, I could replay potentially. Would it be worth it? or would it be better to have an asterisk explaining that versions prior to X aren't available?

@znerp, I've not thought about exposing delete. Could this be exposed but I would like to think if this could be abused somehow...

 
lucideer Scriptwright

+1 on znerps suggestion.

I have a script or two with 5/6 versions even though they're only really on v1. Typos, accidental uploads, debugger removals, etc. are strangely common occurences... ;)

@Jesse
How could it be abused if only a logged in author can do it to their own scripts? (or are you talking about potential XSS holes?)

 
Jesse Andrews Admin

@lucideer,

nothing in particular - I've been thinking about storing versions for a while now and hadn't thought about deletion. Pretty much everything on the site has been targeted at one point or another... off the top of my head:

1) user uploads clean script
2) submits to digg/reddit/... games their system to the top
3) as it gets popular uploads a new evil version
4) after the traffic peaks deletes the evil version so that the userscripts.org regulars don't see it.

 
CDM Scriptwright

Yeah I think some support for version deleting/editing? or control over the creation of new versions would be nice.. sometimes I just want to remove extra whitespace or fix minor typos, thus I create a dozen variations of the same script for the sake of looking neat lol.

Other than that, love the site, keep up the great work.

 
znerp Scriptwright

I agree that this could easily be abused in quite a few ways, and so I added "or have removed". My thoughts on this were that it could be an option to have authors request versions of their scripts be removed, although I don't know to what extent this would be used and it could really bog down the admin. Presumably (and this goes also for the case where authors can remove versions themselves) there will also be scriptwrights who elect to remove every version of their script but the current one, and this would defeat the purpose of the versions.

On the other side of the fence though, users could make changes that they want to remove from public viewing immediately, and waiting for these to be approved might not be an entirely acceptable delay.

This said though, knowing that versions of scripts are stored will make me think twice when uploading a script in future so maybe that could be enough for most authors. But with regard to ScroogeMcPump's question, for the reasons I listed earlier, I'd prefer if versions prior to the current date weren't added to the main site. Just my thoughts on the matter.

 
lucideer Scriptwright

@Jesse
Ah, yes. I suppose I should've thought it through a bit more than I did. That would be quite dangerous.

Then again, wasn't that just as possible before versioning was introduced? Either way, if versioning adds a layer of security, no point in taking it away again.

Requesting approval as znerp mentioned would be a huge administrative strain I'm sure.

Does diff have some way of outputting the "level" of change between two versions (in kb or some other arbitrary unit). So very major changes would force a new version, while with minor changes it would be at the authors discretion.

 
Jesse Andrews Admin

@lucideer,

Having stats about the size of the DIFF is in the work (the normal measurement is in number of lines changed).

The previous hole did already exist (as you mention). Versioning made it so it was harder to hide. One possibility is that versions can be "deleted" but what it really does is hide them by default - but any logged in user can say show all versions.

(btw, I love your gravatar)

 
JoeSimmons Scriptwright

Sweet Jesse.

 
jerone Scriptwright

I like it and I have a little suggestion;
add a border on the right-side of the + and - (like google code).
That way it doesn't look like it belongs to the source.

 
QP Scriptwright

Hi,
related to versions it would be interesting to have number of downloads per version.
That could later generate some sort of graphic chart (maybe using SVG?) to show progress of downloads per versions.

Maybe also, comments per version... numbers and graphics..

So those are my suggestions..

Regards,
QP

 
Jesse Andrews Admin

@QP,

It is definitely a goal to add those features. I'm releasing as I go instead of building lots of features and release all at once - so the existing version system is only phase 1.

 
QP Scriptwright

Hi Jesse,

Btw, just occurred to me another detail... in a script's versions page, now there is a date, install link and changes link, if there is a @version in the script it would also be interesting information to be shown.

Yes, I know you're adding them as you go... keep up the good work :)

Regards,
QP

PS: Btw, on other topics I had posted in the forums about bugs and improvements... should I put it elsewhere? where? :)
(Sorry on this being offtopic, but I really had no "official" answers on those small bugs/improvements)

 
znerp Scriptwright

Btw, on other topics I had posted in the forums about bugs and improvements... should I put it elsewhere? where? :)
On the left of the screen you'll see an orange "feedback" link. I think that would be the appropriate place for bugs and improvements.

 
Jesse Andrews Admin

znerp, qp,

ya, I'm trying to keep things at uservoice. I need to shutdown the devjavu since the service didn't have adequate spam protection :(

 
badman Scriptwright

i made a script....buh its nt working.....m new in dis stuff....plz help

 
Photodeus Scriptwright

Requesting (as others) a previous | next browsing button, telling what version I am currently navigating and how many versions there are in total. Simple stuff like that.
I don't think normal users care to watch diffs too often, I think it's more interesting to power users and the scripter himself :D