diff --git a/src/router/transparency.ts b/src/router/transparency.ts index 6847da1..97f07aa 100644 --- a/src/router/transparency.ts +++ b/src/router/transparency.ts @@ -53,5 +53,30 @@ app.get('/transparency/:id', async ({ params: { id }, set, error }) => { return html }) + +app.get('/deletion', async ({ set }) => { + const cached = await redis.get('deletion:html') + if (cached) { + set.headers['Content-Type'] = 'text/html; charset=utf-8' + return cached + } + + const deletionVideos = await db.selectFrom('videos') + .where('deletion_stage', 'is not', null) + .selectAll() + .execute() + + const html = await m(eta.render('./deletion', { + title: 'Deletion Log | PreserveTube', + pendingDelete: deletionVideos.filter(v => v.deletion_stage === 'pending_delete'), + softDelete: deletionVideos.filter(v => v.deletion_stage === 'soft_delete'), + deleted: deletionVideos.filter(v => v.deletion_stage === 'deleted'), + })) + await redis.set('deletion:html', html, 'EX', 3600) + + set.headers['Content-Type'] = 'text/html; charset=utf-8' + return html +}) + app.onError(error) export default app \ No newline at end of file diff --git a/src/templates/deletion.eta b/src/templates/deletion.eta new file mode 100644 index 0000000..620e95d --- /dev/null +++ b/src/templates/deletion.eta @@ -0,0 +1,135 @@ +<% layout('./layout') %> + +
+

+ To help preserve storage, PreserveTube will start removing videos that serve little to no purpose -- things like blank screens, timers, and relaxation music; anything that could be computer-generated without any human involvement. That said, every video will be reviewed manually before deletion, so nothing gets removed without a proper look. +

+ +

+ The deletion process goes through three stages: +

+ + +

+ All videos that are in any stage of deletion are displayed below for the sake of transparency. If you see a video that you think shouldn't be deleted, please email me with the video link and an explanation of why you think it should be preserved. +

+ + <% if (it.pendingDelete.length != 0) { %> +

+ pending_delete + Videos queued for deletion but not yet processed. If you'd like to contest this, email me. +

+
+ <% it.pendingDelete.forEach(function(v){ %> + +
+ +
+

<%= v.title %>

+

<%= v.channel %>

+
+
+
+ <% }) %> +
+ <% } %> + + <% if (it.softDelete.length != 0) { %> +

+ soft_delete + Videos marked as deleted but still recoverable. +

+
+ <% it.softDelete.forEach(function(v){ %> + +
+ +
+

<%= v.title %>

+

<%= v.channel %>

+
+
+
+ <% }) %> +
+ <% } %> + + + <% if (it.deleted.length != 0) { %> +

+ deleted + Videos permanently removed. +

+
+ <% it.deleted.forEach(function(v){ %> + +
+ +
+

<%= v.title %>

+

<%= v.channel %>

+
+
+
+ <% }) %> +
+ <% } %> +
+ + \ No newline at end of file diff --git a/src/templates/index.eta b/src/templates/index.eta index a02e705..b59ef3d 100644 --- a/src/templates/index.eta +++ b/src/templates/index.eta @@ -121,7 +121,7 @@