diff --git a/appinfo/info.xml b/appinfo/info.xml
index 86e7799..ba803a2 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -19,4 +19,7 @@
app.svg
-->
+
+
+
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index 18f8265..7c4787e 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -14,10 +14,11 @@ use OCP\User\Events\PostLoginEvent;
use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent;
+use OCP\Files\Events\Node\BeforeNodeDeletedEvent;
+
class Application extends App {
protected $AppName = 'Agency';
- # TEST
public function __construct() {
parent::__construct($this->AppName);
@@ -31,6 +32,43 @@ class Application extends App {
# Checking, if a user logged in in Django and which user is logged in in Django.
$dispatcher->addServiceListener(BeforeTemplateRenderedEvent::class, LoginByNC::class);
+
+ # Event before a File is deletet
+ $dispatcher->addServiceListener(BeforeNodeDeletedEvent::class, DeleteNCFileDjango::class);
+ }
+}
+
+/*
+ A File is ready to be deleted in NC, before that happens delete the File in Django and remove it from addedfiles_nc in standards
+*/
+
+class DeleteNCFileDjango extends Controller {
+
+ protected $session;
+ //private $nclink = 'https://test.app.digitale-agentur.com';
+ private $nclink = 'http://host.docker.internal:8000';
+
+ public function __construct(string $AppName, IRequest $request, IUserSession $session) {
+ parent::__construct($AppName, $request);
+ $this->session = $session;
+ }
+
+ public function handle(BeforeNodeDeletedEvent $event): void {
+ $opts = [
+ "http" => array(
+ "method" => "GET",
+ "header" => ""
+ ),
+ "ssl"=> array(
+ "verify_peer"=>false,
+ "verify_peer_name"=>false,
+ ),
+ ];
+ $context = stream_context_create($opts);
+
+
+
+ $file = file_get_contents($this->nclink.'/api/deletefile/'.$event->getNode()->getId().'/87zuhjk87GHJ546tzgvhas76aaskbdhr45edfVHAKia87s6gbAVGFGSR3451627gBHAKJBN', false, $context);
}
}