mirror of
https://github.com/openvk/openvk
synced 2025-04-23 08:33:02 +03:00
!
- Добавлены строки для мобильной темы - Добавлено предупреждение перед полным удалением плейлиста - Нажатие кнопки M = нажатие кнопки наушников - В классе апи Audio поставлены willExecuteWriteAction, ещё теперь нельзя получить число аудиозаписей у пользователей, которые их закрыли. Ещё теперь нельзя получать uploaded_only аудиозаписи у тех ну вы поняли короче. - При наведении на длинное название песни оно теперь показывается полностью - Надо ещё что-то сюда написать, так что: При редактировании аудиозаписи название окна теперь не "Редактировать", а "Редактировать аудиозапись", а вместо кнопки OK кнопка "Сохранить"
This commit is contained in:
parent
5cd52c22f0
commit
bc29eb91e7
6 changed files with 87 additions and 23 deletions
|
@ -184,6 +184,9 @@ final class Audio extends VKAPIRequestHandler
|
||||||
if(!$user)
|
if(!$user)
|
||||||
$this->fail(0404, "User not found");
|
$this->fail(0404, "User not found");
|
||||||
|
|
||||||
|
if(!$user->getPrivacyPermission("audios.read", $this->getUser()))
|
||||||
|
$this->fail(15, "Access denied");
|
||||||
|
|
||||||
if($uploaded_only) {
|
if($uploaded_only) {
|
||||||
return DatabaseConnection::i()->getContext()->table("audios")
|
return DatabaseConnection::i()->getContext()->table("audios")
|
||||||
->where([
|
->where([
|
||||||
|
@ -264,6 +267,14 @@ final class Audio extends VKAPIRequestHandler
|
||||||
if($owner_id <= 0)
|
if($owner_id <= 0)
|
||||||
$this->fail(8, "uploaded_only can only be used with owner_id > 0");
|
$this->fail(8, "uploaded_only can only be used with owner_id > 0");
|
||||||
|
|
||||||
|
$user = (new \openvk\Web\Models\Repositories\Users)->get($owner_id);
|
||||||
|
|
||||||
|
if(!$user)
|
||||||
|
$this->fail(0602, "Invalid user");
|
||||||
|
|
||||||
|
if(!$user->getPrivacyPermission("audios.read", $this->getUser()))
|
||||||
|
$this->fail(15, "Access denied: this user chose to hide his audios");
|
||||||
|
|
||||||
if(!is_null($shuffleSeed)) {
|
if(!is_null($shuffleSeed)) {
|
||||||
$audio_ids = [];
|
$audio_ids = [];
|
||||||
$query = $dbCtx->table("audios")->select("virtual_id")->where([
|
$query = $dbCtx->table("audios")->select("virtual_id")->where([
|
||||||
|
@ -351,6 +362,7 @@ final class Audio extends VKAPIRequestHandler
|
||||||
function beacon(int $aid, ?int $gid = NULL): int
|
function beacon(int $aid, ?int $gid = NULL): int
|
||||||
{
|
{
|
||||||
$this->requireUser();
|
$this->requireUser();
|
||||||
|
$this->willExecuteWriteAction();
|
||||||
|
|
||||||
$audio = (new Audios)->get($aid);
|
$audio = (new Audios)->get($aid);
|
||||||
if(!$audio)
|
if(!$audio)
|
||||||
|
@ -428,6 +440,7 @@ final class Audio extends VKAPIRequestHandler
|
||||||
function edit(int $owner_id, int $audio_id, ?string $artist = NULL, ?string $title = NULL, ?string $text = NULL, ?int $genre_id = NULL, ?string $genre_str = NULL, int $no_search = 0): int
|
function edit(int $owner_id, int $audio_id, ?string $artist = NULL, ?string $title = NULL, ?string $text = NULL, ?int $genre_id = NULL, ?string $genre_str = NULL, int $no_search = 0): int
|
||||||
{
|
{
|
||||||
$this->requireUser();
|
$this->requireUser();
|
||||||
|
$this->willExecuteWriteAction();
|
||||||
|
|
||||||
$audio = (new Audios)->getByOwnerAndVID($owner_id, $audio_id);
|
$audio = (new Audios)->getByOwnerAndVID($owner_id, $audio_id);
|
||||||
if(!$audio)
|
if(!$audio)
|
||||||
|
@ -470,6 +483,7 @@ final class Audio extends VKAPIRequestHandler
|
||||||
function add(int $audio_id, int $owner_id, ?int $group_id = NULL, ?int $album_id = NULL): string
|
function add(int $audio_id, int $owner_id, ?int $group_id = NULL, ?int $album_id = NULL): string
|
||||||
{
|
{
|
||||||
$this->requireUser();
|
$this->requireUser();
|
||||||
|
$this->willExecuteWriteAction();
|
||||||
|
|
||||||
if(!is_null($album_id))
|
if(!is_null($album_id))
|
||||||
$this->fail(10, "album_id not implemented");
|
$this->fail(10, "album_id not implemented");
|
||||||
|
@ -504,6 +518,7 @@ final class Audio extends VKAPIRequestHandler
|
||||||
function delete(int $audio_id, int $owner_id, ?int $group_id = NULL): int
|
function delete(int $audio_id, int $owner_id, ?int $group_id = NULL): int
|
||||||
{
|
{
|
||||||
$this->requireUser();
|
$this->requireUser();
|
||||||
|
$this->willExecuteWriteAction();
|
||||||
|
|
||||||
$from = $this->getUser();
|
$from = $this->getUser();
|
||||||
if(!is_null($group_id)) {
|
if(!is_null($group_id)) {
|
||||||
|
@ -592,6 +607,7 @@ final class Audio extends VKAPIRequestHandler
|
||||||
function addAlbum(string $title, ?string $description = NULL, int $group_id = 0): int
|
function addAlbum(string $title, ?string $description = NULL, int $group_id = 0): int
|
||||||
{
|
{
|
||||||
$this->requireUser();
|
$this->requireUser();
|
||||||
|
$this->willExecuteWriteAction();
|
||||||
|
|
||||||
$group = NULL;
|
$group = NULL;
|
||||||
if($group_id != 0) {
|
if($group_id != 0) {
|
||||||
|
@ -624,6 +640,7 @@ final class Audio extends VKAPIRequestHandler
|
||||||
function editAlbum(int $album_id, ?string $title = NULL, ?string $description = NULL): int
|
function editAlbum(int $album_id, ?string $title = NULL, ?string $description = NULL): int
|
||||||
{
|
{
|
||||||
$this->requireUser();
|
$this->requireUser();
|
||||||
|
$this->willExecuteWriteAction();
|
||||||
|
|
||||||
$album = (new Audios)->getPlaylist($album_id);
|
$album = (new Audios)->getPlaylist($album_id);
|
||||||
if(!$album)
|
if(!$album)
|
||||||
|
@ -646,6 +663,7 @@ final class Audio extends VKAPIRequestHandler
|
||||||
function deleteAlbum(int $album_id): int
|
function deleteAlbum(int $album_id): int
|
||||||
{
|
{
|
||||||
$this->requireUser();
|
$this->requireUser();
|
||||||
|
$this->willExecuteWriteAction();
|
||||||
|
|
||||||
$album = (new Audios)->getPlaylist($album_id);
|
$album = (new Audios)->getPlaylist($album_id);
|
||||||
if(!$album)
|
if(!$album)
|
||||||
|
@ -661,6 +679,7 @@ final class Audio extends VKAPIRequestHandler
|
||||||
function moveToAlbum(int $album_id, string $audio_ids): int
|
function moveToAlbum(int $album_id, string $audio_ids): int
|
||||||
{
|
{
|
||||||
$this->requireUser();
|
$this->requireUser();
|
||||||
|
$this->willExecuteWriteAction();
|
||||||
|
|
||||||
$album = (new Audios)->getPlaylist($album_id);
|
$album = (new Audios)->getPlaylist($album_id);
|
||||||
if(!$album)
|
if(!$album)
|
||||||
|
@ -700,6 +719,7 @@ final class Audio extends VKAPIRequestHandler
|
||||||
function removeFromAlbum(int $album_id, string $audio_ids): int
|
function removeFromAlbum(int $album_id, string $audio_ids): int
|
||||||
{
|
{
|
||||||
$this->requireUser();
|
$this->requireUser();
|
||||||
|
$this->willExecuteWriteAction();
|
||||||
|
|
||||||
$album = (new Audios)->getPlaylist($album_id);
|
$album = (new Audios)->getPlaylist($album_id);
|
||||||
if(!$album)
|
if(!$album)
|
||||||
|
@ -739,6 +759,7 @@ final class Audio extends VKAPIRequestHandler
|
||||||
function bookmarkAlbum(int $id): int
|
function bookmarkAlbum(int $id): int
|
||||||
{
|
{
|
||||||
$this->requireUser();
|
$this->requireUser();
|
||||||
|
$this->willExecuteWriteAction();
|
||||||
|
|
||||||
$album = (new Audios)->getPlaylist($id);
|
$album = (new Audios)->getPlaylist($id);
|
||||||
if(!$album)
|
if(!$album)
|
||||||
|
@ -753,6 +774,7 @@ final class Audio extends VKAPIRequestHandler
|
||||||
function unBookmarkAlbum(int $id): int
|
function unBookmarkAlbum(int $id): int
|
||||||
{
|
{
|
||||||
$this->requireUser();
|
$this->requireUser();
|
||||||
|
$this->willExecuteWriteAction();
|
||||||
|
|
||||||
$album = (new Audios)->getPlaylist($id);
|
$album = (new Audios)->getPlaylist($id);
|
||||||
if(!$album)
|
if(!$album)
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
<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" style="margin-bottom: -8px; cursor: pointer;display:flex;width: 85%;">
|
||||||
<div style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
|
<div class="info noOverflow">
|
||||||
<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(), 50)}</a>
|
<a href="/search?query=&type=audios&sort=id&only_performers=on&query={$audio->getPerformer()}">{ovk_proc_strtr($audio->getPerformer(), 50)}</a>
|
||||||
</strong>
|
</strong>
|
||||||
|
|
|
@ -1,3 +1,14 @@
|
||||||
|
.noOverflow {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.overflowedName {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 99;
|
||||||
|
}
|
||||||
|
|
||||||
.musicIcon {
|
.musicIcon {
|
||||||
background-image: url('/assets/packages/static/openvk/img/audios_controls.png');
|
background-image: url('/assets/packages/static/openvk/img/audios_controls.png');
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
|
|
|
@ -346,7 +346,7 @@ class bigPlayer {
|
||||||
})
|
})
|
||||||
|
|
||||||
u(document).on("keyup", (e) => {
|
u(document).on("keyup", (e) => {
|
||||||
if([87, 65, 83, 68, 82].includes(e.keyCode)) {
|
if([87, 65, 83, 68, 82, 77].includes(e.keyCode)) {
|
||||||
if(document.querySelector(".ovk-diag-cont") != null)
|
if(document.querySelector(".ovk-diag-cont") != null)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -365,6 +365,9 @@ class bigPlayer {
|
||||||
case 82:
|
case 82:
|
||||||
document.querySelector(".bigPlayer .additionalButtons .repeatButton").click()
|
document.querySelector(".bigPlayer .additionalButtons .repeatButton").click()
|
||||||
break
|
break
|
||||||
|
case 77:
|
||||||
|
document.querySelector(".bigPlayer .additionalButtons .deviceButton").click()
|
||||||
|
break
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -661,7 +664,21 @@ document.addEventListener("DOMContentLoaded", function() {
|
||||||
|
|
||||||
if(bigplayer != null)
|
if(bigplayer != null)
|
||||||
bigPlayerObserver.observe(bigplayer);
|
bigPlayerObserver.observe(bigplayer);
|
||||||
}})
|
}
|
||||||
|
|
||||||
|
$(`.audioEntry .mediaInfo`).on("mouseover mouseleave", (e) => {
|
||||||
|
const info = e.currentTarget.closest(".mediaInfo")
|
||||||
|
const overfl = info.querySelector(".info")
|
||||||
|
|
||||||
|
if(e.originalEvent.type == "mouseleave" || e.originalEvent.type == "mouseout") {
|
||||||
|
overfl.classList.add("noOverflow")
|
||||||
|
overfl.classList.remove("overflowedName")
|
||||||
|
} else {
|
||||||
|
overfl.classList.remove("noOverflow")
|
||||||
|
overfl.classList.add("overflowedName")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
$(document).on("click", ".audioEmbed > *", (e) => {
|
$(document).on("click", ".audioEmbed > *", (e) => {
|
||||||
const player = e.currentTarget.closest(".audioEmbed")
|
const player = e.currentTarget.closest(".audioEmbed")
|
||||||
|
@ -827,7 +844,7 @@ $(document).on("click", ".musicIcon.edit-icon", (e) => {
|
||||||
let genre = player.dataset.genre
|
let genre = player.dataset.genre
|
||||||
let lyrics = e.currentTarget.dataset.lyrics
|
let lyrics = e.currentTarget.dataset.lyrics
|
||||||
|
|
||||||
MessageBox(tr("edit"), `
|
MessageBox(tr("edit_audio"), `
|
||||||
<div>
|
<div>
|
||||||
${tr("performer")}
|
${tr("performer")}
|
||||||
<input name="performer" maxlength="40" type="text" value="${performer}">
|
<input name="performer" maxlength="40" type="text" value="${performer}">
|
||||||
|
@ -854,7 +871,7 @@ $(document).on("click", ".musicIcon.edit-icon", (e) => {
|
||||||
<hr>
|
<hr>
|
||||||
<a id="_fullyDeleteAudio">${tr("fully_delete_audio")}</a>
|
<a id="_fullyDeleteAudio">${tr("fully_delete_audio")}</a>
|
||||||
</div>
|
</div>
|
||||||
`, [tr("ok"), tr("cancel")], [
|
`, [tr("save"), tr("cancel")], [
|
||||||
function() {
|
function() {
|
||||||
let t_name = $(".ovk-diag-body input[name=name]").val();
|
let t_name = $(".ovk-diag-body input[name=name]").val();
|
||||||
let t_perf = $(".ovk-diag-body input[name=performer]").val();
|
let t_perf = $(".ovk-diag-body input[name=performer]").val();
|
||||||
|
@ -894,7 +911,7 @@ $(document).on("click", ".musicIcon.edit-icon", (e) => {
|
||||||
player.querySelector(".title").classList.add("withLyrics")
|
player.querySelector(".title").classList.add("withLyrics")
|
||||||
} else {
|
} else {
|
||||||
player.insertAdjacentHTML("beforeend", `
|
player.insertAdjacentHTML("beforeend", `
|
||||||
<div class="lyrics" n:if="!empty($audio->getLyrics())">
|
<div class="lyrics">
|
||||||
${response.new_info.lyrics}
|
${response.new_info.lyrics}
|
||||||
</div>
|
</div>
|
||||||
`)
|
`)
|
||||||
|
@ -1037,7 +1054,7 @@ $(document).on("click", ".musicIcon.add-icon-group", async (ev) => {
|
||||||
let body = `
|
let body = `
|
||||||
${tr("what_club_add")}
|
${tr("what_club_add")}
|
||||||
<div style="margin-top: 4px;">
|
<div style="margin-top: 4px;">
|
||||||
<select id="addIconsWindow" style="width: 36%;"></select>
|
<select id="addIconsWindow" style="width: 59%;"></select>
|
||||||
<input name="addButton" type="button" class="button" value="${tr("add")}">
|
<input name="addButton" type="button" class="button" value="${tr("add")}">
|
||||||
</div>
|
</div>
|
||||||
<span class="errorPlace"></span>
|
<span class="errorPlace"></span>
|
||||||
|
@ -1117,23 +1134,25 @@ $(document).on("click", ".musicIcon.add-icon", (e) => {
|
||||||
$(document).on("click", "#_deletePlaylist", (e) => {
|
$(document).on("click", "#_deletePlaylist", (e) => {
|
||||||
let id = e.currentTarget.dataset.id
|
let id = e.currentTarget.dataset.id
|
||||||
|
|
||||||
$.ajax({
|
MessageBox(tr("warning"), tr("sure_delete_playlist"), [tr("yes"), tr("no")], [() => {
|
||||||
type: "POST",
|
$.ajax({
|
||||||
url: `/playlist${id}/action?act=delete`,
|
type: "POST",
|
||||||
data: {
|
url: `/playlist${id}/action?act=delete`,
|
||||||
hash: u("meta[name=csrf]").attr("value"),
|
data: {
|
||||||
},
|
hash: u("meta[name=csrf]").attr("value"),
|
||||||
beforeSend: () => {
|
},
|
||||||
e.currentTarget.classList.add("lagged")
|
beforeSend: () => {
|
||||||
},
|
e.currentTarget.classList.add("lagged")
|
||||||
success: (response) => {
|
},
|
||||||
if(response.success) {
|
success: (response) => {
|
||||||
window.location.assign("/playlists" + response.id)
|
if(response.success) {
|
||||||
} else {
|
window.location.assign("/playlists" + response.id)
|
||||||
fastError(response.flash.message)
|
} else {
|
||||||
|
fastError(response.flash.message)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
})
|
}, Function.noop])
|
||||||
})
|
})
|
||||||
|
|
||||||
$(document).on("click", "#_audioAttachment", (e) => {
|
$(document).on("click", "#_audioAttachment", (e) => {
|
||||||
|
|
|
@ -831,6 +831,8 @@
|
||||||
"audio_successfully_uploaded" = "Audio has been successfully uploaded and is currently being processed.";
|
"audio_successfully_uploaded" = "Audio has been successfully uploaded and is currently being processed.";
|
||||||
|
|
||||||
"broadcast_audio" = "Broadcast audio to status";
|
"broadcast_audio" = "Broadcast audio to status";
|
||||||
|
"sure_delete_playlist" = "Do you sure want to delete this playlist?";
|
||||||
|
"edit_audio" = "Edit audio";
|
||||||
|
|
||||||
/* Notifications */
|
/* Notifications */
|
||||||
|
|
||||||
|
@ -1938,6 +1940,7 @@
|
||||||
/* Mobile */
|
/* Mobile */
|
||||||
"mobile_friends" = "Friends";
|
"mobile_friends" = "Friends";
|
||||||
"mobile_photos" = "Photos";
|
"mobile_photos" = "Photos";
|
||||||
|
"mobile_audios" = "Audios";
|
||||||
"mobile_videos" = "Videos";
|
"mobile_videos" = "Videos";
|
||||||
"mobile_messages" = "Messages";
|
"mobile_messages" = "Messages";
|
||||||
"mobile_notes" = "Notes";
|
"mobile_notes" = "Notes";
|
||||||
|
@ -1951,6 +1954,9 @@
|
||||||
"mobile_user_info_hide" = "Hide";
|
"mobile_user_info_hide" = "Hide";
|
||||||
"mobile_user_info_show_details" = "Show details";
|
"mobile_user_info_show_details" = "Show details";
|
||||||
|
|
||||||
|
"my" = "My";
|
||||||
|
"enter_a_name_or_artist" = "Enter a name or artist...";
|
||||||
|
|
||||||
/* Moderation */
|
/* Moderation */
|
||||||
|
|
||||||
"section" = "Section";
|
"section" = "Section";
|
||||||
|
|
|
@ -786,6 +786,8 @@
|
||||||
"audio_successfully_uploaded" = "Аудио успешно загружено и на данный момент обрабатывается.";
|
"audio_successfully_uploaded" = "Аудио успешно загружено и на данный момент обрабатывается.";
|
||||||
|
|
||||||
"broadcast_audio" = "Транслировать аудио в статус";
|
"broadcast_audio" = "Транслировать аудио в статус";
|
||||||
|
"sure_delete_playlist" = "Вы действительно хотите удалить этот плейлист?";
|
||||||
|
"edit_audio" = "Редактировать аудиозапись";
|
||||||
|
|
||||||
/* Notifications */
|
/* Notifications */
|
||||||
|
|
||||||
|
@ -1827,6 +1829,7 @@
|
||||||
/* Mobile */
|
/* Mobile */
|
||||||
"mobile_friends" = "Друзья";
|
"mobile_friends" = "Друзья";
|
||||||
"mobile_photos" = "Фотографии";
|
"mobile_photos" = "Фотографии";
|
||||||
|
"mobile_audios" = "Аудиозаписи";
|
||||||
"mobile_videos" = "Видеозаписи";
|
"mobile_videos" = "Видеозаписи";
|
||||||
"mobile_messages" = "Сообщения";
|
"mobile_messages" = "Сообщения";
|
||||||
"mobile_notes" = "Заметки";
|
"mobile_notes" = "Заметки";
|
||||||
|
@ -1840,6 +1843,9 @@
|
||||||
"mobile_user_info_hide" = "Скрыть";
|
"mobile_user_info_hide" = "Скрыть";
|
||||||
"mobile_user_info_show_details" = "Показать подробнее";
|
"mobile_user_info_show_details" = "Показать подробнее";
|
||||||
|
|
||||||
|
"my" = "Мои";
|
||||||
|
"enter_a_name_or_artist" = "Введите название или автора...";
|
||||||
|
|
||||||
/* Moderation */
|
/* Moderation */
|
||||||
|
|
||||||
"section" = "Раздел";
|
"section" = "Раздел";
|
||||||
|
|
Loading…
Reference in a new issue