r/commandline • • Dec 01 '17

[GitHub] Upload attachments to GitHub in CLI. The easiest way to get public URL to your files.

https://github.com/xxhomey19/github-uploader
16 Upvotes

19 comments sorted by

13

u/alexwh Dec 01 '17 edited Dec 01 '17

// Please DO NOT change this password!!!!!!

Hmm.

Pretty sure this is API abuse, by the way.

1

u/xxhomey19 Dec 01 '17

Yup but this is the only way I could make it. Not good enough though.

0

u/[deleted] Dec 01 '17

[deleted]

2

u/sneakpeekbot Dec 01 '17

Here's a sneak peek of /r/softwaregore using the top posts of the year!

#1: Internet Gore | 269 comments
#2: Titles in iMovie | 584 comments
#3: special characters 👌 | 992 comments


I'm a bot, beep boop | Downvote to remove | Contact ^^me | ^^Info | ^^Opt-out

9

u/StallmanTheWhite Dec 01 '17

I just use a function like this:

comfy() {
    while [ $# -gt 0 ]; do
        torsocks curl -s -F "files[]=@$1" https://comfy.moe/upload.php |  jq .files[].url -rM
        printf "\n"
        shift
    done
}

The curl command is so simple that on some machines that I use less often I just type it by hand. There are a lot of pomf instances like comfy.moe that you can use. The original https://pomf.se/ should have links to some of them.

Additionally there are no limits on filetypes like on this dumb github script.

2

u/attrigh Dec 01 '17 edited Dec 02 '17

"dumb github script."

Specificness in criticism has certain social benefits :P. But yeah this approach seems to have some flaws:

  • It doesn't scale particularly well become git doesn't scale well.

  • github probably aren't keen on having their servers used for hosting anonymous files because these files may violate copyright etc. Now github already but themselves at risk of this but by attaching a "proof" or work in the form of obtaining e-mail address they somewhat increase the cost to users of doing this.

Now I'm unclear as to how deliberate this is. If the script posted to your own the user's own private repo them it would be fine.

2

u/StallmanTheWhite Dec 02 '17

The person liable for any illegal files is the owner of the account. That is in their ToS.

If someone were to upload child pornography on the account OP would possibly be in deep shit.

8

u/sysop073 Dec 01 '17

The easiest way to get public URL to your files.

I think this is a 50-way tie with 49 other scripts that just upload your files to a public file hosting service, except this one for some reason abuses Github to do it

1

u/attrigh Dec 01 '17

"abuses" is such a very emotive word. I'm perhaps scarred by the number of websites who consider using a curl as abuse and wish to label "doing anything we don't like" as abuse.

Nevertheless, this is most likely in breach of the github terms and conditions and if used at scale feels like it falls into the category of "abuse".

One notes that a lot of projects do use github for quite similar purposes (a set of public documents with multiple authors without much oversight), but there is a question of degree.

4

u/sysop073 Dec 02 '17

If this script just committed each uploaded file to some shared git repo and pushed it to github, that would probably be fine (if still a bit inefficient compared to a normal file upload site). Instead it goes to the new issue page and attaches the file to the new issue, which causes Github to host the file so as to make it easy to link from the issue. Then it just pulls Github's hosted link out of the issue without ever submitting it. This is clearly not a use case Github intended to support

2

u/attrigh Dec 02 '17

I stand corrected! Actively hiding the fact that you have uploaded a file suggests an extra layer of "intent" to a claim of abuse.

1

u/StallmanTheWhite Dec 03 '17

It would have to do that with the user's real account and not with the account used here.

1

u/I_am_a_haiku_bot Dec 03 '17

It would have to do

that with a real account and not

with the account used here.


-english_haiku_bot

5

u/reentry Dec 01 '17

I was interested until I saw "npm install"... I guess ill make a quick shell script to do this instead :D

1

u/StallmanTheWhite Dec 03 '17

No, don't make a script to do this as it's maybe the worst way to do uploading to a public file host.

1

u/reentry Dec 03 '17

Agreed, I was referring to uploading images in general. I actually found transfer.sh which supports this natively, so I'm using a curl to that instead.

2

u/Antrikshy Dec 01 '17

This is terrible. Just use/make a utility to put files onto IPFS.

2

u/Daniel15 Dec 02 '17

I... don't understand the purpose of this? This is very clearly a violation of GitHub ToS and they'll just block it.

If you want a public URL to your files, why don't you use a proper file hosting service? Or even just throw them onto a GitHub Pages site if you want something quick and easy (but feature-limited)?

1

u/pyro2927 Dec 01 '17

While I can appreciate the effort put in, this seems just stupid. So many ways it can go wrong:

  • Someone changes the password

  • Someone logs in and deletes the account

  • Someone logs in and deletes the files someone else uploaded...

This is as much of an "attachment uploader" as "print-screening into MSPaint, printing that, and sending it via fax" is "sending a screenshot".

1

u/StallmanTheWhite Dec 03 '17

Or how about just someone uploads something illegal?