IsmaelMartinez / teams-for-linux

Unofficial Microsoft Teams for Linux client
GNU General Public License v3.0
2.95k stars 240 forks source link

Custom backgrounds are not working on Teams V2 (configJSON is not iterable) #1424

Closed nfp0 closed 1 month ago

nfp0 commented 1 month ago

Describe the bug

Custom background is not working for me. It fails with the output shown below. I have tried deleting .config/teams-for-linux/ to start with a fresh environment, but it did not help.

To Reproduce Steps to reproduce the behavior:

  1. Configure backgrounds web server according to the README.
  2. Open Teams with the following arguments: teams-for-linux --isCustomBackgroundEnabled=true --customBGServiceBaseUrl=http://localhost:5317 --webDebug
  3. Custom backgrounds don't show up.

Expected behavior Custom backgrounds should show up.

Desktop (please complete the following information):

Debug

19:15:33.128 › Custom background service url is 'http://localhost:5317'
19:15:33.129 › processArgs: [
  '/opt/teams-for-linux/teams-for-linux',
  '--isCustomBackgroundEnabled=true',
  '--customBGServiceBaseUrl=http://localhost:5317'
  '--webDebug'
]
19:15:33.213 › Fetched custom background remote configuration but failed to save at '/home/myuser/.config/teams-for-linux/custom_bg_remote.json'. configJSON is not iterable

Additional context

My config.json file looks like this:

{
  "videoBackgroundImages": [
    {
      "filetype": "png",
      "id": "Some_id",
      "name": "Some background",
      "src": "/evergreen-assets/backgroundimages/some-bg.png",
      "thumb_src": "/evergreen-assets/backgroundimages/some-bg.png"
    }
  ]
}
nfp0 commented 1 month ago

Additionally, I am wondering: Is the /evergreen-assets/backgroundimages/ path really mandatory for V2?

EDIT: I've tested and it is not mandatory.

IsmaelMartinez commented 1 month ago

Are you running a server as described in the docs? What happens if you run the test server we provide? Ta

On Thu, 26 Sept 2024, 19:33 nfp0, @.***> wrote:

Additionally, I am wondering: Is the /evergreen-assets/backgroundimages/ path really mandatory for V2?

— Reply to this email directly, view it on GitHub https://github.com/IsmaelMartinez/teams-for-linux/issues/1424#issuecomment-2377660702, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADJHEB7IM7KYFXT3ZPVW3DZYRHRFAVCNFSM6AAAAABO5TJTOKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZXGY3DANZQGI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

nfp0 commented 1 month ago

@IsmaelMartinez I've managed to get it to work using npx as described here (Even though I had a few cache issues).

I was originally trying to get it to work with Nginx. Probably some configuration was not set correctly there but I'm not going to pursue it further, seeing as that serving with npx is a very simple alternative.

Anyway, thank you for the help and for this awesome app!

nfp0 commented 1 month ago

I am sorry, but I need to reopen it again. After closing and reopening Teams, now the image shows only a black background, and the server log shows no attempt of Teams trying to GET the image in any way. I've deleted the .config/teams-for-linux folder but the problem persists.

The logs show:

17:28:22.555 › Fetching custom background configuration from 'http://localhost:5318/config.json'
17:28:22.602 › Custom background service url is 'http://localhost:5318'
17:28:22.602 › processArgs: [
  '/opt/teams-for-linux/teams-for-linux',
  '--isCustomBackgroundEnabled=true',
  '--customBGServiceBaseUrl=http://localhost:5318'
]
17:28:22.603 › testing RegExp processArgs false
17:28:22.603 › testing RegExp processArgs false
17:28:22.603 › testing RegExp processArgs false
17:28:22.604 › Testing network using net.request() for https://teams.microsoft.com
17:28:22.604 › Spellchecker is disabled!
17:28:22.692 › Fetched custom background remote configuration but failed to save at '/home/user/.config/teams-for-linux/custom_bg_remote.json'. configJSON is not iterable
17:28:22.992 › Network test successful with method https
17:28:23.282 › GetSystemIdleState => IdleTimeout: 300s, IdleTimeoutPollInterval: 10s, ActiveCheckPollInterval: 2s, IdleTime: 0s, IdleState: 'active'
17:28:23.753 › did-frame-finish-load {} true
17:28:23.754 › did-finish-load
17:28:24.844 › Badge count set to '0'
17:28:24.854 › Badge count set to '0'
17:28:25.479 › Badge count set to '0'
17:28:26.822 › did-frame-finish-load {} false
17:28:30.728 › Badge count set to '0'
17:28:33.297 › GetSystemIdleState => IdleTimeout: 300s, IdleTimeoutPollInterval: 10s, ActiveCheckPollInterval: 2s, IdleTime: 0s, IdleState: 'active'
17:28:36.134 › Forwarding 'https://statics.teams.cdn.office.net/evergreen-assets/backgroundimages/config.json?v=6' to 'http://localhost:5318/config.json?v=6'
17:28:43.297 › GetSystemIdleState => IdleTimeout: 300s, IdleTimeoutPollInterval: 10s, ActiveCheckPollInterval: 2s, IdleTime: 0s, IdleState: 'active'
[442855:1001/172852.047229:ERROR:gl_surface_presentation_helper.cc(260)] GetVSyncParametersIfAvailable() failed for 1 times!
17:28:53.298 › GetSystemIdleState => IdleTimeout: 300s, IdleTimeoutPollInterval: 10s, ActiveCheckPollInterval: 2s, IdleTime: 0s, IdleState: 'active'
17:29:03.299 › GetSystemIdleState => IdleTimeout: 300s, IdleTimeoutPollInterval: 10s, ActiveCheckPollInterval: 2s, IdleTime: 0s, IdleState: 'active'
17:29:13.300 › GetSystemIdleState => IdleTimeout: 300s, IdleTimeoutPollInterval: 10s, ActiveCheckPollInterval: 2s, IdleTime: 0s, IdleState: 'active'
17:29:23.300 › GetSystemIdleState => IdleTimeout: 300s, IdleTimeoutPollInterval: 10s, ActiveCheckPollInterval: 2s, IdleTime: 0s, IdleState: 'active'

