more work on docs

This commit is contained in:
Kevin Froman 2018-01-13 22:30:10 -06:00
parent 097c57b97a
commit a69e1d2d72
No known key found for this signature in database
GPG Key ID: 0D414D0FE405B63B
2 changed files with 9 additions and 1 deletions

View File

@ -31,6 +31,7 @@ class Onionr:
In general, external programs and plugins should not use this class. In general, external programs and plugins should not use this class.
''' '''
self.runningDaemon = False
if os.path.exists('dev-enabled'): if os.path.exists('dev-enabled'):
print('DEVELOPMENT MODE ENABLED (THIS IS LESS SECURE!)') print('DEVELOPMENT MODE ENABLED (THIS IS LESS SECURE!)')
self._developmentMode = True self._developmentMode = True
@ -106,12 +107,17 @@ class Onionr:
shutil.rmtree('data/') shutil.rmtree('data/')
return return
def daemon(self): def daemon(self):
''' Start the Onionr communication daemon
'''
if not os.environ.get("WERKZEUG_RUN_MAIN") == "true": if not os.environ.get("WERKZEUG_RUN_MAIN") == "true":
subprocess.Popen(["./communicator.py", "run"]) subprocess.Popen(["./communicator.py", "run"])
print('Started communicator') print('Started communicator')
api.API(self.config, self.debug) api.API(self.config, self.debug)
return return
def killDaemon(self): def killDaemon(self):
if self.runningDaemon == False:
onionrUtils.printErr('No known daemon is running')
sys.exit(1)
return return
def showStats(self): def showStats(self):
return return

View File

@ -14,10 +14,12 @@
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
''' '''
# Misc functions that do not fit in the main api, but are useful # Misc functions that do not fit in the main api, but are useful
import getpass import getpass, sys
class OnionrUtils(): class OnionrUtils():
def __init__(self): def __init__(self):
return return
def printErr(self, text='an error occured'):
sys.stderr.write(text + '\n')
def getPassword(self, message='Enter password: '): def getPassword(self, message='Enter password: '):
# Get a password safely with confirmation and return it # Get a password safely with confirmation and return it
while True: while True: