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