From 3a82baec9d793edf81ac2b151b0f4d4159641375 Mon Sep 17 00:00:00 2001
From: Freya Murphy <freya@freyacat.org>
Date: Mon, 1 Apr 2024 11:09:25 -0400
Subject: login and register, liking on homepage

---
 db/rest/util/_api_serve_media.sql | 41 ---------------------------------------
 1 file changed, 41 deletions(-)
 delete mode 100644 db/rest/util/_api_serve_media.sql

(limited to 'db/rest/util/_api_serve_media.sql')

diff --git a/db/rest/util/_api_serve_media.sql b/db/rest/util/_api_serve_media.sql
deleted file mode 100644
index 8b0f0b8..0000000
--- a/db/rest/util/_api_serve_media.sql
+++ /dev/null
@@ -1,41 +0,0 @@
-CREATE FUNCTION _api.serve_media(
-	_name TEXT
-)
-RETURNS sys."*/*"
-LANGUAGE plpgsql VOLATILE
-AS $BODY$
-DECLARE
-	_headers TEXT;
-	_data BYTEA;
-BEGIN
-
-	SELECT FORMAT(
-      '[{"Content-Type": "%s"},'
-       '{"Content-Disposition": "inline; filename=\"%s\""},'
-       '{"Cache-Control": "max-age=259200"}]'
-      ,	m.type, m.name)
-	FROM admin.media m
-	WHERE m.name = _name INTO _headers;
-
-	PERFORM SET_CONFIG('response.headers', _headers, true);
-
-	SELECT m.content
-	FROM admin.media m
-	WHERE m.name = _name
-	INTO _data;
-
-	IF FOUND THEN
-		RETURN(_data);
-	ELSE
-		PERFORM _api.raise(
-			_msg => 'api_not_found',
-			_err => 404
-		);
-	END IF;
-END
-$BODY$;
-
-GRANT EXECUTE ON FUNCTION _api.serve_media(TEXT)
-	TO rest_anon, rest_user;
-GRANT SELECT ON TABLE admin.media
-	TO rest_anon, rest_user;
-- 
cgit v1.2.3-freya

