owncloud / client

🖥️ Desktop Syncing Client for ownCloud
GNU General Public License v2.0
1.39k stars 667 forks source link

Command line access to context menu features #6673

Open PVince81 opened 6 years ago

PVince81 commented 6 years ago

Use case:

Current flow:

  1. Move/copy or create a file "test.txt" inside the local "ownCloud" folder
  2. Wait a bit for sync
  3. Open file manager, in my case dolphin .
  4. Locate the uploaded file
  5. Right client
  6. Copy private link

Expected flow:

  1. Move/copy or create a file "test.txt" inside the local "ownCloud" folder
  2. Wait a bit for sync
  3. owncloud-cli show-private-link test.txt
  4. System outputs the private link
PVince81 commented 6 years ago

at least two possible approaches:

PVince81 commented 6 years ago

For approach 2:

from what I see the fileid is available in the sync db:

phash|pathlen|path|inode|uid|gid|mode|modtime|type|md5|fileid|remotePerm|filesize|ignoredChildrenRemote|content

so it might just be a matter of: 1) check every parent folder for the sync db, file with format ._sync_$hash.db and remember this as the sync root 2) compute the relative path based on sync root 3) open the DB file 4) select fileid from metadata where path='$relativePath' => $fileid 5) find the $baseUrl somewhere in main config ??? 6) create private link based on known format: "$baseUrl/f/$fileid".

PVince81 commented 6 years ago

hmm or first go and read the configs in .local/share/data/ownCloud/owncloud.cfg to find all sync configs and find the root path, which incidentally also contains the path to the sync DB.

ok, depending what the client devs say I might spend some spare time writing up a quick python script to do just that :-)