Compare commits

..

No commits in common. "f43b5a5dc53f5975d7ba9adfdfc562f9661d86b2" and "8ad720afc8803451ecdebdf718481f640528c762" have entirely different histories.

4 changed files with 13 additions and 32 deletions

View File

@ -31,7 +31,7 @@
{
"type": "git",
"url": "https://git.bugsy.cz/beval/roster.git",
"tag": "v0.8.3"
"tag": "v0.8.2"
}
]
}

View File

@ -1,5 +1,5 @@
project('roster',
version: '0.8.3',
version: '0.8.2',
meson_version: '>= 1.0.0',
default_options: [ 'warning_level=2', 'werror=false', ],
)

View File

@ -924,9 +924,6 @@ class RequestTabWidget(Gtk.Box):
language = self._get_language_from_content_type(content_type)
source_buffer.set_language(language)
# Switch to body tab
self.response_stack.set_visible_child_name("body")
def display_error(self, error: str) -> None:
"""Display error in this tab's UI."""
self.status_label.set_text("Error")
@ -1153,18 +1150,6 @@ class RequestTabWidget(Gtk.Box):
return ""
def _is_json_content_type(self, content_type):
"""Check if the content type is JSON or a JSON-based format."""
return ('application/json' in content_type
or 'text/json' in content_type
or '+json' in content_type)
def _is_xml_content_type(self, content_type):
"""Check if the content type is XML or an XML-based format."""
return ('application/xml' in content_type
or 'text/xml' in content_type
or '+xml' in content_type)
def _get_language_from_content_type(self, content_type):
"""Get GtkSourceView language ID from content type."""
if not content_type:
@ -1172,9 +1157,9 @@ class RequestTabWidget(Gtk.Box):
language_manager = GtkSource.LanguageManager.get_default()
if self._is_json_content_type(content_type):
if 'application/json' in content_type or 'text/json' in content_type:
return language_manager.get_language('json')
elif self._is_xml_content_type(content_type):
elif 'application/xml' in content_type or 'text/xml' in content_type:
return language_manager.get_language('xml')
elif 'text/html' in content_type:
return language_manager.get_language('html')
@ -1191,10 +1176,10 @@ class RequestTabWidget(Gtk.Box):
return body
try:
if self._is_json_content_type(content_type):
if 'application/json' in content_type or 'text/json' in content_type:
parsed = json.loads(body)
return json.dumps(parsed, indent=2, ensure_ascii=False)
elif self._is_xml_content_type(content_type):
elif 'application/xml' in content_type or 'text/xml' in content_type:
dom = xml.dom.minidom.parseString(body)
return dom.toprettyxml(indent=" ")
except Exception as e:

View File

@ -1183,8 +1183,9 @@ class RosterWindow(Adw.ApplicationWindow):
return
# Apply variable substitution if environment is selected
def show_export(env):
substituted_request = request
if widget.selected_environment_id:
env = widget.get_selected_environment()
if env:
from .variable_substitution import VariableSubstitution
substituted_request, undefined = VariableSubstitution.substitute_request(request, env)
@ -1200,11 +1201,6 @@ class RosterWindow(Adw.ApplicationWindow):
dialog = ExportDialog(substituted_request)
dialog.present(self)
if widget.selected_environment_id:
widget.get_selected_environment(show_export)
else:
show_export(None)
def _mark_tab_as_saved(self, saved_request_id, name, request, scripts=None):
"""Mark the current tab as saved (clear modified flag)."""
page = self.tab_view.get_selected_page()