mirror of
https://github.com/OpenFactorioServerManager/factorio-server-manager.git
synced 2024-12-31 03:11:17 +02:00
added method to download saves, updated readme
This commit is contained in:
parent
34bcd07912
commit
81e73a81bb
34
README.md
34
README.md
@ -1,21 +1,43 @@
|
||||
#Factorio Server Manager
|
||||
|
||||
A tool for managing both local and remote Factorio servers.
|
||||
###A tool for managing dedicated Factorio servers.
|
||||
This tool runs on a Factorio server and allows management of saves, mods and many other features.
|
||||
|
||||
![Factorio Server Manager Screenshot](http://i.imgur.com/EbRM03Z.png "Factorio Server Manager")
|
||||
|
||||
## Installation
|
||||
1. Clone the repository
|
||||
2. Build the binary from the repository root (go build)
|
||||
3. Run the program
|
||||
|
||||
Backend is built as a REST api via the Go application. It also acts as the webserver to serve the front end react application
|
||||
## Usage
|
||||
Run the server and specify the directory of your Factorio server installation and the interface to run the HTTP server on.
|
||||
```
|
||||
Usage of ./factorio-server-manager:
|
||||
-dir string
|
||||
Specify location of Factorio config directory. (default "./")
|
||||
-host string
|
||||
Specify IP for webserver to listen on. (default "0.0.0.0")
|
||||
-port string
|
||||
Specify a port for the server (default "8080")
|
||||
|
||||
All api actions are accessible with the /api route.
|
||||
```
|
||||
|
||||
To build
|
||||
Building Go backend
|
||||
|
||||
|
||||
## Building the server
|
||||
The backend is built as a REST API via the Go web application.
|
||||
|
||||
It also acts as the webserver to serve the front end react application
|
||||
|
||||
All api actions are accessible with the /api route. The frontend is accessible with the root url.
|
||||
###Building Go backend
|
||||
git clone
|
||||
cd
|
||||
go build
|
||||
|
||||
building React frontend
|
||||
###building React frontend
|
||||
install nodejs (use )
|
||||
cd static/js
|
||||
npm install
|
||||
webpack
|
||||
|
@ -25855,15 +25855,15 @@
|
||||
_react2.default.createElement(
|
||||
"strong",
|
||||
null,
|
||||
"Copyright © 2015 ",
|
||||
"Copyright © 2016 ",
|
||||
_react2.default.createElement(
|
||||
"a",
|
||||
{ href: "#" },
|
||||
"Company"
|
||||
"Mitch Roote"
|
||||
),
|
||||
"."
|
||||
),
|
||||
" All rights reserved."
|
||||
" MIT License."
|
||||
);
|
||||
}
|
||||
}]);
|
||||
@ -26928,6 +26928,11 @@
|
||||
'th',
|
||||
null,
|
||||
'Filesize'
|
||||
),
|
||||
_react2.default.createElement(
|
||||
'th',
|
||||
null,
|
||||
'Download'
|
||||
)
|
||||
)
|
||||
),
|
||||
@ -26962,7 +26967,7 @@
|
||||
/* 238 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
@ -26992,7 +26997,24 @@
|
||||
}
|
||||
|
||||
_createClass(Save, [{
|
||||
key: 'render',
|
||||
key: "downloadSave",
|
||||
value: function downloadSave(e) {
|
||||
e.preventDefault();
|
||||
var node = this.refs.saveName;
|
||||
var saveName = node.name;
|
||||
$.ajax({
|
||||
url: "/api/saves/dl/" + saveName,
|
||||
dataType: "json",
|
||||
success: function success(data) {
|
||||
console.log(data);
|
||||
},
|
||||
error: function error(xhr, status, err) {
|
||||
console.log('api/mods/list', status, err.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var saveSize = parseFloat(this.props.save.size / 1024 / 1024).toFixed(3);
|
||||
var saveLastMod = Date.parse(this.props.save.last_mod);
|
||||
@ -27000,23 +27022,37 @@
|
||||
var dateFmt = date.getFullYear() + '-' + date.getMonth() + '-' + date.getDay() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
|
||||
|
||||
return _react2.default.createElement(
|
||||
'tr',
|
||||
"tr",
|
||||
null,
|
||||
_react2.default.createElement(
|
||||
'td',
|
||||
"td",
|
||||
null,
|
||||
this.props.save.name
|
||||
),
|
||||
_react2.default.createElement(
|
||||
'td',
|
||||
"td",
|
||||
null,
|
||||
dateFmt
|
||||
),
|
||||
_react2.default.createElement(
|
||||
'td',
|
||||
"td",
|
||||
null,
|
||||
saveSize,
|
||||
' MB'
|
||||
" MB"
|
||||
),
|
||||
_react2.default.createElement(
|
||||
"td",
|
||||
null,
|
||||
_react2.default.createElement(
|
||||
"form",
|
||||
{ onSubmit: this.downloadSave.bind(this) },
|
||||
_react2.default.createElement("input", { className: "btn btn-default btn-sm",
|
||||
ref: "saveName",
|
||||
type: "submit",
|
||||
value: "Download Save",
|
||||
name: this.props.save.name
|
||||
})
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
1
mods.go
1
mods.go
@ -96,3 +96,4 @@ func (m ModList) save() error {
|
||||
}
|
||||
|
||||
//TODO Add method to allow downloading all installed mods in zip file
|
||||
//TODO Add method for uploading new mods
|
||||
|
@ -7,7 +7,7 @@ class Footer extends React.Component {
|
||||
<div className="pull-right hidden-xs">
|
||||
Anything you want!!!!!!
|
||||
</div>
|
||||
<strong>Copyright © 2015 <a href="#">Company</a>.</strong> All rights reserved.
|
||||
<strong>Copyright © 2016 <a href="#">Mitch Roote</a>.</strong> MIT License.
|
||||
</footer>
|
||||
)
|
||||
}
|
||||
|
@ -1,6 +1,22 @@
|
||||
import React from 'react';
|
||||
|
||||
class Save extends React.Component {
|
||||
downloadSave(e) {
|
||||
e.preventDefault();
|
||||
const node = this.refs.saveName;
|
||||
const saveName = node.name;
|
||||
$.ajax({
|
||||
url: "/api/saves/dl/" + saveName,
|
||||
dataType: "json",
|
||||
success: (data) => {
|
||||
console.log(data)
|
||||
},
|
||||
error: (xhr, status, err) => {
|
||||
console.log('api/mods/list', status, err.toString());
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
let saveSize = parseFloat(this.props.save.size / 1024 / 1024).toFixed(3)
|
||||
let saveLastMod = Date.parse(this.props.save.last_mod);
|
||||
@ -13,6 +29,16 @@ class Save extends React.Component {
|
||||
<td>{this.props.save.name}</td>
|
||||
<td>{dateFmt}</td>
|
||||
<td>{saveSize} MB</td>
|
||||
<td>
|
||||
<form onSubmit={this.downloadSave.bind(this)}>
|
||||
<input className='btn btn-default btn-sm'
|
||||
ref='saveName'
|
||||
type='submit'
|
||||
value='Download Save'
|
||||
name={this.props.save.name}
|
||||
/>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
)
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ class SavesList extends React.Component {
|
||||
<th>Filname</th>
|
||||
<th>Last Modified Time</th>
|
||||
<th>Filesize</th>
|
||||
<th>Download</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
Loading…
Reference in New Issue
Block a user