After the config.json file is read, no attempts are made at trying to read the background image.

IsmaelMartinez commented 1 month ago

Can you share the contents of the file? The assets need the "evergreen" stuff on their URL, as the example ones shows

Like in https://github.com/IsmaelMartinez/teams-for-linux/blob/develop/app/customBackground/example/config.json You will see that the path for the images needs that /evergreen-assets/backgroundimages/ if the images are in the same path. If they are in a different path (subfolder) you will need to add those to the path of images, but I haven't tried that.

On Tue, 1 Oct 2024, 17:35 nfp0, @.***> wrote:

I am sorry, but I need to reopen it again. After closing and reopening Teams, now the image shows only a black background, and the server log shows no attempt of Teams trying to GET the image in any way. I've deleted the .config/teams-for-linux folder but the problem persists.

The logs show:

17:28:22.555 › Fetching custom background configuration from 'http://localhost:5318/config.json' 17:28:22.602 › Custom background service url is 'http://localhost:5318' 17:28:22.602 › processArgs: [ '/opt/teams-for-linux/teams-for-linux', '--isCustomBackgroundEnabled=true', '--customBGServiceBaseUrl=http://localhost:5318' ] 17:28:22.603 › testing RegExp processArgs false 17:28:22.603 › testing RegExp processArgs false 17:28:22.603 › testing RegExp processArgs false 17:28:22.604 › Testing network using net.request() for https://teams.microsoft.com 17:28:22.604 › Spellchecker is disabled! 17:28:22.692 › Fetched custom background remote configuration but failed to save at '/home/user/.config/teams-for-linux/custom_bg_remote.json'. configJSON is not iterable 17:28:22.992 › Network test successful with method https 17:28:23.282 › GetSystemIdleState => IdleTimeout: 300s, IdleTimeoutPollInterval: 10s, ActiveCheckPollInterval: 2s, IdleTime: 0s, IdleState: 'active' 17:28:23.753 › did-frame-finish-load {} true 17:28:23.754 › did-finish-load 17:28:24.844 › Badge count set to '0' 17:28:24.854 › Badge count set to '0' 17:28:25.479 › Badge count set to '0' 17:28:26.822 › did-frame-finish-load {} false 17:28:30.728 › Badge count set to '0' 17:28:33.297 › GetSystemIdleState => IdleTimeout: 300s, IdleTimeoutPollInterval: 10s, ActiveCheckPollInterval: 2s, IdleTime: 0s, IdleState: 'active' 17:28:36.134 › Forwarding 'https://statics.teams.cdn.office.net/evergreen-assets/backgroundimages/config.json?v=6' to 'http://localhost:5318/config.json?v=6' 17:28:43.297 › GetSystemIdleState => IdleTimeout: 300s, IdleTimeoutPollInterval: 10s, ActiveCheckPollInterval: 2s, IdleTime: 0s, IdleState: 'active' [442855:1001/172852.047229:ERROR:gl_surface_presentation_helper.cc(260)] GetVSyncParametersIfAvailable() failed for 1 times! 17:28:53.298 › GetSystemIdleState => IdleTimeout: 300s, IdleTimeoutPollInterval: 10s, ActiveCheckPollInterval: 2s, IdleTime: 0s, IdleState: 'active' 17:29:03.299 › GetSystemIdleState => IdleTimeout: 300s, IdleTimeoutPollInterval: 10s, ActiveCheckPollInterval: 2s, IdleTime: 0s, IdleState: 'active' 17:29:13.300 › GetSystemIdleState => IdleTimeout: 300s, IdleTimeoutPollInterval: 10s, ActiveCheckPollInterval: 2s, IdleTime: 0s, IdleState: 'active' 17:29:23.300 › GetSystemIdleState => IdleTimeout: 300s, IdleTimeoutPollInterval: 10s, ActiveCheckPollInterval: 2s, IdleTime: 0s, IdleState: 'active'

