Skip to content

Commit

Permalink
Merge pull request #24 from exodus4d/develop
Browse files Browse the repository at this point in the history
v0.0.10
  • Loading branch information
exodus4d committed Sep 22, 2015
2 parents 9350ab8 + 02a23af commit bf64717
Show file tree
Hide file tree
Showing 58 changed files with 563 additions and 32,942 deletions.
6 changes: 5 additions & 1 deletion .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ php_flag log_errors on

## js/source maps
<Filesmatch "\.(js|map)$">
ExpiresActive off
ExpiresActive on
ExpiresDefault "access plus 1 year"
Header append Cache-Control "public"
FileETag None
Header unset ETag
</Filesmatch>

# html templates
Expand Down
203 changes: 174 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,165 @@
## *PATHFINDER* (DRAFT VERSION)
Mapping tool for *EVE ONLINE*
## *PATHFINDER*
Mapping tool for [*EVE ONLINE*](https://www.eveonline.com)

url: https://www.pathfinder.exodus4d.de
- Project[https://www.pathfinder.exodus4d.de](https://www.pathfinder.exodus4d.de)
- Community[google +](https://plus.google.com/u/0/b/110257318165279088853/110257318165279088853)
- Screenshots[imgur.com](http://imgur.com/a/k2aVa)
- Media[youtube.com](https://www.youtube.com/channel/UC7HU7XEoMbqRwqxDTbMjSPg)
- Licence[MIT](http://opensource.org/licenses/MIT)

IMPORTANT: This project is still in beta phase and is not officially released! Feel free to check the code for security issues. You can not get the project to work, on your own server, until some required SQL dumps have been included to this repository! I will provide all required dumps once the beta phase is over. Do not expect this before the end of 2015.
##### Beta Information
> This project is still in beta phase and is not officially released! Feel free to check the code for security issues.
You can not get the project to work, on your own server, until some required SQL dumps have been included to this repository!
I will provide all required dumps once the beta phase is over.

### Project requirements ---------------------------------------------
## Requirements
#### APACHE Webserver
- PHP 5.3.4 or higher
- PCRE 8.02 or higher (usually shipped with PHP package, but needs to be additionally updated on CentOS or Red Hat systems)
- mod_rewrite and mod_headers enabled
- GD libary (for Image plugin)
- cURL, sockets or stream extension (for Web plugin)
- Gzip compression

Nginx and Lighttpd configurations are also possible.
http://fatfreeframework.com/system-requirements
- PHP 5.3.4 or higher
- PCRE 8.02 or higher (usually shipped with PHP package, but needs to be additionally updated on CentOS or Red Hat systems)
- mod_rewrite and mod_headers enabled
- GD libary (for Image plugin)
- cURL, sockets or stream extension (for Web plugin)
- Gzip compression

> Nginx and Lighttpd configurations are also possible.
http://fatfreeframework.com/system-requirements

#### Database
- mysql: MySQL 5.x
- sqlite: SQLite 3 and SQLite 2
- pgsql: PostgreSQL
- sqlsrv: Microsoft SQL Server / SQL Azure
- mssql, dblib, sybase: FreeTDS / Microsoft SQL Server / Sybase
- odbc: ODBC v3
- oci: Oracle
- mysql: MySQL 5.x
- sqlite: SQLite 3 and SQLite 2
- pgsql: PostgreSQL
- sqlsrv: Microsoft SQL Server / SQL Azure
- mssql, dblib, sybase: FreeTDS / Microsoft SQL Server / Sybase
- odbc: ODBC v3
- oci: Oracle

>Here is a list of links to DSN connection details for all currently supported engines in the SQL layer:
http://fatfreeframework.com/sql

## Setup
#### Backend (PHP)

*PATHFINDER* is pretty easy to configure! If you are not planning "getting your hands dirty" with programming stuff,
you don´t have to change a lot. All configuration files can be found here:
- [config.ini](https://github.com/exodus4d/pathfinder/blob/master/app/config.ini) Main config **(DO NOT CHANGE)**
- [pathfinder.ini](https://github.com/exodus4d/pathfinder/blob/master/app/pathfinder.ini) Pathfinder config
- [cron.ini](https://github.com/exodus4d/pathfinder/blob/master/app/cron.ini) Cronjob config
- [routes.ini](https://github.com/exodus4d/pathfinder/blob/master/app/routes.ini) Routes config **(DO NOT CHANGE)**

> The default configuration should be fine in most cases. Edit all values with caution!
#### Frontend (JS)
There is **no** need to change any javascript configuration, except *Signature names* that can be changed/added
- [init.js](https://github.com/exodus4d/pathfinder/blob/master/js/app/init.js) Main config **(DO NOT CHANGE)**
- [signature_type.js](https://github.com/exodus4d/pathfinder/blob/master/js/app/config/signature_type.js) Signature mapping config **(DO NOT CHANGE)**
- [system_effect](https://github.com/exodus4d/pathfinder/blob/master/js/app/config/system_effect.js) System effect config **(DO NOT CHANGE)**

> If you found any *Signature Names* or other information missing in these files, please create an [Issue](https://github.com/exodus4d/pathfinder/issues) for that!
I´ll try to fix it with the next release.
If you still want to change anything in here, make sure to run the `build` process afterwards (see below).

## Development Environment
*PATHFINDER* comes along with a simple, [*Gulp*](http://gulpjs.com/) based, build process.
There are two main *Gulp tasks* that should help you.
- `default` task is designed for *"continuous development"* scenario
- `production` task is designed for *"production deployment"* scenario

> If you are **not** planning to change the codebase, you don´t have to do the following steps!
**1. Install [Node.js](https://nodejs.org)(> v.4.0.1) with [npm](https://www.npmjs.com/)**

**2. [Copy/Fork](https://help.github.com/articles/fork-a-repo/) this Repo**
```
$ git clone https://github.com/exodus4d/pathfinder.git
```
**3. Install all required `node_modules` for *"continuous development"* from `package.json` (e.g.[Gulp](http://gulpjs.com/))**
```
$ npm install
```
**4. Run *Gulp* task `default` with your version `tag` as param. It will do:**
- clean `dist` folder (./public/js/x.x.x)
- init file watcher for \*.js changes
- running [jsHint](http://jshint.com/docs/) on file change
- copying **raw** *\*.js* files from *./js* to `dist` folder on file change

```
$ gulp default --tag v0.0.10
```

## Production Environment
**1. Install all required dependencies (check "Development Environment" steps )**

**2. Run *Gulp* task `production` with your version `tag` as param. It will do:**
- clean `dist` folder (./public/js/x.x.x)
- running [jsHint](http://jshint.com/docs/)
- running [requireJs Optimizer](http://requirejs.org/docs/optimization.html) (see [build.js](https://github.com/exodus4d/pathfinder/blob/master/build.js))
- minify \*.js files
- uglyfy \*.js files
- combine \*.js dependencies
- generate \.js `source maps`
- copying **compressed** *\*.js* to `dist` folder for production deployment

```
$ gulp production --tag v0.0.10
```
> The `production` task may take some seconds (30+ seconds)!
As a result, you should have all generated \*.js files ready for deployment in the `dist` folder.
The unique version `tag` in this path should ensure that `cache busting` is working correct.

## CSS generation
If you are planning to change/edit any *CSS* styles, you need to install [Compass](http://compass-style.org/),
in order to build the single \*.css file out of the **raw** \*.scss source files.

**1. [Ruby install](https://www.ruby-lang.org/en/)**

**2. [Compass install](http://compass-style.org/install/)**

**3. Start *Compass* file watcher for \*.scss changes in project `root` (see [config.rb](https://github.com/exodus4d/pathfinder/blob/master/config.rb))**
```
$ compass watch
```
> This will watch all \*.scss files for changes and generate a compressed \*.css file (./public/css/pathfinder.css).
Don´t worry about `cache busting`. Your current version `tag` will be added to the final path (e.g. ./public/css/pathfinder.css?v.0.0.10)

## SQL Schema
To get *PATHFINDER* to work, you will need (at least) **two** databases. The first one is the [SDE](https://developers.eveonline.com/resource/static-data-export)
from *CCP*. The second database is *PATHFINDERS*´s own DB. Make sure, you have the correct DB export for your version!

**1. *CCP* Static Data Export ([SDE](https://developers.eveonline.com/resource/static-data-export))**

You need to import the Eve SDE into the database specified in the `DB_CCP_*` settings. You can do this like the following:
```
wget https://www.fuzzwork.co.uk/dump/mysql-latest.tar.bz2
tar xf mysql-latest.tar.bz2
cd mysql-{}/
mysql -u -p __DATABASE_NAME__ < db_file.sql
```
> If you need an older versions of the SDE, check out[**Fuzzwork**](https://www.fuzzwork.co.uk/dump/)´s awesome dumps!
Here is a list of links to DSN connection details for all currently supported engines in the SQL layer:
http://fatfreeframework.com/sql
#### Development Environment
- t.b.a.
**2. *PATHFINDER* Clean Data Export ([CDE](https://www.google.de))**
> Make sure, that all column `indexes` and foreign `key constraints` have been imported correct!
Otherwise you will get DB errors and the cache engine can not track all tables (Models), which may result in bad performance!

### Folder structure (production) ------------------------------------
## Cronjob configuration
*PATHFINDER* requires some dynamic `system data` from *CCP*´s [XML APIv2](http://wiki.eve-id.net/APIv2_Page_Index).
This data is automatically imported by a [*Cron-Job*](https://en.wikipedia.org/wiki/Cron) into the DB.

Moreover, there are some predefined *Cron-Jobs* that handle some `db maintenance` and clean up tasks.

You have to setup a **single** *Cron-Jobs* for this, that handles **all** other *Cron-Jobs* and works as a "*dispatcher*".
- **Important**: Block access to `[YOUR INSTALLATION]/cron` (e.g. by `.htaccess` or edit `cron.ini`)
- Trigger `[YOUR INSTALLATION]/cron` by [*CLI*](http://php.net/manual/en/features.commandline.php) **every minute**, e.g create `cron.phpx`:

``` php
exec('wget -qO- /dev/null [YOUR INSTALLATION]/cron &> /dev/null', $out, $result);
echo "start:";
echo "Returncode: " .$result ."<br>";
echo "Ausgabe des Scripts: " ."<br>";
echo "<pre>"; print_r($out);
```
- ... or use [*CURL*](http://php.net/manual/en/book.curl.php) for this ;)

## Project structure

```
|-- (0755) app --> backend [*.php]
Expand All @@ -51,17 +180,33 @@ IMPORTANT: This project is still in beta phase and is not officially released! F
|-- app.js --> require.js config (!required for production!)
|-- (0777) logs --> log files
|-- ...
| -- node_modules --> node.js modules (not used for production )
| -- node_modules --> node.js modules (not used for production) [check "Development Environment"]
|-- ...
|-- (0755) public --> frontend source
|-- css --> CSS build folder (minified)
|-- fonts --> Web/Icon fonts
|-- css --> CSS dist/build folder (minified)
|-- fonts --> (icon)-Fonts
|-- img --> images
|-- js --> JS dist/build folder
|-- templates --> templates
|-- sass --> SCSS source (not used for production )
|-- ...
|-- (0777) tmp --> cache folder
|-- ...
|-- (0755) .htaccess --> reroute/caching rules
|-- (0755) index.php
--------------------------
CI/CD config files:
--------------------------
|-- build.js --> "RequireJs Optimizer" config (not used for production )
|-- config.rb --> "Compass" config (not used for production )
|-- gulpfile.js --> "Gulp" task config (not used for production )
|-- package.json --> "Node.js" dependency config (not used for production )
|-- README.md --> This file :) (not used for production )
```

## Thanks!
I´m very proud that **you** are using *PATHFINDER*!

It took me month of time in development until this project got into the first *BETA*. If you like it, please help to improve it.
(report bugs, find security issues,...)
13 changes: 8 additions & 5 deletions app/main/controller/controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function beforeroute($f3) {
$f3->set('isIngame', self::isIGB() );

// js path (build/minified or raw uncompressed files)
$f3->set('pathJs', self::getEnvironmentData('PATH_JS') );
$f3->set('pathJs', 'public/js/' . $f3->get('PATHFINDER.VERSION') );
}

/**
Expand Down Expand Up @@ -105,7 +105,7 @@ static function isIGBTrusted(){
}

/**
* extract all eve IGB specific header data
* get all eve IGB specific header data
* @return object
*/
static function getIGBHeaderData(){
Expand All @@ -115,9 +115,12 @@ static function getIGBHeaderData(){
$headerData = apache_request_headers();

foreach($headerData as $key => $value){
if (strpos($key, 'EVE_') === 0) {
$key = str_replace('EVE_', '', $key);
$key = strtolower($key);
$key = strtolower($key);
$key = str_replace('eve_', 'eve-', $key);


if (strpos($key, 'eve-') === 0) {
$key = str_replace('eve-', '', $key);

if (
$key === 'trusted' &&
Expand Down
28 changes: 11 additions & 17 deletions app/pathfinder.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[PATHFINDER]
NAME = "PATHFINDER"
; installed version (used for CSS/JS cache busting)
VERSION = "v0.0.9"
VERSION = "v0.0.10"
; contact information (DO NOT CHANGE)
CONTACT = "https://github.com/exodus4d"
; source code (DO NOT CHANGE)
Expand Down Expand Up @@ -31,9 +31,6 @@ URL = http://localhost/exodus4d/pathfinder
; Verbosity level of the stack trace
DEBUG = 3

; js path -> use raw files
PATH_JS = "js"

; main db
DB_DNS = mysql:host=localhost;port=3306;dbname=
DB_NAME = pathfinder
Expand Down Expand Up @@ -65,30 +62,27 @@ URL = https://www.pathfinder.exodus4d.de
; Verbosity level of the stack trace
DEBUG = 0

; js path -> use build files
PATH_JS = "build_js"

; main db
DB_DNS = mysql:host=localhost;port=3306;dbname=
DB_NAME = d01d8636
DB_USER = d01d8636
DB_PASS = bQ9VAd6fE86sVs4s
DB_NAME =
DB_USER =
DB_PASS =

; EVE-Online CCP Database export
DB_CCP_DNS = mysql:host=localhost;port=3306;dbname=
DB_CCP_NAME = d01f20be
DB_CCP_USER = d01f20be
DB_CCP_PASS = 2gkBWs87zDcApH4A
DB_CCP_NAME =
DB_CCP_USER =
DB_CCP_PASS =

; SMTP settings
SMTP_HOST = localhost
SMTP_PORT = 25
SMTP_SCHEME = TLS
SMTP_USER = pathfinder
SMTP_PASS = root
SMTP_USER =
SMTP_PASS =

SMTP_FROM = pathfinder@localhost.com
SMTP_ERROR = pathfinder@localhost.com
SMTP_FROM = registration.pathfinder@exodus4d.de
SMTP_ERROR = pathfinder@exodus4d.de

; ======================================================================================================
[PATHFINDER.REGISTRATION]
Expand Down
6 changes: 3 additions & 3 deletions node_modules/requirejs/bin/build.js → build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//then all the files from the app directory will be copied to the dir:
//output area, and baseUrl will assume to be a relative path under
//this directory.
appDir: "../../../js",
appDir: "./js",

//By default, all modules are located relative to this path. If baseUrl
//is not explicitly set, then all modules are loaded relative to
Expand All @@ -24,7 +24,7 @@
//or require.config({}) call found in that file will be used.
//As of 2.1.10, mainConfigFile can be an array of values, with the last
//value's config take precedence over previous values in the array.
mainConfigFile: '../../../js/app.js',
mainConfigFile: './js/app.js',

//Specify modules to stub out in the optimized file. The optimizer will
//use the source version of these modules for dependency tracing and for
Expand Down Expand Up @@ -197,7 +197,7 @@
//The directory path to save the output. If not specified, then
//the path will default to be a directory called "build" as a sibling
//to the build file. All relative paths are relative to the build file.
dir: "../../../build_js"
dir: "./build_js"



Expand Down
2 changes: 0 additions & 2 deletions build_js/app.js

This file was deleted.

Loading

0 comments on commit bf64717

Please sign in to comment.