diff --git a/data/icons/hicolor/scalable/apps/cz.bugsy.roster.svg b/data/icons/hicolor/scalable/apps/cz.bugsy.roster.svg index 50a9375..4afb2b1 100644 --- a/data/icons/hicolor/scalable/apps/cz.bugsy.roster.svg +++ b/data/icons/hicolor/scalable/apps/cz.bugsy.roster.svg @@ -1,15 +1,4 @@ - diff --git a/data/icons/hicolor/symbolic/apps/cz.bugsy.roster-symbolic.svg b/data/icons/hicolor/symbolic/apps/cz.bugsy.roster-symbolic.svg index 9cb5d34..03db369 100644 --- a/data/icons/hicolor/symbolic/apps/cz.bugsy.roster-symbolic.svg +++ b/data/icons/hicolor/symbolic/apps/cz.bugsy.roster-symbolic.svg @@ -1,15 +1,4 @@ - diff --git a/src/constants.py b/src/constants.py index a6e627e..a289dec 100644 --- a/src/constants.py +++ b/src/constants.py @@ -6,7 +6,7 @@ # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. -# +# # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -18,6 +18,10 @@ # # SPDX-License-Identifier: GPL-3.0-or-later +# Application Version +# Set at runtime by main.py from the version passed by the launcher script +VERSION = "0.0.0" # Fallback for development/testing + # UI Layout Constants UI_PANE_REQUEST_RESPONSE_POSITION = 510 # Initial position for request/response split UI_PANE_RESPONSE_DETAILS_POSITION = 400 # Initial position for response body/headers split diff --git a/src/main.py b/src/main.py index dd950ca..6e44929 100644 --- a/src/main.py +++ b/src/main.py @@ -26,6 +26,7 @@ gi.require_version('Adw', '1') from gi.repository import Gtk, Gio, Adw from .window import RosterWindow from .preferences_dialog import PreferencesDialog +from . import constants class RosterApplication(Adw.Application): @@ -111,5 +112,7 @@ class RosterApplication(Adw.Application): def main(version): """The application's entry point.""" + # Set the version constant for use throughout the application + constants.VERSION = version app = RosterApplication(version=version) return app.run(sys.argv) diff --git a/src/models.py b/src/models.py index d86cd1f..3c8aef4 100644 --- a/src/models.py +++ b/src/models.py @@ -20,6 +20,7 @@ from dataclasses import dataclass, asdict from typing import Dict, Optional, List +from . import constants @dataclass @@ -31,6 +32,13 @@ class HttpRequest: body: str # Raw text body syntax: str = "RAW" # Syntax highlighting: "RAW", "JSON", or "XML" + @classmethod + def default_headers(cls) -> Dict[str, str]: + """Return default headers for new requests.""" + return { + "User-Agent": f"Roster/{constants.VERSION}" + } + def to_dict(self): """Convert to dictionary for JSON serialization.""" return asdict(self) diff --git a/src/request_tab_widget.py b/src/request_tab_widget.py index ac54230..052aee8 100644 --- a/src/request_tab_widget.py +++ b/src/request_tab_widget.py @@ -48,7 +48,7 @@ class RequestTabWidget(Gtk.Box): super().__init__(orientation=Gtk.Orientation.VERTICAL, **kwargs) self.tab_id: str = tab_id - self.request: HttpRequest = request or HttpRequest(method="GET", url="", headers={}, body="", syntax="RAW") + self.request: HttpRequest = request or HttpRequest(method="GET", url="", headers=HttpRequest.default_headers(), body="", syntax="RAW") self.response: Optional[HttpResponse] = response self.modified: bool = False self.original_request: Optional[HttpRequest] = None