diff --git a/api/urls.py b/api/urls.py index 1731738..f3f50e9 100644 --- a/api/urls.py +++ b/api/urls.py @@ -26,4 +26,5 @@ urlpatterns = [ # EXTERNAL FROM NC path('logout/', views.apilogout, name="api-logout"), path('uschanged//', views.userChangedInNc, name="api-userchanged"), + path('deletefile//', views.deleteNCFile, name="api-deletencfile"), ] \ No newline at end of file diff --git a/api/views.py b/api/views.py index 6000778..cb4a38b 100644 --- a/api/views.py +++ b/api/views.py @@ -439,4 +439,19 @@ def NCSwitchStandardFiles(request): ncfile = NCFile.objects.create(agency=standard.agency, nc_id=fileid, file_id=f) standard.addedfiles_nc.add(ncfile) return JsonResponse({"status" : response_status}) - return JsonResponse({"status" : "NO AUTH"}) \ No newline at end of file + return JsonResponse({"status" : "NO AUTH"}) + +@api_view(['GET'], ) +def deleteNCFile(request, fid, secretkey): + if request.method == "GET": + if(secretkey == '87zuhjk87GHJ546tzgvhas76aaskbdhr45edfVHAKia87s6gbAVGFGSR3451627gBHAKJBN'): + try: + file_to_del = NCFile.objects.filter(nc_id=fid).first() + file_to_del.delete() + except: + pass + return JsonResponse({"status" : 'true'}) + else: + return JsonResponse({"status" : "NO AUTH"}) + else: + return JsonResponse({"status" : "NO AUTH"}) \ No newline at end of file diff --git a/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc b/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc index c73c812..eb5d89b 100644 Binary files a/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc and b/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc differ diff --git a/standards/templatetags/counter_tag.py b/standards/templatetags/counter_tag.py index ba88977..a70e798 100644 --- a/standards/templatetags/counter_tag.py +++ b/standards/templatetags/counter_tag.py @@ -1141,7 +1141,6 @@ def getNCFileInfosURL(request, ncid): try: filesearchdata = '/files/' + request.user.username + 'infinity' + str(ncid) + '' r = requests.request("SEARCH", settings.NEXTCLOUD_URL + "remote.php/dav/", data=filesearchdata, headers={'Content-Type' : 'text/xml', 'Authorization' : "Bearer " + request.user.profile.nc_sid}) - print(r.text) split_response = r.text.split("") split_fileele = split_response[1].split("") # Return file-link except first slash in string