Commit 55193a95 authored by Manuel Cortez's avatar Manuel Cortez

Fixed error that was making some links to redirect to 404 errors in chat...

Fixed error that was making some links  to redirect to 404 errors in chat messages, posts and comments
parent bb92a8a8
Pipeline #578 passed with stages
in 4 minutes and 39 seconds
......@@ -4,6 +4,16 @@
### New additions
### bugfixes
* Fixed an error that was making socializer unable to render correctly certain Links containing uppercase letters (such as yandex.disk shared links). Before, those links were giving 404 errors when pressed, now they should work normally. This error was present in wall posts, comments, topics and chat messages.
### Changes
## Changes in Version 0.23 (11.11.2019)
### New additions
* Socializer is now more tolerant to internet issues. When attempting to create a wall post, comment, topic or send a chat message, if the data is unable to be posted to VK, socializer will allow you to try to post it again, giving you the opportunity to edit or copy the text of the post in case you want to save it for later.
* Switching accounts is now supported in socializer. In the application menu, there is an option called "manage accounts" which allows you to add or remove an account. Socializer will take changes after a restart of the application. In case of having multiple accounts, every time Socializer starts, you will see a dialog from where is possible to choose the account for logging in.
* when selecting multiple audio files in audio buffers, multiple actions can be performed in all items, these actions are present in the contextual menu of the buffer (namely play, add/remove from the library and move to a different playlist). This means you can select all the audios you want and Socializer will perform the selected options in all items, making it a bit easier to operate with multiple songs.
......
......@@ -17,6 +17,8 @@ backports.functools_lru_cache
yandex.translate
mutagen
mock
# cx_freeze for building the executable files.
cx_freeze
# forked repositories previously found at http://q-continuum.net
git+https://code.manuelcortez.net/manuelcortez/libloader
git+https://code.manuelcortez.net/manuelcortez/platform_utils
......
......@@ -567,9 +567,10 @@ class Controller(object):
return
# If the chat already exists, let's create a dictionary wich will contains data of the received message.
message.update(id=obj.message_id, user_id=uid, date=obj.timestamp, body=utils.clean_text(obj.text), attachments=obj.attachments)
# if attachments is true, let's request for the full message with attachments formatted in a better way.
# if attachments is true or body contains at least an URL, let's request for the full message with attachments formatted in a better way.
# ToDo: code improvements. We shouldn't need to request the same message again just for these attachments.
if len(message["attachments"]) != 0:
if len(message["attachments"]) != 0 or len(utils.find_urls_in_text(message["body"])) != 0:
print(message["body"])
message_ids = message["id"]
results = self.session.vk.client.messages.getById(message_ids=message_ids)
message = results["items"][0]
......
......@@ -147,6 +147,7 @@ class vkSession(object):
self.logged = True
self.get_my_data()
except VkApiError as error:
print(error)
if error.code == 5: # this means invalid access token.
self.settings["vk"]["user"] = ""
self.settings["vk"]["password"] = ""
......@@ -330,17 +331,18 @@ class vkSession(object):
log.error("Error calling method %s.%s with arguments: %r. Failed during loading attachments. Error: %s" % (parent_endpoint, child_endpoint, post_arguments, str(error)))
# Report a failed function here too with same arguments so the client should be able to recreate it again.
wx.CallAfter(pub.sendMessage, "postFailed", parent_endpoint=parent_endpoint, child_endpoint=child_endpoint, from_buffer=from_buffer, attachments_list=attachments_list, post_arguments=post_arguments)
### ToDo: Let's avoid this piece of code cause it seems VK changes everything to lowercase letters.
# VK generally defines all kind of messages under "text", "message" or "body" so let's try with all of those
possible_message_keys = ["text", "message", "body"]
for i in possible_message_keys:
if post_arguments.get(i):
urls = utils.find_urls_in_text(post_arguments[i])
if len(urls) != 0:
if len(attachments) == 0:
attachments = urls[0]
else:
attachments += urls[0]
post_arguments[i] = post_arguments[i].replace(urls[0], "")
# possible_message_keys = ["text", "message", "body"]
# for i in possible_message_keys:
# if post_arguments.get(i):
# urls = utils.find_urls_in_text(post_arguments[i])
# if len(urls) != 0:
# if len(attachments) == 0:
# attachments = urls[0]
# else:
# attachments += urls[0]
# post_arguments[i] = post_arguments[i].replace(urls[0], "")
# After modifying everything, let's update the post arguments if needed.
if len(attachments) > 0:
if parent_endpoint == "messages":
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment