Skip to content

Commit

Permalink
Merge pull request #210 from WatWowMap/readme-patch-1
Browse files Browse the repository at this point in the history
Update README.md for Docs site
  • Loading branch information
versx authored Sep 18, 2020
2 parents f54f7b1 + 4b6a7ed commit 7b48ffa
Showing 1 changed file with 16 additions and 345 deletions.
361 changes: 16 additions & 345 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
[![Documentation Status](https://readthedocs.org/projects/mapjs/badge/?version=latest)](https://mapjs.readthedocs.io/en/latest/?badge=latest)
[![Documentation Status](https://readthedocs.org/projects/mapjs/badge/?version=latest)](https://mapjs.readthedocs.io/en/latest/?badge=latest)
![Node.js CI](https://github.com/versx/MapJS/workflows/Node.js%20CI/badge.svg)
![Lint](https://github.com/versx/MapJS/workflows/Lint/badge.svg)

[![GitHub Release](https://img.shields.io/github/release/WatWowMap/MapJS.svg)](https://github.com/WatWowMap/MapJS/releases/)
[![GitHub Contributors](https://img.shields.io/github/contributors/WatWowMap/MapJS.svg)](https://github.com/WatWowMap/MapJS/graphs/contributors/)
[![Discord](https://img.shields.io/discord/552003258000998401.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/zZ9h9Xa)

# MapJS

NodeJS Map clone replacement for [RealDeviceMap](https://github.com/realdevicemap/realdevicemap)
Expand Down Expand Up @@ -38,353 +42,20 @@ NodeJS Map clone replacement for [RealDeviceMap](https://github.com/realdevicema

## Installation

1. Clone repository `git clone https://github.com/versx/MapJS`
1. Install dependencies `npm run update`
1. Copy config `cp src/configs/config.example.json src/configs/config.json`
1. Create a Discord bot at https://discord.com/developers and enter the `botToken`, `clientId`, and `clientSecret` in your `config.json`
1. Fill out config `vi src/configs/config.json`
1. Create/copy a `static/custom/nests.json` file to show nests (geoJSON file format)
1. Create/copy a `static/custom/areas.json` file to show scan areas (geoJSON file format, see below)
1. Run `npm start`
1. Access via http://machineip:port/ login using your Discord account

## Configuration

Your `config.json` file is only required for a few options. Anything you do not include will use the `default.json` as a fallback. When viewing the `default.json` file you will see additional settings that can be applied to your `config.json` in order to modify the values. **Please note** json files can not have code comments (`//`) as such we have provided notes on the configuration settings in the below snippet.

```js
{
// Listening interface IP address
"interface": "0.0.0.0",
// Listening port
"port": 8080,
// Map title shown in navigation bar
"title": "MapJS",
// Web page title (shown in tab)
"headerTitle": "MapJS - NodeJS Map Replacement",
// Localization to use for the map
"locale": "en",
// Theme style (dark/light)
"style": "dark",
// Cookie session secret key, make sure to randomize and NOT use default
// either keyboard mash or a generator https://browserling.com/tools/random-hex
"sessionSecret": "98ki^e72~!@#(85o3kXLI*#c9wu5l!Z",
//set the number of sessions (devices) a user is allowed to be signed in on
"maxSessions": 1,
// API rate limiting
"ratelimit": {
// Amount of cooldown time period if rate limit is reached (minutes)
"time": 60,
// Maximum number of API requests that can be made within a minute
"requests": 100
},
// Map settings
"map": {
// Maximum available Pokemon
"maxPokemonId": 649,
// Map start location latitude
"startLat": 0,
// Map start location longitude
"startLon": 0,
// Map start zoom
"startZoom": 12,
// Map minimum zoom level
"minZoom": 10,
// Map maximum zoom level
"maxZoom": 18,
// Defines the color of 70m paths and Quest/IV Polygons
"devicePathColor": "red",
// Clustering settings
"clusters": {
// Enable pokemon clustering
"pokemon": true,
// Enable gym clustering
"gyms": true,
// Enable pokestop clustering
"pokestops": true,
// Zoom level when clustering starts/stops
"zoomLevel": 13
},
// Default filter settings for new users/cleared cache
"filters": {
// Show gyms
"gyms": true,
// Show raids
"raids": false,
// Show raid timers
"raidTimers": false,
// Show pokestops
"pokestops": false,
// Show quests
"quests": false,
// Show invasions
"invasions": false,
// Show invasion timers
"invasionTimers": false,
// Show spawnpoints
"spawnpoints": false,
// Show Pokemon
"pokemon": false,
// Show nests
"nests": false,
// Show S2 scan cells
"scanCells": false,
// Show S2 submission cells
"submissionCells": false,
// Show weather cells
"weather": false,
// Show scan area polygons
"scanAreas": false,
// Show active devices
"devices": false
},
// Pokemon glow settings
"glow": {
"iv": { "value": 100, "color": "red" }, //min IV for glow
"pvp": { "value": 1, "color": "blue" }, //min PVP for glow
"both": { "color": "purple" } //color if a Pokemon meets IV & PVP requirements
}
},
// Areas list with location and zoom dropdown in navbar
"areas": {
"test": { "lat": 4.01, "lon": 117.01, "zoom": 15 }
},
// Custom navigation headers
"header": {
// Left side navigation headers (leave empty `[]` if not needed)
"left": [
{ "name": "Stats", "url": "https://stats.example.com", "icon": "fas fa-chart-bar" }
],
// Right side navigation headers (leave empty `[]` if not needed)
"right": [
{ "name": "Discord", "url": "https://discord.com/invite/example", "icon": "fab fa-discord" }
]
},
// Available tileservers
"tileservers": {
"Default": "https://{s}.basemaps.cartocdn.com/rastertiles/voyager_labels_under/{z}/{x}/{y}{r}.png;Map tiles by Carto, under CC BY 3.0. Data by <a href='https://www.openstreetmap.org/'>OpenStreetMap</a>, under ODbL.",
"OSM": "https://tile.openstreetmap.org/{z}/{x}/{y}.png;Map data © <a href='https://www.openstreetmap.org'>OpenStreetMap</a> contributors",
"Dark Matter": "https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png;© <a href='https://www.openstreetmap.org/copyright'>OpenStreetMap</a> contributors © <a href='https://carto.com/attributions'>CARTO</a>",
"Alidade Smooth Dark": "https://tiles.stadiamaps.com/tiles/alidade_smooth_dark/{z}/{x}/{y}.png;&copy; <a href='https://stadiamaps.com/'>Stadia Maps</a>, &copy; <a href='https://openmaptiles.org/'>OpenMapTiles</a> &copy; <a href='http://openstreetmap.org'>OpenStreetMap</a> contributors",
"Thunder Forest": "https://{s}.tile.thunderforest.com/transport-dark/{z}/{x}/{y}.png;&copy; <a href='http://www.thunderforest.com/'>Thunderforest</a>, &copy; <a href='https://www.openstreetmap.org/copyright'>OpenStreetMap</a> contributors",
"Satellite": "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x};Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community"
},
// Database settings
"db": {
// RealDeviceMap scanner database settings
"scanner": {
"host": "127.0.0.1",
"port": 3306,
"username": "user",
"password": "pass123!",
"database": "rdmdb",
"charset": "utf8mb4"
},
// PMSF nest script database settings
"manualdb": {
"host": "127.0.0.1",
"port": 3306,
"username": "user",
"password": "pass123!",
"database": "manualdb",
"charset": "utf8mb4"
}
},
// Discord authentication settings
"discord": {
// Enable discord authentication
"enabled": true,
// Channel ID for logging
"logChannelId": "",
// Status display message for the bot
"status": "Map Status: Online",
// Discord bot token
"botToken": "",
// Discord bot client id
"clientId": "",
// Discord bot client secret
"clientSecret": "",
// Discord bot redirect uri
"redirectUri": "http://localhost:8080/api/discord/callback",
// Required guilds in order to authenticate successfully (i.e. ["9834983749834", "9834983743", etc])
// leave empty `[]` for no guild requirement although not recommended.
"guilds": [],
// Map permissions
"perms": {
// View map permissions
"map": {
// Enable map (probably redundant)
"enabled": true,
// Discord roles required in order to view map (leave empty `[]` for no role requirement)
// (i.e ["803948098", "983409830", etc]
"roles": []
},
// View Pokemon permissions
"pokemon": {
// Enable Pokemon
"enabled": true,
// Discord roles required in order to view Pokemon (leave empty `[]` for no role requirement)
// (i.e ["803948098", "983409830", etc]
"roles": []
},
"raids": {
"enabled": true,
"roles": []
},
"gyms": {
"enabled": true,
"roles": []
},
"pokestops": {
"enabled": true,
"roles": []
},
"quests": {
"enabled": true,
"roles": []
},
"lures": {
"enabled": true,
"roles": []
},
"invasions": {
"enabled": true,
"roles": []
},
"spawnpoints": {
"enabled": true,
"roles": []
},
"iv": {
"enabled": true,
"roles": []
},
"pvp": {
"enabled": true,
"roles": []
},
"s2cells": {
"enabled": true,
"roles": []
},
"submissionCells": {
"enabled": true,
"roles": []
},
"nests": {
"enabled": true,
"roles": []
},
"scanAreas": {
"enabled": true,
"roles": []
},
"weather": {
"enabled": true,
"roles": []
},
"devices": {
"enabled": true,
"roles": []
}
}
},
// Google settings
"google": {
// Google analytics key
"analytics": "",
// Google Ad-Sense key
"adsense": ""
},
// Custom icon repository locations
"icons": {
// Default local icon repository
"Default": {
"path": "/img/pokemon"
},
"POGO": {
"path": "https://mygod.github.io/pokicons/v2"
},
// Remote icon repository
"RemotePokemonExample": {
"path": "https://example.com/pokemon_images",
// For repo without index.json support, since we can't traverse a remote directory easily,
// you'll need to provide a list of available forms, shiny, or gender icons so the map is
// aware of available icons that way invalid icons are not shown.
"pokemonList": ["001_00", "002_00", "002_00_shiny", "003_00", "003_00_female", "003_950"]
// expected format is <xxx pokemon id>(_00|_<form id>|_v<temp evolution id>)[_female][_<xx costume id>][_shiny]
// automatic fallback is in place, so the bare minimum you need to provide is "xxx_00" for each pokemon
// and "000" for new pokemon fallback (000 does not need to appear in pokemonList)
// Reference: Asset icon processing tool: https://github.com/Mygod/pokemon-icon-postprocessor
}
},
// Scouting settings
"scouting": {
// Enable scouting
"enabled": false,
// GoFestController endpoint
"url": "",
// Maximum amount of scouts allowed
"maxScouts": 15
},
// Maximum search results for global search to return
"searchMaxResults": 20,
// These fields let you customize each of the preset filter buttons available in the Pokemon Filter menu.
}
```

## Updating

1. `git pull`
1. Run `npm run update` in root folder
1. Run `npm start`


## Scan Areas (`static/custom/areas.json` file to show scan areas on the map)

#### Convert INI geofence format to GeoJSON format

1. Create `geofences` directory in the root of project folder (with src folder)
1. Copy your `.txt` INI format geofence files to the `geofences` folder
1. Run `npm run convert -- ./geofences/` which will convert your INI geofences to one `areas.json` GeoJSON format file in the root of the project folder
1. Copy `areas.json` to `static/custom/areas.json` to show the scan areas on the map

#### Convert Poracle geofence format to GeoJSON format

1. Copy your geofence.json file from Poracle to the root of the project folder (with src folder)
1. Run `npm run convert-poracle -- geofence.json` which will convert the file to an `areas.json` GeoJSON format file in the root of the project folder
1. Copy `areas.json` to `static/custom/areas.json` to show the scan areas on the map

## PM2 (recommended)

Once everything is setup and running appropriately, you can add this to PM2 ecosystem.config.js file so it is automatically started:
[Quick Install Guide](https://wwm.readthedocs.io/projects/mapjs/en/latest/install/quick-start/)

```js
module.exports = {
apps : [{
name: 'MapJS',
script: 'index.js',
cwd: '/home/username/MapJS/src/',
instances: 1,
autorestart: true,
watch: false,
max_memory_restart: '2G',
out_file: 'NULL'
}]
};
```
## [Documentation](https://wwm.readthedocs.io/projects/mapjs/en/latest/)

## TODO
## Contributors

- Notifications
- Notification sounds
- Bouncing marker options
- Heatmaps
- Possibly change filter selection from a list to a grid
- Only clear layers if filter changed
- Icon spacing
- Search quest by task name
- Filter by Pokemon type for Pokemon/raids/quests?
- [versx](https://github.com/versx)
- [Mygod](https://github.com/Mygod)
- [sketchysocks](https://github.com/sketchysocks)
- [clburlison](https://github.com/clburlison)
- [bschultz](https://github.com/bschultz)
- [PartTimeJS](https://github.com/PartTimeJS)
- [darthbutcher](https://github.com/darthbutcher)
- [sabregreen](https://github.com/sabregreen)

## Credits

Expand Down

0 comments on commit 7b48ffa

Please sign in to comment.