mirror of
https://github.com/openvk/openvk
synced 2025-04-23 00:23:01 +03:00
Add something
This commit is contained in:
parent
120c5b3c0e
commit
c8e7da9c6d
5 changed files with 34 additions and 4 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
{if !$addToPlaylistButton}
|
||||
<div class="remove-icon musicIcon" data-id="{$audio->getId()}" n:if="isset($thisUser) && $hasAudio" ></div>
|
||||
<div class="add-icon musicIcon" data-id="{$audio->getId()}" n:if="isset($thisUser) && !$hasAudio && !$isWithdrawn" ></div>
|
||||
<div class="edit-icon musicIcon" data-lyrics="{$audio->getLyrics()}" data-title="{$audio->getTitle()}" data-performer="{$audio->getPerformer()}" data-explicit="{(int)$audio->isExplicit()}" n:if="isset($thisUser) && $editable && !$isWithdrawn" ></div>
|
||||
<div class="edit-icon musicIcon" data-lyrics="{$audio->getLyrics()}" data-title="{$audio->getTitle()}" data-performer="{$audio->getPerformer()}" data-explicit="{(int)$audio->isExplicit()}" data-searchable="{(int)!$audio->isUnlisted()}" n:if="isset($thisUser) && $editable && !$isWithdrawn" ></div>
|
||||
<div class="report-icon musicIcon" data-id="{$audio->getId()}" n:if="isset($thisUser) && !$editable && !$isWithdrawn" ></div>
|
||||
{else}
|
||||
jrgnwighweif
|
||||
|
|
|
@ -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) => {
|
|||
</div>
|
||||
|
||||
<div style="margin-top: 11px">
|
||||
<label><input type="checkbox" name="explicit" ${e.currentTarget.dataset.explicit == 1 ? "checked" : ""} maxlength="500">${tr("audios_explicit")}</label>
|
||||
<label><input type="checkbox" name="explicit" ${e.currentTarget.dataset.explicit == 1 ? "checked" : ""}>${tr("audios_explicit")}</label><br>
|
||||
<label><input type="checkbox" name="searchable" ${e.currentTarget.dataset.searchable == 1 ? "checked" : ""}>${tr("searchable")}</label>
|
||||
<hr>
|
||||
<a id="_fullyDeleteAudio">${tr("fully_delete_audio")}</a>
|
||||
</div>
|
||||
`, [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])
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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" = "Ответы";
|
||||
|
|
Loading…
Reference in a new issue