Q: Is there a way to access files on Nextcloud by File Browser?

Is there a way to access files on Nextcloud by File Browser?

Installed successfully a Nextcloud account on the phone (Xperia 10 / SFOS 4.5.0.24) and creating a backup works. Backup is visible when checking the Nextcloud by computer, it’s in a directory ~/Sailfish OS/Backups/Xperia-10—Dual-SIM_somelettercombination/sailfish_backup_2024-07-28T10-04-04Z.tar.gz.

But I can see no way to simply upload some file (image, text, whatever…) to the Nextcloud server manually here and now (not timer-controlled/scheduled), and how to define a directory to be synchronized, that is accessible by File Browser.

Since installation of the Nextcloud account, there is a directory “Sync” visible" in the home directory, but copying a file into it does nothing. The file doesn’t appear on Nextcloud when checking with computer.

Did I forget something? What can I do to make it work?
Thanks for any help!

edit: in the Gallery app, images from cloud are visible.

edit: Gallery app has “Documents” as default for sharing with Nextcloud. Can be changed for one upload but will be not stored permanently. Next upload I have to change directory name again. What can I do to make Photos a permanent target and no more suggest Documents in Gallery app?

For single file uploads and downloads the GhostCloud app works okay.

You can use rclone or davfs2 to mount an NC path somewhere, but that’s a bit involved and there is no GUI for that.

2 Likes

There might be better and less convoluted ways of going around, but this is my current setup for this purpose… in practice I need to pretty much always use the last ./nc.sh command because it wasn’t mounted after several network swaps anymore, so not ideal, but good enough for my usage :blush:

devel-su zypper install davfs2
mkdir ~/.davfs2 && mkdir ~/Nextcloud
devel-su cp -v /etc/davfs2/secrets ~/.davfs2/secrets
devel-su chown -v defaultuser:defaultuser ~/.davfs2/secrets
devel-su chmod -v 600 ~/.davfs2/secrets
vim ~/.davfs2/secrets

Append to this file:

/home/defaultuser/Nextcloud account@domain.extension Your-25-Digit-Password

devel-su vim /etc/fstab

Add this entry:

https://nextclouddomain.extension/remote.php/dav/files/account@domain.extension/ /home/defaultuser/Nextcloud davfs _netdev,user,rw,noauto 0 0

(it’s not auto-mounted to avoid startup issues without network, we’ll mount it later)

devel-su vim /etc/davfs2/davfs2.conf

Uncomment and edit:

use_locks 0
cache_dir ~/.cache/davfs2 # per user cache
cache_size 128 # MiByte
dir_refresh 120 # seconds
delay_upload 20

Allow defaultuser to mount/unmount:

devel-su gpasswd -a defaultuser mount

Create a systemd unit file:

vim ~/.config/systemd/user/autostart-cmd.service

[Unit]
Description=Execute script with commands at startup
Requires=lipstick.service
After=lipstick.service

[Service]
Type=Oneshot
ExecStart=/home/defaultuser/.config/systemd/scripts/autostart-cmd.sh

[Install]
WantedBy=post-user-session.target

mkdir -v /home/defaultuser/.config/systemd/scripts/
vim /home/defaultuser/.config/systemd/scripts/autostart-cmd.sh

This rather convoluted script unmounts and remounts Nextcloud regardless of what state the mount is in:

#!/bin/sh

sleep 1 && sync /home/defaultuser/Nextcloud
sleep 1 && umount /home/defaultuser/Nextcloud
sleep 3 && fusermount -uz /home/defaultuser/Nextcloud
sleep 3 && rm /var/run/mount.davfs/home-defaultuser-Nextcloud.pid
sleep 20 && mount /home/defaultuser/Nextcloud

chmod +x -v /home/defaultuser/.config/systemd/scripts/autostart-cmd.sh
systemctl --user daemon-reload
systemctl --user enable autostart-cmd.service
systemctl --user start autostart-cmd.service

And finally, to quickly restore the mount via the phones Terminal application with ./nc.sh:

ln -vs ~/.config/systemd/scripts/autostart-cmd.sh nc.sh

4 Likes

Cargo Dock works with nextcloud (just use the owncloud option and for path use ‘/remote.php/dav/files/username’), it has multi-select and can copy over folders

2 Likes

Meanwhile I’m sure that there is a login problem with the not working account and not a path problem. I have to clear with provider. As said, the other Nextcloud account (Hetzner) works.