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

View File

@ -14,10 +14,12 @@
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
import getpass
import getpass, sys
class OnionrUtils():
def __init__(self):
return
def printErr(self, text='an error occured'):
sys.stderr.write(text + '\n')
def getPassword(self, message='Enter password: '):
# Get a password safely with confirmation and return it
while True: