UnlimitedHugs / RimworldHugsLib

A lightweight shared library for Rimworld modding.
Other
245 stars 59 forks source link

Abstract GitHub token/allow users to specify #52

Closed aph3rson closed 1 year ago

aph3rson commented 5 years ago

Right now, logs are posted as Gists using a token committed to the repo. GitHub automatically revokes these tokens when they're committed (for good reason).

The better way to do this would be to load the encrypted production token in to a CI build config (e.g. Travis, etc.), yet allow users to specify their own tokens if they so choose. This could be for development purposes (as there'd be no access to the token), or just because (I'd like to have access to all the logs I've uploaded in one place).

UnlimitedHugs commented 5 years ago

Setting up a CI server just to inject a token seems a tad overkill. Still, I'm curious as to how you would implement this- would the CI server just write out the key in the source file before compilation? Even if it were to be encrypted, what good would that do, since we still have to decrypt it client-side to make the request?

aph3rson commented 5 years ago

You would implement Travis CI, which is available for all public GitHub repos. Travis has a mechanism to encrypt secrets asymmetrically, so the values committed to the VCS are decrypted during Travis's build process.

As for where you'd be incorporating the value, you could just replace the value in the source file with the encrypted value. There's a guide on the Travis website mentioning how that all works.

aph3rson commented 5 years ago

Regarding it still being necessary client side, you're correct, someone could decompile the DLLs to get the token back, but it's non-trivial to do so.

UnlimitedHugs commented 5 years ago

Thanks for the clarifications. I'll probably pass on the CI to avoid needless complexity, but I can see about adding some mechanism to use a custom token- perhaps using a config file. Until then there is the Ctrl+Alt+F12 shortcut to copy the log to clipboard so you can publish it where you like.

UnlimitedHugs commented 1 year ago

Custom token support added to log publisher in 10.0.0. To use, press Ctrl+F12, uncheck "Use recommended settings", and paste a token into the input field.