14 Commits

Author SHA1 Message Date
arian 771f557bae /ping healthcheck endpoint 2026-03-10 08:03:28 -04:00
arian 4c87869392 Merge branch 'theming' 2026-03-07 04:15:38 -05:00
arian 2e5d1ce78a remove upload header 2026-03-07 04:14:19 -05:00
arian 005a70ca65 dashed border for drop zone 2026-03-07 04:12:00 -05:00
arian aea43550c4 dashed border for drop zone 2026-03-07 04:10:37 -05:00
arian d301da7f09 important flag 2026-03-07 04:05:58 -05:00
arian d5c38e322c better dark theme 2026-03-07 04:00:43 -05:00
arian 46ba681137 Merge branch 'dropzone' 2026-03-06 06:02:37 -05:00
arian a2d50eccb0 drag & drop handling 2026-03-06 05:55:59 -05:00
arian 090676d82e drag and drop zone for uploads 2026-03-06 05:28:01 -05:00
arian 6d598bde26 add author info 2026-03-06 05:11:32 -05:00
arian 69c8540e83 add & link dropzone lib 2026-03-06 05:06:28 -05:00
arian a295ca6861 Merge branch 'pr-css-ext' 2026-03-06 05:01:21 -05:00
arian 36c98ed2ef move css inline to external 2026-03-06 04:57:12 -05:00
7 changed files with 40 additions and 33 deletions
+13 -10
View File
@@ -1,3 +1,7 @@
# Navidrome Upload Utility
# Arian Nasr
# March 6, 2026
import os
from flask import Flask, request, render_template
from werkzeug.utils import secure_filename
@@ -12,24 +16,23 @@ 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':
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):
for key, file in request.files.items():
if key.startswith('file') and file and allowed_file(file.filename) and 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 "{file.filename}" is not allowed. Allowed types: {", ".join(ALLOWED_EXTENSIONS)}'), 400
return render_template('error.html', error_message=f'File is not allowed.'), 400
return render_template('success.html', success_message=f'{len(files)} file(s) uploaded successfully!')
return render_template('success.html', success_message=f'{len(request.files)} file(s) uploaded successfully!'), 200
return render_template('index.html')
return render_template('index.html'), 200
if __name__ == '__main__':
+1
View File
File diff suppressed because one or more lines are too long
+10
View File
@@ -0,0 +1,10 @@
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
+1 -6
View File
@@ -4,12 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Error - Upload Music</title>
<style>
body {
background-color: #2B2726;
color: #FFFFFF;
}
</style>
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css" />
</head>
<body>
<h1>Error</h1>
+13 -11
View File
@@ -4,18 +4,20 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Upload Music</title>
<style>
body {
background-color: #2B2726;
color: #FFFFFF;
}
</style>
<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" />
</head>
<body>
<h1>Upload new File</h1>
<form method=post enctype=multipart/form-data>
<input type=file name=file multiple>
<input type=submit value=Upload>
</form>
<script>
Dropzone.options.myDropzone = {
parallelUploads: 2,
uploadMultiple: true,
acceptedFiles: 'audio/*'
};
</script>
<form action="/"
class="dropzone"
id="my-dropzone"></form>
</body>
</html>
+1 -6
View File
@@ -4,12 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Success - Upload Music</title>
<style>
body {
background-color: #2B2726;
color: #FFFFFF;
}
</style>
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css" />
</head>
<body>
<h1>Success</h1>