mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 13:45:10 +00:00
[MOD] Import PNG media.
This commit is contained in:
parent
9d9453f96a
commit
1f3d738bb4
12 changed files with 87 additions and 42 deletions
|
|
@ -23,8 +23,8 @@ RouteHead(RouteMedia, arr, argp)
|
|||
params = HttpRequestParams(args->ctx);
|
||||
hmac = HashMapGet(params, "hmac");
|
||||
|
||||
/* TODO: Make it check the DB for its validicity. "Purging" would be useful.
|
||||
*/
|
||||
/* TODO: Make it check the DB for its validicity. "Purging" would be
|
||||
* useful, alongside checking if someone isn't just a little idiotic. */
|
||||
{
|
||||
char *concat = StrConcat(3, server, "/", identi);
|
||||
chkmak = ParseeHMACS(args->data->id, concat);
|
||||
|
|
@ -32,12 +32,18 @@ RouteHead(RouteMedia, arr, argp)
|
|||
}
|
||||
if (!server || !identi || !hmac || !StrEquals(hmac, chkmak))
|
||||
{
|
||||
char *err =
|
||||
hmac && StrEquals(hmac, chkmak) ?
|
||||
"No server/identifier/HMAC code" :
|
||||
"Hah! You _dirty_ little liar! Try a little harder!";
|
||||
Free(chkmak);
|
||||
HttpResponseStatus(args->ctx, HTTP_BAD_REQUEST);
|
||||
return MatrixCreateError("M_NOT_YET_UPLOADED", "No server/identifier");
|
||||
return MatrixCreateError("M_NOT_YET_UPLOADED", err);
|
||||
}
|
||||
Free(chkmak);
|
||||
|
||||
/* Proxy the media through an authenticated endpoint if the HMAC
|
||||
* is valid. */
|
||||
server = HttpUrlEncode(server);
|
||||
identi = HttpUrlEncode(identi);
|
||||
path = StrConcat(4, "/_matrix/media/v3/download/", server, "/", identi);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue