how to use nc_share.py
repository on github: https://github.com/SpotlightKid/nc_share
copy files to system
sudo cp files/{nc_share.py,nextcloud.py} /usr/local/bin/
modified nc_share.py
update nc_share.py line 11
#from . import nextcloud
import nextcloud
and update NEXTCLOUD_URL , DEST_DIR
add function in ~/.bashrc
ncu() {
nc_share.py "${1:--}" --user nextcloud_accoun --password nextcloud_password -v
}
install dependency
sudo apt install -y xsel xclip
sudo pip install pyperclip keyring
apply ~/.bashrc
source ~/.bashrc
upload files to nextcloud in shell
chchang@hqdc039:~$ ncu server.cfg
OCS request: GET https://nextcloud.org/ocs/v1.php/cloud/capabilities {'headers': {'OCS-APIREQUEST': 'true'}}
DAV request: PUT /server.cfg
Headers: {'X-OC-MTIME': '1623721838'}
DAV status: 201
OCS request: POST https://nextcloud.org/ocs/v1.php/apps/files_sharing/api/v1/shares {'data': {'shareType': 3, 'path': '/server.cfg'}, 'headers': {'OCS-APIREQUEST': 'true'}}
OCS response: apps/files_sharing/api/v1
Share link URL: https://nextcloud.org/index.php/s/i83YFQgCcFjqpez
chchang@hqdc039:~$