Giter Club home page Giter Club logo

Comments (14)

alexismarquis avatar alexismarquis commented on August 16, 2024 3

Great! I will set up a development environment and test the implementation.

from core.

alexismarquis avatar alexismarquis commented on August 16, 2024 1

Hey there,

I'm experiencing the same issue with photos from different users in shared albums.

I did some testing :

  • Calling SYNO.Fototeam.Download on shared photos results in a 801 error
  • Shared albums have a passphrase field. Providing this passphrase as an argument to SYNO.Foto.Download seems to resolve the issue.

This will require some changes to the library. On the HA side, it would either involve saving the passphrase in the BrowseMediaSource (but is it subject to change over time ?), or calling the SYNO.Foto.Browse.Album api before SYNO.Foto.Download.

from core.

alexismarquis avatar alexismarquis commented on August 16, 2024 1

The passphrase is also used in the public sharing link when enabled. It appears to be generated when the album is created and doesn't ever change. I tried disabling and re-enabling sharing, and it kept the same key. Changing the album share mode doesn’t affect it either.

The web app does include it in api requests but only when the album is shared.

The get method of SYNO.Foto.Browse.Album does provide the passphrase.
But as it's not changing, it should be safe to store it at the photo item level.
I think this would make it easier and more transparent to use, eliminating the need to manually pass the passphrase to all methods that require it (as far as I know: download and thumbnail).

I can draft a PR for the lib later this week if you’d like :)

from core.

lodesmets avatar lodesmets commented on August 16, 2024 1

ate all my cameras from my surveillance station are unavailable. I tried to remove the integration and add it back and now it will not bring any of them in. I have not found any breaking changes or anything online to say that it is no longer supported not sure whats happened.

Hey,

Please make a new issue

from core.

home-assistant avatar home-assistant commented on August 16, 2024

Hey there @hacf-fr, @Quentame, @mib1185, mind taking a look at this issue as it has been labeled with an integration (synology_dsm) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of synology_dsm can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign synology_dsm Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


synology_dsm documentation
synology_dsm source
(message by IssueLinks)

from core.

lodesmets avatar lodesmets commented on August 16, 2024

I tested it when developing the fix, and it worked then. I haven't tested it when it is integrated.

The problem is, I use Synology photos without sharing. So it is difficult to test everything.

Lets say user A is the user you use with the integration and user B is the other one.
Is user A the one who created the album, and shared it with B?
Or did B create the album and share it with A?

from core.

ethemcemozkan avatar ethemcemozkan commented on August 16, 2024

@lodesmets, I think it is the first case.
User A: owns the album, also is the user HA using to connect. It also have pictures owned by itself in the album. These pictures are visible in the media browser
User B: Album is shared with this user, it adds a few photos into this album, which are not visible in the media browser.

from core.

lodesmets avatar lodesmets commented on August 16, 2024

Hey, I'm looking at your logs:
The images that work have owner_user_id 4:
{'id': 17081, 'filename': 'wp11611080-2000x1200-wallpapers.jpg', 'filesize': 1743048, 'time': 1717362360, 'indexed_time': 1717414576108, 'owner_user_id': 4, 'folder_id': 142, 'type': 'photo', 'additional': {'thumbnail': {'m': 'ready', 'xl': 'ready', 'preview': 'broken', 'sm': 'ready', 'cache_key': '17081_1717407736', 'unit_id': 17081}}}

The ones that don't work have user_id 2:
{'id': 20167, 'filename': 'IMG_0257.JPG', 'filesize': 406987, 'time': 1719490272, 'indexed_time': 1719497050888, 'owner_user_id': 2, 'folder_id': 7, 'type': 'photo', 'additional': {'thumbnail': {'m': 'ready', 'xl': 'ready', 'preview': 'broken', 'sm': 'ready', 'cache_key': '20167_1719489851', 'unit_id': 20167}}}

I only use shared albums with a link and users that don't have an account. In this case the user_id is always 0

So I will have to create another user and test it that way. I'll let you know if I find anything.

The main problem is that synology photos doesn't have a public documentation for the api, so everything was reverse engineered.

from core.

lodesmets avatar lodesmets commented on August 16, 2024

@mib1185
Hey, I can't seem to find the issue. I don't know if you use synology photos, but you are the main developper of this integration.

The issue is that when requesting a picture by someone else it gives an error. The previous fix for shared images works. But this is a different issue indeed. There the issue was with shared images here the issue is with images shared by another user (different use cases).

@ethemcemozkan (and I can confirm in my logs) get error code 117 (Unknown internal error) when requesting the image.

When developing the photos integration I mainly used reverse engineering. But the requests are almost the same as the browser:
Request the browser does:
https://xxxxxxxxxxxxx/webapi/entry.cgi?cache_key=%2215004_1719943137%22&unit_id=%5B15004%5D&album_id=6&api=%22SYNO.Foto.Download%22&method=%22download%22&version=2&SynoToken=xxxxxxxx
As you can see the parameters are:
cache_key=%2215003_1719942819%22
unit_id=%5B15003%5D
album_id=6
api=%22SYNO.Foto.Download%22
method=%22download%22
version=2
SynoToken=xxxxxxxxxxxx

The request HA does:
https://xxxxxxxxxxxxxxx/webapi/entry.cgi?unit_id=%5B15003%5D&cache_key=15003_1719942819&api=SYNO.Foto.Download&version=2&method=download&_sid=*********&SynoToken=*********
As you can see the parameters are:
unit_id=%5B15003%5D
cache_key=15003_1719942819
api=SYNO.Foto.Download
version=2
method=download
_sid=*********
SynoToken=*********

There are a couple differences:

  • The request the browser does has " around the values of api, cache_key and method. I tried adding this, but sadly this does not change anything
  • HA adds the _sid parameter. Why do you add this? Is this needed? Because Synology photos in the browser does not do this?

Any clues?

from core.

mib1185 avatar mib1185 commented on August 16, 2024

I don't really use the photo station much, it is installed and sometimes I browser through the albums, but they are all owned by the same user.

iirc the _sid is used to identify HA as a known device for the Synology πŸ€”

Maybe we need to use the SYNO.Fototeam.Download api for every not self owned photo πŸ€” so we need to find out what is our own user_id and than assume every different user_id to be a shared photo. Will try to figure it out within the next days/weeks (my calendar is pretty well filled these days) πŸ‘ if you have already a setup ready to test this use case, it would highly be appreciated if you could check if for photos from other users also the other api is used. As soon as we have this info, it should be easy to implement a solution for it 🀞

Btw. I took over the maintainer role for this integration some time ago, so I'm not the original author of this and even for my everything was and is reverse engineering πŸ™ˆ

from core.

mib1185 avatar mib1185 commented on August 16, 2024

Hi @alexismarquis

thanks for your efforts in analyzing this πŸ‘ Since i do not use the photo station at all, any contributions to the lib are highly welcome πŸ˜‰

from core.

lodesmets avatar lodesmets commented on August 16, 2024

@alexismarquis
Nice find. I tried looking what the browser did differently, and it didn't use the passphrase, so I didn't see it.

You say calling the SYNO.Foto.Browse.Album before download. Does this one give the passphrase?

from core.

antasp3136 avatar antasp3136 commented on August 16, 2024

Not sure if this is related but all of the sudden after the latest home assistant update all my cameras from my surveillance station are unavailable. I tried to remove the integration and add it back and now it will not bring any of them in. I have not found any breaking changes or anything online to say that it is no longer supported not sure whats happened.

from core.

mib1185 avatar mib1185 commented on August 16, 2024

Hi @alexismarquis
meanwhile your PR has been merged in the py-synologydsm-api lib and a new release has been done, it is now time to implement it to the integration. For this I've created #123613 which bumps to use the new lib version and implements the necessary adjustments, so that the passphrase is now considered.
But i do not use the photo station in such way, any test efforts of this PR are highly welcome!

from core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.