mirror of
https://github.com/onyx-and-iris/q3rcon-tui.git
synced 2026-04-08 21:23:30 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 74393f5fb3 | |||
| 316fa2bd5f | |||
| e87ca1d0e5 | |||
| 3fbac04756 | |||
| 637597c95a |
@@ -1,5 +1,7 @@
|
||||
# q3rcon tui
|
||||
|
||||
[](https://github.com/pypa/hatch)
|
||||
[](https://github.com/astral-sh/ruff)
|
||||
[](https://pypi.org/project/q3rcon-tui)
|
||||
[](https://pypi.org/project/q3rcon-tui)
|
||||
|
||||
@@ -42,7 +44,7 @@ q3rcon-tui --host=localhost --port=28960 --password=rconpassword
|
||||
|
||||
Store and load from dotenv files located at:
|
||||
- .env in the cwd
|
||||
- user home directory / .config / rcon-tui / config.env
|
||||
- user home directory / .config / q3rcon-tui / config.env
|
||||
|
||||
example .env:
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
|
||||
[project]
|
||||
name = "q3rcon-tui"
|
||||
dynamic = ["version"]
|
||||
description = ''
|
||||
description = 'A terminal user interface for managing Q3 compatible servers using RCON.'
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.10"
|
||||
license = "MIT"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# SPDX-FileCopyrightText: 2026-present onyx-and-iris <code@onyxandiris.online>
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
__version__ = '0.1.0'
|
||||
__version__ = '0.2.0'
|
||||
|
||||
@@ -2,7 +2,7 @@ import re
|
||||
from pathlib import Path
|
||||
from typing import Annotated, Type
|
||||
|
||||
from aioq3rcon import Client
|
||||
from aioq3rcon import Client, RCONError
|
||||
from loguru import logger
|
||||
from pydantic import AfterValidator, BeforeValidator
|
||||
from pydantic_settings import BaseSettings, CliSettingsSource, SettingsConfigDict
|
||||
@@ -36,7 +36,7 @@ class Settings(BaseSettings):
|
||||
model_config = SettingsConfigDict(
|
||||
env_file=(
|
||||
'.env',
|
||||
Path.home() / '.config' / 'rcon-tui' / 'config.env',
|
||||
Path.home() / '.config' / 'q3rcon-tui' / 'config.env',
|
||||
),
|
||||
env_file_encoding='utf-8',
|
||||
env_prefix='Q3RCON_TUI_',
|
||||
@@ -94,12 +94,19 @@ class RconApp(App):
|
||||
if settings.refresh_output:
|
||||
self.query_one('#response', RichLog).clear()
|
||||
|
||||
async with Client(settings.host, settings.port, settings.password) as client:
|
||||
response = await client.send_command(
|
||||
self.query_one('#command', Input).value
|
||||
)
|
||||
try:
|
||||
async with Client(
|
||||
settings.host, settings.port, settings.password
|
||||
) as client:
|
||||
response = await client.send_command(
|
||||
self.query_one('#command', Input).value
|
||||
)
|
||||
self.query_one('#response', RichLog).write(
|
||||
self.remove_color_codes(response.removeprefix('print\n'))
|
||||
)
|
||||
except RCONError as e:
|
||||
self.query_one('#response', RichLog).write(
|
||||
self.remove_color_codes(response.removeprefix('print\n'))
|
||||
f'{type(e).__name__}: Unable to connect to server: is the server running and are the host, port, and password correct? ({e})'
|
||||
)
|
||||
|
||||
self.query_one('#command', Input).value = ''
|
||||
|
||||
Reference in New Issue
Block a user