Git Product home page Git Product logo

sharedrop's Introduction

ShareDrop

ShareDrop is a system that eases file sharing on Linux, provided you've got your own server to store the files.

It works by monitoring a folder for file creation or modification and by automatically and securely synchronizing these files to your web server through rsync.

Requirements

  • bash (tested with 4.2.42)
  • sha1sum (tested with the version from GNU coreutils 8.21)
  • fswatch
  • convert
  • a web server

Also depending on the sync_command

  • ssh (tested with OpenSSH 6.1)
  • rsync (tested with 3.0.9)

Linux

  • notify-send (tested with the version from libnotify 0.7.5)

OSX

  • terminal-notifier (optional)
$ brew install fswatch
$ brew install imagemagick

Setup

ShareDrop needs some (quite easy) setup.

  1. Define a VirtualHost (or equivalent) on your Web server that allows serving files from a given directory
  2. Write a config file for ShareDrop (see below)
  3. Run sharedrop.sh
  4. Drop files in the folder you launched ShareDrop in
  5. Wait for the notification giving you an URL for your file

Persistent setup

You may also want to automatically run ShareDrop on session start. You can give a path to ShareDrop to monitor as the first argument of the command. This should ease setting up your session manager.

Configuration

ShareDrop is configured through a config.sh file in a standard configuration folder (if you haven't tweaked $XDG_CONFIG_HOME then it's likely to be in $HOME/.config/sharedrop/). This file must define two bash variables:

  • $REMOTE: an rsync remote folder specification (such as example.com:public_html/)
  • $BASE_URL: the URL for the VirtualHost you configured in your web server (e.g.: http://example.com/share/)

sharedrop's People

Contributors

madx avatar moox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

piec maxwellsun

sharedrop's Issues

Add filter to only catch certains files

I put all kind of crap on my Desktop folder, including the screenshots (default location on osx) so we should add a way to filter what should be handled by this program. Maybe just (png|jpg...) for a start ?
Or a regex pattern to catch "Screen shot ..." ?

Better architecture

Ok, I just had a review of the code after @MoOx's PR, there are some things I really don't like with the codebase in general (not due to @MoOx's commits but due to the fact that the script was a hack at the beginning)

Here's a better architecture I've been thinking about:

sharedrop
├── bin
│   └── sharedrop                 # Actual executable, to be symlinked in ~/.bin
├── lib
│   ├── config.sh                 # Configuration variables definitions
│   ├── core.sh                   # Core functionality
│   ├── logging.sh                # Logging facilities
│   ├── os 
│   │   ├── linux.sh              # Linux-specific stuff
│   │   └── osx.sh                # OS X-specific stuff
│   └── web.sh                    # Web listing generator
├── Makefile                      # Makefile to help installation and bootstrap
├── README.md                     # Project description and instructions
└── test
    ├── test_add_local_file.sh    # Tests for adding a local file
    ├── test_clean_old_files.sh   # Tests for cleaning old files
    └── test_remove_local_file.sh # Tests for removing a local file

What do you think?

Drop the Ruby dependency

$HASH_CMD "$file" | cut -d' ' -f1 | ruby -ne 'puts $_.to_i(16).to_s(36)'

This line depends on Ruby, I don't want this dependency anymore if the project is going to be used by more that 1 person (me :D)

I need to find away to do this efficiently in bash.

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.