brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Save URLs to NextDash with a Dropzone 5 action on macOS

So I built a custom Dropzone 5 Action for macOS. With it you can send any URL from Safari or Chrome to your NextDash inbox with one click or a drag and drop.

Why a Dropzone action?

Dropzone 5 is a macOS utility in your menu bar for file sharing, launching applications and running macros. With NextDash it works as a desktop shortcut for saving web links.

  • No switching: save links without opening your dashboard tab or leaving your current browser session.
  • Two ways to capture: drag a URL directly onto the Dropzone icon, or copy a URL to your clipboard and click the Dropzone action.
  • Inbox first: links go straight to NextDash’s /api/inbox endpoint, so you can sort them later.

How it works

NextDash has a small REST API for adding items to your dashboard. The Dropzone action calls it with a Ruby script (action.rb) inside a .dzbundle container.

  1. Input: when triggered via click, the script reads your macOS clipboard using Dropzone’s $dz.read_clipboard API. When triggered via drag-and-drop, it grabs the dragged text or link from $items[0].
  2. Payload: the script puts the URL in a JSON payload: {"url": "https://example.com"}.
  3. Request: it sends an HTTPS POST request to your self-hosted NextDash endpoint (/api/inbox). If you have configured a NEXTDASH_WRITE_TOKEN in your NextDash environment variables, the script sends it in the X-NextDash-Token HTTP request header.
  4. Feedback: Dropzone shows a notification in the menu bar ($dz.finish or $dz.fail) that tells you whether the bookmark was saved.

Installation

On Dropzone 5 for macOS you can install the action with one Terminal command.

Open Terminal, paste this command and press Enter:

python3 -c "
import os

p1 = os.path.expanduser('~/Library/Application Support/Dropzone/Actions/NextDash.dzbundle')
p2 = os.path.expanduser('~/Library/Application Support/Dropzone 5/Actions/NextDash.dzbundle')

code = '''# Dropzone Action Info
# Name: NextDash Bookmark
# Description: Saves a URL to NextDash via the API
# Handles: Text, URLs
# Creator: Jordi Brouwer
# URL: https://github.com/jordibrouwer/nextdash
# Events: Clicked, Dragged
# SkipConfig: No
# Version: 1.0
# MinDropzoneVersion: 4.0

require 'net/http'
require 'uri'
require 'json'

# Configuration
NEXTDASH_URL = \"https://nextdash.example.com/api/inbox\"
WRITE_TOKEN = \"\" # Optional: Set your NEXTDASH_WRITE_TOKEN if enabled

def save_to_nextdash(url_string)
  \$dz.begin(\"Saving bookmark to NextDash...\")
  uri = URI.parse(NEXTDASH_URL)
  request = Net::HTTP::Post.new(uri)
  request.content_type = \"application/json\"
  request[\"X-NextDash-Token\"] = WRITE_TOKEN unless WRITE_TOKEN.empty?
  request.body = JSON.dump({ url: url_string.strip })
  req_options = { use_ssl: uri.scheme == \"https\" }
  begin
    response = Net::HTTP.start(uri.hostname, uri.port, req_options) { |http| http.request(request) }
    if [200, 201].include?(response.code.to_i)
      \$dz.finish(\"Bookmark saved to NextDash!\")
    else
      \$dz.fail(\"Error: HTTP #{response.code}\")
    end
  rescue => e
    \$dz.fail(\"Connection error: #{e.message}\")
  end
end

def dragged
  \$dz.begin(\"Processing URL...\")
  save_to_nextdash(\$items[0])
end

def clicked
  txt = \$dz.read_clipboard
  if txt && (txt.start_with?(\"http://\") || txt.start_with?(\"https://\"))
    save_to_nextdash(txt)
  else
    \$dz.fail(\"No valid URL found on clipboard.\")
  end
end
'''

for p in [p1, p2]:
    os.makedirs(p, exist_ok=True)
    with open(os.path.join(p, 'action.rb'), 'w') as f:
        f.write(code)
    py_file = os.path.join(p, 'action.py')
    if os.path.exists(py_file):
        os.remove(py_file)

print('NextDash action bundle created successfully!')
"

After running the command:

  1. Restart Dropzone 5.
  2. Open the action folder via Finder (open "~/Library/Application Support/Dropzone 5/Actions").
  3. Double-click or drag NextDash.dzbundle into your active Dropzone grid.

Source code (action.rb)

To read or customize the Ruby code, create a folder named NextDash.dzbundle in your Dropzone actions directory and save the code below as action.rb:

# Dropzone Action Info
# Name: NextDash Bookmark
# Description: Saves a URL to NextDash via the API
# Handles: Text, URLs
# Creator: Jordi Brouwer
# URL: https://github.com/jordibrouwer/nextdash
# Events: Clicked, Dragged
# SkipConfig: No
# Version: 1.0
# MinDropzoneVersion: 4.0

require 'net/http'
require 'uri'
require 'json'

# --- Configuration ---
# Replace with your actual NextDash instance URL (Tailscale, Nginx proxy, or local IP)
NEXTDASH_URL = "https://nextdash.example.com/api/inbox"

# Optional: Add your NEXTDASH_WRITE_TOKEN if your instance requires token auth
WRITE_TOKEN = ""

def save_to_nextdash(url_string)
  $dz.begin("Saving bookmark to NextDash...")
  
  uri = URI.parse(NEXTDASH_URL)
  request = Net::HTTP::Post.new(uri)
  request.content_type = "application/json"
  
  unless WRITE_TOKEN.empty?
    request["X-NextDash-Token"] = WRITE_TOKEN
  end
  
  request.body = JSON.dump({ url: url_string.strip })

  req_options = {
    use_ssl: uri.scheme == "https"
  }

  begin
    response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
      http.request(request)
    end

    if response.code.to_i == 200 || response.code.to_i == 201
      $dz.finish("Bookmark saved to NextDash!")
    else
      $dz.fail("Error: HTTP #{response.code}")
    end
  rescue => e
    $dz.fail("Connection error: #{e.message}")
  end
end

def dragged
  $dz.begin("Processing URL...")
  url = $items[0]
  save_to_nextdash(url)
end

def clicked
  clipboard_text = $dz.read_clipboard
  if clipboard_text && (clipboard_text.start_with?("http://") || clipboard_text.start_with?("https://"))
    save_to_nextdash(clipboard_text)
  else
    $dz.fail("No valid URL found on clipboard.")
  end
end

How to use it

Once it is set up, saving a link takes under a second:

  • Clipboard: copy any web link (Cmd + C) while browsing in Safari, Chrome, or Firefox. Click the NextDash Bookmark icon in your Dropzone grid. The action reads your clipboard and sends the URL straight to your NextDash inbox.
  • Drag and drop: highlight a URL or link element in your browser, drag it up to the macOS menu bar to open Dropzone, and drop it onto the NextDash Bookmark action tile.

Get NextDash

NextDash is open source and free to self-host with Docker or Unraid. The code is in the NextDash GitHub Repository.

Star the repo, send a pull request, or tell me which API integration you would like next.

Link