CloudApp alternative using Synology NAS and Dropzone

I've been using the CloudApp for a year as a very satisfied user. However latest price changes and new Synology NAS below my table brought me to the idea to build my own alternative to the CloudApp. It is simple: why should I pay 25 USD per month when I have own storage available on the internet?

Synology NAS (I have DS214+) has a possibility to serve the websites thanks to DSM 5 operating system and its Web Station package. So I've changed my DNS from the CloudApp to the Synology's IP address and created the website on it. It is actually a folder with empty index.html file.

So whenever I upload any file to this website, it is accessible via something.mydomain.tld/filename.ext. Now remains to solve how to do this comfortably.

Synology NAS is accessible via the local network so I can use Finder (or ForkLift to be precious) to copy the files to my new sharing website. But there is a problem - how to get the filename with URL to the clipboard automatically?

Dropzone helps you to create CloudApp alternative

Then I've found the small app called Dropzone. It works simillar way to CloudApp. It resides in the top bar of OS X and you can drag and drop any file to it and then use one of the targets icons. There is built-in support for AirDrop or Twitter for example.

So I've build a custom action with this script. It copies the drag'n'dropped file to the NAS (and the folder for the website) via the local network and then put the URL to the clipboard.

# Dropzone Action Info
# Name: Share
# Description: Copies to Synology
# Handles: Files
# Creator: Jan Polzer
# URL: http://www.polzer-sw.com/
# OptionsNIB: ChooseFolder
# UseSelectedItemNameAndIcon: Yes
# Events: Clicked, Dragged
# SkipConfig: Yes
# RunsSandboxed: Yes
# Version: 1.0
# MinDropzoneVersion: 3.0

def dragged
  $dz.determinate(true)
  $dz.begin("Copying file")
  Rsync.do_copy($items, ENV['EXTRA_PATH'], false)
  $dz.finish("Copy finished")
  $dz.url(false)
  $dz.text('http://share.mydomain.tld/'+$items[0].strip.split(File::SEPARATOR)[-1].strip[0..-1])
end

def clicked
  escaped_path = ENV['EXTRA_PATH'].gsub(/["`$\\]/){ |s| '\\' + s }
  system("open \"#{escaped_path}\"")
end

Using this simple script for Dropzone and Synology NAS I have a fully functional alternative to CloudApp without any limits. I can share as big file as I want and as many files as I need. The truth is I use it mostly for the screenshots coming from Skitch app.