Code Monkey home page Code Monkey logo

botspot / cloudbuddy Goto Github PK

View Code? Open in Web Editor NEW
65.0 8.0 9.0 349 KB

CloudBuddy is the ultimate wizard for cloud storage. It uses rclone to connect to your cloud drives, download from them, upload to them, mount them to your file manager, and more. In addition, CloudBuddy features an interactive file browser to easily generate shareable links and to perform various server-side operations.

Shell 100.00%
google-drive google-cloud onedrive dropbox rclone rclone-gui cloud-storage cloud raspberry-pi raspberry-pi-4

cloudbuddy's Introduction

program icon

CloudBuddy

Bash-based GUI client for rclone. This was written by Botspot on 7/29/2021. 2021-07-28-204821_1366x768_scrot

Installation:

badge

Or, to download manually:

git clone https://github.com/Botspot/cloudbuddy

CloudBuddy is portable and can be executed from anywhere on your filesystem. For simplicity, this README will assume CloudBuddy is located in your $HOME directory.

First run:

~/cloudbuddy/main.sh

When running for the first time, CloudBuddy will:

  • Check and install dependencies: yad, xclip, rclone. Note: If rclone is already installed with apt, CloudBuddy will overwrite it with the latest version of rclone from source.
  • Add a Main menu launcher. (~/.local/share/applications/cloudbuddy.desktop) This launcher is located under the Internet category.
  • Make sure the "fuse" kernel module has been loaded so that rclone can mount drives. If fuse is not loaded, CloudBuddy will attempt to load it by running sudo modprobe fuse. If that fails, CloudBuddy's mounting capabilities will be disabled and hidden.
  • Check for updates. If the last local commit and the latest online commit do not match, CloudBuddy will run git pull and refresh the script if it was modified. Note: If you make a fork of this repository, you should change the github URL in the script to point to your repository. To disable update-checking, create a file at: ~/cloudbuddy/no-update.

Usage

Note: CloudBuddy is intended to be self-explanatory. Everything should proceed in a logical fashon and nearly all users will have no problem using this program. But for those few users who wish to get acquainted with CloudBuddy before they try it out, here you go.

Connecting to a new cloud drive

This automates the rclone config process. Feel free to manually run rclone config for more options and a wider selection of cloud storage providers.

  1. In the main window, click this button:
    Screenshot from 2021-07-30 09-28-46
  2. Choose a name for the new cloud drive, and select which type of drive it is.
    Screenshot from 2021-07-30 09-35-38
  3. Within seconds, a web browser will appear for authorization.
    2021-07-30-095030_1366x768_scrot
  4. That's it!

Disconnecting from a cloud drive

  1. In the main window, click this button:
    Screenshot from 2021-07-30 10-04-22
  2. Choose a cloud drive to sign out of.
    Screenshot from 2021-07-30 10-05-22
  3. That's it! First, this uses rclone config disconnect to ask the cloud to revoke rclone's API key, then deletes the cloud drive from rclone's config file using rclone config delete.

Mounting a drive

This uses rclone's mount command to view your cloud drive as if it was an external data disk.

  1. In the main window, click this button:
    Screenshot from 2021-07-30 10-12-08
  2. Select a drive to continue.
    Screenshot from 2021-07-30 10-17-07
  3. Choose an empty directory to mount the cloud drive to.
    Screenshot from 2021-07-30 10-22-20
  4. Wait for it...
    2021-07-30-103150_1366x768_scrot
  5. Done!

Unmounting a drive

  1. In the main window, click this button:
    Screenshot from 2021-07-30 10-35-26
  2. Choose a drive to be unmounted.
    Screenshot from 2021-07-30 10-39-19
  3. Done!

Browsing a drive

  1. In the main window, click this button:
    Screenshot from 2021-07-30 10-41-39
  2. Select a drive to continue.
    Screenshot from 2021-07-30 10-17-07
  3. This is CloudBuddy's built-in file browser. It exclusively uses rclone commands for navigation and all operations are performed server-side.
    Screenshot from 2021-07-30 10-45-49
    The file browser is capable of:
  • Uploading files or folders with this handy drag-n-drop window:
    Screenshot from 2021-07-30 11-04-10
  • Downloading the selected file(s) or folder(s) from the list to $HOME/Downloads. This takes advantage of rclone copy. Just look at that pretty terminal output!
    2021-07-30-121153_1366x768_scrot
  • Moving or Renaming an item. This uses the rclone moveto command - it makes an API call to the cloud drive to perform the operation so no large downloads or uploads have to occur.
    Screenshot from 2021-07-30 12-17-19
  • Deleting the selected file(s) or folder(s) from the cloud drive. This uses rclone purge or rclone deletefile commands. Keep in mind that most cloud drives will keep deleted items in a recovery folder for a while.
  • Creating a publically sharable link to the selected file or folder.
    Screenshot from 2021-07-30 12-40-19
    Notice the above Copy button. Because it uses xclip to copy the URL, CloudBuddy treats xclip as a required dependency.

Web Interface

This simple button runs rclone's built-in browser interface.

  1. In the main window, click this button:
    Screenshot from 2021-07-30 20-51-07
  2. A web browser should open with rclone's HTML-based interface.
    Fun fact: I (Botspot, the maker of CloudBuddy) was not aware rclone had this feature until after CloudBuddy was mostly complete.

And with that, the GUI usage tutorial comes to an end. If CloudBuddy was designed correctly, you didn't have to read this to use CloudBuddy.

Command-line options

CloudBuddy is run by a single bash megascript. It's not that long a script though, so why do I call it called a megascript?
Because CloudBuddy's main.sh script is actually many bash scripts in one.
When you launch CloudBuddy, it will start at the top of the script, run a little preliminary stuff like update-checking, then skip nearly all the way to the end of the script and launch the main choice window. When you click a button, that window will run another background instance of CloudBuddy's main.sh with a command-line flag to preserve which button you clicked.
This approach has its downsides, but it is necessary for the main window to have a button layout of 3-by-2. Otherwise, all 6 buttons would be in one long row - which would look horrible and would prevent additional buttons from being added due to space constraints.
Did I mention that all CloudBuddy windows use yad? This dialog box utility is the most robust GTK dialog available for bash scripting, and is the basis of Pi-Apps, Pi Power Tools, YouTubuddy, Update Buddy, The TwisterOS Patcher, and Windows Screensavers for RPi. YAD is not perfect though, and its inability to display multiple rows of exit-code-type buttons is a major hindrance.
Enough said. Command-line options for CloudBuddy are below.
PRO TIP: if you run CloudBuddy in a terminal, it will dynamically generate a custom-tailored command to instantly reach the exact same place later. For example, if I was using the file browser and wanted to quickly reach a deep subdirectory later, this information would be very helpful:
2021-07-30-133534_1366x768_scrot

Set up CloudBuddy and then exit

On every launch, CloudBuddy checks for dependencies and creates a menu launcher. To run this preliminary stuff and then exit immediately, use this command-line flag:

~/cloudbuddy/main.sh setup

Source CloudBuddy's functions and then exit

Necessary for when CloudBuddy is downloading or uploading something in a terminal and we want to reuse CloudBuddy's colorized-echo functions.

source ~/cloudbuddy/main.sh source

More functions may be added in the future, but at the time of writing this they are: error, warning, echobright, echocommand, echoprogress, list_descendants, back, drivetype, and choosedrive.

New drive

~/cloudbuddy/main.sh newdrive

Optionally, a drive name and drive type can be specified (in that order) on the command-line to skip launching the selection window.

Remove drive

~/cloudbuddy/main.sh removedrive

Optionally, a drive name can be specified on the command-line to skip launching the selection window.

Mount drive

~/cloudbuddy/main.sh mountdrive

Optionally, a drive name and mountpoint can be specified (in that order) on the command-line to skip launching the selection window.

Unmount drive

~/cloudbuddy/main.sh unmountdrive

Optionally, a drive name, OR a mountpoint can be specified on the command-line to skip launching the selection window.

Browse drive

~/cloudbuddy/main.sh browsedrive

Optionally, a drive can be specified on the command-line to skip launching the selection window. Additionally, you can specify a subfolder to begin in, like this:

~/cloudbuddy/main.sh browsedrive "My Google Drive:Attachments/old stuff"

Additionally, a simpler, faster file browser can be launched if the fastmode variable is set to 1, like this:

fastmode=1 ~/cloudbuddy/main.sh browsedrive

Web Interface

~/cloudbuddy/main.sh webinterface

cloudbuddy's People

Contributors

botspot avatar tdwong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cloudbuddy's Issues

Windows

Botspot if you would have any expireince on windows, maybe you could deploy it to windows or a web interface. That would be amazing. BTW, I love all the projects you worked on. Especially Pi-apps.

How to start at boot?

I know, this is not an issue.
But it is a nice tool and easy to use.
But is there a way to start it automatic at boot?
Thanks

Some files/folders have no file size

image
I've noticed this appears with folders, and also files like .docx and .xlsx and .svg, but there are probably more file types that don't have a file size. Also, you could perhaps use some commands to remove of modify weird stuff in the dates?
image

Remote upload possible

Let us assume below scenario :-

I have multiple static download links with me saved in notepad file which are media in nature. Is the remote upload directly from url to onedrive is possible...?

Url can be in placed inside notepad file or pasted in batch. Whichever is possible.

Pi-Apps

More of a suggestion than an issue, will you add this to pi-apps?

cloudbuddy disabling mounting if `fuse` is not a module

In my kernel, fuse is a builtin driver, not a module. The main.sh script disables features if fuse is not a module

The availability of fuse as a builtin or module driver can be checked with:

ls /sys/module | grep -Fx fuse

and yes, I have checked the builtin version of fuse works fine with the script otherwise if you make the below edit

GoogleDrive issue

Hi,

So while OneDrive works a treat, I am having little luck with connecting to my GoogleDrive. Using the CloudBuddy gui, I can name a new cloud drive (MyGoogleDrive), but when I click on the GoogleDrive button, all that happens is the gui retracts to a single 'cancel' button, and it stays there. No rclone driven browser window opens to allow me to enter my login details for google drive.

So if I push the 'cancel' button, the gui returns. If I now look at listed drives in the gui "MyGoogleDrive" appears in the list - so I removed it so that I could try a more basic approach. On my second attempt, I opened a terminal and ran the 'main.sh' script so I could monitor the commands being executed. The gui popped up as usual and I went through the motions again. It still halted at the same place, with no browser window opening, and only a 'cancel' button showing. I have copied the terminal output into the attached file. It stops on an entry requiring a 'service_account_file'. No default value is given, and the line above says 'Press enter to leave empty'. So I did that in the terminal (after a few minutes), but the whole script terminates and I am back at the terminal cursor. I have added some comments into the terminal transcript, detailing what I did at those points. Those few entries are surrounded by [ ].

All suggestions appreciated. Note that through the standard Chromium window I can log in, and navigate, my actual GoogleDrive.

GoogleDrive_terminal.txt

Issue using File Manager

Issue: I can't access mounted drive through File Manager, but can access through terminal with sudo prefaced commands.

Setup: Raspberry Pi400 running with Raspberry OS (bullseye, 64 bit). Using CloudBuddy, I mount my OneDrive repository to the empty directory 'cloud' (/home/pi400/cloud).

Before mounting, the directory's permissions are:

    drwxrwxrwx 2 pi400 pi400 4096 Jul 19 08:41 cloud

After mounting, the directory's permissions change to:

    d????????? ? ?     ?        ?            ? cloud

As stated, File Manager can no longer access the directory after OneDrive is mounted (the mount does appear in left hand top panel), however I can browse/delete/create the mounted OneDrive directories and files by using terminal commands, prefaced by sudo. Without sudo, I receive the standard:
ls: cannot access 'cloud': Permission denied

Using 'sudo chmod u+rwx cloud' has no effect while OneDrive is mounted to the directory cloud.
This may not be an issue if I have missed something in setting up CloudBuddy? However I believe I have followed all the steps.

Breaks after fail to unmount drive

image

I keep forgetting to cd out of the folder before unmount, perhaps implement a warning if a unmount fails with a already in use error?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.