diff --git a/viewer/templates/add.html b/viewer/templates/add.html new file mode 100644 index 0000000..4caa799 --- /dev/null +++ b/viewer/templates/add.html @@ -0,0 +1,64 @@ +{% extends 'base.html' %} +{% block content %} +
+
+

+ Add New Directory +

+
+
+
+

+ Adds a new Directory to be served by the server. +
+ If specified, a RegEx pattern can be used to filter files and will only display the ones you want. +
+ RegEx patterns can be configured below to match against the entire path or just the filename. +
+ Additionally, files can be matched recursively if you so wish. Please note that this functionality may create anomalous behavior around duplicate files. +

+
+ {% csrf_token %} +
+ +
+ + + + +
+

+ We recommend that you use a full path. Do not escape the path or use a relative path for best results. +

+
+
+ +
+ + + + +
+

+ This is optional. Do not enter anything if you wish to disable RegEx matching and simply add all files. +

+
+ + + +
+
+ +
+
+
+
+
+
+{% endblock content %} diff --git a/viewer/templates/base.html b/viewer/templates/base.html index e03a51c..8a2e8db 100644 --- a/viewer/templates/base.html +++ b/viewer/templates/base.html @@ -20,7 +20,9 @@ diff --git a/viewer/urls.py b/viewer/urls.py index 2b2acb8..a479eec 100644 --- a/viewer/urls.py +++ b/viewer/urls.py @@ -4,6 +4,8 @@ from . import views urlpatterns = [ path('', views.index, name='index'), - path('//', views.browse, name='browse'), - path('///', views.file, name='file') + path('add/', views.add, name='add'), + path('add/submit', views.submit_new, name='add_submit'), + path('/', views.browse, name='browse'), + path('//', views.file, name='file') ] diff --git a/viewer/views.py b/viewer/views.py index 00b7aa3..a34832f 100644 --- a/viewer/views.py +++ b/viewer/views.py @@ -1,6 +1,6 @@ import os -from django.http import FileResponse +from django.http import FileResponse, HttpResponse from django.shortcuts import render, get_object_or_404 from viewer.helpers import extra_listdir @@ -54,3 +54,11 @@ def file(request, directory_id, file): ) } return render(request, 'message.html', context, status=500) + + +def add(request): + return render(request, 'add.html', {'title': 'Add New Directory'}) + + +def submit_new(request): + return HttpResponse('')