-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding dav resource for avatars #26872
Conversation
@DeepDiver1975, thanks for your PR! By analyzing the history of the files in this pull request, we identified @bartv2, @PVince81, @tanghus and @DeepDiver1975 to be potential reviewers. |
Link to the spec for easier overview ? |
This will be useful for mobile clients as well. |
Using cadaver I can download the file correctly, but when listing collection there is an error: dav:/remote.php/dav/avatars/tomas/> ls |
indeed - I'm having a look |
fixed |
A wonderful 'if (server.version >= ... )' is coming to Android... |
Works 👍 |
I would not do this based on the server version - with caldav and carddav a user's calendar/addressbook home is detected via a property on the current principal. I did the same here $ curl --request PROPFIND --user admin:admin --header "Content-Type: text/xml" --data "<D:propfind xmlns:D='DAV:' xmlns:oc='http://owncloud.org/ns'><D:prop><D:displayname/><oc:avatar-home/></D:prop></D:propfind>" http://localhost:8080/remote.php/dav/principals/users/admin
<?xml version="1.0"?>
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:cs="http://calendarserver.org/ns/" xmlns:card="urn:ietf:params:xml:ns:carddav" xmlns:oc="http://owncloud.org/ns">
<d:response>
<d:href>/remote.php/dav/principals/users/admin/</d:href>
<d:propstat>
<d:prop>
<d:displayname>Mr. Admin</d:displayname>
<oc:avatar-home>
<d:href>/remote.php/dav/avatars/admin</d:href>
</oc:avatar-home>
</d:prop>
<d:status>HTTP/1.1 200 OK</d:status>
</d:propstat>
</d:response>
</d:multistatus> |
.... or we add a capability |
ping @dragotin |
Just out of curiosity: If I do a request like
to get all the available properties of the resource, the result is
Is that correct? http://www.restpatterns.org/HTTP_Methods/PROPFIND describes different. @DeepDiver1975 I am trying to find out which other props I can query from the principal. |
The avatar image is fetched from the server async, thus connect a signal from the account if the avatar changes. Server feature owncloud/core#26872 is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me to implement owncloud/client#5482 yet I can not comment too much on the php code :-)
Thanks!
@DeepDiver1975 btw - I would appreciate if a client would not have to query the path to the avatar from the principals properties but if it just could always get The reason is if we use that API also to get avatars for the users in the activity stream, we would have to query first for the path, and than for the image itself, basically doubling the amount of queries... (even if the client caches the avatars for the users it saw...) |
A capability would be nice. |
for? |
querying the prop only works for the own user - one has no access to the principal of other users as far as I have been retesting this ..... Well - just use the url as is. |
Yes, ok. So if we want to extend usage of the avatar image it is important that
About the capability: In general it would be enough to know if the avatar image can be queried yes/no. However since there will be changes in time, maybe a capability that tells the 'capability api version' would be best. |
yes
already possible |
Client status: We have the PR for client but we'd like for the server to have this merged first |
what us missing from your point of view - do we need a capability? |
The current code works by just guessing the URL: https://github.com/owncloud/client/pull/5482/files#diff-4301a6735ca9b7817b27e8f2f1bd5615R596 From the client developer perspective this is completely fine, but you guys are usually not happy about too many requests on the server so if you want to avoid that then better supply a capability? @ogoffart Feel free to override my opinion |
1657932
to
0d750e8
Compare
function getChildren() { | ||
try { | ||
return [ | ||
$this->getChild('96.jpeg') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hardcoded just like that ? "jpeg" or "jpg" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we support jpeg and png - we have to choose on extension
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"jpg" then ? 😉
Are real avatars really stored as "jpeg" and not "jpg" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did choose jpeg all over the place - https://github.com/owncloud/core/pull/26872/files#diff-a35b648d0c28cd73c0a837606ddff51cR62
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not stored - we convert on the fly - https://github.com/owncloud/core/pull/26872/files#diff-bd5bb24cc378d2ec7bc1b76759b3f975R66
Fine then, "jpeg" it is. What else is missing ? Capability ? Integration tests ? (integration tests could be added later) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What else is missing ? Capability ? Integration tests ? (integration tests could be added later)
fixing ui tests .... no capabilities required according to the client team
function getChildren() { | ||
try { | ||
return [ | ||
$this->getChild('96.jpeg') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not stored - we convert on the fly - https://github.com/owncloud/core/pull/26872/files#diff-bd5bb24cc378d2ec7bc1b76759b3f975R66
please get commit e5d1c36 into this branch to make the UI tests pass |
baa42d6
to
0fd7746
Compare
I rebased this branch and the commit is in here - but I still observe the error ... strange ... |
what - now green - are you kidding me? @individual-it THX |
@PVince81 objections in merging? |
Please raise doc ticket with instructions how to use the endpoint. And add this to the wiki page about new features |
Added in https://github.com/owncloud/core/wiki/ownCloud-10.0-Features "For Developers" |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
There is one root resource called /avatars/ - within this collection there is a list of all users (only enumerable in debug mode as usual).
Within this user node avatars can be loaded following the pattern
$size.$ext
where size is less then 1024 and ext is wither jppg or png.
A default child named 96.jpeg is listed.
To Decide:
ToDo:
Motivation and Context
@dragotin wants to have some fun with the desktop client during the holidays and I happily support him
How Has This Been Tested?
Browser with sabre's browser plugin - see screeshot
Screenshots (if appropriate):
Types of changes
Checklist: