mirror of
https://github.com/openvk/openvk
synced 2025-04-23 08:33:02 +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;
|
break;
|
||||||
case "edit":
|
case "edit":
|
||||||
$audio = $this->audios->get($audio_id);
|
$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);
|
$this->flashFail("err", "error", tr("invalid_audio"), null, true);
|
||||||
|
|
||||||
if ($audio->getOwner()->getId() !== $this->user->id)
|
if ($audio->getOwner()->getId() !== $this->user->id)
|
||||||
|
@ -423,6 +423,7 @@ final class AudioPresenter extends OpenVKPresenter
|
||||||
$lyrics = $this->postParam("lyrics");
|
$lyrics = $this->postParam("lyrics");
|
||||||
$genre = empty($this->postParam("genre")) ? "undefined" : $this->postParam("genre");
|
$genre = empty($this->postParam("genre")) ? "undefined" : $this->postParam("genre");
|
||||||
$nsfw = (int)($this->postParam("explicit") ?? 0) === 1;
|
$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
|
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);
|
$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->setLyrics(empty($lyrics) ? NULL : $lyrics);
|
||||||
$audio->setGenre($genre);
|
$audio->setGenre($genre);
|
||||||
$audio->setExplicit($nsfw);
|
$audio->setExplicit($nsfw);
|
||||||
|
$audio->setSearchability($unlisted);
|
||||||
$audio->save();
|
$audio->save();
|
||||||
|
|
||||||
$this->returnJson(["success" => true, "new_info" => [
|
$this->returnJson(["success" => true, "new_info" => [
|
||||||
|
@ -440,6 +442,7 @@ final class AudioPresenter extends OpenVKPresenter
|
||||||
"lyrics_unformatted" => $audio->getLyrics() ?? "",
|
"lyrics_unformatted" => $audio->getLyrics() ?? "",
|
||||||
"explicit" => $audio->isExplicit(),
|
"explicit" => $audio->isExplicit(),
|
||||||
"genre" => $audio->getGenre(),
|
"genre" => $audio->getGenre(),
|
||||||
|
"unlisted" => $audio->isUnlisted(),
|
||||||
]]);
|
]]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
{if !$addToPlaylistButton}
|
{if !$addToPlaylistButton}
|
||||||
<div class="remove-icon musicIcon" data-id="{$audio->getId()}" n:if="isset($thisUser) && $hasAudio" ></div>
|
<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="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>
|
<div class="report-icon musicIcon" data-id="{$audio->getId()}" n:if="isset($thisUser) && !$editable && !$isWithdrawn" ></div>
|
||||||
{else}
|
{else}
|
||||||
jrgnwighweif
|
jrgnwighweif
|
||||||
|
|
|
@ -155,11 +155,17 @@ class bigPlayer {
|
||||||
document.querySelector(".bigPlayer .track .timeTip").style.display = "none"
|
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) {
|
if(this.tracks["currentTrack"] == null) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(e.type == "mousemove") {
|
||||||
|
let buttonsPresseed = _bsdnUnwrapBitMask(e.buttons)
|
||||||
|
if(!buttonsPresseed[0])
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let rect = this.nodes["thisPlayer"].querySelector(".volumePanel .selectableTrack").getBoundingClientRect();
|
let rect = this.nodes["thisPlayer"].querySelector(".volumePanel .selectableTrack").getBoundingClientRect();
|
||||||
|
|
||||||
const width = e.clientX - rect.left;
|
const width = e.clientX - rect.left;
|
||||||
|
@ -471,6 +477,15 @@ class bigPlayer {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}, "10000")
|
}, "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>
|
||||||
|
|
||||||
<div style="margin-top: 11px">
|
<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>
|
</div>
|
||||||
`, [tr("ok"), tr("cancel")], [
|
`, [tr("ok"), tr("cancel")], [
|
||||||
function() {
|
function() {
|
||||||
|
@ -608,6 +626,7 @@ $(document).on("click", ".musicIcon.edit-icon", (e) => {
|
||||||
let t_genre = $(".ovk-diag-body select[name=genre]").val();
|
let t_genre = $(".ovk-diag-body select[name=genre]").val();
|
||||||
let t_lyrics = $(".ovk-diag-body textarea[name=lyrics]").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_explicit = document.querySelector(".ovk-diag-body input[name=explicit]").checked;
|
||||||
|
let t_unlisted = document.querySelector(".ovk-diag-body input[name=searchable]").checked;
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
|
@ -617,6 +636,7 @@ $(document).on("click", ".musicIcon.edit-icon", (e) => {
|
||||||
performer: t_perf,
|
performer: t_perf,
|
||||||
genre: t_genre,
|
genre: t_genre,
|
||||||
lyrics: t_lyrics,
|
lyrics: t_lyrics,
|
||||||
|
unlisted: Number(t_unlisted),
|
||||||
explicit: Number(t_explicit),
|
explicit: Number(t_explicit),
|
||||||
hash: u("meta[name=csrf]").attr("value")
|
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-lyrics", response.new_info.lyrics_unformatted)
|
||||||
e.currentTarget.setAttribute("data-explicit", Number(response.new_info.explicit))
|
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)
|
player.setAttribute("data-genre", response.new_info.genre)
|
||||||
} else {
|
} else {
|
||||||
MessageBox(tr("error"), response.flash.message, [tr("ok")], [Function.noop])
|
MessageBox(tr("error"), response.flash.message, [tr("ok")], [Function.noop])
|
||||||
|
|
|
@ -770,6 +770,7 @@
|
||||||
"withdrawn" = "Withdrawn";
|
"withdrawn" = "Withdrawn";
|
||||||
"deleted" = "Deleted";
|
"deleted" = "Deleted";
|
||||||
"owner" = "Owner";
|
"owner" = "Owner";
|
||||||
|
"searchable" = "Searchable";
|
||||||
|
|
||||||
"select_audio" = "Select audios";
|
"select_audio" = "Select audios";
|
||||||
"no_playlists_thisuser" = "You haven't added any playlists yet.";
|
"no_playlists_thisuser" = "You haven't added any playlists yet.";
|
||||||
|
@ -784,6 +785,8 @@
|
||||||
"edit_playlist" = "Edit playlist";
|
"edit_playlist" = "Edit playlist";
|
||||||
"unable_to_load_queue" = "Error when loading queue.";
|
"unable_to_load_queue" = "Error when loading queue.";
|
||||||
|
|
||||||
|
"fully_delete_audio" = "Fully delete audio";
|
||||||
|
|
||||||
/* Notifications */
|
/* Notifications */
|
||||||
|
|
||||||
"feedback" = "Feedback";
|
"feedback" = "Feedback";
|
||||||
|
|
|
@ -726,6 +726,7 @@
|
||||||
"withdrawn" = "Изъято";
|
"withdrawn" = "Изъято";
|
||||||
"deleted" = "Удалено";
|
"deleted" = "Удалено";
|
||||||
"owner" = "Владелец";
|
"owner" = "Владелец";
|
||||||
|
"searchable" = "Доступно в поиске";
|
||||||
|
|
||||||
"select_audio" = "Выбрать аудиозаписи";
|
"select_audio" = "Выбрать аудиозаписи";
|
||||||
"no_playlists_thisuser" = "Вы ещё не добавляли плейлистов.";
|
"no_playlists_thisuser" = "Вы ещё не добавляли плейлистов.";
|
||||||
|
@ -740,6 +741,8 @@
|
||||||
"edit_playlist" = "Редактировать плейлист";
|
"edit_playlist" = "Редактировать плейлист";
|
||||||
"unable_to_load_queue" = "Не удалось загрузить очередь.";
|
"unable_to_load_queue" = "Не удалось загрузить очередь.";
|
||||||
|
|
||||||
|
"fully_delete_audio" = "Полностью удалить аудиозапись";
|
||||||
|
|
||||||
/* Notifications */
|
/* Notifications */
|
||||||
|
|
||||||
"feedback" = "Ответы";
|
"feedback" = "Ответы";
|
||||||
|
|
Loading…
Reference in a new issue