mirror of
https://github.com/openvk/openvk
synced 2025-04-23 16:43:02 +03:00
Compare commits
1 commit
fe17d16f97
...
428e1e9f95
Author | SHA1 | Date | |
---|---|---|---|
|
428e1e9f95 |
12 changed files with 31 additions and 180 deletions
|
@ -18,7 +18,7 @@ final class Audio extends VKAPIRequestHandler
|
|||
if (!$audio) {
|
||||
$this->fail(0o404, "Audio not found");
|
||||
} elseif (!$audio->canBeViewedBy($this->getUser())) {
|
||||
$this->fail(201, "Access denied to audio(" . $audio->getId() . ")");
|
||||
$this->fail(201, "Access denied to audio(" . $audio->getPrettyId() . ")");
|
||||
}
|
||||
|
||||
# рофлан ебало
|
||||
|
@ -201,7 +201,7 @@ final class Audio extends VKAPIRequestHandler
|
|||
$this->fail(15, "Access denied");
|
||||
}
|
||||
|
||||
if ($uploaded_only && $owner_id == $this->getUser()->getRealId()) {
|
||||
if ($uploaded_only) {
|
||||
return DatabaseConnection::i()->getContext()->table("audios")
|
||||
->where([
|
||||
"deleted" => false,
|
||||
|
@ -283,7 +283,7 @@ final class Audio extends VKAPIRequestHandler
|
|||
}
|
||||
|
||||
$dbCtx = DatabaseConnection::i()->getContext();
|
||||
if ($uploaded_only == 1 && $owner_id == $this->getUser()->getRealId()) {
|
||||
if ($uploaded_only == 1) {
|
||||
if ($owner_id <= 0) {
|
||||
$this->fail(8, "uploaded_only can only be used with owner_id > 0");
|
||||
}
|
||||
|
|
|
@ -78,10 +78,6 @@ final class AudioPresenter extends OpenVKPresenter
|
|||
} elseif ($mode === "new") {
|
||||
$audios = $this->audios->getNew();
|
||||
$audiosCount = $audios->size();
|
||||
} elseif ($mode === "uploaded") {
|
||||
$stream = $this->audios->getByUploader($this->user->identity);
|
||||
$audios = $stream->page($page, 10);
|
||||
$audiosCount = $stream->size();
|
||||
} elseif ($mode === "playlists") {
|
||||
if ($owner < 0) {
|
||||
$entity = (new Clubs())->get(abs($owner));
|
||||
|
@ -134,11 +130,6 @@ final class AudioPresenter extends OpenVKPresenter
|
|||
}
|
||||
}
|
||||
|
||||
public function renderUploaded()
|
||||
{
|
||||
$this->renderList(null, "uploaded");
|
||||
}
|
||||
|
||||
public function renderEmbed(int $owner, int $id): void
|
||||
{
|
||||
$audio = $this->audios->getByOwnerAndVID($owner, $id);
|
||||
|
@ -850,10 +841,6 @@ final class AudioPresenter extends OpenVKPresenter
|
|||
$audios = [$found_audio];
|
||||
$audiosCount = 1;
|
||||
break;
|
||||
case "uploaded":
|
||||
$stream = $this->audios->getByUploader($this->user->identity);
|
||||
$audios = $stream->page($page, $perPage);
|
||||
$audiosCount = $stream->size();
|
||||
}
|
||||
|
||||
$pagesCount = ceil($audiosCount / $perPage);
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
{/if}
|
||||
{elseif $mode == 'new'}
|
||||
{_audio_new}
|
||||
{elseif $mode == 'uploaded'}
|
||||
{_my_audios_small_uploaded}
|
||||
{elseif $mode == 'popular'}
|
||||
{_audio_popular}
|
||||
{elseif $mode == 'alone_audio'}
|
||||
|
@ -34,12 +32,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div n:if="$mode == 'uploaded'">
|
||||
{_my_audios_small}
|
||||
»
|
||||
{_my_audios_small_uploaded}
|
||||
</div>
|
||||
|
||||
<div n:if="$mode == 'new'">
|
||||
{_audios}
|
||||
»
|
||||
|
@ -66,7 +58,7 @@
|
|||
{block content}
|
||||
{* ref: https://archive.li/P32em *}
|
||||
|
||||
{include "bigplayer.xml", buttonsShow_summary => $audiosCount > 10}
|
||||
{include "bigplayer.xml"}
|
||||
|
||||
<script>
|
||||
window.__current_page_audio_context = null
|
||||
|
@ -76,12 +68,6 @@
|
|||
entity_id: {$ownerId},
|
||||
page: {$page}
|
||||
}
|
||||
{elseif $mode == 'uploaded'}
|
||||
window.__current_page_audio_context = {
|
||||
name: 'uploaded',
|
||||
entity_id: 0,
|
||||
page: {$page}
|
||||
}
|
||||
{elseif $mode == 'alone_audio'}
|
||||
window.__current_page_audio_context = {
|
||||
name: 'alone_audio',
|
||||
|
@ -91,22 +77,6 @@
|
|||
{/if}
|
||||
</script>
|
||||
|
||||
<div class='summaryBarHideable summaryBar summaryBarFlex padding' style="margin: 0px -10px;width: 99.5%;display: none;">
|
||||
<div class='summary'>
|
||||
<b>{tr("is_x_audio", $audiosCount)}</b>
|
||||
</div>
|
||||
|
||||
{include "../components/paginator.xml", conf => (object) [
|
||||
"page" => $page,
|
||||
"count" => $audiosCount,
|
||||
"amount" => sizeof($audios),
|
||||
"perPage" => $perPage ?? OPENVK_DEFAULT_PER_PAGE,
|
||||
"atTop" => true,
|
||||
"space" => 6,
|
||||
"tidy" => true,
|
||||
]}
|
||||
</div>
|
||||
|
||||
<div class="audiosDiv">
|
||||
<div class="audiosContainer audiosSideContainer audiosPaddingContainer" n:if="$mode != 'playlists'">
|
||||
<div n:if="$audiosCount <= 0" style='height: 100%;'>
|
||||
|
|
|
@ -52,9 +52,5 @@
|
|||
<div class="shuffleButton musicIcon" data-tip='simple' data-title="{_shuffle_tip}"></div>
|
||||
<div class="deviceButton musicIcon" data-tip='simple' data-title="{_mute_tip} [M]"></div>
|
||||
</div>
|
||||
|
||||
<div class="absoluteButtons">
|
||||
<div n:if="$buttonsShow_summary" id="summarySwitchButton">-</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<div class="verticalGrayTabs">
|
||||
<div class='with_padding'>
|
||||
<a n:if="isset($thisUser)" n:attr="id => $mode === 'list' && $isMy ? 'used' : 'ki'" href="/audios{$thisUser->getId()}">{_my_music}</a>
|
||||
<a n:attr="id => $mode === 'uploaded' ? 'used' : 'ki'" href="/audios/uploaded">{_my_audios_small_uploaded}</a>
|
||||
{* TODO: show upload link as and plusick (little plus) in button up*}
|
||||
<a n:if="isset($thisUser)" href="/player/upload{if $isMyClub}?gid={abs($ownerId)}{/if}">{_upload_audio}</a>
|
||||
<a n:if="isset($thisUser)" n:attr="id => $mode === 'new' ? 'used' : 'ki'" href="/search?section=audios">{_audio_new}</a>
|
||||
|
@ -14,7 +13,7 @@
|
|||
|
||||
<a n:if="isset($thisUser)" href="/audios/newPlaylist">{_new_playlist}</a>
|
||||
|
||||
{if !$isMy && $mode !== 'popular' && $mode !== 'new' && $mode != 'alone_audio' && $mode != 'uploaded'}
|
||||
{if !$isMy && $mode !== 'popular' && $mode !== 'new' && $mode != 'alone_audio'}
|
||||
<hr>
|
||||
|
||||
<a n:if="!$isMy" n:attr="id => $mode === 'list' ? 'used' : 'ki'" href="/audios{$ownerId}">{if $ownerId > 0}{_music_user}{else}{_music_club}{/if}</a>
|
||||
|
|
|
@ -36,30 +36,24 @@
|
|||
</style>
|
||||
{if $count > 0}
|
||||
{foreach $data as $dat}
|
||||
{if $dat->isDeleted()}
|
||||
<div n:class="deleted_mark, $section == 'photos' ? album-photo : deleted_mark_average">
|
||||
<span>[deleted]</span>
|
||||
{if $section == "posts"}
|
||||
<div class="scroll_node">
|
||||
{include "../components/post.xml", post => $dat, commentSection => true}
|
||||
</div>
|
||||
{elseif $section == "comments"}
|
||||
<div class="scroll_node">
|
||||
{include "../components/comment.xml", comment => $dat, correctLink => true, no_reply_button => true}
|
||||
</div>
|
||||
{elseif $section == "photos"}
|
||||
<div class="album-photo scroll_node" onclick="OpenMiniature(event, {$dat->getURLBySizeId('larger')}, null, {$dat->getPrettyId()}, null)">
|
||||
<a href="/photo{$dat->getPrettyId()}">
|
||||
<img class="album-photo--image" src="{$dat->getURLBySizeId('tinier')}" alt="{$dat->getDescription()}" loading="lazy" />
|
||||
</a>
|
||||
</div>
|
||||
{elseif $section == "videos"}
|
||||
<div class="scroll_node">
|
||||
{include "../components/video.xml", video => $dat}
|
||||
</div>
|
||||
{else}
|
||||
{if $section == "posts"}
|
||||
<div class="scroll_node">
|
||||
{include "../components/post.xml", post => $dat, commentSection => true}
|
||||
</div>
|
||||
{elseif $section == "comments"}
|
||||
<div class="scroll_node">
|
||||
{include "../components/comment.xml", comment => $dat, correctLink => true, no_reply_button => true}
|
||||
</div>
|
||||
{elseif $section == "photos"}
|
||||
<div class="album-photo scroll_node" onclick="OpenMiniature(event, {$dat->getURLBySizeId('larger')}, null, {$dat->getPrettyId()}, null)">
|
||||
<a href="/photo{$dat->getPrettyId()}">
|
||||
<img class="album-photo--image" src="{$dat->getURLBySizeId('tinier')}" alt="{$dat->getDescription()}" loading="lazy" />
|
||||
</a>
|
||||
</div>
|
||||
{elseif $section == "videos"}
|
||||
<div class="scroll_node">
|
||||
{include "../components/video.xml", video => $dat}
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
{else}
|
||||
|
|
|
@ -201,8 +201,6 @@ routes:
|
|||
handler: "Audio->upload"
|
||||
- url: "/audios{num}"
|
||||
handler: "Audio->list"
|
||||
- url: "/audios/uploaded"
|
||||
handler: "Audio->uploaded"
|
||||
- url: "/audio{num}/listen"
|
||||
handler: "Audio->listen"
|
||||
- url: "/audio{num}_{num}"
|
||||
|
|
|
@ -52,34 +52,6 @@
|
|||
height: 46px;
|
||||
}
|
||||
|
||||
.bigPlayer .bigPlayerWrapper .absoluteButtons {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.bigPlayer .bigPlayerWrapper .absoluteButtons > div {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
font-size: 9px;
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #ebebeb;
|
||||
border: 1px solid #c3c3c3;
|
||||
border-bottom: unset;
|
||||
border-right: unset;
|
||||
color: #c3c3c3;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.bigPlayer .bigPlayerWrapper .absoluteButtons > div:active {
|
||||
background: #c3c3c3;
|
||||
color: #ebebeb;
|
||||
}
|
||||
|
||||
/* Play button and arrows */
|
||||
.bigPlayer .playButtons {
|
||||
display: flex;
|
||||
|
@ -341,7 +313,7 @@
|
|||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.audioEmbed.processed .playerButton {
|
||||
.audioEmbed.processed {
|
||||
filter: opacity(0.6);
|
||||
}
|
||||
|
||||
|
|
|
@ -3039,10 +3039,6 @@ a.poll-retract-vote {
|
|||
gap: 1px;
|
||||
}
|
||||
|
||||
.verticalGrayTabsPad {
|
||||
padding: 0px 0px 0px 8px;
|
||||
}
|
||||
|
||||
.searchList hr, .verticalGrayTabs hr {
|
||||
width: 153px;
|
||||
margin-left: 0px;
|
||||
|
@ -4282,7 +4278,3 @@ hr {
|
|||
height: 30px;
|
||||
background-position-y: 9px;
|
||||
}
|
||||
|
||||
.deleted_mark_average {
|
||||
padding: 5px 61px;
|
||||
}
|
||||
|
|
|
@ -54,9 +54,6 @@ window.player = new class {
|
|||
current_track_id = 0
|
||||
tracks = []
|
||||
|
||||
// time type:
|
||||
// 0 - shows remaining time before end
|
||||
// 1 - shows full track time
|
||||
get timeType() {
|
||||
return localStorage.getItem('audio.timeType') ?? 0
|
||||
}
|
||||
|
@ -65,7 +62,6 @@ window.player = new class {
|
|||
localStorage.setItem('audio.timeType', value)
|
||||
}
|
||||
|
||||
// <audio> tag
|
||||
get audioPlayer() {
|
||||
return this.__realAudioPlayer
|
||||
}
|
||||
|
@ -235,9 +231,6 @@ window.player = new class {
|
|||
'query': this.context.object.query,
|
||||
}))
|
||||
break
|
||||
case "uploaded":
|
||||
form_data.append('context', this.context.object.name)
|
||||
break
|
||||
case 'alone_audio':
|
||||
form_data.append('context', this.context.object.name)
|
||||
form_data.append('context_entity', this.context.object.entity_id)
|
||||
|
@ -329,8 +322,6 @@ window.player = new class {
|
|||
|
||||
this.__updateFace()
|
||||
u(this.audioPlayer).trigger('volumechange')
|
||||
|
||||
document.title = ovk_proc_strtr(escapeHtml(`${window.player.currentTrack.performer} — ${window.player.currentTrack.name}`), 255)
|
||||
}
|
||||
|
||||
hasContext() {
|
||||
|
@ -386,7 +377,7 @@ window.player = new class {
|
|||
}
|
||||
|
||||
await this.setTrack(this.previousTrack.id)
|
||||
if(/*!this.currentTrack.available || */this.currentTrack.withdrawn) {
|
||||
if(!this.currentTrack.available || this.currentTrack.withdrawn) {
|
||||
if(!this.previousTrack) {
|
||||
return
|
||||
}
|
||||
|
@ -403,7 +394,7 @@ window.player = new class {
|
|||
}
|
||||
|
||||
await this.setTrack(this.nextTrack.id)
|
||||
if(/*!this.currentTrack.available || */this.currentTrack.withdrawn) {
|
||||
if(!this.currentTrack.available || this.currentTrack.withdrawn) {
|
||||
if(!this.nextTrack) {
|
||||
return
|
||||
}
|
||||
|
@ -673,8 +664,6 @@ window.player = new class {
|
|||
})
|
||||
}
|
||||
|
||||
// the listen counts if you reach half of song
|
||||
// but it doesnt checks on server normally so you can "накрутить" listens
|
||||
async __countListen() {
|
||||
let playlist = 0
|
||||
if(!this.listen_coef) {
|
||||
|
@ -798,10 +787,6 @@ window.player = new class {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
toggleSummary() {
|
||||
$(".summaryBarHideable").slideToggle(300, "linear")
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", async () => {
|
||||
|
@ -1178,25 +1163,7 @@ u(document).on("drop", '.audiosContainer', function(e) {
|
|||
}
|
||||
})
|
||||
|
||||
u(document).on("click", "#summarySwitchButton", (e) => {
|
||||
if(u(".summaryBarHideable").nodes[0].style.overflow == "hidden") {
|
||||
return
|
||||
}
|
||||
|
||||
if(u(e.target).html() == "-") {
|
||||
u(e.target).html("+")
|
||||
} else {
|
||||
u(e.target).html("-")
|
||||
}
|
||||
|
||||
window.player.toggleSummary()
|
||||
})
|
||||
|
||||
u(document).on('contextmenu', '.bigPlayer, .audioEmbed, #ajax_audio_player', (e) => {
|
||||
if(e.shiftKey) {
|
||||
return
|
||||
}
|
||||
|
||||
e.preventDefault()
|
||||
|
||||
u('#ctx_menu').remove()
|
||||
|
@ -1212,10 +1179,6 @@ u(document).on('contextmenu', '.bigPlayer, .audioEmbed, #ajax_audio_player', (e)
|
|||
x = e.pageX - rx
|
||||
y = e.pageY - ry
|
||||
|
||||
if((rect.height + rect.top) + 100 > window.innerHeight) {
|
||||
y = ((rect.height + 120) * -1)
|
||||
}
|
||||
|
||||
const ctx_u = u(`
|
||||
<div id='ctx_menu' style='top:${y}px;left:${x}px;' data-type='ctx_type'>
|
||||
<a id='audio_ctx_copy'>${tr('copy_link_to_audio')}</a>
|
||||
|
@ -1231,7 +1194,7 @@ u(document).on('contextmenu', '.bigPlayer, .audioEmbed, #ajax_audio_player', (e)
|
|||
<a id='audio_ctx_add_to_playlist'>${tr('audio_ctx_add_to_playlist')}</a>
|
||||
${ctx_type == 'main_player' ? `
|
||||
<a id='audio_ctx_clear_context'>${tr('audio_ctx_clear_context')}</a>` : ''}
|
||||
${ctx_type == 'main_player' ? `<a href='https://github.com/mrilyew' target='_blank'>BigPlayer v1.2 by MrIlyew</a>` : ''}
|
||||
${ctx_type == 'main_player' ? `<a href='https://github.com/mrilyew' target='_blank'>BigPlayer v1.1 by MrIlyew</a>` : ''}
|
||||
</div>
|
||||
`)
|
||||
u(parent).append(ctx_u)
|
||||
|
@ -1985,12 +1948,8 @@ $(document).on("click", ".audioEmbed.processed .playerButton", (e) => {
|
|||
title: tr('error'),
|
||||
body: tr('audio_embed_processing'),
|
||||
unique_name: 'processing_notify',
|
||||
buttons: [tr("audio_embed_processing_bait"), tr('ok')],
|
||||
callbacks: [() => {
|
||||
const pl = u(e.target).closest(".audioEmbed")
|
||||
pl.removeClass("processed")
|
||||
pl.find(".playIcon").trigger("click")
|
||||
}, Function.noop]
|
||||
buttons: [tr('ok')],
|
||||
callbacks: [Function.noop]
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -928,8 +928,7 @@
|
|||
"audio_embed_deleted" = "Audio has been deleted";
|
||||
"audio_embed_withdrawn" = "The audio has been withdrawn at the request of the copyright holder";
|
||||
"audio_embed_forbidden" = "The user's privacy settings do not allow this audio to be embedded";
|
||||
"audio_embed_processing" = "Audio is processing.";
|
||||
"audio_embed_processing_bait" = "Play anyway";
|
||||
"audio_embed_processing" = "Audio is still being processed or has not been processed correctly.";
|
||||
|
||||
"audios_count_zero" = "No audios";
|
||||
"audios_count_one" = "One audio";
|
||||
|
@ -948,7 +947,6 @@
|
|||
"audio_search" = "Search";
|
||||
|
||||
"my_audios_small" = "My audios";
|
||||
"my_audios_small_uploaded" = "Uploaded";
|
||||
"my_playlists" = "My playlists";
|
||||
"playlists" = "Playlists";
|
||||
"audios_explicit" = "Contains obscene language";
|
||||
|
@ -1040,12 +1038,6 @@
|
|||
"audio_ctx_play_next" = "Play next";
|
||||
"audio_ctx_clear_context" = "Clear tracks list";
|
||||
|
||||
"is_x_audio_zero" = "No audios";
|
||||
"is_x_audio_one" = "Just one audio.";
|
||||
"is_x_audio_few" = "Just $1 audios.";
|
||||
"is_x_audio_many" = "Just $1 audios.";
|
||||
"is_x_audio_other" = "Just $1 audios.";
|
||||
|
||||
/* Notifications */
|
||||
|
||||
"feedback" = "Feedback";
|
||||
|
|
|
@ -883,8 +883,7 @@
|
|||
"audio_embed_deleted" = "Аудиозапись была удалена";
|
||||
"audio_embed_withdrawn" = "Аудиозапись была изъята по обращению правообладателя.";
|
||||
"audio_embed_forbidden" = "Настройки приватности пользователя не позволяют встраивать эту композицию";
|
||||
"audio_embed_processing" = "Аудио находится в обработке.";
|
||||
"audio_embed_processing_bait" = "Всё равно хочу воспроизвести";
|
||||
"audio_embed_processing" = "Аудио ещё обрабатывается, либо обработалось неправильно.";
|
||||
|
||||
"audios_count_zero" = "Нет аудиозаписей";
|
||||
"audios_count_one" = "Одна аудиозапись"; /* сингл */
|
||||
|
@ -903,7 +902,6 @@
|
|||
"audio_search" = "Поиск";
|
||||
|
||||
"my_audios_small" = "Мои аудиозаписи";
|
||||
"my_audios_small_uploaded" = "Загруженное";
|
||||
"my_playlists" = "Мои плейлисты";
|
||||
"playlists" = "Плейлисты";
|
||||
"audios_explicit" = "Содержит нецензурную лексику";
|
||||
|
@ -996,12 +994,6 @@
|
|||
"audio_ctx_play_next" = "Воспроизвести следующим";
|
||||
"audio_ctx_clear_context" = "Очистить список треков";
|
||||
|
||||
"is_x_audio_zero" = "Нету аудиозаписей";
|
||||
"is_x_audio_one" = "Всего одна аудиозапись.";
|
||||
"is_x_audio_few" = "Всего $1 аудиозаписи.";
|
||||
"is_x_audio_many" = "Всего $1 аудиозаписей.";
|
||||
"is_x_audio_other" = "Всего $1 аудиозаписей.";
|
||||
|
||||
/* Notifications */
|
||||
|
||||
"feedback" = "Ответы";
|
||||
|
|
Loading…
Reference in a new issue