Sorunome / mx-puppet-skype

16 stars 4 forks source link

bridge fails to update avatars #6

Closed RuralYak closed 4 years ago

RuralYak commented 4 years ago

After joining to active multi user room I noticed that not all users has their avatars like in skype. Found this in logs:

May-2 06:20:20.409 [UserSync] silly: Start of getClient request
May-2 06:20:20.409 [UserSync] info: Fetching client for -1
May-2 06:20:20.409 [SQLite3] silly: Get: SELECT * FROM user_store WHERE user_id = $id AND puppet_id = $pid
May-2 06:20:20.410 [bot-sdk-MatrixLiteClient] info: (REQ-1) POST http://public-matrix:8008/_matrix/client/r0/register
May-2 06:20:20.410 [bot-sdk-MatrixLiteClient] debug: (REQ-1) qs = {"user_id":"@_skypepuppet__8=<USER_ID>:domain.tld"}
May-2 06:20:20.410 [bot-sdk-MatrixLiteClient] debug: (REQ-1) body = {"type":"m.login.application_service","username":"_skypepuppet__8=<USER_ID>"}
May-2 06:20:20.418 [bot-sdk-Appservice] error: Error registering user: User ID is in use
May-2 06:20:20.418 [bot-sdk-Metrics] debug: matrix_client_function_call
May-2 06:20:20.419 [Util] info: Processing profile update...
May-2 06:20:20.419 [Util] verbose: {
  puppetId: -1,
  userId: '8:<user_id>',
  name: '<user_full_name>',
  avatarUrl: 'https://avatar.skype.com/v1/avatars/<user_id>/public',
  avatarMxc: 'mxc://domain.tld/FdJaaHexidRalCuTcOzhujiK',
  avatarHash: 'ae47723c33cfc5360a2130a41e72c5694e890673b3f156a9c363c932ec930b4c701c1c1ef2db14d20065da58ebf81b0c2d17cd47b2214553a9e4d7c7a74546c2'
} --> {
  puppetId: 2,
  userId: '8:<user_id>',
  name: '<user_full_name>',
  avatarUrl: 'https://avatar.skype.com/v1/avatars/<user_id>/public'
}
May-2 06:20:20.419 [Util] verbose: Old profile exists, looking at diff...
May-2 06:20:20.419 [UserSync] verbose: Returning client
May-2 06:20:20.420 [bot-sdk-Metrics] debug: intent_function_call
May-2 06:20:20.420 [bot-sdk-Metrics] debug: matrix_client_function_call
May-2 06:20:20.420 [RoomSync] info: Fetching mxid for roomId 19:4e34f1b5ee3f4df3a2e920a14204c70b@thread.skype and puppetId -1
May-2 06:20:20.421 [Util] info: Processing profile update...
May-2 06:20:20.421 [Util] verbose: {
  mxid: '!RBOWQEZaOhwgZslZBp:domain.tld',
  roomId: '19:4e34f1b5ee3f4df3a2e920a14204c70b@thread.skype',
  puppetId: -1,
  isDirect: false,
  e2be: false,
  isUsed: false,
  name: '<room_name>',
  avatarUrl: null,
  avatarMxc: null,
  avatarHash: null,
  topic: null,
  groupId: null,
  externalUrl: null
} --> {
  puppetId: 2,
  roomId: '19:4e34f1b5ee3f4df3a2e920a14204c70b@thread.skype',
  name: '<room_name>',
  avatarUrl: 'https://api.asm.skype.com/v1/objects/0-weu-d3-44884962d3d93c3079810ee31b344698/views/avatar_fullsize'
}
May-2 06:20:20.421 [Util] verbose: Old profile exists, looking at diff...
May-2 06:20:20.421 [Util] verbose: Uploading avatar...
May-2 06:20:20.421 [Util] silly: https://api.asm.skype.com/v1/objects/0-weu-d3-44884962d3d93c3079810ee31b344698/views/avatar_fullsize
May-2 06:20:20.421 [Util] silly: fetching avatar...
May-2 06:20:20.715 [Util] error: Error uploading file content: HTTPError: Response code 401 (Unauthorized)
    at EventEmitter.<anonymous> (/opt/mx-puppet-skype/node_modules/got/dist/source/as-promise.js:118:31)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
Sorunome commented 4 years ago

fixed in https://github.com/Sorunome/mx-puppet-skype/commit/0255283d5aebbc8340d9f1ed389e3d91960925fe