After the config.json file is read, no attempts are made at trying to read the background image.

— Reply to this email directly, view it on GitHub https://github.com/IsmaelMartinez/teams-for-linux/issues/1424#issuecomment-2386477231, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADJHEEEVQNHWW5KTUT3WM3ZZLFNPAVCNFSM6AAAAABO5TJTOKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOBWGQ3TOMRTGE . You are receiving this because you were mentioned.Message ID: @.***>

nfp0 commented 1 month ago

The contents of the file are the ones on my first post. I will repost them here:

{
  "videoBackgroundImages": [
    {
      "filetype": "png",
      "id": "Some_id",
      "name": "Some background",
      "src": "/evergreen-assets/backgroundimages/some-bg.png",
      "thumb_src": "/evergreen-assets/backgroundimages/some-bg.png"
    }
  ]
}

I have tried both with and without the "evergreen" path. Note that the "src" and "thumb_src" are the same, but that's intentional and shouldn't cause any issues I believe.

While testing, now I noticed that the http-server outputs the following when I open the backgrounds menu on Teams:

[Wed Oct 02 2024 12:30:58 GMT+0100 (Western European Summer Time)]  "OPTIONS /config.json?v=6" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.6367.243 Safari/537.36"
(node:61088) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
(Use `node --trace-deprecation ...` to show where the warning was created)

I have also noticed that Teams is trying to access my old file location without the "evergreen" path even though the config.json is set up as above. Could this be a cache issue on Teams's side?

image image

Copying the PNG file to the root location also did not help.

nfp0 commented 1 month ago

Very interesting. After setting my computer to sleep and waking it up an hour later, it now works even though I haven't changed anything! I've also restarted to test it and it keeps working. The Teams log now says:

13:58:28.420 › Forwarding 'https://statics.teams.cdn.office.net/evergreen-assets/backgroundimages/some-bg.png' to 'http://localhost:5317/some-bg.png'

This is even though the path in the config file is /evergreen-assets/backgroundimages/some-bg.png.

The http-server cache is set to it's default of 3600 seconds (1 hour), so I wonder if this was a cache related issue.

IsmaelMartinez commented 1 month ago

The cache might have been playing with you. The /evergreen-assets/backgroundimages/ is there for the MS side, but then it gets redirected without that path in your server.

It is confusing, but glad to see it is working. Check if still tomorrow and then close the issue.

RMCampos commented 1 month ago

Yes, worked for me too. However I had to copy the images from the actual backgroundimages folder to the server root. maybe a symlink also works.

But when I wanted to add more images (changing config.json file), I noticed MS Teams not being refreshed, not picking them up inside MS Teams. I had to manually delete .config/teams-for-linux and re-login. Then it worked. However this is not useful for this issue, please ignore.

IsmaelMartinez commented 1 month ago

ok, closing this as complete then. Glad you all found a solution.

nfp0 commented 1 month ago

But when I wanted to add more images (changing config.json file), I noticed MS Teams not being refreshed, not picking them up inside MS Teams. I had to manually delete .config/teams-for-linux and re-login.

@RMCampos I guess this helps the case that it might be a server cache issue. Maybe fully disabling the http-server cache is a good option to avoid these problems.

SuperTux88 commented 2 days ago

My teams is logging the same Fetched custom background remote configuration but failed to save at '/home/myuser/.config/teams-for-linux/custom_bg_remote.json'. configJSON is not iterable error from the original issue (and search brought me here). But to me it looks like everything is working and I can select my backgrounds as usual ... but I'm a bit confused why this error is logged.

The existing file on the disk indeed doesn't get updated, but teams shows me the correct backgrounds. When I delete the old existing file, it also doesn't store a new version there, but teams still shows me the correct backgrounds. So should I just ignore the error then? But why is it an error if it still just works? :thinking:

IsmaelMartinez commented 2 days ago

@SuperTux88 , can you open a separate issue with as much info as possible? You need a server running to use the custom background (see the docs and the example in the custom background section. Config area). My guess is you are probably not running a server or you haven't got the right config, but I will be able to tell more by looking at the config and your logs. Ta