Skip to content

Commit

Permalink
20.1 (#72)
Browse files Browse the repository at this point in the history
* Fix to prevent setup.py from import theonionbox; addressing PEP#517.

* Housekeeping: Removed some artefacts.

* Dashboard: Session 'prepared' after successful login was not accepted as valid. Fixed.

* Dashboard: Truncate __HashedControlSessionPassword (alike HashedControlPassword). No need to show this in full length.

* 19.3

* Adjust Copyright info to '2020'

* Additional commandline parameter: --password

* gitignore nodes

* Fixed install path for uptime (win); removed osxtemp source files (macos).

* Obsolete modules removed.

* Refactored the whole import system. Tried to account for PEP328 & get rid of CurrentWorkingDirectory patching.

* ... 2020.

* Ignoring RapydScript cache files.

* Fixed import issue.

* 20.1
  • Loading branch information
ralphwetzel authored Jan 7, 2020
1 parent aab150c commit 3a0af29
Show file tree
Hide file tree
Showing 59 changed files with 450 additions and 813 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,7 @@ theonionbox/theonionbox.ltd
# Special to The Onion Box
# Glide Library comes with a 'dist' directory that we need!
!theonionbox/libs/glide-*/dist/
/node_modules/

# Rapydscript
*.pyj-cached
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015 - 2019 Ralph Wetzel
Copyright (c) 2015 - 2020 Ralph Wetzel

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion cc/ControlCenter/dialogs/about.pyj
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class About(DialogBase):

$.post({
'url': self.base_path + "/" + self.session_id + "/cc/" + "about"
, 'timeout': 2000
, 'timeout': 5000
})
.done(def(data):
$('#about').removeClass('text-center').addClass('text-left')
Expand Down
2 changes: 1 addition & 1 deletion cc/ControlCenter/dialogs/launcher.pyj
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Launcher(DialogBase):
</div>
<div class="modal-footer">
<div style='font-family: LatoLatinWeb; font-size: 14px;'>
Copyright &copy; 2015 - 2019 Ralph Wetzel
Copyright &copy; 2015 - 2020 Ralph Wetzel
</div>
</div>
</div>
Expand Down
36 changes: 20 additions & 16 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,14 +302,18 @@ def generate_data_files(data_files):
}

package_data = {
'theonionbox': ['config/*',
'css/*',
'libs/*',
'pages/*',
'scripts/*',
'sections/*',
'tor/*'
]
'theonionbox': [
'config/*',
'css/*',
'libs/*',
'pages/*',
'scripts/*',
'sections/*',
'tor/*'
],
'theonionbox.tob.system.windows': [
'uptime/*'
]
}

package_data_exclude = {
Expand All @@ -326,13 +330,13 @@ def generate_data_files(data_files):
('service/FreeBSD', ['FreeBSD/theonionbox.sh']),
('service/init.d', ['init.d/theonionbox.sh']),
('service/systemd', ['systemd/theonionbox.service']),
('service/Docker', ['Docker/Dockerfile', 'Docker/theonionbox.cfg']),
('support', []),
('support/osxtemp', []),
('support/osxtemp/libsmc', ['support/osxtemp/libsmc/LICENSE', 'support/osxtemp/libsmc/Makefile']),
('support/osxtemp/libsmc/include', ['support/osxtemp/libsmc/include/smc.h']),
('support/osxtemp/libsmc/src', ['support/osxtemp/libsmc/src/smc.c']),
('theonionbox/tob/system/windows/uptime', ['theonionbox/tob/system/windows/uptime/*.*']),
('service/Docker', ['Docker/Dockerfile', 'Docker/theonionbox.cfg'])
# , ('support', [])
# , ('support/osxtemp', [])
# , ('support/osxtemp/libsmc', ['support/osxtemp/libsmc/LICENSE', 'support/osxtemp/libsmc/Makefile'])
# , ('support/osxtemp/libsmc/include', ['support/osxtemp/libsmc/include/smc.h'])
# , ('support/osxtemp/libsmc/src', ['support/osxtemp/libsmc/src/smc.c'])
# , ('theonionbox/tob/system/windows/uptime', ['theonionbox/tob/system/windows/uptime/*.*']),
]
# print(generate_data_files(data_files))

Expand Down Expand Up @@ -439,6 +443,6 @@ def generate_data_files(data_files):
'Topic :: System :: Networking :: Monitoring',
'Topic :: Utilities',
],
platforms=['Linux', 'Windows', 'MacOS X', 'FreeBSD'],
platforms=['Linux', 'Windows', 'MacOSX', 'FreeBSD'],
# ext_modules=extensions(),
)
30 changes: 16 additions & 14 deletions theonionbox/__main__.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
#!/usr/bin/env python
from __future__ import absolute_import
import sys, os
import os
import pathlib
import site
import sys


