Compare commits

..

1 Commits

Author SHA1 Message Date
Willyb321
3eb26651f7 initial ed-forgr 2018-11-22 09:44:11 +11:00
7 changed files with 34 additions and 56 deletions

23
Jenkinsfile vendored
View File

@@ -1,23 +0,0 @@
pipeline {
agent any
stages {
stage('Get coriolis-data') {
steps {
sh '''YES=`echo $GIT_BRANCH | awk -F / \'{print $2}\'`
export BRANCH=`git rev-parse --abbrev-ref $YES`
rm -rf $WORKSPACE/../coriolis-data
git clone https://github.com/edcd/coriolis-data.git $WORKSPACE/../coriolis-data
cd ../coriolis-data
git fetch --all
git checkout $BRANCH'''
}
}
stage('Build') {
steps {
sshagent (credentials: ['63c9de04-3213-47c3-8345-2f3442097a5b']) {
sh 'ssh -p 56499 -o StrictHostKeyChecking=no willb@172.17.0.1 echo hi'
}
}
}
}
}

View File

@@ -127,6 +127,7 @@
"coriolis-data": "../coriolis-data",
"d3": "^5.7.0",
"detect-browser": "^3.0.1",
"ed-forge": "^1.3.0",
"fbemitter": "^2.1.1",
"lodash": "^4.17.11",
"lz-string": "^1.4.4",

View File

@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import TranslatedComponent from './TranslatedComponent';
import { orbisUpload } from '../utils/ShortenUrl';
import { orbisUpload, API_ORBIS_BASE_URL } from '../utils/ShortenUrl';
import Persist from '../stores/Persist';
/**
@@ -23,10 +23,8 @@ export default class ModalOrbis extends TranslatedComponent {
this.state = {
orbisCreds: Persist.getOrbisCreds(),
orbisUrl: '...',
ship: this.props.ship,
authenticatedStatus: 'Checking...'
};
this.orbisCategory = this.orbisCategory.bind(this);
}
/**
@@ -54,7 +52,7 @@ export default class ModalOrbis extends TranslatedComponent {
* @returns {Object} auth status
*/
getOrbisAuthStatus() {
return fetch('https://orbis.zone/api/checkauth', {
return fetch(`${API_ORBIS_BASE_URL}/api/checkauth`, {
credentials: 'include',
mode: 'cors'
})
@@ -90,17 +88,6 @@ export default class ModalOrbis extends TranslatedComponent {
});
}
/**
* Handler for changing category
* @param {SyntheticEvent} e React Event
*/
orbisCategory(e) {
let ship = this.state.ship;
let cat = e.target.value;
ship.category = cat;
this.setState({ship});
}
/**
* Render the modal
* @return {React.Component} Modal Content
@@ -117,18 +104,7 @@ export default class ModalOrbis extends TranslatedComponent {
<label>Orbis auth status: </label>
<input value={this.state.authenticatedStatus} readOnly size={25} onFocus={ (e) => e.target.select() }/>
<br/><br/>
<a className='button' href="https://orbis.zone/api/auth">Log in / signup to Orbis</a>
<br/><br/>
<h3>Category</h3>
<select onChange={this.orbisCategory}>
<option value="">No Category</option>
<option>Combat</option>
<option>Mining</option>
<option>Trading</option>
<option>Exploration</option>
<option>Passenger Liner</option>
<option>PvP</option>
</select>
<a className='button' href={`${API_ORBIS_BASE_URL}/api/checkauth`}>Log in / signup to Orbis</a>
<br/><br/>
<h3 >{translate('Orbis link')}</h3>
<input value={this.state.orbisUrl} readOnly size={25} onFocus={ (e) => e.target.select() }/>

View File

@@ -682,7 +682,32 @@ export default class OutfittingPage extends Page {
*/
_genOrbis() {
const data = {};
const {Ship, Module, Factory} = require('ed-forge');
const forgeShip = Factory.newShip(this.state.ship.id);
console.log(forgeShip);
const ship = this.state.ship;
const forgeOrder = {
0: 'bh',
1: 'pp',
2: 't',
3: 'fsd',
4: 'ls',
5: 'pd',
6: 's',
7: 'ft'
}
ship.standard.forEach((standard, idx) => {
console.log(standard)
const mod = Factory.newModule(standard.m.symbol, standard.m.class.toString(), standard.m.rating.toString());
console.log(mod);
const coreIdx = Object.entries(forgeOrder).findIndex(e => e[1] === standard.m.grp);
console.log(coreIdx)
console.log(forgeShip.getCoreModules())
forgeShip.getCoreModules()[coreIdx].setItem(standard.m.symbol);
if (standard.m.blueprint) {
console.log(standard.m.blueprint)
}
});
ship.coriolisId = ship.id;
data.coriolisShip = ship;
data.url = window.location.href;

View File

@@ -105,7 +105,7 @@ function orbisShorten(url, success, error) {
}
}
const API_ORBIS = 'https://orbis.zone/api/builds/add';
export const API_ORBIS_BASE_URL = process.env.NODE_ENV === 'development' ? 'http://localhost:3030' : 'https://orbis.zone';
/**
* Upload to Orbis
* @param {object} ship The URL to shorten
@@ -117,7 +117,7 @@ export function orbisUpload(ship, creds) {
if (window.navigator.onLine) {
try {
agent
.post(API_ORBIS)
.post(`${API_ORBIS_BASE_URL}/api/builds/add`)
.withCredentials()
.redirects(0)
.set('Content-Type', 'application/json')

View File

@@ -59,7 +59,9 @@
<!-- End Piwik Code -->
<!-- Bugsnag -->
<script src="https://d2wy8f7a9ursnm.cloudfront.net/v5.0.0/bugsnag.min.js"></script>
<script src="//d2wy8f7a9ursnm.cloudfront.net/v4/bugsnag.min.js"></script>
<script
src="//d2wy8f7a9ursnm.cloudfront.net/bugsnag-plugins/v1/bugsnag-react.min.js"></script>
<script>
window.bugsnagClient = bugsnag('ba9fae819372850fb660755341fa6ef5', {appVersion: window.BUGSNAG_VERSION || undefined})
window.Bugsnag = window.bugsnagClient

View File

@@ -22,9 +22,6 @@ module.exports = {
},
optimization: {
minimize: false,
splitChunks: {
chunks: 'all'
}
},
output: {
path: path.join(__dirname, 'build'),