From cfbc834eb5e843f0f805618f0a02bfe8a72265ff Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Fri, 17 Aug 2018 16:50:16 -0500 Subject: [PATCH] * fixed locale issue in docker * fixed uploaded blocks not saving type properly --- Dockerfile | 9 +++++++-- onionr/blockimporter.py | 4 ++-- onionr/static-data/default-plugins/pms/main.py | 2 ++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7b7feb20..90f16342 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,13 +4,18 @@ FROM ubuntu:xenial ENV HOME /root #Install needed packages -RUN apt update && apt install -y python3 python3-dev python3-pip tor +RUN apt update && apt install -y python3 python3-dev python3-pip tor locales + +RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ + locale-gen +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US:en +ENV LC_ALL en_US.UTF-8 WORKDIR /srv/ ADD ./requirements.txt /srv/requirements.txt RUN pip3 install -r requirements.txt - WORKDIR /root/ #Add Onionr source COPY . /root/ diff --git a/onionr/blockimporter.py b/onionr/blockimporter.py index 1b37c3cd..2c29927f 100644 --- a/onionr/blockimporter.py +++ b/onionr/blockimporter.py @@ -21,7 +21,7 @@ import core, onionrexceptions, logger def importBlockFromData(content, coreInst): retData = False - dataHash = coreInst._getSha3Hash(content) + dataHash = coreInst._crypto.sha3Hash(content) if coreInst._blacklist.inBlacklist(dataHash): raise onionrexceptions.BlacklistedBlock('%s is a blacklisted block' % (dataHash,)) @@ -40,7 +40,7 @@ def importBlockFromData(content, coreInst): if coreInst._crypto.verifyPow(content): # check if POW is enough/correct logger.info('Block passed proof, saving.') blockHash = coreInst.setData(content) - blockHash = coreInst.addToBlockDB(blockHash, dataSaved=True) + coreInst.addToBlockDB(blockHash, dataSaved=True) coreInst._utils.processBlockMetadata(blockHash) # caches block metadata values to block database retData = True return retData \ No newline at end of file diff --git a/onionr/static-data/default-plugins/pms/main.py b/onionr/static-data/default-plugins/pms/main.py index 3da4d268..4b7199fd 100644 --- a/onionr/static-data/default-plugins/pms/main.py +++ b/onionr/static-data/default-plugins/pms/main.py @@ -22,6 +22,8 @@ import logger, config, threading, time, readline, datetime from onionrblockapi import Block import onionrexceptions +import locale +locale.setlocale(locale.LC_ALL, '') plugin_name = 'pms' PLUGIN_VERSION = '0.0.1'