diff --git a/include/APK.php b/include/APK.php index bb22ec0..651f1d9 100644 --- a/include/APK.php +++ b/include/APK.php @@ -1,81 +1,85 @@ name = $name; $this->url = $url; $this->sha256 = $sha256; $this->ABI = $ABI; } /** * @return array */ public function getPhorgeCommentLines() { return [ $this->getPhorgeDownloadLink(), $this->getPhorgeAPKSignatureLine() ]; } /** * @return array */ public function getTelegramCommentLines() { return [ $this->getTelegramDownloadLink(), $this->getPhorgeAPKSignatureLine() ]; } /** * Get a very generic download link for Phorge. * @return string */ private function getPhorgeDownloadLink(): string { return sprintf( "[%s](%s)", "Download {$this->name}", $this->url ); } /** * Get a very generic download link for Phorge. * @return string */ private function getTelegramDownloadLink(): string { // In Telegram it seems we must escape the link text from special characters. // The link, instead, can be returned as-is. // So the Text from: "Download asd.apk" // to: "Download asd\\.apk" - $tempname = basename($this->name); return sprintf( "[%s](%s)", - TelegramStupidSDK::escapeMarkdownV2("Download {$tempname}"), + TelegramStupidSDK::escapeMarkdownV2("Download {$this->name}"), $this->url ); } /** * Get a very generic line about the sha256sum of this APK. * @return string */ private function getPhorgeAPKSignatureLine() { // NOTE: if you write a ":" here, Telegram will crash. Sanitize it for Telegram asd. return sprintf( "APK sha256: `%s`", $this->sha256 ); } }