Compare commits

...

4 commits

Author SHA1 Message Date
mrilyew
4afcdc70c6
Merge 3fec1b57a4 into b7fc23bb52 2025-04-20 20:53:17 +03:00
Vladimir Barinov
b7fc23bb52
fix(pda), chore(locale): adapt for pda (#1276) 2025-04-19 17:37:59 +03:00
mrilyew
3fec1b57a4 Merge branch 'master' into predictable-thumbnail-id-fix 2025-03-02 19:15:06 +03:00
mrilyew
ca8b6a83fb fix 2025-02-17 20:12:06 +03:00
7 changed files with 25 additions and 5 deletions

View file

@ -187,7 +187,7 @@ class Photo extends Media
foreach ($sizes as $id => $meta) { foreach ($sizes as $id => $meta) {
if (isset($meta[3]) && !$meta[3]) { if (isset($meta[3]) && !$meta[3]) {
$res[$id] = (object) [ $res[$id] = (object) [
"url" => ovk_scheme(true) . $_SERVER["HTTP_HOST"] . "/photos/thumbnails/" . $this->getId() . "_$id.jpeg", "url" => ovk_scheme(true) . $_SERVER["HTTP_HOST"] . "/photos/thumbnails/" . $this->getRecord()->hash . "_$id.jpeg",
"width" => null, "width" => null,
"height" => null, "height" => null,
"crop" => null, "crop" => null,

View file

@ -28,6 +28,17 @@ class Photos
return new Photo($photo); return new Photo($photo);
} }
public function getByHash(string $hash): ?Photo
{
$photo = $this->photos->where("hash", $hash)->fetch();
if (!$photo) {
return null;
}
return new Photo($photo);
}
public function getByOwnerAndVID(int $owner, int $vId): ?Photo public function getByOwnerAndVID(int $owner, int $vId): ?Photo
{ {
$photo = $this->photos->where([ $photo = $this->photos->where([

View file

@ -371,7 +371,11 @@ abstract class OpenVKPresenter extends SimplePresenter
$whichbrowser->isEngine('NetFront') || // PSP and other japanese portable systems $whichbrowser->isEngine('NetFront') || // PSP and other japanese portable systems
$whichbrowser->isOs('Android') || $whichbrowser->isOs('Android') ||
$whichbrowser->isOs('iOS') || $whichbrowser->isOs('iOS') ||
$whichbrowser->isBrowser('Internet Explorer', '<=', '8')) { $whichbrowser->isBrowser('BlackBerry Browser') ||
$whichbrowser->isBrowser('Internet Explorer', '<=', '8') ||
$whichbrowser->isBrowser('Firefox', '<=', '47') ||
$whichbrowser->isBrowser('Safari', '<=', '7') ||
$whichbrowser->isBrowser('Google Chrome', '<=', '35')) {
// yeah, it's old, but ios and android are? // yeah, it's old, but ios and android are?
if ($whichbrowser->isOs('iOS') && $whichbrowser->isOs('iOS', '<=', '9')) { if ($whichbrowser->isOs('iOS') && $whichbrowser->isOs('iOS', '<=', '9')) {
return true; return true;

View file

@ -229,9 +229,9 @@ final class PhotosPresenter extends OpenVKPresenter
$this->renderPhoto($photo->getOwner(true)->getId(), $photo->getVirtualId()); $this->renderPhoto($photo->getOwner(true)->getId(), $photo->getVirtualId());
} }
public function renderThumbnail($id, $size): void public function renderThumbnail($hash, $size): void
{ {
$photo = $this->photos->get($id); $photo = $this->photos->getByHash((string) $hash);
if (!$photo || $photo->isDeleted()) { if (!$photo || $photo->isDeleted()) {
$this->notFound(); $this->notFound();
} }

View file

@ -173,8 +173,10 @@ routes:
handler: "Photos->photo" handler: "Photos->photo"
- url: "/photo{num}_{num}/like" - url: "/photo{num}_{num}/like"
handler: "Photos->like" handler: "Photos->like"
- url: "/photos/thumbnails/{num}_{text}.jpeg" - url: "/photos/thumbnails/{?hash}_{text}.jpeg"
handler: "Photos->thumbnail" handler: "Photos->thumbnail"
placeholders:
hash: "[A-z0-9\\-_\\/]{15,}"
- url: "/photos/{text}" - url: "/photos/{text}"
handler: "Photos->absolutePhoto" handler: "Photos->absolutePhoto"
- url: "/photo{num}_{num}/edit" - url: "/photo{num}_{num}/edit"

View file

@ -2235,6 +2235,7 @@
"mobile_like" = "Like"; "mobile_like" = "Like";
"mobile_user_info_hide" = "Hide"; "mobile_user_info_hide" = "Hide";
"mobile_user_info_show_details" = "Show details"; "mobile_user_info_show_details" = "Show details";
"mobile_attachment_only_for_pc" = "This attachments is not implemented for PDA version. Please, view it on PC.";
/* Fullscreen player */ /* Fullscreen player */

View file

@ -2130,6 +2130,7 @@
"mobile_like" = "Нравится"; "mobile_like" = "Нравится";
"mobile_user_info_hide" = "Скрыть"; "mobile_user_info_hide" = "Скрыть";
"mobile_user_info_show_details" = "Показать подробнее"; "mobile_user_info_show_details" = "Показать подробнее";
"mobile_attachment_only_for_pc" = "Вложение недоступно в PDA версии, его просмотр возможен только с другого устройства";
/* Fullscreen player */ /* Fullscreen player */
@ -2306,3 +2307,4 @@
"faves_few" = "$1 закладки"; "faves_few" = "$1 закладки";
"faves_many" = "$1 закладок"; "faves_many" = "$1 закладок";
"faves_other" = "$1 закладок"; "faves_other" = "$1 закладок";