mirror of
https://github.com/openvk/openvk
synced 2025-01-06 16:00:00 +03:00
Compare commits
2 commits
2018131934
...
3db545f91a
Author | SHA1 | Date | |
---|---|---|---|
|
3db545f91a | ||
|
79ae72f15a |
3 changed files with 8 additions and 5 deletions
|
@ -61,7 +61,7 @@ final class Photos extends VKAPIRequestHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
return (object) [
|
return (object) [
|
||||||
"upload_url" => $this->getPhotoUploadUrl("photo", isset($club) ? 0 : $club->getId()),
|
"upload_url" => $this->getPhotoUploadUrl("photo", !isset($club) ? 0 : $club->getId()),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,6 +125,7 @@ final class Wall extends VKAPIRequestHandler
|
||||||
"can_archive" => false, # TODO MAYBE
|
"can_archive" => false, # TODO MAYBE
|
||||||
"is_archived" => false,
|
"is_archived" => false,
|
||||||
"is_pinned" => $post->isPinned(),
|
"is_pinned" => $post->isPinned(),
|
||||||
|
"is_explicit" => $post->isExplicit(),
|
||||||
"attachments" => $attachments,
|
"attachments" => $attachments,
|
||||||
"post_source" => $post_source,
|
"post_source" => $post_source,
|
||||||
"comments" => (object)[
|
"comments" => (object)[
|
||||||
|
@ -299,6 +300,7 @@ final class Wall extends VKAPIRequestHandler
|
||||||
"can_archive" => false, # TODO MAYBE
|
"can_archive" => false, # TODO MAYBE
|
||||||
"is_archived" => false,
|
"is_archived" => false,
|
||||||
"is_pinned" => $post->isPinned(),
|
"is_pinned" => $post->isPinned(),
|
||||||
|
"is_explicit" => $post->isExplicit(),
|
||||||
"post_source" => $post_source,
|
"post_source" => $post_source,
|
||||||
"attachments" => $attachments,
|
"attachments" => $attachments,
|
||||||
"comments" => (object)[
|
"comments" => (object)[
|
||||||
|
|
|
@ -99,20 +99,21 @@ final class VKAPIPresenter extends OpenVKPresenter
|
||||||
|
|
||||||
function renderPhotoUpload(string $signature): void
|
function renderPhotoUpload(string $signature): void
|
||||||
{
|
{
|
||||||
$secret = CHANDLER_ROOT_CONF["security"]["secret"];
|
$secret = CHANDLER_ROOT_CONF["security"]["secret"];
|
||||||
$computedSignature = hash_hmac("sha3-224", $_SERVER["QUERY_STRING"], $secret);
|
$queryString = rawurldecode($_SERVER["QUERY_STRING"]);
|
||||||
|
$computedSignature = hash_hmac("sha3-224", $queryString, $secret);
|
||||||
if(!(strlen($signature) == 56 && sodium_memcmp($signature, $computedSignature) == 0)) {
|
if(!(strlen($signature) == 56 && sodium_memcmp($signature, $computedSignature) == 0)) {
|
||||||
header("HTTP/1.1 422 Unprocessable Entity");
|
header("HTTP/1.1 422 Unprocessable Entity");
|
||||||
exit("Try harder <3");
|
exit("Try harder <3");
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = unpack("vDOMAIN/Z10FIELD/vMF/vMP/PTIME/PUSER/PGROUP", base64_decode($_SERVER["QUERY_STRING"]));
|
$data = unpack("vDOMAIN/Z10FIELD/vMF/vMP/PTIME/PUSER/PGROUP", base64_decode($queryString));
|
||||||
if((time() - $data["TIME"]) > 600) {
|
if((time() - $data["TIME"]) > 600) {
|
||||||
header("HTTP/1.1 422 Unprocessable Entity");
|
header("HTTP/1.1 422 Unprocessable Entity");
|
||||||
exit("Expired");
|
exit("Expired");
|
||||||
}
|
}
|
||||||
|
|
||||||
$folder = __DIR__ . "../../tmp/api-storage/photos";
|
$folder = __DIR__ . "/../../tmp/api-storage/photos";
|
||||||
$maxSize = OPENVK_ROOT_CONF["openvk"]["preferences"]["uploads"]["api"]["maxFileSize"];
|
$maxSize = OPENVK_ROOT_CONF["openvk"]["preferences"]["uploads"]["api"]["maxFileSize"];
|
||||||
$maxFiles = OPENVK_ROOT_CONF["openvk"]["preferences"]["uploads"]["api"]["maxFilesPerDomain"];
|
$maxFiles = OPENVK_ROOT_CONF["openvk"]["preferences"]["uploads"]["api"]["maxFilesPerDomain"];
|
||||||
$usrFiles = sizeof(glob("$folder/$data[USER]_*.oct"));
|
$usrFiles = sizeof(glob("$folder/$data[USER]_*.oct"));
|
||||||
|
|
Loading…
Reference in a new issue