diff --git a/Web/Presenters/AudioPresenter.php b/Web/Presenters/AudioPresenter.php index 0811ecd2..e98fc6fc 100644 --- a/Web/Presenters/AudioPresenter.php +++ b/Web/Presenters/AudioPresenter.php @@ -412,7 +412,7 @@ final class AudioPresenter extends OpenVKPresenter break; case "edit": $audio = $this->audios->get($audio_id); - if (!$audio || $audio->isDeleted() || $audio->isWithdrawn() || $audio->isUnlisted()) + if (!$audio || $audio->isDeleted() || $audio->isWithdrawn()) $this->flashFail("err", "error", tr("invalid_audio"), null, true); if ($audio->getOwner()->getId() !== $this->user->id) @@ -423,6 +423,7 @@ final class AudioPresenter extends OpenVKPresenter $lyrics = $this->postParam("lyrics"); $genre = empty($this->postParam("genre")) ? "undefined" : $this->postParam("genre"); $nsfw = (int)($this->postParam("explicit") ?? 0) === 1; + $unlisted = (int)($this->postParam("unlisted") ?? 0) === 1; if(empty($performer) || empty($name) || iconv_strlen($performer . $name) > 128) # FQN of audio must not be more than 128 chars $this->flashFail("err", tr("error"), tr("error_insufficient_info"), null, true); @@ -431,6 +432,7 @@ final class AudioPresenter extends OpenVKPresenter $audio->setLyrics(empty($lyrics) ? NULL : $lyrics); $audio->setGenre($genre); $audio->setExplicit($nsfw); + $audio->setSearchability($unlisted); $audio->save(); $this->returnJson(["success" => true, "new_info" => [ @@ -440,6 +442,7 @@ final class AudioPresenter extends OpenVKPresenter "lyrics_unformatted" => $audio->getLyrics() ?? "", "explicit" => $audio->isExplicit(), "genre" => $audio->getGenre(), + "unlisted" => $audio->isUnlisted(), ]]); break; diff --git a/Web/Presenters/templates/Audio/player.xml b/Web/Presenters/templates/Audio/player.xml index da226dab..e1d33993 100644 --- a/Web/Presenters/templates/Audio/player.xml +++ b/Web/Presenters/templates/Audio/player.xml @@ -45,7 +45,7 @@ {if !$addToPlaylistButton}
- + {else} jrgnwighweif diff --git a/Web/static/js/al_music.js b/Web/static/js/al_music.js index 70b3e2e2..33cc54ec 100644 --- a/Web/static/js/al_music.js +++ b/Web/static/js/al_music.js @@ -155,11 +155,17 @@ class bigPlayer { document.querySelector(".bigPlayer .track .timeTip").style.display = "none" }) - u(".bigPlayer .volumePanel > div").on("click mouseup", (e) => { + u(".bigPlayer .volumePanel > div").on("click mouseup mousemove", (e) => { if(this.tracks["currentTrack"] == null) { return } + if(e.type == "mousemove") { + let buttonsPresseed = _bsdnUnwrapBitMask(e.buttons) + if(!buttonsPresseed[0]) + return; + } + let rect = this.nodes["thisPlayer"].querySelector(".volumePanel .selectableTrack").getBoundingClientRect(); const width = e.clientX - rect.left; @@ -471,6 +477,15 @@ class bigPlayer { } }) }, "10000") + + let album = document.querySelector(".playlistBlock") + + navigator.mediaSession.metadata = new MediaMetadata({ + title: obj.name, + artist: obj.performer, + album: album == null ? "OpenVK Audios" : album.querySelector(".playlistInfo h4").innerHTML, + artwork: [{ src: album == null ? "/assets/packages/static/openvk/img/song.jpg" : album.querySelector(".playlistCover img") }], + }); } } @@ -599,7 +614,10 @@ $(document).on("click", ".musicIcon.edit-icon", (e) => { `, [tr("ok"), tr("cancel")], [ function() { @@ -608,6 +626,7 @@ $(document).on("click", ".musicIcon.edit-icon", (e) => { let t_genre = $(".ovk-diag-body select[name=genre]").val(); let t_lyrics = $(".ovk-diag-body textarea[name=lyrics]").val(); let t_explicit = document.querySelector(".ovk-diag-body input[name=explicit]").checked; + let t_unlisted = document.querySelector(".ovk-diag-body input[name=searchable]").checked; $.ajax({ type: "POST", @@ -617,6 +636,7 @@ $(document).on("click", ".musicIcon.edit-icon", (e) => { performer: t_perf, genre: t_genre, lyrics: t_lyrics, + unlisted: Number(t_unlisted), explicit: Number(t_explicit), hash: u("meta[name=csrf]").attr("value") }, @@ -645,6 +665,7 @@ $(document).on("click", ".musicIcon.edit-icon", (e) => { e.currentTarget.setAttribute("data-lyrics", response.new_info.lyrics_unformatted) e.currentTarget.setAttribute("data-explicit", Number(response.new_info.explicit)) + e.currentTarget.setAttribute("data-searchable", Number(response.new_info.unlisted)) player.setAttribute("data-genre", response.new_info.genre) } else { MessageBox(tr("error"), response.flash.message, [tr("ok")], [Function.noop]) diff --git a/locales/en.strings b/locales/en.strings index b3af7832..b5766204 100644 --- a/locales/en.strings +++ b/locales/en.strings @@ -770,6 +770,7 @@ "withdrawn" = "Withdrawn"; "deleted" = "Deleted"; "owner" = "Owner"; +"searchable" = "Searchable"; "select_audio" = "Select audios"; "no_playlists_thisuser" = "You haven't added any playlists yet."; @@ -784,6 +785,8 @@ "edit_playlist" = "Edit playlist"; "unable_to_load_queue" = "Error when loading queue."; +"fully_delete_audio" = "Fully delete audio"; + /* Notifications */ "feedback" = "Feedback"; diff --git a/locales/ru.strings b/locales/ru.strings index 9274d1a9..48a619b4 100644 --- a/locales/ru.strings +++ b/locales/ru.strings @@ -726,6 +726,7 @@ "withdrawn" = "Изъято"; "deleted" = "Удалено"; "owner" = "Владелец"; +"searchable" = "Доступно в поиске"; "select_audio" = "Выбрать аудиозаписи"; "no_playlists_thisuser" = "Вы ещё не добавляли плейлистов."; @@ -740,6 +741,8 @@ "edit_playlist" = "Редактировать плейлист"; "unable_to_load_queue" = "Не удалось загрузить очередь."; +"fully_delete_audio" = "Полностью удалить аудиозапись"; + /* Notifications */ "feedback" = "Ответы";