revert: Remove web panel configuration and CLI features
This commit is contained in:
@ -733,31 +733,6 @@ def get_webpanel_api_token() -> str | None:
|
||||
'''Gets the API token of WebPanel.'''
|
||||
return run_cmd(['bash', Command.SHELL_WEBPANEL.value, 'api-token'])
|
||||
|
||||
def get_webpanel_env_config() -> dict[str, Any]:
|
||||
'''Retrieves the current configuration for the WebPanel service from its .env file.'''
|
||||
try:
|
||||
if not os.path.exists(WEBPANEL_ENV_FILE):
|
||||
return {}
|
||||
|
||||
env_vars = dotenv_values(WEBPANEL_ENV_FILE)
|
||||
config = {}
|
||||
|
||||
config['DOMAIN'] = env_vars.get('DOMAIN')
|
||||
config['ROOT_PATH'] = env_vars.get('ROOT_PATH')
|
||||
|
||||
port_val = env_vars.get('PORT')
|
||||
if port_val and port_val.isdigit():
|
||||
config['PORT'] = int(port_val)
|
||||
|
||||
exp_val = env_vars.get('EXPIRATION_MINUTES')
|
||||
if exp_val and exp_val.isdigit():
|
||||
config['EXPIRATION_MINUTES'] = int(exp_val)
|
||||
|
||||
return config
|
||||
except Exception as e:
|
||||
print(f"Error reading WebPanel .env file: {e}")
|
||||
return {}
|
||||
|
||||
def reset_webpanel_credentials(new_username: str | None = None, new_password: str | None = None):
|
||||
'''Resets the WebPanel admin username and/or password.'''
|
||||
if not new_username and not new_password:
|
||||
@ -771,36 +746,6 @@ def reset_webpanel_credentials(new_username: str | None = None, new_password: st
|
||||
|
||||
run_cmd(cmd_args)
|
||||
|
||||
def change_webpanel_expiration(expiration_minutes: int):
|
||||
'''Changes the session expiration time for the WebPanel.'''
|
||||
if not expiration_minutes:
|
||||
raise InvalidInputError('Error: Expiration minutes must be provided.')
|
||||
run_cmd(
|
||||
['bash', Command.SHELL_WEBPANEL.value, 'changeexp', str(expiration_minutes)]
|
||||
)
|
||||
|
||||
|
||||
def change_webpanel_root_path(root_path: str | None = None):
|
||||
'''Changes the root path for the WebPanel. A new random path is generated if not provided.'''
|
||||
cmd_args = ['bash', Command.SHELL_WEBPANEL.value, 'changeroot']
|
||||
if root_path:
|
||||
cmd_args.append(root_path)
|
||||
run_cmd(cmd_args)
|
||||
|
||||
|
||||
def change_webpanel_domain_port(domain: str | None = None, port: int | None = None):
|
||||
'''Changes the domain and/or port for the WebPanel.'''
|
||||
if not domain and not port:
|
||||
raise InvalidInputError('Error: At least a new domain or new port must be provided.')
|
||||
|
||||
cmd_args = ['bash', Command.SHELL_WEBPANEL.value, 'changedomain']
|
||||
if domain:
|
||||
cmd_args.extend(['-d', domain])
|
||||
if port:
|
||||
cmd_args.extend(['-p', str(port)])
|
||||
|
||||
run_cmd(cmd_args)
|
||||
|
||||
def get_services_status() -> dict[str, bool] | None:
|
||||
'''Gets the status of all project services.'''
|
||||
if res := run_cmd(['bash', Command.SERVICES_STATUS.value]):
|
||||
|
||||
Reference in New Issue
Block a user