From 86b6b44a7977cbbd02bd9b4f8cfb54199813d38a Mon Sep 17 00:00:00 2001 From: KF Date: Sat, 16 Feb 2019 14:40:30 -0600 Subject: [PATCH 1/2] windows color compat --- onionr/logger.py | 26 +++++++++----------------- run-windows.bat | 5 +++-- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/onionr/logger.py b/onionr/logger.py index 2e7773a1..18dfdf1d 100755 --- a/onionr/logger.py +++ b/onionr/logger.py @@ -20,8 +20,6 @@ import re, sys, time, traceback, os -MAX_LOG_SIZE = 100000000 - class colors: ''' This class allows you to set the color if ANSI codes are supported @@ -66,7 +64,10 @@ class colors: ''' Use the bitwise operators to merge these settings ''' -USE_ANSI = 0b100 +if os.name == 'nt': + USE_ANSI = 0b000 +else: + USE_ANSI = 0b100 OUTPUT_TO_CONSOLE = 0b010 OUTPUT_TO_FILE = 0b001 @@ -79,12 +80,8 @@ LEVEL_IMPORTANT = 6 _type = OUTPUT_TO_CONSOLE | USE_ANSI # the default settings for logging _level = LEVEL_DEBUG # the lowest level to log -dataFolder = os.getenv('ONIONR_HOME') -if type(dataFolder) is type(None): - dataFolder = 'data/' -if not dataFolder.endswith('/'): - dataFolder += '/' -_outputfile = dataFolder + 'output.log' # the file to log to +_outputfile = './output.log' # the file to log to + def set_settings(type): ''' Set the settings for the logger using bitwise operators @@ -139,15 +136,10 @@ def raw(data, fd = sys.stdout, sensitive = False): ts = fd.write('%s\n' % data) if get_settings() & OUTPUT_TO_FILE and not sensitive: try: - if os.path.getsize(_outputfile) >= MAX_LOG_SIZE: - return - except FileNotFoundError: + with open(_outputfile, "a+") as f: + f.write(colors.filter(data) + '\n') + except OSError: pass - try: - with open(_outputfile, "a+") as f: - f.write(colors.filter(data) + '\n') - except OSError: - pass def log(prefix, data, color = '', timestamp=True, fd = sys.stdout, prompt = True, sensitive = False): ''' diff --git a/run-windows.bat b/run-windows.bat index 5a8f5dbd..3d323610 100755 --- a/run-windows.bat +++ b/run-windows.bat @@ -1,3 +1,4 @@ @echo off -cd onionr -python3 onionr.py +setlocal +chdir onionr +python onionr.py %* From 23601b03d2e69cd01cce2157f0cf18a4f1a92201 Mon Sep 17 00:00:00 2001 From: KF Date: Sat, 16 Feb 2019 14:47:35 -0600 Subject: [PATCH 2/2] added windows bs node --- onionr/static-data/bootstrap-nodes.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/onionr/static-data/bootstrap-nodes.txt b/onionr/static-data/bootstrap-nodes.txt index fb8679b7..3dbed366 100755 --- a/onionr/static-data/bootstrap-nodes.txt +++ b/onionr/static-data/bootstrap-nodes.txt @@ -1 +1 @@ -lc4mw2es4se22xsjrccumna3ih53difx64q2t2mgk5ijjk7d6aiacbqd.onion \ No newline at end of file +n6bvl3azuqkzckfc6ny2ruxxn2yh56tfpnbgzb3cz6zvwj64blfxj6id.onion