Jump to content

Editing a file through Java


TheRealMcrafter

Recommended Posts

Been looking around for a while and I cant find anything. Is it possible (without coremods or crazy Java wizardry) to either

 

A) Edit a file in my GitHub repository (on github.com) and save the changes while in a separate thread by using OutputStreamWriter, or

B) Download said file, edit it locally, and re-upload to my GitHub repo, via the aforementioned separate thread?

 

I'm just grasping at straws here, I have no idea if any of this makes sense.

 

Thanks in advance.

 

-TheRealMcrafter

 

Link to comment
Share on other sites

I have some beta testers that are not allowed to share my download link. I shipped my mod with a unique string for each beta tester. I want, for the first time my mod is loaded, to send that string to my file. Then, if I have two of the same strings in my repo file, that person is sharing the link.

Link to comment
Share on other sites

The only way to do this is if your mod commits every change to the file. Problem with that is if two of your beta testers connect and edit the file at the same time, it will cause conflicts, thus resulting in you having to merge those commits...

 

What I'd suggest rather than messing with GitHub is using Pastebin. Create a new user there for your purpose and use the API to create new paste files containing the unique string under that user. Then you can go through each paste and see if there are duplicates of your string.

Here have the documentation of the pastebin API: http://pastebin.com/api

 

But if you really want to use GitHub, then the only way you can programatically edit files in a repo is via GitHub API -> https://developer.github.com/v3/

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Link to comment
Share on other sites

I think you misunderstand. My beta testers cannot commit to my github. They get access to my beta builds, and report problems to my issues page. I dont want them spreading around the download link, so I'd like my mod to communicate with a file in my github repo and tell me if one of my testers is spreading around the link.

 

(Also I need this for future use in my mod)

Link to comment
Share on other sites

Hey man, just an opinion passing by. I've been here for a while and I remember, when I started, that I was all about mod/source security.

I even tried obfuscating source or trimming it from server classes (2nd I still have leftovers).

 

There is just NO POINT in doing it. Seriously. Release beta, if they spread it - what's the big deal?

I mean, there is no real way of providing 100% "safety". Not possible.

 

As to problem - it's really easy if you step outside Java and GitHub.

Get hosting, place php script, set keys in secured file. Make http request/response. Literally 1h of work.

If you really want to key-checking systems like that I don't think GitHub is right place to do it (opinion).

 

... but why? :o

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

Hey man, just an opinion passing by. I've been here for a while and I remember, when I started, that I was all about mod/source security.

I even tried obfuscating source or trimming it from server classes (2nd I still have leftovers).

 

There is just NO POINT in doing it. Seriously. Release beta, if they spread it - what's the big deal?

I mean, there is no real way of providing 100% "safety". Not possible.

 

As to problem - it's really easy if you step outside Java and GitHub.

Get hosting, place php script, set keys in secured file. Make http request/response. Literally 1h of work.

If you really want to key-checking systems like that I don't think GitHub is right place to do it (opinion).

 

... but why? :o

 

Honestly, thanks for the opinion. I used to be like that with my source too. I'm not concerned about my source being released, I'm concerned about a tester releasing a ridiculously buggy mod to the public. And in reality, I could just send them unique download links and count downloads on them, but well, I tend to overcomplicate things sometimes. Just wanting to screw around with file sending really.

Link to comment
Share on other sites

And in reality, I could just send them unique download links and count downloads on them.

 

Yes, I was going to suggest something similar (count accesses to a unique page rather than edit files).

 

In terms of github, you said you want to edit files based on the mod's usage but also say you don't want to do a commit. Isn't that pretty much the same thing? I don't know how you'd get git to consider a new file in a repository without committing it.

 

I'm still not sure how you could prevent redistribution, but I guess you're just trying to detect redistribution?

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

I think you misunderstand. My beta testers cannot commit to my github. They get access to my beta builds, and report problems to my issues page. I dont want them spreading around the download link, so I'd like my mod to communicate with a file in my github repo and tell me if one of my testers is spreading around the link.

 

(Also I need this for future use in my mod)

 

That is the point I made: you cannot change a file on github without committing the change! In your case, the only option would be the suggestion I made with Pastebin, or count the DLs on those links like you said.

 

By the way, is the GitHub repo considered a pure issue tracker or is the mod source on it?

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.