added timestamp to logger & removed debug prints
parent
97baec453c
commit
edce30ea20
|
@ -226,11 +226,9 @@ class API:
|
||||||
host = self.host
|
host = self.host
|
||||||
if hostType == 'private':
|
if hostType == 'private':
|
||||||
if not request.host.startswith('127') and not self._utils.checkIsIP(request.host):
|
if not request.host.startswith('127') and not self._utils.checkIsIP(request.host):
|
||||||
print("WHAT")
|
|
||||||
abort(403)
|
abort(403)
|
||||||
elif hostType == 'public':
|
elif hostType == 'public':
|
||||||
if not request.host.endswith('onion') and not request.host.endswith('i2p'):
|
if not request.host.endswith('onion') and not request.host.endswith('i2p'):
|
||||||
print("WHAT2")
|
|
||||||
abort(403)
|
abort(403)
|
||||||
# Validate x-requested-with, to protect against CSRF/metadata leaks
|
# Validate x-requested-with, to protect against CSRF/metadata leaks
|
||||||
if not self._developmentMode:
|
if not self._developmentMode:
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import re, sys
|
import re, sys, time
|
||||||
|
|
||||||
class colors:
|
class colors:
|
||||||
'''
|
'''
|
||||||
|
@ -134,15 +134,18 @@ def raw(data):
|
||||||
with open(_outputfile, "a+") as f:
|
with open(_outputfile, "a+") as f:
|
||||||
f.write(colors.filter(data) + '\n')
|
f.write(colors.filter(data) + '\n')
|
||||||
|
|
||||||
def log(prefix, data, color = ''):
|
def log(prefix, data, color = '', timestamp=True):
|
||||||
'''
|
'''
|
||||||
Logs the data
|
Logs the data
|
||||||
prefix : The prefix to the output
|
prefix : The prefix to the output
|
||||||
data : The actual data to output
|
data : The actual data to output
|
||||||
color : The color to output before the data
|
color : The color to output before the data
|
||||||
'''
|
'''
|
||||||
|
if timestamp:
|
||||||
output = colors.reset + str(color) + '[' + colors.bold + str(prefix) + colors.reset + str(color) + '] ' + str(data) + colors.reset
|
curTime = time.strftime("%m-%d %H:%M:%S")
|
||||||
|
else:
|
||||||
|
curTime = ''
|
||||||
|
output = colors.reset + str(color) + '[' + colors.bold + str(prefix) + colors.reset + str(color) + '] ' + curTime + ' ' + str(data) + colors.reset
|
||||||
if not get_settings() & USE_ANSI:
|
if not get_settings() & USE_ANSI:
|
||||||
output = colors.filter(output)
|
output = colors.filter(output)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue