feat: App.HostName is now optional

Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
This commit is contained in:
Macintxsh 2025-03-26 14:03:28 +03:00
parent 496ea38b5c
commit a41417ee84
Signed by: mctaylors
GPG key ID: 4EEF4F949A266EE2
3 changed files with 6 additions and 4 deletions

View file

@ -38,10 +38,12 @@ async def answer_query(update: Update, query: str,
copyrights = humanize_tags_from_json(data['tag_string_copyright'], "unknown copyright")
artists = humanize_tags_from_json(data['tag_string_artist'], "unknown artist")
rating = format_rating(data['rating'])
hostname = config.get('App', 'HostName')
hostname = hostname if hostname != "" else config.get('App', 'Host')
keyboard = [
[
InlineKeyboardButton(f"Open in {config.get('App', 'Name')}",
url=f"https://{config.get('App', 'HostName')}/posts/{query}"),
url=f"https://{hostname}/posts/{query}"),
InlineKeyboardButton("View original", url=data['file_url'])
]
]