rockdevourer / borderlands

Interact with Shift
MIT License
132 stars 34 forks source link

Improve Usage for Code Redemption #5

Open seang96 opened 5 years ago

seang96 commented 5 years ago

I have had a few suggestions, but lack the time to currently submit a PR. This removes the need for people to open up the developers/debugging window in their browser. This works on Chrome, but may require preference changes to work on FireFox.

  1. Minify the Javascript Code
  2. Get a permanent link to the minified code in the README
  3. Update README with new instructions a. Open minified code [INSERT LINK] and copy it b. Go to the link to redeem (already existing in the steps) c. Type into the address bar javascript: (paste code) d. Hit enter
Acen commented 5 years ago

I'm working on rewriting this from scratch to work more like a mini-app rather than a script.

https://github.com/Acen/borderlands

See src for source files, redeemer.js for webpack-generated file. Can be rebuilt with: yarn install yarn run production or for non-minified yarn run dev

Still writing tests for functionality. Might even throw in a light front-end.

seang96 commented 5 years ago

@Acen I thought that may be a better approach, but also disliked the idea that everyone will need to install nodejs to run it. Maybe an alternative route, do the frontend and use AWS S3 static hosting to host the frontend, easy to setup with fullstack-serverless.

You can also use an API with API Gateway where people can submit new codes and have it push to a DynamoDB database. All of this should be extremely cheap in costs since it wouldn't have a large user base. Heroku may be another good option to consider too I suppose to host it for "free".

rockdevourer commented 5 years ago

I agree with @seang96, my plan was/is to make this available as a service. There's apparently another code redemption out there that I didn't know about at the time time that runs as a standalone executable. From an end-user perspective, if it were to be something downloaded and ran, something like that would function better than relying on a user having sufficient rights and knowledge to be able to set up any sort of environment to run this in.

seang96 commented 5 years ago

If someone made a front end website I would be more than happy to put the code in to host it as a service and deploy it, Placing an in an advertisement banner at some point to cover the costs (if any incur) may be something depending on how popular it is.

Acen commented 5 years ago

FYI the build steps are only to build the files initially. Once it's built it runs anywhere.

It's considerably larger than the initial script though. 8KiB (plain script) vs 37KiB (production build).

idk, I'll reach feature parity and then maybe throw it up somewhere. It handles failure nicer than the script does, but technically has a lot more complexity because of the usage of modern JS to split content into several files/classes.

An idea I've had in terms of longevity of the mini-app though is for it to not need to carry around a copy of the local codes at all. Store the codes it's retrieved and cache them inside of WebSQL (within the browser) and have it update either periodically with a service worker, or on run check the last-updated of the place it's pulling the new codes from (Google Sheet, github repo, etc).

rockdevourer commented 5 years ago

Just as an update, this is a WIP; right now, this is in a private repo as there's nothing worthwhile sharing at the moment, but once there is, I will submit a pull request with all the changes. Ultimately it'll be hosted on a VPS.

After the pull, not sure if it's worth maintaining a separate component that a user can use on their own if they feel more comfortable? Probably not, as all the code could be reviewed on this repo, and really at that point they're two separate ideas.

Being lazy and copying and pasting from my notes on the readme I updated a little while ago:

`* Make usage easier (from Issue #5) o Preliminary work has begun; plan is to utilize the MERN stack (Mongo or Maria, undetermined; purpose is to fulfill the top 2 items) o Automatic redemption theoretically could be performed BUT I don't know/remember if there's a login token presented

If not, the only way would be to store passwords, and I don't think there's any good way to secure this as such (and I imagine people reuse emails/passwords, and the "greater good" would be to not allow this). o Frontend is 99% developed, only need is to tie to backend (to be developed) and possibly update formatting (frontend is not my forte and hasn't been my focus in a long, long time) Front end would need to be updated for options other than Borderlands 3 for Golden Keys, as I'm sure there are plenty of people that still enjoy BL2/BL1 GOTY Remaster/TPS (maybe?)`