mirror of
https://github.com/openvk/openvk
synced 2024-12-22 16:42:32 +03:00
Something related with audios
- Теперь аудиозаписи в wall.get,getById,getComments,getComment выглядит нормально - Теперь при создании плейлиста можно выбрать до тысячи песен - По идее, название трека теперь нормально обрезается и раскрывается при наведении - Добавлена проверка на существование коммента в wall.getComment - Плейлисты теперь не вылетают, если пользователь не залогинен.
This commit is contained in:
parent
d183b1a8a3
commit
63702d44d1
5 changed files with 29 additions and 14 deletions
|
@ -60,7 +60,10 @@ final class Wall extends VKAPIRequestHandler
|
||||||
} else if ($attachment instanceof \openvk\Web\Models\Entities\Note) {
|
} else if ($attachment instanceof \openvk\Web\Models\Entities\Note) {
|
||||||
$attachments[] = $attachment->toVkApiStruct();
|
$attachments[] = $attachment->toVkApiStruct();
|
||||||
} else if ($attachment instanceof \openvk\Web\Models\Entities\Audio) {
|
} else if ($attachment instanceof \openvk\Web\Models\Entities\Audio) {
|
||||||
$attachments[] = $attachment->toVkApiStruct($this->getUser());
|
$attachments[] = [
|
||||||
|
"type" => "audio",
|
||||||
|
"audio" => $attachment->toVkApiStruct($this->getUser()),
|
||||||
|
];
|
||||||
} else if ($attachment instanceof \openvk\Web\Models\Entities\Post) {
|
} else if ($attachment instanceof \openvk\Web\Models\Entities\Post) {
|
||||||
$repostAttachments = [];
|
$repostAttachments = [];
|
||||||
|
|
||||||
|
@ -237,7 +240,10 @@ final class Wall extends VKAPIRequestHandler
|
||||||
} else if ($attachment instanceof \openvk\Web\Models\Entities\Note) {
|
} else if ($attachment instanceof \openvk\Web\Models\Entities\Note) {
|
||||||
$attachments[] = $attachment->toVkApiStruct();
|
$attachments[] = $attachment->toVkApiStruct();
|
||||||
} else if ($attachment instanceof \openvk\Web\Models\Entities\Audio) {
|
} else if ($attachment instanceof \openvk\Web\Models\Entities\Audio) {
|
||||||
$attachments[] = $attachment->toVkApiStruct($this->getUser());
|
$attachments[] = [
|
||||||
|
"type" => "audio",
|
||||||
|
"audio" => $attachment->toVkApiStruct($this->getUser())
|
||||||
|
];
|
||||||
} else if ($attachment instanceof \openvk\Web\Models\Entities\Post) {
|
} else if ($attachment instanceof \openvk\Web\Models\Entities\Post) {
|
||||||
$repostAttachments = [];
|
$repostAttachments = [];
|
||||||
|
|
||||||
|
@ -576,7 +582,10 @@ final class Wall extends VKAPIRequestHandler
|
||||||
} elseif($attachment instanceof \openvk\Web\Models\Entities\Note) {
|
} elseif($attachment instanceof \openvk\Web\Models\Entities\Note) {
|
||||||
$attachments[] = $attachment->toVkApiStruct();
|
$attachments[] = $attachment->toVkApiStruct();
|
||||||
} elseif($attachment instanceof \openvk\Web\Models\Entities\Audio) {
|
} elseif($attachment instanceof \openvk\Web\Models\Entities\Audio) {
|
||||||
$attachments[] = $attachment->toVkApiStruct($this->getUser());
|
$attachments[] = [
|
||||||
|
"type" => "audio",
|
||||||
|
"audio" => $attachment->toVkApiStruct($this->getUser()),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -636,6 +645,9 @@ final class Wall extends VKAPIRequestHandler
|
||||||
|
|
||||||
$comment = (new CommentsRepo)->get($comment_id); # один хуй айди всех комментов общий
|
$comment = (new CommentsRepo)->get($comment_id); # один хуй айди всех комментов общий
|
||||||
|
|
||||||
|
if(!$comment || $comment->isDeleted())
|
||||||
|
$this->fail(100, "Invalid comment");
|
||||||
|
|
||||||
$profiles = [];
|
$profiles = [];
|
||||||
|
|
||||||
$attachments = [];
|
$attachments = [];
|
||||||
|
@ -644,7 +656,10 @@ final class Wall extends VKAPIRequestHandler
|
||||||
if($attachment instanceof \openvk\Web\Models\Entities\Photo) {
|
if($attachment instanceof \openvk\Web\Models\Entities\Photo) {
|
||||||
$attachments[] = $this->getApiPhoto($attachment);
|
$attachments[] = $this->getApiPhoto($attachment);
|
||||||
} elseif($attachment instanceof \openvk\Web\Models\Entities\Audio) {
|
} elseif($attachment instanceof \openvk\Web\Models\Entities\Audio) {
|
||||||
$attachments[] = $attachment->toVkApiStruct($this->getUser());
|
$attachments[] = [
|
||||||
|
"type" => "audio",
|
||||||
|
"audio" => $attachment->toVkApiStruct($this->getUser()),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -304,7 +304,7 @@ final class AudioPresenter extends OpenVKPresenter
|
||||||
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||||
$title = $this->postParam("title");
|
$title = $this->postParam("title");
|
||||||
$description = $this->postParam("description");
|
$description = $this->postParam("description");
|
||||||
$audios = !empty($this->postParam("audios")) ? array_slice(explode(",", $this->postParam("audios")), 0, 100) : [];
|
$audios = !empty($this->postParam("audios")) ? array_slice(explode(",", $this->postParam("audios")), 0, 1000) : [];
|
||||||
|
|
||||||
if(empty($title) || iconv_strlen($title) < 1)
|
if(empty($title) || iconv_strlen($title) < 1)
|
||||||
$this->flashFail("err", tr("error"), tr("set_playlist_name"));
|
$this->flashFail("err", tr("error"), tr("set_playlist_name"));
|
||||||
|
@ -478,9 +478,9 @@ final class AudioPresenter extends OpenVKPresenter
|
||||||
$this->template->audios = iterator_to_array($playlist->fetch($page, 10));
|
$this->template->audios = iterator_to_array($playlist->fetch($page, 10));
|
||||||
$this->template->ownerId = $owner_id;
|
$this->template->ownerId = $owner_id;
|
||||||
$this->template->owner = $playlist->getOwner();
|
$this->template->owner = $playlist->getOwner();
|
||||||
$this->template->isBookmarked = $playlist->isBookmarkedBy($this->user->identity);
|
$this->template->isBookmarked = $this->user->identity && $playlist->isBookmarkedBy($this->user->identity);
|
||||||
$this->template->isMy = $playlist->getOwner()->getId() === $this->user->id;
|
$this->template->isMy = $this->user->identity && $playlist->getOwner()->getId() === $this->user->id;
|
||||||
$this->template->canEdit = $playlist->canBeModifiedBy($this->user->identity);
|
$this->template->canEdit = $this->user->identity && $playlist->canBeModifiedBy($this->user->identity);
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderAction(int $audio_id): void
|
function renderAction(int $audio_id): void
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
<img src="{$playlist->getCoverURL('normal')}" alt="{_playlist_cover}">
|
<img src="{$playlist->getCoverURL('normal')}" alt="{_playlist_cover}">
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<div class="profile_links" style="width: 139px;">
|
<div class="profile_links" style="width: 139px;" n:if="isset($thisUser)">
|
||||||
<a class="profile_link" style="width: 98%;" href="/playlist{$playlist->getPrettyId()}/edit" n:if="$playlist->canBeModifiedBy($thisUser)">{_edit_playlist}</a>
|
<a class="profile_link" style="width: 98%;" href="/playlist{$playlist->getPrettyId()}/edit" n:if="$playlist->canBeModifiedBy($thisUser)">{_edit_playlist}</a>
|
||||||
<a class="profile_link" style="width: 98%;" id="bookmarkPlaylist" data-id="{$playlist->getId()}" n:if="!$isBookmarked">{_bookmark}</a>
|
<a class="profile_link" style="width: 98%;" id="bookmarkPlaylist" data-id="{$playlist->getId()}" n:if="!$isBookmarked">{_bookmark}</a>
|
||||||
<a class="profile_link" style="width: 98%;" id="unbookmarkPlaylist" data-id="{$playlist->getId()}" n:if="$isBookmarked">{_unbookmark}</a>
|
<a class="profile_link" style="width: 98%;" id="unbookmarkPlaylist" data-id="{$playlist->getId()}" n:if="$isBookmarked">{_unbookmark}</a>
|
||||||
|
|
|
@ -11,13 +11,13 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="status" style="margin-top: 12px;">
|
<div class="status" style="margin-top: 12px;">
|
||||||
<div class="mediaInfo" style="margin-bottom: -8px; cursor: pointer;display:flex;width: 85%;">
|
<div class="mediaInfo noOverflow" style="margin-bottom: -8px; cursor: pointer;display:flex;width: 85%;">
|
||||||
<div class="info noOverflow">
|
<div class="info">
|
||||||
<strong class="performer">
|
<strong class="performer">
|
||||||
<a href="/search?query=&type=audios&sort=id&only_performers=on&query={$audio->getPerformer()}">{ovk_proc_strtr($audio->getPerformer(), 30)}</a>
|
<a href="/search?query=&type=audios&sort=id&only_performers=on&query={$audio->getPerformer()}">{$audio->getPerformer()}</a>
|
||||||
</strong>
|
</strong>
|
||||||
—
|
—
|
||||||
<span class="title {if !empty($audio->getLyrics())}withLyrics{/if}">{ovk_proc_strtr($audio->getTitle(), 30)}</span>
|
<span class="title {if !empty($audio->getLyrics())}withLyrics{/if}">{$audio->getTitle()}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="explicitMark" n:if="$audio->isExplicit()"></div>
|
<div class="explicitMark" n:if="$audio->isExplicit()"></div>
|
||||||
|
|
|
@ -669,7 +669,7 @@ document.addEventListener("DOMContentLoaded", function() {
|
||||||
bigPlayerObserver.observe(bigplayer);
|
bigPlayerObserver.observe(bigplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
$(`.audioEntry .mediaInfo`).on("mouseover mouseleave", (e) => {
|
$(document).on("mouseover mouseleave", `.audioEntry .mediaInfo`, (e) => {
|
||||||
const info = e.currentTarget.closest(".mediaInfo")
|
const info = e.currentTarget.closest(".mediaInfo")
|
||||||
const overfl = info.querySelector(".info")
|
const overfl = info.querySelector(".info")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue