Giter VIP home page Giter VIP logo

mylolfantasy's Introduction

My LoL Fantasy

Play fantasy League of Legends with your friends by earning your team's points yourself. Play League of Legends games with friends to compete and see who is the best!

NOTE: This project is dead.

Technologies

  • Node.js
  • Express
  • Angular
  • Redis
  • PostgreSQL
  • League of Legends API
  • Less

Getting up and running

First install the following:

  • Node.js (v6.3.0)
  • PostgreSQL (v9.4.1)
  • Redis (v3.0.500)
  • Python (v2.7.11)
  • The correct build system for C++, for node-gyp (e.g. VS Community 2015 on Windows)

Other versions may be okay, but these are the ones we use and test with.

Next, git clone the repo. In the root directory do npm install and make sure all the dependencies are fetched and built correctly. At this point you'll want to make sure that you've set up a working PostgreSQL service and a local Redis service. Now, you need to set up a settings.json with the following:

{
  "lol_api_key": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
  "postgre_url": "postgres://user:password@hostname/database",
  "email_url": "smtps://user%40example.com:[email protected]",
  "secret_key": "keyboard cat"
}

Where:

  • lol_api_key is your API key from Riot games
  • postgre_url is a URL to your PostgreSQL database dedicated to MyLF
  • email_url is a connection URL for sending emails (used for resetting passwords, can be set to a dummy value while developing)
  • secret_key is used for cookies, use some cryptographically random string here

Finally, as long as you've done everything correctly so far, you should be able to run node batch/create_db.js to initialize database tables (CAUTION: this wipes any exisitng tables for MyLF; don't perform this step if your DB is already set up). Now, install gulp, npm install -g gulp-cli, and then run gulp bower to install front-end dependencies. Finally, you can run gulp to build the Less and Jade files and start the webserver. Once it is running you should be able to view the app in your browser at localhost.

Contributing

Fork the repo, make sure that you have the latest changes, then branch off the development branch. Make your changes. Send a pull request into the original repo's development branch and wait for us to review it and hopefully accept it. All that we ask is that you try to follow the exisitng coding styles that we use.

Special mentions

We would like to thank the following people for their work on My LoL Fantasy:

mylolfantasy's People

Contributors

bsankara avatar joshkergan avatar peteypii avatar pperrier27 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

mylolfantasy's Issues

Cookies should not be session based

Whenever I restart my computer I have to log in again. This is cause our cookies are currently session based. We need to make them persistent by giving them a max age.

We should make the app HTTPS compliant

This is basically a must have when dealing with passwords. It seems simple enough to implement. Just need additional set up to create a certificate to use

Add Google Analytics to the site

This should be for prod only (meaning we'll need a setting) and the GA key should be configurable so my website isn't tied to this project (so we'll need another setting for that).

We should start using Git branches

Mainly thinking about having a release branch, a dev branch, and a new branch for every feature/fix. Helps keep things organized (can switch between branches quickly to see what has changed) and stuff can be tested before being published

We are vulnerable to CSRF

Currently other sites can forge requests creating new accounts, creating/deleting leagues, and logging out. We should stop this from being able to happen

Use nicer class syntax in jade templates

I didn't know multiple classes could be put on a tag by doing div.class1.class2 so I was doing div(class= 'class1 class2') instead. It'd be nice if this was remedied.

Refactor settings into its own module

It's kind of cumbersome at the moment since loading them is pretty long incantation using lodash and then the settings aren't validated everywhere.

We should cache data from the LoL API to reduce call times

Commonly, a user will group themselves with another player many times so we could reduce the number of times we ask for recent games by using some sort of cache. The cache must be able to be reset so that we can update a player's newest stats.

We should allow users to have 12 players (or any number) in a league

12 is for custom 6v6 with your friends, but we could just make it limitless to be future proof. Along with this change it would be nice if on the front end, it only displayed the last option as empty. I.e. only show the "Summoner 4" input box only if you've filled input boxes for summoners 1-3.

Cleanup silly pathname logic

I thought something this path.join(__dirname, 'database.js') was necessary when running the server from a parent directory (which is done for my website). This type of stuff should just be changed to './database.js'.

We should start using Sass for CSS

It has a lot of neato features that make CSS a whole lot nicer to use. The only downside is that it's another dependency for development.

Failed web requests stop stat refreshing

If Riot servers are down or if we accidentally reach our rate limit somehow, that request only should fail. Currently, the stat refresher aborts upon an exception. We should either retry after a small wait or just handle the fail properly and hopefully the next time around the loop the stats will refresh properly.

Floating point precision errors showing up in league stats page

Instead of saying a summoner has 29.01 points it'll say they have 29.0999999998 points (or similar). This is due to CS counting as 0.01 points... We should probably round to 2 decimal places and also make sure that when stats get large, errors are not introduced by multiplying by 0.01.

Trying to access a non-existent group throws an exception

Making a DB call with a bad group ID is bad. Need to check if it exists first. The question is, do we want to say that group doesn't exist or say you don't have access to keep it parallel. I'm thinking saying a group doesn't exist is fine since the IDs of groups don't really need to be protected in this way.

We should refactor the settings code

Right now we're doing identical error checking in multiple files (the server and the stats code as well as my personal script). It would be nice to have all this error checking in one location even if it means enforcing having certain settings set that aren't strictly necessary in a particular case.

Stop grunt from opening a web page automatically

I'd like this because I usually stop the grunt task to do something on the command line and then restart it. In its current state I end up with many MLF tabs. I propose moving the current behaviour to a task called open so that I can call grunt open the first time and then grunt every time after.

We should start doing version numbers

It helps users know when an update has occurred. We should have a MAJOR.MINOR.BUILD kind of deal where MINOR is incremented every time we publish something and BUILD is incremented every pull request that's merged or just incremented every day.

We should relocate data things into its own server

Having the stat tracker in the Flask server as a global variable doesn't work properly (things break with simultaneous requests and on production) so we should move the data related code into its own Node.js server that can be called locally by the Flask server

We should have a logout button

Somewhere in the navbar hopefully. Should take you to the home page or the sign in page upon clicking it and logging you out

We should allow users to delete leagues

Add a remove league button for each league on the leagues page (maybe a button on the specific league's page as well). We probably want some kind of confirmation so that we don't have users accidentally deleting an important league

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.