mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 12:00:55 +01:00
Use file.download
to retrieve macro images in the IRC macro bot
Summary: Fixes T5884. Macro images are no longer public on most installs. We could generate tokens for them, but this (using Conduit to pull the file data) is easier and more correct. Test Plan: Logged a bot into IRC and had it spam part of a macro before being killed for flooding. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T5884 Differential Revision: https://secure.phabricator.com/D10274
This commit is contained in:
parent
607e99490b
commit
f9de495d0b
2 changed files with 13 additions and 2 deletions
|
@ -72,7 +72,8 @@ final class MacroQueryConduitAPIMethod extends MacroConduitAPIMethod {
|
|||
'uri' => $file->getBestURI(),
|
||||
'phid' => $macro->getPHID(),
|
||||
'authorPHID' => $file->getAuthorPHID(),
|
||||
'dateCreated' => $file->getDateCreated(),
|
||||
'dateCreated' => $file->getDateCreated(),
|
||||
'filePHID' => $file->getPHID(),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,17 @@ final class PhabricatorBotMacroHandler extends PhabricatorBotHandler {
|
|||
}
|
||||
|
||||
public function rasterize($macro, $size, $aspect) {
|
||||
$image = HTTPSFuture::loadContent($macro['uri']);
|
||||
try {
|
||||
$image = $this->getConduit()->callMethodSynchronous(
|
||||
'file.download',
|
||||
array(
|
||||
'phid' => $macro['filePHID'],
|
||||
));
|
||||
$image = base64_decode($image);
|
||||
} catch (Exception $ex) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$image) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue