Code Monkey home page Code Monkey logo

Comments (15)

Mottie avatar Mottie commented on May 24, 2024 1

Please test out the script - https://github.com/Mottie/GitHub-userscripts/wiki/GitHub-download-zip

from github-userscripts.

aspiers avatar aspiers commented on May 24, 2024

This sounds like a nice idea. I encourage you to submit it both to GitHub and also to https://github.com/isaacs/github/issues/new ...

from github-userscripts.

Mottie avatar Mottie commented on May 24, 2024

Yes, nice idea indeed!

It may not be too difficult to implement since GitHub names the download file based on the api link:

URL Name of downloaded file Details
https://api.github.com/repos/Mottie/GitHub-userscripts/zipball/master Mottie-GitHub-userscripts-v1.0.213-0-gaaafb00.zip user + repo + #? + "g" + SHA of last commit
https://api.github.com/repos/Mottie/GitHub-userscripts/zipball/v1.0.208 Mottie-GitHub-userscripts-v1.0.208-0-gaa9b2db.zip user + repo + #? + "g" + SHA of tagged version
https://api.github.com/repos/Mottie/GitHub-userscripts/zipball/31340a9 Mottie-GitHub-userscripts-v1.0.211-3-g31340a9.zip user + repo + #? + "g" + SHA of set SHA with last tagged version
https://api.github.com/repos/mozilla/pdf.js/zipball/gh-pages mozilla-pdf.js-078f568.zip user + repo + SHA of last commit in that branch

from github-userscripts.

Bluscream avatar Bluscream commented on May 24, 2024

I hoped so hard that this issue was about releases download stats :x

from github-userscripts.

CollinChaffin avatar CollinChaffin commented on May 24, 2024

Holy cow Rob! Just grabbed it and will test it today/tonight. I'm blown away you got something to test so fast.

EDIT: Will continue testing but only needed a minute and a couple clicks/tests and I confirm it's exactly what's been missing all along. What are your thoughts on optional #2 above and in addition to renaming the files with commit info, adding certain number of releases below the main repo zip like you did with rawlinks? Or, is the different type of releases going to be an issue if someone has three releases with a single zip and gz, vs someone who's every release has 12 release types (linux/win/mac/etc.)?

from github-userscripts.

CollinChaffin avatar CollinChaffin commented on May 24, 2024

Just had a recall good idea of how to address different release types #s etc. if you ever did want to try #2 above......

Underneath the newly-renovated main repo ZIP download, add (through look-ahead API like rawlinks):

  1. One new table ROW per release. Split row into columns for release types. So, a release 1.01 that has one zip and one tgz will have a single button under zip spit into 2 for zip/tgz. Another release, however, has 1.01 and 8 sub types (zip, exe, x64win, x32linux, etc.) - those are column splits of that release row. Yes, this could get tiny but only in extreme cases and looking at the current table size it might be pretty usable, and very logical allowing then still up to 3 releases that have say 8 types of binary distributions, all on 3 new "button" (table rows) below main repo ZIP.

Just an idea. I'm envious I wish I could churn out JS fast enough to help write it. Now, if it were dotnet or even a scripting lang like Powershell I'd me a lot more help! :)

from github-userscripts.

Mottie avatar Mottie commented on May 24, 2024

The userscript I created is using the standard API. It isn't renaming the files at all. I don't think we can modify the file name once the browser download kicks in, and I'm not sure if it is even possible to use the API to change the file name. As far as I know, GitHub only serves up ZIP and TGZ compressed files. I've never any other file type being served - am I missing something?

Is there a case where you'd switch between downloading the repo as a ZIP vs TGZ? Instead of splitting the button, I could add a userscript option that allows you to set your preference.

One new table ROW per release. Split row into columns for release types...

I'm not really sure what you mean here. Can you mock up something for me to look at? And what page would it be on? I'm guessing the commits page?

from github-userscripts.

CollinChaffin avatar CollinChaffin commented on May 24, 2024

Hey sorry for the poor expanation - here's an example of what I mean:

https://github.com/Maximus5/ConEmu/releases

and if you then query the API:

https://api.github.com/repos/Maximus5/ConEmu/tags

According to what I've been reading on:

https://developer.github.com/v3/repos/releases/#get-a-single-release-asset

So that most recent release of ConEmu as example has 2 executable installers, and 3 total zip/gz/7z bundles for releases. My vision would be to use the API which does list all those under tag assets, to:

Create and append a new table element row beneath the ZIP you just enhanced, and across that row/box, split it X number of times depending on ASSETS for that release tag. So, in this case, a 5-way split and perhaps even a mouseover tooltip is best in the event there are a dozen and the slices get a bit thin for actual text (icons instead?). Now, rinse and repeat UP TO 2 more times (or whatever you decide I guess with vertical real estate perhaps you could pull up to the most recent 5 release tags, add the 5 buttons and split them horizontally depending on assets of that release tag.

Make more sense? I apologize I should have just tried to wireframe this up as a quick mockup to show you the vision but hopefully this explanation is a bit better. It's pretty much taking almost exactly the new dropdown you created for rawlinks and tacking it below the main ZIP with the main diff having to deal with the darn release tag ASSETS as a new level. Not sure my vision is best approach but hey - nobody's done anything like it yet and I'd already put serious $ down that this script is going to wind up being so popular that it tops your user lists, and that GH begins borrowing for future site changes. :)

EDIT: Hence why my initial stab at the name was more of "Git-Releases" vs "Git-Zip" since it would also be adding the very much missing front-page repo links to actual binary installers and other release assets that I have always been blown away is totally void from the main GH repo page. 😉

from github-userscripts.

Mottie avatar Mottie commented on May 24, 2024

Hmm, I'm not sure how well that would work. If you look at GitHub's hub releases, you'll see they have 11 different downloadable files. Luckily, the old API provides those link urls in the browser_download_url value. I think it might look better with a dropdown instead of including all the links. Maybe something like this?

As for listing all of the assets in the tags tab, that seems doable.

In both instances, I'd use the same method as the raw links userscript - include an empty dropdown that populates when you interact with it.

from github-userscripts.

CollinChaffin avatar CollinChaffin commented on May 24, 2024

Doh! Not sure where my brain was but yes a dropdown absolutely is the logical choice and looks awesome in your example! The one thing I would ask you to (re)consider that I just noticed using the enhanced new ZIP download on a repo was that one previously-used naming element seems to have actually gotten dropped with all the new additions - being the [BRANCH]! Don't you agree that needs to be put back in? I'll run through a quick breakdown to demonstrate.

I just happen to have open the ConEmu repo so I'll use as example:

https://github.com/Maximus5/ConEmu/tree/master

Go there, disable this new userscript, and download the repo zip and the browser (via Content-Disposition header) will suggest filename of:

ConEmu-master.zip

Now switch to daily branch and click zip again and receive:

ConEmu-daily.zip

However, enable this script and do the same and you get:

Master: Maximus5-ConEmu-v-preview-0-g0a4f947.zip
Daily: Maximus5-ConEmu-v-preview-37-gf2c89b6.zip

Given today's path length max allowances, I see no issue with you adding back branch name. I do see the difference when the versioning plus commit is in fact reflected, but hopefully you see my point there is now no quick visual indicator which branch it came from and you can of course have commits rolled into different branches/releases. In fact, removing the branch in cases where they have chosen release titles like the one used here "preview", you can see how it can be pretty confusing without branch in the name. If I had to pick, I would simply add it back in right where it originally was - after the repo name so:

Master: Maximus5-ConEmu-master-v-preview-0-g0a4f947.zip
Develop: Maximus5-ConEmu-daily-v-preview-37-gf2c89b6.zip

IMO at that point, you have achieved absolute naming perfection, and frankly how it always should have been.

from github-userscripts.

Mottie avatar Mottie commented on May 24, 2024

Forgot to add this to my to-do list... I'll get to this soon!

from github-userscripts.

CollinChaffin avatar CollinChaffin commented on May 24, 2024

Hey @Mottie I just saw the available update to this "Github Download Zip" script and installed it, and despite it working as before in the commits links, for some reason now on the most important (to me) main repo page download button ZIP, it no longer is adding the icon nor changing the link so the default -master.zip downloads. With this being the main link others probably have gotten spoiled with using this for is there any chance (other than my original above enhancement discussion) take a quick look at fixing current to get it at least back up and running again? Thanks!

from github-userscripts.

Mottie avatar Mottie commented on May 24, 2024

Bah, I forgot about this enhancement again 😿

from github-userscripts.

Mottie avatar Mottie commented on May 24, 2024

I looked at the latest request and I don't think it's possible. This userscript is essentially pointing to urls of existing end-points, and there isn't any way I can think of to intercept and rename the downloaded file.

As for creating a select, I haven't gotten around to it yet. Sorry 😞

from github-userscripts.

Mottie avatar Mottie commented on May 24, 2024

Finally added!

from github-userscripts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.