fix site creator not working with full paths by using a temporary chdir
fix grammar issue in site creator
This commit is contained in:
parent
33896d9c91
commit
2a65f605f5
@ -3,6 +3,7 @@
|
|||||||
Command to create Onionr mutli-page sites
|
Command to create Onionr mutli-page sites
|
||||||
"""
|
"""
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
import getpass
|
import getpass
|
||||||
|
|
||||||
from httpapi import onionrsitesapi
|
from httpapi import onionrsitesapi
|
||||||
@ -27,8 +28,11 @@ from etc import onionrvalues
|
|||||||
def create_multipage_site():
|
def create_multipage_site():
|
||||||
"""Command to create mutlipage sites with specified dir and password."""
|
"""Command to create mutlipage sites with specified dir and password."""
|
||||||
error_encountered = False
|
error_encountered = False
|
||||||
|
orig_dir = os.getcwd()
|
||||||
try:
|
try:
|
||||||
directory = sys.argv[2]
|
directory = sys.argv[2]
|
||||||
|
os.chdir(directory)
|
||||||
|
directory = '.'
|
||||||
except IndexError:
|
except IndexError:
|
||||||
directory = '.'
|
directory = '.'
|
||||||
try:
|
try:
|
||||||
@ -51,7 +55,7 @@ If you want to update your site later you must remember the passphrase.''',
|
|||||||
error_encountered = True
|
error_encountered = True
|
||||||
logger.error(
|
logger.error(
|
||||||
f'Passphrase must be at least {onionrvalues.PASSWORD_LENGTH}' +
|
f'Passphrase must be at least {onionrvalues.PASSWORD_LENGTH}' +
|
||||||
'characters.', terminal=True)
|
' characters.', terminal=True)
|
||||||
|
|
||||||
if error_encountered:
|
if error_encountered:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -61,6 +65,7 @@ If you want to update your site later you must remember the passphrase.''',
|
|||||||
results = (results[0].replace('=', ''), results[1])
|
results = (results[0].replace('=', ''), results[1])
|
||||||
logger.info(f'Site address {results[0]}', terminal=True)
|
logger.info(f'Site address {results[0]}', terminal=True)
|
||||||
logger.info(f'Block for this version {results[1]}', terminal=True)
|
logger.info(f'Block for this version {results[1]}', terminal=True)
|
||||||
|
os.chdir(orig_dir)
|
||||||
|
|
||||||
|
|
||||||
create_multipage_site.onionr_help = "[directory path " # type: ignore
|
create_multipage_site.onionr_help = "[directory path " # type: ignore
|
||||||
|
Loading…
Reference in New Issue
Block a user