Skip to content

Commit e74a4c1

Browse files
committed
Release v0.3.1
* devel: Bump version to v0.3.1 Fix copying .htaccess to dist folder Remove unused links from user menu NERD,FTAS: fix when configuration is empty API: check if config file was loaded API: just log failure while connecting to mongo
2 parents ab6f872 + 2e3e150 commit e74a4c1

File tree

9 files changed

+23
-10
lines changed

9 files changed

+23
-10
lines changed

api/liberouterapi/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,14 @@
2424
"""
2525
Load user config specified by an argument or in default path.
2626
"""
27-
config = Config()
27+
28+
29+
try:
30+
config = Config()
31+
except KeyError as e:
32+
import sys
33+
print("Missing item in config %s" % e)
34+
sys.exit()
2835

2936
from .dbConnector import dbConnector
3037
from .session import SessionManager

api/liberouterapi/configurator.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
import sys
66
import os
77
from liberouterapi import app
8+
import logging
9+
10+
log = logging.getLogger(__name__)
811

912
import unittest
1013
class Config(object):
@@ -29,6 +32,10 @@ def __init__(self):
2932

3033
self.config.read(args['config'])
3134

35+
# Check if config was loaded successfully, api section must be there
36+
if "api" not in self.config:
37+
log.error("Missing config file")
38+
3239
self.DEBUG = self.config["api"].getboolean("debug", True)
3340
self.HOST = self.config["api"].get("host", "localhost")
3441
self.PORT = self.config["api"].getint("port", 8000)

api/liberouterapi/dbConnector.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@ def mongodb(self):
9090
# Small trick to catch exception for unavailable database
9191
except pymongo.errors.ServerSelectionTimeoutError as err:
9292
app.logger.error("Failed to connect to database: " + str(err))
93-
print(err)
94-
exit(1)
9593

9694
def sqlite(self):
9795
from flask_sqlalchemy import SQLAlchemy

www/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,4 @@ testem.log
4040
Thumbs.db
4141

4242
config.json
43+
./.htaccess

www/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "liberouter-gui",
3-
"version": "0.3.0",
3+
"version": "0.3.1",
44
"license": "MIT",
55
"angular-cli": {},
66
"scripts": {
File renamed without changes.

www/src/app/app.component.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ <h1 class="user-area">
1111
{{ user?.user?.username }}
1212
</a>
1313
<div class="dropdown-menu" aria-labelledby="userActions">
14-
<button class="dropdown-item">Action - 1</button>
15-
<button class="dropdown-item" routerLink='["users", user["user"]["_id"]["$oid"]]'>Profile</button>
1614
<button class="dropdown-item" routerLink="logout">
1715
Logout
1816
</button>

www/src/app/modules/ftas/ftas.component.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class FtasComponent implements OnInit {
4747
params : Object;
4848

4949
// Configuration fetched froms backend
50-
config : Object;
50+
config : Object = {};
5151

5252
// Output ID
5353
output : number;
@@ -116,9 +116,11 @@ export class FtasComponent implements OnInit {
116116
this.baseUrl += this.config['url'] + "/ftas/stat.pl";
117117
}
118118

119-
this.output = +this.config['output'] || -1;
119+
this.output = +this.config['output'];
120120

121-
if (this.output == -1 || this.baseUrl == "https://") {
121+
console.log(this.baseUrl, this.output)
122+
123+
if (isNaN(this.output) || this.baseUrl == "https://") {
122124
console.warn("FTAS output or URL isn't set.");
123125

124126
// Open modal window

www/src/app/modules/nerd/nerd.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export class NerdComponent implements OnInit {
106106
this.openSettings();
107107
}
108108

109-
if (!this.params["ip"])
109+
if (!this.params || !this.params["ip"])
110110
this.url = this.baseUrl;
111111
else {
112112
this.url = this.baseUrl + "/ip/" + this.params["ip"];

0 commit comments

Comments
 (0)