Giter VIP home page Giter VIP logo

modcolle's Introduction

Modcolle

Build Status Coverage Status

Modcolle is a proxy server for playing Kantai Collection (艦隊これくしょん ~艦これ~). The main goal of Modcolle is to provide in-game translation displaying in the flash client directly. Unlike Kancolle Viewer that wraps IE browser and listens to outgoing traffic, Modcolle, acting as a web server, makes Kancolle send all HTTP requests to Modcolle instead. Thus, it has the opportunity to process requests before forwarding them to destinated Kancolle servers or response back to clients. In this case, Modcolle is a middleman between client and Kancolle servers. Client can access modcolle without having to configure proxy connection. No more cookie injection, Japan timezone synchronization, or VPN connection in order to play the game. Modcolle do all those things behind the scenes. Since the processes involves calling DMM API directly, no bloating javascript is executed, it is faster than accessing from DMM website. Modcolle also distributes game asset requests .png, .mp3, and .swf among multiple Kancolle servers to relief traffic bottle neck. Ensures that all assets will be delivered as fast as possible.

Feature

  • Enjoy playing the game on full screen
  • Place custom content to be displayed inside a game such as ships, musics, or any game assets similar to KancolleCacher. this feature is suspeneded, will implement sometime later
  • Display translations inside the game Just for a proof of concept. No full translation are implemented in this release
  • Realtime logging. See what Kancolle makes requests to the server including decoded API requests and responses for statistical analysis

Installation

Modcolle is a Node.js server application, not a desktop application. There is no executable launcher. It is intended to run on a web server. However, you can setup your machine as a web server to run Modcolle locally.

Modcolle needs to run together with Nginx in order to operate normally. Please follows steps below to run Modcolle

Docker

  1. Install Docker and Docker Compose
  2. Clone this repository git clone [email protected]:makemek/Modcolle.git and run npm install
  3. Open terminal and run docker-compose up. You can add -d flag to detach the process and run as a daemon.
  4. Open a web browser and type localhost in the url

Manual Installation

  1. Install Nginx and Node.js (v. 6.9.1)
  2. Clone this repository git clone [email protected]:makemek/Modcolle.git and run npm install
  3. Copy /deployment/nginx/nginx.conf to \path\to\nginx\conf. Make sure to backup nginx.conf first before overwrite.
  4. Inside nginx.conf replace app1 and DOMAIN_NAME with localhost
  5. Start nginx
  6. Type npm install pm2 -g and run npm start
  7. Open a browser and type localhost in the url

Starting the Application

Cluster Mode

This command runs pm2 using configuration defined in env of process.yml.

npm start

You can also start the application in production mode by passing --env production to pm2.

npm start -- --env production

Development Mode

With nodemon and browser-sync

In this mode, no environment variables are loaded. You can still set them inside a command line if needed.

npm run dev

-----------
(optional) configure browser-sync using environment variables before running.
PORT=<port number> # browser-sync app's proxy port; default is 5000
PORT_DEV=<port number> # browser-sync listeing port; default is 3000

Configuration

process.yml is PM2's process file for Modcolle. Inside process.yml, env contains common environment variables required by the application. env_production used in production contains envrionment variables that overrides variables in env.

Environment Variables

  • LOGGER_LEVEL: select a logging level
  • LOGGER_PRETTY: pretty print log (should be set to false in production)
  • PORT: application port
  • PORT_DEV: FOR DEVELOPMENT ONLY will take effect when run npm run dev
  • KANCOLLE_SERVER_MASTER: A host name for main Kancolle server that have interface/kcsapi/api_world/get_id for requesting players world id
  • KANCOLLE_SERVER_#: A host name for other Kancolle servers where # is world id

modcolle's People

Contributors

greenkeeper[bot] avatar makemek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

samouly nekoma0

modcolle's Issues

Provide alternative login methods

Have other ways connect to Kancolle server.
Kancolle html page in DMM uses VIEWER_ID and ST (security token) contained in gadgetinfo to determine the player's server and request the API token.
The problem is that when Kancolle game page in DMM site requests API token it doesn't call the API directly.
Instead, it calls DMM API (OSAPI) http://osapi.dmm.com/gadgets/makeRequest to make a proxy request passing ST token along to confirm user's identity.
OSAPI doesn't permit public access.
Calling KC Api /kcsapi/api_auth_member/dmmlogin directly is not possible.
Both VIEWER_ID and ST value can be obtained after Modcolle have access to DMM account.

  • By API Token
    Play Kancolle by using API token directly. The value will be appended after api_token=.
    This enables third party tools like KCV and Poi to input api_token

  • By DMM Session
    Login in to DMM account without having to provide username and password.
    It can also be useful for those who doesn't register DMM account by email eg. use Google account, Facebook account.
    The session is the value of cookie INT_SESID.
    DMM doesn't provide OAuth authentication method to the public.
    This method maybe able to bypass IP location checking upon login.
    Thus, not suspend the account and issue an email indicating suspicious login by Modcolle.

  • By username and password
    If other method fail go for this method, it is likely that DMM will temporary suspend the account due to suspicious login

DMM OSAPI reply 'request error' when making a request for KC API token

Looks like DMM made changes to API http://osapi.dmm.com/gadgets/makeRequest resulted in request error.

DMM replied with (parsed JSON get from log)
rc=500, body=request error, headers=[]
Modcolle expects data inside body to be JSON that contains api_token but got plain text.

I'm pretty sure its coming from DMM side since stable v0.2.2 used to work, but now it doesn't.
If request error is a reply sent from KC server, header should not be empty.

Default requests made by browser works fine though.
The cause of this problem might be due to mismatch POST payload and/or request headers.
Tried with http://www.example.com and https://post-get.herokuapp.com works fine though weird.

Here is the full stack of this error

SyntaxError: Unexpected token r in JSON at position 0
    at Object.parse (native)
    at osapi.proxyRequest.then.response (/var/www/modcolle/src/kancolle/server/server.js:47:32)
    at tryCatcher (/var/www/modcolle/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/var/www/modcolle/node_modules/bluebird/js/release/promise.js:510:31)
    at Promise._settlePromise (/var/www/modcolle/node_modules/bluebird/js/release/promise.js:567:18)
    at Promise._settlePromise0 (/var/www/modcolle/node_modules/bluebird/js/release/promise.js:612:10)
    at Promise._settlePromises (/var/www/modcolle/node_modules/bluebird/js/release/promise.js:691:18)
    at Async._drainQueue (/var/www/modcolle/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/var/www/modcolle/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues (/var/www/modcolle/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:637:20)
    at tryOnImmediate (timers.js:610:5)
    at processImmediate [as _immediateCallback] (timers.js:582:5)

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.