mirror of
https://github.com/mclueppers/xo-server.git
synced 2025-07-24 06:25:37 +02:00
Initial commit.
This commit is contained in:
commit
ae091cdb8c
27
README.md
Normal file
27
README.md
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# Xen Orchestra Server
|
||||||
|
|
||||||
|
**This is a test implementation using node.js.**
|
||||||
|
|
||||||
|
XO-Server is part of [Xen Orchestra](https://github.com/vatesfr/xo), a web interface for [XCP](https://en.wikipedia.org/wiki/Xen_Cloud_Platform).
|
||||||
|
|
||||||
|
It contains all the logic of XO and handles:
|
||||||
|
|
||||||
|
- connections to all XCP servers/pools;
|
||||||
|
- a cache system to provide the best response time possible;
|
||||||
|
- users authentication and authorizations;
|
||||||
|
- a JSON-RPC based interface for XO clients (i.e. [XO-Web](https://github.com/vatesfr/xo-web)).
|
||||||
|
|
||||||
|
__XO is currently under development and may be subject to important bugs.__
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
_There is currently no package available for XO-Server, you must therefore use the following procedure._
|
||||||
|
|
||||||
|
1. Download the code, you may either use git `git clone git://github.com/vatesfr/xo-server` or download a [Zip archive](https://github.com/vatesfr/xo-server/archive/master.zip).
|
||||||
|
2. Finally, run `./xo-server`.
|
||||||
|
|
||||||
|
The first time you start XO-Server an `admin` user with the `admin` password is created.
|
||||||
|
|
||||||
|
## How to report a bug?
|
||||||
|
|
||||||
|
Do not report any bug against this version for now, thank you :)
|
47
src/api.js
Normal file
47
src/api.js
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
var _ = require('underscore');
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
var api = {}
|
||||||
|
|
||||||
|
function Api(xo)
|
||||||
|
{
|
||||||
|
this.xo = xo;
|
||||||
|
}
|
||||||
|
|
||||||
|
Api.prototype.get = function (name) {
|
||||||
|
var parts = name.split('.');
|
||||||
|
|
||||||
|
var current = api;
|
||||||
|
for (
|
||||||
|
var i = 0, n = parts.length;
|
||||||
|
(i < n) && (current = current[parts[i]]);
|
||||||
|
++i
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
return _.isFunction(current)
|
||||||
|
? current
|
||||||
|
: undefined
|
||||||
|
;
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = function (xo) {
|
||||||
|
return new Api(xo);
|
||||||
|
};
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
api.session = {
|
||||||
|
|
||||||
|
'signInWithPassword': function (req, res)
|
||||||
|
{
|
||||||
|
if (!req.hasParams('user', 'password'))
|
||||||
|
{
|
||||||
|
res.sendInvalidParamsError();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ()
|
||||||
|
},
|
||||||
|
};
|
22
src/main.js
Normal file
22
src/main.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
var xo = {};
|
||||||
|
var api = require('./api')(xo);
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
require('socket.io')
|
||||||
|
.listen(8080)
|
||||||
|
.sockets.on('connection', function (socket) {
|
||||||
|
|
||||||
|
// When a message is received.
|
||||||
|
socket.on('message', function () {});
|
||||||
|
})
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var json_rpc = require('./json-rpc');
|
||||||
|
|
||||||
|
|
38
xo-server
Executable file
38
xo-server
Executable file
@ -0,0 +1,38 @@
|
|||||||
|
#/bin/sh -eu
|
||||||
|
|
||||||
|
# _fail message
|
||||||
|
_fail()
|
||||||
|
{
|
||||||
|
printf '%s\n' "$1" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# _have <command>
|
||||||
|
_have()
|
||||||
|
{
|
||||||
|
type "$1" 2> /dev/null >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
########################################
|
||||||
|
|
||||||
|
cd -P "$(dirname "$(which "$0")")"
|
||||||
|
|
||||||
|
########################################
|
||||||
|
|
||||||
|
if [ "${NODE:-}" ]
|
||||||
|
then
|
||||||
|
node=$NODE
|
||||||
|
unset NODE # Unexports it.
|
||||||
|
elif _have node
|
||||||
|
then
|
||||||
|
node=node
|
||||||
|
elif _have nodejs
|
||||||
|
then
|
||||||
|
node=nodejs
|
||||||
|
else
|
||||||
|
_fail 'node.js could not be found'
|
||||||
|
fi
|
||||||
|
|
||||||
|
########################################
|
||||||
|
|
||||||
|
exec "$node" "src/main.js" "$@"
|
Loading…
x
Reference in New Issue
Block a user