Commit ebe34a69 authored by Birin Sanchez's avatar Birin Sanchez
Browse files

Add a public area so unauthenticated users can download files.


Signed-off-by: Birin Sanchez's avatarBirin Sanchez <birin.sanchez@puri.sm>
parent 31971e49
Pipeline #4995 passed with stage
in 40 seconds
......@@ -49,5 +49,7 @@ urlpatterns = [
url(r'^captcha/', include('captcha.urls')),
url(r'^cart/(?P<reward>\d+)/$', CartRegistrationView.as_view(), name="register_reward"),
url(r'^tunnel/api/v1/get_user_creds',
purist.views.UserDetail.as_view(), name='get_user_creds')
purist.views.UserDetail.as_view(), name='get_user_creds'),
url(r'^public/(?P<target>.*)',
purist.views.public_area, name='public_area')
]
......@@ -5,7 +5,7 @@ from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import permissions
from .serializers import UserSerializer
from django.http import Http404
from django.http import Http404, FileResponse
class UserDetail(APIView):
......@@ -43,3 +43,12 @@ def jslicense(request):
}
return render(request, 'purist/jslicense.html', render_data)
def public_area(request, target):
if target == 'certificate.ovpn':
f = open('/etc/opt/purist/middleware/certificate.ovpn', 'rb')
else:
raise Http404
res = FileResponse(f, content_type='application/octet-stream')
return res
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment