Permalink
Browse files

add application version to front

Signed-off-by: Alexander Alemayhu <alexander@alemayhu.com>
  • Loading branch information...
scanf committed Mar 20, 2017
1 parent bf47da5 commit 9eddb2eeb94919370293cb7f47f125d0e67d2d5d
Showing with 17 additions and 3 deletions.
  1. +2 −1 DESIGN.md
  2. +5 −0 index.js
  3. +9 −0 public/app.js
  4. +1 −2 public/index.html
@@ -14,12 +14,13 @@ meant for local development. The exact versions are available in the
### API
The server consists of four GET and one POST methods.
The server consists of five GET and one POST methods.
- POST `/translate` - runs `iptables-translate <input>` returns new rules and
hash which can be used for downloading the file.
- GET `/download/:hash` - sends the file if it exists or redirects to `/help`.
- GET `/version` - returns iptables revision from git output.
- GET `/app_version` - returns version from package.json.
- GET `/help` - returns `iptables-translate --help` output.
- GET `/werbinich` - returns `whoami` output.
@@ -1,5 +1,6 @@
var execSync = require('child_process').execSync;
var bodyParser = require('body-parser');
var pjson = require('./package.json');
var express = require('express');
var crypto = require('crypto');
var fs = require('fs');
@@ -104,6 +105,10 @@ app.get('/download/:hash', function (req, res) {
res.download(path);
});
app.get('/app_version', function(req, res){
res.send(pjson.version);
});
app.get('/version', function(req, res){
var iptables_version = execSync('git -C netfilter.org/iptables describe');
res.send(iptables_version);
@@ -31,6 +31,15 @@ let controller = app.controller('MainController', ['$scope', '$http', function (
}, function errorCallback(response) {
});
$scope.app_version = "xyz";
$http({
method: 'GET',
url: '/app_version'
}).then(function successCallback(response) {
$scope.app_version = response.data;
}, function errorCallback(response) {
});
$scope.number_of_rows = function(lines) {
var min = 10;
@@ -11,8 +11,7 @@
</head>
<body ng-controller="MainController">
<div>
<h1>2nft</h1>
<p>
<h1>2nft<small ng-if="app_version != 'xyz'"> - v{{ app_version }}</small></h1>
<strong ng-if="iptables_version != 'xyz'">using iptables-translate {{ iptables_version }}</strong>
</p>
<!-- old rules -->

0 comments on commit 9eddb2e

Please sign in to comment.