Skip to content

Command and Conquer Ladder API built in Node, Restify and MongoDB

License

Notifications You must be signed in to change notification settings

sean3z/cncnet-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CnCNet Leaderboard

Coverage Status PayPal donate MIT License

This is an open source WOL leaderboard emulator for legacy Westwood Studios games; specifically, those hosted by CnCNet. Ideally though, this application should work with any client sending WOLv1 or WOLv2 Game Resolution packets. This application serves several REST API endpoints (documented below) to consume and post leaderboard data.

Games Supported

Usage

  1. npm install --production
  2. npm start

REST API Endpoints

There's a few params listed below.

  • :game can be any of the following ^(td|d2k?|ra2?|ts|dta|fs|yr|am)$
  • :gameId can only be numeric (\d+)
  • :player and :clan can be alpha-numeric with some special characters (\w\d\[\])
General Endpoints
  • GET /ping to ensure that the server is online
Leaderboard Endpoints
  • POST /ladder/:game accepts gameres packet (via POST body) for the supplied :game
  • GET /ladder/:game will return the top 150 leaderboard players for the supplied :game
  • GET /ladder/:game/game/:gameId will return all data for a given :gameId
  • GET /ladder/:game/player/:player will return most data for given :player
Clan Endpoints

URL /ladder/:game/clan/:clan is used for the following methods. Most of these endpoints require authorization similar to Player Authentication.

  • GET will return most data for the given :clan (does not require auth)
  • PUT create the given :clan
  • POST will join, part or modify (supplied to action query) the given :clan
  • DELETE permanently delete the given :clan
Player Authentication
  • GET /auth/:player HTTP authentication using Account credentials

Successful authentication of this endpoint will return an JSON Web Token which can be used to call subsequent endpoints which require auth. This endpoint uses basic HTTP authentication.

example player auth request

curl -isu Tahj:MyPassword http://localhost:4007/auth/tahj3z
Account Creation
  • PUT /auth/:player using HTTP authentication

Accounts can be created using this endpoint. After an account has been created, users can then proceed to login using the Player Authentication endpoint above. Future iterations will allow consumers to additionally update Account information using this endpoint.

Contributing

The below subjects outline how to extend the functionality of this project. Any help is warmly accepted and greatly appreciated! :)

Debugging

Windows

set DEBUG=wol:leaderboard,-not-this
grunt serve

Mac

DEBUG=wol:leaderboard grunt serve

MongoDB

Leaderboard stats are stored via MongoDB. You'll need this installed for local development. You can start Mongo using the following command.

mongod --dbpath data/db

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •