3 Commits

Author SHA1 Message Date
arian a503d1e788 drag & drop functionality 2026-03-05 13:57:37 -05:00
arian fa0226e319 Revert "drag & drop functionality"
This reverts commit 1d582eec8f.
2026-03-05 13:52:16 -05:00
arian 1d582eec8f drag & drop functionality 2026-03-05 13:46:18 -05:00
25 changed files with 75 additions and 274 deletions
-3
View File
@@ -1,3 +0,0 @@
NAVIDROME_MUSIC_FOLDER="/opt/navidrome/music"
BIND_ADDRESS="0.0.0.0"
BIND_PORT="5001"
-4
View File
@@ -2,7 +2,3 @@ venv/
setup.sh
navidrome-upload.service
.idea/
.env
/README.md
__pycache__/
*.deb
-27
View File
@@ -1,27 +0,0 @@
# Navidome-Uploader Dockerfile for building .deb packages
# Arian Nasr
# May 9, 2026
FROM debian:13-slim
# Prevent interactive prompts
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
build-essential \
debhelper \
devscripts \
fakeroot \
python3 \
python3-venv \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build/src
RUN mkdir -p /dist
COPY . .
RUN chmod +x release/build-deb.sh
CMD ["sh", "-c", "./release/build-deb.sh && mv ../*.deb /dist/"]
-47
View File
@@ -1,47 +0,0 @@
[Unit]
Description=Navidrome Music Uploader Service
After=network.target,navidrome.service
[Service]
Type=simple
User=navidrome-uploader
Group=navidrome-uploader
WorkingDirectory=/opt/navidrome-uploader
Environment="PATH=/opt/navidrome-uploader/venv/bin"
EnvironmentFile=/etc/default/navidrome-uploader/.env
ExecStart=/opt/navidrome-uploader/venv/bin/gunicorn --no-control-socket -c gunicorn.conf.py main:app
Restart=on-failure
RestartSec=30
NoNewPrivileges=yes
CapabilityBoundingSet=
AmbientCapabilities=
ProtectSystem=strict
ProtectHome=yes
PrivateTmp=yes
ReadWritePaths=/opt/navidrome-uploader /opt/navidrome/music
InaccessiblePaths=/boot /mnt /media
PrivateDevices=yes
ProtectKernelTunables=yes
ProtectKernelModules=yes
ProtectKernelLogs=yes
ProtectControlGroups=yes
ProtectClock=yes
ProtectHostname=yes
RestrictNamespaces=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
LockPersonality=yes
SystemCallFilter=@system-service
SystemCallErrorNumber=EPERM
PrivateNetwork=no
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
UMask=0027
[Install]
WantedBy=multi-user.target
-18
View File
@@ -1,18 +0,0 @@
navidrome-uploader (0.1.0-2) unstable; urgency=high
* Run pip install stage as navidrome-uploader user instead of root
-- Arian Nasr <arian@2ari.ca> Tue, 14 Apr 2026 12:11:00 -0400
navidrome-uploader (0.1.0-1) unstable; urgency=medium
* Disable gunicorn control socket in systemd service unit
-- Arian Nasr <arian@2ari.ca> Thu, 09 Apr 2026 01:58:00 -0400
navidrome-uploader (0.1.0) unstable; urgency=medium
* Add Debian packaging with systemd service integration and venv setup.
-- Arian Nasr <arian@2ari.ca> Tue, 07 Apr 2026 12:00:00 +0000
-12
View File
@@ -1,12 +0,0 @@
Source: navidrome-uploader
Section: web
Priority: optional
Maintainer: Arian Nasr <arian@2ari.ca>
Build-Depends: debhelper-compat (= 13)
Standards-Version: 4.7.0
Rules-Requires-Root: no
Package: navidrome-uploader
Architecture: all
Depends: ${misc:Depends}, adduser, python3, python3-venv
Description: Navidrome Web Upload Utility
-7
View File
@@ -1,7 +0,0 @@
opt/navidrome-uploader
opt/navidrome-uploader/templates
opt/navidrome-uploader/static
opt/navidrome-uploader/static/css
opt/navidrome-uploader/static/js
etc/default/navidrome-uploader
-9
View File
@@ -1,9 +0,0 @@
main.py opt/navidrome-uploader/
gunicorn.conf.py opt/navidrome-uploader/
requirements.txt opt/navidrome-uploader/
.env.example opt/navidrome-uploader/
templates/* opt/navidrome-uploader/templates/
static/css/* opt/navidrome-uploader/static/css/
static/js/* opt/navidrome-uploader/static/js/
contrib/navidrome-uploader.service lib/systemd/system/navidrome-uploader.service
-26
View File
@@ -1,26 +0,0 @@
#!/bin/sh
set -e
APP_DIR="/opt/navidrome-uploader"
VENV_DIR="${APP_DIR}/venv"
APP_USER="navidrome-uploader"
case "$1" in
configure)
chown -R "$APP_USER:$APP_USER" "$APP_DIR"
runuser -u "$APP_USER" -- python3 -m venv "$VENV_DIR"
runuser -u "$APP_USER" -- "$VENV_DIR/bin/pip" install --no-cache-dir --upgrade pip
runuser -u "$APP_USER" -- "$VENV_DIR/bin/pip" install --no-cache-dir -r "$APP_DIR/requirements.txt"
if command -v systemctl >/dev/null 2>&1; then
systemctl daemon-reload || true
systemctl enable navidrome-uploader.service || true
systemctl restart navidrome-uploader.service || true
fi
;;
esac
exit 0
-15
View File
@@ -1,15 +0,0 @@
#!/bin/sh
set -e
if command -v systemctl > /dev/null 2>&1; then
systemctl daemon-reload || true
fi
if [ "$1" = "purge" ]; then
rm -rf /etc/default/navidrome-uploader
rm -rf /opt/navidrome-uploader/venv
rm -rf /opt/navidrome-uploader/__pycache__
fi
exit 0
-10
View File
@@ -1,10 +0,0 @@
#!/bin/sh
set -e
if ! getent passwd navidrome-uploader > /dev/null 2>&1; then
printf "Creating navidrome-uploader user\n"
useradd --system --shell /usr/sbin/nologin --user-group navidrome-uploader
fi
exit 0
-14
View File
@@ -1,14 +0,0 @@
#!/bin/sh
set -e
case "$1" in
remove|deconfigure)
if command -v systemctl > /dev/null 2>&1; then
systemctl stop navidrome-uploader.service || true
systemctl disable navidrome-uploader.service || true
fi
;;
esac
exit 0
-10
View File
@@ -1,10 +0,0 @@
#!/usr/bin/make -f
%:
dh $@
override_dh_install:
dh_install
install -d debian/navidrome-uploader/etc/default/navidrome-uploader
install -m 0640 .env.example debian/navidrome-uploader/etc/default/navidrome-uploader/.env
-2
View File
@@ -1,2 +0,0 @@
3.0 (native)
-16
View File
@@ -1,16 +0,0 @@
# gunicorn.conf.py
# Arian Nasr
# April 4, 2026
import os
BIND_ADDRESS = os.environ.get('BIND_ADDRESS', '0.0.0.0')
BIND_PORT = int(os.environ.get('BIND_PORT', 5001))
bind = f"{BIND_ADDRESS}:{BIND_PORT}"
workers = 2
accesslog = "-" # Log to stdout
errorlog = "-" # Log to stderr
# gunicorn -c gunicorn.conf.py main:app
+15 -16
View File
@@ -1,37 +1,36 @@
# Navidrome Upload Utility
# Arian Nasr
# March 6, 2026
import os
from flask import Flask, request, render_template
from werkzeug.utils import secure_filename
UPLOAD_FOLDER = os.environ.get('NAVIDROME_MUSIC_FOLDER', '/opt/navidrome/music')
UPLOAD_FOLDER = '/opt/navidrome/music'
ALLOWED_EXTENSIONS = {'flac', 'mp3', 'wav'}
MAX_CONTENT_LENGTH = 500 * 1024 * 1024
app = Flask(__name__)
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
app.config['MAX_CONTENT_LENGTH'] = MAX_CONTENT_LENGTH
def allowed_file(filename):
return '.' in filename and \
filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
@app.route('/ping')
def ping():
return 'pong', 200
@app.route('/', methods=['GET', 'POST'])
def upload_file():
if request.method == 'POST':
for key, file in request.files.items():
if key.startswith('file') and file and allowed_file(file.filename) and file.filename != '':
if 'file' not in request.files:
return render_template('error.html', error_message='No file part in the request'), 400
files = request.files.getlist('file')
for file in files:
if file.filename == '':
return render_template('error.html', error_message='No selected file'), 400
if file and allowed_file(file.filename):
filename = secure_filename(file.filename)
file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
else:
return render_template('error.html', error_message=f'File is not allowed.'), 400
return render_template('error.html', error_message=f'File "{file.filename}" is not allowed. Allowed types: {", ".join(ALLOWED_EXTENSIONS)}'), 400
return render_template('success.html', success_message=f'{len(request.files)} file(s) uploaded successfully!'), 200
return render_template('success.html', success_message=f'{len(files)} file(s) uploaded successfully!')
return render_template('index.html'), 200
return render_template('index.html')
if __name__ == '__main__':
app.run(host='192.168.2.24', port=5001, debug=False)
View File
-9
View File
@@ -1,9 +0,0 @@
#!/bin/sh
set -eu
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
PROJECT_ROOT="$(CDPATH= cd -- "${SCRIPT_DIR}/.." && pwd)"
cd "${PROJECT_ROOT}"
dpkg-buildpackage -us -uc -b
+2 -5
View File
@@ -1,10 +1,7 @@
blinker==1.9.0
click==8.3.3
click==8.3.1
Flask==3.1.3
itsdangerous==2.2.0
Jinja2==3.1.6
MarkupSafe==3.0.3
Werkzeug==3.1.8
gunicorn==26.0.0
pip==26.1.1
packaging==26.2
Werkzeug==3.1.6
-1
View File
File diff suppressed because one or more lines are too long
-10
View File
@@ -1,10 +0,0 @@
body {
background-color: #252526;
color: #FFFFFF;
}
.dropzone {
background: #3e3e42 !important;
border-radius: 2rem !important;
border-style: dashed !important;
border-color: #FFFFFF !important;
}
-1
View File
File diff suppressed because one or more lines are too long
+7 -1
View File
@@ -4,9 +4,15 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Error - Upload Music</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css" />
<style>
body {
background-color: #2B2726;
color: #FFFFFF;
}
</style>
</head>
<body>
<button onclick="window.location.href='/outpost.goauthentik.io/sign_out'">Logout</button>
<h1>Error</h1>
<p>{{ error_message }}</p>
<a href="/"><button>Upload another file</button></a>
+42 -8
View File
@@ -3,21 +3,55 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://s3.2ari.ca/navidrome-upload/dropzone.min.js"></script>
<link rel="stylesheet" href="https://s3.2ari.ca/navidrome-upload/dropzone.min.css" type="text/css" />
<title>Upload Music</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css" />
<script src="{{ url_for('static', filename='js/dropzone.min.js') }}"></script>
<link rel="stylesheet" href="{{ url_for('static', filename='css/dropzone.min.css') }}" type="text/css" />
<style>
body {
background-color: #2B2726;
color: #FFFFFF;
}
.dropzone {
border: 2px dashed #666;
border-radius: 5px;
background: #3B3736;
padding: 20px;
min-height: 200px;
}
.dropzone .dz-message {
color: #FFFFFF;
font-size: 18px;
}
</style>
</head>
<body>
<button onclick="window.location.href='/outpost.goauthentik.io/sign_out'">Logout</button>
<h1>Upload new File</h1>
<form action="/" method="post" enctype="multipart/form-data" class="dropzone" id="my-dropzone">
<div class="dz-message">
Drop files here or click to upload
</div>
</form>
<script>
Dropzone.options.myDropzone = {
parallelUploads: 4,
paramName: "file",
maxFilesize: 500, // MB
uploadMultiple: true,
acceptedFiles: 'audio/*'
parallelUploads: 5,
acceptedFiles: "audio/*",
dictDefaultMessage: "Drop files here or click to upload",
init: function() {
this.on("success", function(file, response) {
console.log("Upload successful:", file.name);
});
this.on("error", function(file, errorMessage) {
console.error("Upload failed:", errorMessage);
});
}
};
</script>
<form action="/"
class="dropzone"
id="my-dropzone"></form>
</body>
</html>
+7 -1
View File
@@ -4,9 +4,15 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Success - Upload Music</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css" />
<style>
body {
background-color: #2B2726;
color: #FFFFFF;
}
</style>
</head>
<body>
<button onclick="window.location.href='/outpost.goauthentik.io/sign_out'">Logout</button>
<h1>Success</h1>
<p>{{ success_message }}</p>
<a href="/"><button>Upload another file</button></a>