From 8dd368a8e4d6e8f2f929bb32ac1fc509d2e16977 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Thu, 24 Mar 2022 23:05:49 +0200 Subject: [PATCH] banger --- server/src/client/ClipIndex.js | 14 ++++++++++++++ server/src/client/endpoints/api/Logout.js | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/server/src/client/ClipIndex.js b/server/src/client/ClipIndex.js index c1474e2..a44a852 100644 --- a/server/src/client/ClipIndex.js +++ b/server/src/client/ClipIndex.js @@ -74,6 +74,20 @@ class ClipIndex extends EventEmitter { } + delete(filename) { + + const clipEntry = this.index[filename]; + if (!clipEntry) return false; + this.emit('delete', clipEntry); + + delete this.index[filename]; + fs.unlinkSync(path.join(this.videoDirectory, filename)); + fs.unlinkSync(path.join(this.thumbnailDirectory, clipEntry.thumbnail)); + fs.writeFileSync(this.indexDir, JSON.stringify(this.index)); + return true; + + } + async syncIndex() { const index = Object.values(this.index); diff --git a/server/src/client/endpoints/api/Logout.js b/server/src/client/endpoints/api/Logout.js index 7e530d1..9fe8c27 100644 --- a/server/src/client/endpoints/api/Logout.js +++ b/server/src/client/endpoints/api/Logout.js @@ -15,7 +15,7 @@ class Logout extends APIEndpoint { ['post', this.post.bind(this)] ]; - this.middleware = [CheckAuth]; + this.middleware = []; this.init();