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
jsonrpc: expose profile directory in Profiles.GetCurrentProfile/GetProfiles. #15509 #8196
Conversation
Many thanks for this. However, assuming this is being accessed by a remote script (as it's JSON), I suspect it would be more useful if the returned directory were the real OS directory (ie. /storage/.kodi/userdata/profiles/master) rather than the internal "special://" internal Kodi path - is it possible to translate from Kodi to OS and return the latter? Edit: The relative directory returned by the prova profile is useful, however the |
a3316a0
to
784b9c4
Compare
Updated as discussed on Slack. |
Works perfectly - many thanks! |
} | ||
else if (propertyIter->asString() == "directory") | ||
{ | ||
std::string path(CSpecialProtocol::TranslatePath("special://masterprofile")); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Looks good apart from my comment. |
784b9c4
to
2c035fa
Compare
Removed the 2 hardcoded |
Since those folders will not be accessible from remotes after but only from a local script the utility in current form is quite limited :( Should not the API return the special paths with added things in https://github.com/Xbmc/xbmc/blob/master/xbmc/utils/FileUtils.cpp#L110 to allow remote access (Would allow remotes to finally get the advancedsettings and things like that if they are in profiles). And eventually, to fit some special needs, a function to translate path added to JSON API? |
Yes they will - you can access
then download the Oddly I'm not able to obtain a directory listing using JSON
but
so in some cases there is more utility from the OS directories than there is from the That said, I'd have no objection if this method returned |
This is more complicated as explained in the link I gave earlier ;) The fact that PrepareDownload returns something does not mean you have access to it as security are not checked in it. By default from JSON you have no access to files except those explicit declared at : https://github.com/Xbmc/xbmc/blob/master/xbmc/utils/FileUtils.cpp#L110 Or sources with the allowSharing at true and not locked. This means this is normal you can not browse special://masterprofile or any profile. And should not be able to browse real profile directory too. So either you have a source pointing to that or
Is triggered when accessing those folders, and IMO it should not as security risk. I added the allowSharing to sources and fixed the FileUtils too, so have a little background on how this part works. Maybe @Montellese can comment on the CSettings::SETTING_SYSTEM_PLAYLISTSPATH part that maybe opens full access to profiles. (But what profiles : connected one, all, none ?) |
Yeah, true - I had previously added If the security is relaxed to allow However if there are no plans to relax the security around |
Well seeing how many things where not included because they are not perfect, adding something that can't be used by vast majority seems a little premature, but well I'm not in charge (But decision coherence should prevail) ;) I have no problem about special or real path (even if real path can leads to some security concerns, but there's so many others in Kodi). But whatever path is returned, IMO if there's no access from remotes then it should not be present. Your use case is very very specific and potentially dangerous, accessing data from a non loaded profile that could have a settings to not enable web server for security reason should not be possible. And think about problems accessing files like passwords.xml. Anyway as I said not my call, just bringing some knowledge here. |
All my niche case requires is the profile directory name relative to userdata, which I can determine from even the Of course the fact the |
2c035fa
to
c84abcd
Compare
@MilhouseVH this works here. @anaconda thx. |
c84abcd
to
1dc7948
Compare
1dc7948
to
05748df
Compare
Linked this to the corresponding trac ticket |
c677989
to
b257dac
Compare
Added fixup commit to return the > {"jsonrpc":"2.0","id":1,"method":"Profiles.GetProfiles","params":{"properties":["thumbnail","lockmode","directory"]}}
< {"id":1,"jsonrpc":"2.0","result":{"limits":{"end":2,"start":0,"total":2},"profiles":[{"directory":"special://masterprofile/","label":"Master user","lockmode":0,"thumbnail":""},{"directory":"special://masterprofile/profiles/prova/","label":"prova","lockmode":0,"thumbnail":""}]}} |
b257dac
to
957cf43
Compare
@Montellese any chance to get your final ACK before entering RC? |
957cf43
to
ede5f6f
Compare
@Montellese for merge approval |
7ce49e0
to
5c4b211
Compare
bfba81b
to
162921a
Compare
06d1602
to
42a8318
Compare
42a8318
to
cc26720
Compare
cc26720
to
568b99b
Compare
568b99b
to
ea96573
Compare
ea96573
to
19b2d63
Compare
19b2d63
to
3e534c9
Compare
@menakite any plans to revisit this? |
@anaconda this needs a rebase |
I will close this PR. If there's interest please open a new one (with required changes if needed). |
Bumps version to 7.13.0.
@Montellese
cc @MilhouseVH @un1versal
Edit: diff might be confusing - I've inverted the 2
for
loops.