def main():

# the import executes the scripting part...
if __name__ == '__main__':
# we can't use relative imports here!!
# get an absolute path to the directory that contains mypackage
this_dir = os.path.dirname(os.path.join(os.getcwd(), __file__))
sys.path.append(os.path.normpath(os.path.join(this_dir, '..')))
if __name__ == '__main__' and __package__ in ['', None]:

from theonionbox import main as onion_main
# Being __main__, we need to add the current dir to the site-dirs, to allow ABSOLUTE import
# We resolve this Path, as __file__ might be relative, if __name__ == __main__.
cp = pathlib.Path(__file__).resolve()
cp = cp.parent
assert cp.exists()

# Add the current dir to the site-dirs, to allow ABSOLUTE import
site.addsitedir(cp)
from theonionbox import main as onion_main
else:
# we're in a package => RELATIVE should work.
from .theonionbox import main as onion_main

# ... and main() launches the server!
# The scripting part of theonionbox is being executed as we 'import'.
# Now we launch the server:
onion_main()


if __name__ == '__main__':

# args = sys.argv[1:]
main()


2 changes: 2 additions & 0 deletions theonionbox/css/box.css
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ body {
<%
from bottle import TemplateError
import logging

css_log = logging.getLogger('theonionbox')

for section in sections:

special = section[0]
Expand Down
7 changes: 6 additions & 1 deletion theonionbox/pages/cc.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<!DOCTYPE html>

<%
from tob.template_tools import *
try:
from tob.template_tools import *
except ModuleNotFoundError:
from theonionbox.tob.template_tools import *
end

base_path = get('virtual_basepath', '') + '/'
%>

Expand Down
23 changes: 12 additions & 11 deletions theonionbox/pages/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<!DOCTYPE html>

<%
from tob.template_tools import *
try:
from tob.template_tools import *
except ModuleNotFoundError:
from theonionbox.tob.template_tools import *
end

base_path = get('virtual_basepath', '') + '/'
session = get('session')
Expand Down Expand Up @@ -42,6 +46,7 @@
import logging
bL = logging.getLogger('theonionbox')
div_open = False

for section in sections:

if section == '-':
Expand Down Expand Up @@ -69,16 +74,12 @@

file = 'sections/{0}/{0}.html'.format(section)

if os.path.exists(file):
try:
include(file)
except Exception as exc:
import sys, traceback
exc_type, exc_val, exc_tb = sys.exc_info()
bL.warning("While including '{}' into 'index_page.html':\n{}".format(file, traceback.format_exc()))
end
else:
bL.debug("While including '{0}' into 'index_page.html': '{0}' does not exist!".format(file))
try:
include(file)
except Exception as exc:
import logging
bL = logging.getLogger('theonionbox')
bL.debug("While including '{}' into 'index_page.html': {}".format(file, exc))
end
end
out = ('<' + '/div>') if div_open else ''
Expand Down
7 changes: 6 additions & 1 deletion theonionbox/scripts/box.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
<%
base_path = get('virtual_basepath', '') + '/'
sections = get('sections', [])
from tob.template_tools import *

try:
from tob.template_tools import *
except ModuleNotFoundError:
from theonionbox.tob.template_tools import *
end

login = get('box.js_login', False)
token = get('token', 'ThisIsAnError')
Expand Down
4 changes: 2 additions & 2 deletions theonionbox/scripts/cc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8072,7 +8072,7 @@ return this.__repr__();
Launcher.prototype.create = function create() {
var self = this;
var html;
html = "\n <div class=\"modal fade tobcc-font\" id=\"login_modal\" tabindex=\"-1\" role=\"dialog\"\n aria-labelledby=\"exampleModalLabel\" aria-hidden=\"true\">\n <div class=\"modal-dialog modal-dialog-centered\" role=\"document\">\n <div class=\"modal-content\">\n <div class=\"modal-header cc-dialog-header\">\n <h5 class=\"modal-title cc-dialog-title\" style=\"text-shadow: none\"><i class=\"fas fa-circle-notch fa-spin\"></i></h5>\n </div>\n <div class=\"modal-body text-center\" id='about'>\n <div style='font-family: LatoLatinWeb; font-size: 24px;'>\n {{stamp.__title__}} <span style='font-family: LatoLatinWeb; font-size: 18px;'> {{stamp.__version__}}\n </div>\n <div style='font-family: LatoLatinWebLight; font-size: 18px;'>\n {{stamp.__description__}}\n </div>\n </div>\n <div class=\"modal-footer\">\n <div style='font-family: LatoLatinWeb; font-size: 14px;'>\n Copyright &copy; 2015 - 2019 Ralph Wetzel\n </div>\n </div>\n </div>\n </div>\n </div>\n ";
html = "\n <div class=\"modal fade tobcc-font\" id=\"login_modal\" tabindex=\"-1\" role=\"dialog\"\n aria-labelledby=\"exampleModalLabel\" aria-hidden=\"true\">\n <div class=\"modal-dialog modal-dialog-centered\" role=\"document\">\n <div class=\"modal-content\">\n <div class=\"modal-header cc-dialog-header\">\n <h5 class=\"modal-title cc-dialog-title\" style=\"text-shadow: none\"><i class=\"fas fa-circle-notch fa-spin\"></i></h5>\n </div>\n <div class=\"modal-body text-center\" id='about'>\n <div style='font-family: LatoLatinWeb; font-size: 24px;'>\n {{stamp.__title__}} <span style='font-family: LatoLatinWeb; font-size: 18px;'> {{stamp.__version__}}\n </div>\n <div style='font-family: LatoLatinWebLight; font-size: 18px;'>\n {{stamp.__description__}}\n </div>\n </div>\n <div class=\"modal-footer\">\n <div style='font-family: LatoLatinWeb; font-size: 14px;'>\n Copyright &copy; 2015 - 2020 Ralph Wetzel\n </div>\n </div>\n </div>\n </div>\n </div>\n ";
DialogBase.prototype.create.call(self, html);
};
Launcher.prototype.show = function show() {
Expand Down Expand Up @@ -8222,7 +8222,7 @@ return this.__repr__();
$.post((function(){
var ρσ_d = {};
ρσ_d["url"] = self.base_path + "/" + self.session_id + "/cc/" + "about";
ρσ_d["timeout"] = 2e3;
ρσ_d["timeout"] = 5e3;
return ρσ_d;
}).call(this)).done((function() {
var ρσ_anonfunc = function (data) {
Expand Down
6 changes: 5 additions & 1 deletion theonionbox/sections/accounting/accounting.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
%# used for the scripting part of TheOnionBox!

<%
from tob.template_tools import *
try:
from tob.template_tools import *
except ModuleNotFoundError:
from theonionbox.tob.template_tools import *
end

#tor = get('tor', None)
#accounting_on = tor.get_isAccountingEnabled() if tor else False
Expand Down
10 changes: 5 additions & 5 deletions theonionbox/sections/config/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
# used for the scripting part of TheOnionBox!

import os
import psutil


from tob.configcollector import ConfigCollector
cfgcoll = ConfigCollector(tor)
# from tob.configcollector import ConfigCollector
# cfgcoll = ConfigCollector(tor)

configs_used = []
configs_used = get('configs_used', [])
configs_all = []

try:
Expand Down Expand Up @@ -56,7 +57,6 @@
{{!header_row('Tor', 'Configuration', 'config')}}

<%
import psutil
cmd_line = []

if tor.is_localhost():
Expand Down Expand Up @@ -138,7 +138,7 @@
</div>
<%

configs_used = cfgcoll.collect_configs_used()
# configs_used = cfgcoll.collect_configs_used()

manpg = get('manpage', None)

Expand Down
16 changes: 13 additions & 3 deletions theonionbox/sections/license/license.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
# It is intended to be a bottlepy - style template
# used for the scripting part of TheOnionBox!

from tob.license import License
try:
from tob.license import License
except ModuleNotFoundError:
from theonionbox.tob.license import License
end

license = License()
%>
<div class="row">
Expand All @@ -12,7 +17,7 @@
<div class="{{box_value_grid}}">
<div style="color: grey; font-size: 10px; font-weight: 300">
<a href="http://www.theonionbox.com/#readme" target="_blank">The Onion Box</a> |
Version v{{box_stamp}} | Copyright &copy; 2015 - 2019 Ralph Wetzel | License:
Version v{{box_stamp}} | Copyright &copy; 2015 - 2020 Ralph Wetzel | License:
<a role="button" data-toggle="collapse" href="#MIT"
aria-expanded="false" aria-controls="MIT">MIT</a>
</div>
Expand Down Expand Up @@ -60,7 +65,12 @@
<hr>

{{!header_row('', license.get('header'))}}
{{!standard_row('', license.get('copyright'))}}
<div class='row'>
<div class='{{box_datum_grid}}'></div>
<div class='{{box_value_grid}} box_value_margin'>
{{!license.get('copyright')}}
</div>
</div>
<div class="row">
<div class="{{box_datum_grid}}">
</div>
Expand Down
9 changes: 8 additions & 1 deletion theonionbox/sections/monitor/monitor.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
% from tob.livedata import intervals
<%
try:
from tob.livedata import intervals
except ModuleNotFoundError:
from theonionbox.tob.livedata import intervals
end
%>

var monitor_intervals = {{!intervals}};

var monitor_keys = ['1s', '1m', '5m', '1h', '4h', 'Ch', 'm6', 'y1', 'y5'];
Expand Down
10 changes: 8 additions & 2 deletions theonionbox/sections/network/network.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@
%# It is intended to be a bottlepy - style template
%# used for the scripting part of TheOnionBox!

% from tob.log import sanitize_for_html

<%

try:
from tob.log import sanitize_for_html
except ModuleNotFoundError:
from theonionbox.tob.log import sanitize_for_html
end


tor = get('tor') if tor is None else tor
oo_details = get('oo_details') if oo_details is None else oo_details
oo_bw = get('oo_bw')
Expand Down
9 changes: 8 additions & 1 deletion theonionbox/sections/network_bandwidth/network_bandwidth.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
% from tob.livedata import intervals
<%
try:
from tob.livedata import intervals
except ModuleNotFoundError:
from theonionbox.tob.livedata import intervals
end
%>

var history_intervals = {{!intervals}};

var history_keys = ['1s', '1m', '5m', '1h', '4h', 'Ch', 'm6', 'y1', 'y5'];
Expand Down
4 changes: 2 additions & 2 deletions theonionbox/stamp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__title__ = 'The Onion Box'
__description__ = 'Dashboard to monitor Tor node operations.'
__version__ = '19.3'
__stamp__ = '20191229|232641'
__version__ = '20.1'
__stamp__ = '20200105|230447'
Loading

0 comments on commit 3a0af29

Please sign in to comment.