From 246dd4ab9113e7115ff9814c2f5039189aa40f63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B8=D1=80=D0=B8=D0=BB=D0=BB?= <90477403+zavolo@users.noreply.github.com> Date: Sun, 1 Jun 2025 16:28:16 +0300 Subject: [PATCH 01/74] fix(api): handle Apps API for OAuth compatibility (#1313) --- Web/Presenters/InternalAPIPresenter.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Web/Presenters/InternalAPIPresenter.php b/Web/Presenters/InternalAPIPresenter.php index 2e3a33ca..aa5a7ab5 100644 --- a/Web/Presenters/InternalAPIPresenter.php +++ b/Web/Presenters/InternalAPIPresenter.php @@ -13,6 +13,8 @@ final class InternalAPIPresenter extends OpenVKPresenter private function fail(int $code, string $message): void { header("HTTP/1.1 400 Bad Request"); + header("Content-Type: application/x-msgpack"); + exit(MessagePack::pack([ "brpc" => 1, "error" => [ @@ -25,6 +27,7 @@ final class InternalAPIPresenter extends OpenVKPresenter private function succ($payload): void { + header("Content-Type: application/x-msgpack"); exit(MessagePack::pack([ "brpc" => 1, "result" => $payload, From 14a07450d3ab63ee35cf87aff27fc38c9701b8d2 Mon Sep 17 00:00:00 2001 From: Slava Petrov <55963296+saursvepur@users.noreply.github.com> Date: Sun, 1 Jun 2025 16:30:25 +0300 Subject: [PATCH 02/74] feat(admin): ability to hide user's posts from global feed (#1291) --- Web/Models/Entities/User.php | 5 +++++ Web/Presenters/AdminPresenter.php | 1 + Web/Presenters/WallPresenter.php | 2 +- Web/Presenters/templates/Admin/User.xml | 4 ++++ install/sqls/00056-hide-from-global-feed-user.sql | 1 + locales/en.strings | 1 + locales/ru.strings | 1 + 7 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 install/sqls/00056-hide-from-global-feed-user.sql diff --git a/Web/Models/Entities/User.php b/Web/Models/Entities/User.php index 8749b725..b2da3f46 100644 --- a/Web/Models/Entities/User.php +++ b/Web/Models/Entities/User.php @@ -1487,6 +1487,11 @@ class User extends RowModel return $this->isClosed(); } + public function HideGlobalFeed(): bool + { + return (bool) $this->getRecord()->hide_global_feed; + } + public function getRealId() { return $this->getId(); diff --git a/Web/Presenters/AdminPresenter.php b/Web/Presenters/AdminPresenter.php index 8fad1052..1956b8e9 100644 --- a/Web/Presenters/AdminPresenter.php +++ b/Web/Presenters/AdminPresenter.php @@ -119,6 +119,7 @@ final class AdminPresenter extends OpenVKPresenter $user->setLast_Name($this->postParam("last_name")); $user->setPseudo($this->postParam("nickname")); $user->setStatus($this->postParam("status")); + $user->setHide_Global_Feed(empty($this->postParam("hide_global_feed") ? 0 : 1)); if (!$user->setShortCode(empty($this->postParam("shortcode")) ? null : $this->postParam("shortcode"))) { $this->flash("err", tr("error"), tr("error_shorturl_incorrect")); } diff --git a/Web/Presenters/WallPresenter.php b/Web/Presenters/WallPresenter.php index f4a8e898..89b1915d 100644 --- a/Web/Presenters/WallPresenter.php +++ b/Web/Presenters/WallPresenter.php @@ -210,7 +210,7 @@ final class WallPresenter extends OpenVKPresenter $pPage = min((int) ($_GET["posts"] ?? OPENVK_DEFAULT_PER_PAGE), 50); $queryBase = "FROM `posts` LEFT JOIN `groups` ON GREATEST(`posts`.`wall`, 0) = 0 AND `groups`.`id` = ABS(`posts`.`wall`) LEFT JOIN `profiles` ON LEAST(`posts`.`wall`, 0) = 0 AND `profiles`.`id` = ABS(`posts`.`wall`)"; - $queryBase .= "WHERE (`groups`.`hide_from_global_feed` = 0 OR `groups`.`name` IS NULL) AND (`profiles`.`profile_type` = 0 OR `profiles`.`first_name` IS NULL) AND `posts`.`deleted` = 0 AND `posts`.`suggested` = 0"; + $queryBase .= "WHERE (`groups`.`hide_from_global_feed` = 0 OR `groups`.`name` IS NULL) AND ((`profiles`.`profile_type` = 0 AND `profiles`.`hide_global_feed` = 0) OR `profiles`.`first_name` IS NULL) AND `posts`.`deleted` = 0 AND `posts`.`suggested` = 0"; if ($this->user->identity->getNsfwTolerance() === User::NSFW_INTOLERANT) { $queryBase .= " AND `nsfw` = 0"; diff --git a/Web/Presenters/templates/Admin/User.xml b/Web/Presenters/templates/Admin/User.xml index 93cc0ad1..063a4c67 100644 --- a/Web/Presenters/templates/Admin/User.xml +++ b/Web/Presenters/templates/Admin/User.xml @@ -60,6 +60,10 @@ isVerified()} checked {/if} /> +
+ + +
" + + MessageBox(tr("report_question"), uReportMsgTxt, [tr("confirm_m"), tr("cancel")], [ + (function() { + res = document.querySelector("#uReportMsgInput").value; + xhr = new XMLHttpRequest(); + xhr.open("GET", "/report/" + postId + "?reason=" + res + "&type=post", true); + xhr.onload = (function() { + if(xhr.responseText.indexOf("reason") === -1) + MessageBox(tr("error"), tr("error_sending_report"), ["OK"], [Function.noop]); + else + MessageBox(tr("action_successfully"), tr("will_be_watched"), ["OK"], [Function.noop]); + }); + xhr.send(null); + }), + Function.noop + ]); + } \ No newline at end of file From b2d389a7b8128a6647dbe69c91cb53cb15bcecc5 Mon Sep 17 00:00:00 2001 From: mrilyew <99399973+mrilyew@users.noreply.github.com> Date: Fri, 23 May 2025 21:28:01 +0300 Subject: [PATCH 04/74] fix(video api): fix items bug --- VKAPI/Handlers/Video.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/VKAPI/Handlers/Video.php b/VKAPI/Handlers/Video.php index f8cecf05..43d7a468 100755 --- a/VKAPI/Handlers/Video.php +++ b/VKAPI/Handlers/Video.php @@ -20,12 +20,18 @@ final class Video extends VKAPIRequestHandler $this->requireUser(); if (!empty($videos)) { - $vids = explode(',', $videos); + $vids = array_unique(explode(',', $videos)); + + if (sizeof($vids) > 100) { + $this->fail(15, "Too many ids given"); + } + $profiles = []; $groups = []; + $items = []; + foreach ($vids as $vid) { $id = explode("_", $vid); - $items = []; $video = (new VideosRepo())->getByOwnerAndVID(intval($id[0]), intval($id[1])); if ($video && !$video->isDeleted()) { From 6a882aeeb4c3d831c720e8b4f68d3e3b36275edd Mon Sep 17 00:00:00 2001 From: mrilyew <99399973+mrilyew@users.noreply.github.com> Date: Fri, 23 May 2025 21:31:42 +0300 Subject: [PATCH 05/74] feat(wall): remove hidePanel() --- Web/Presenters/templates/components/wall.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Web/Presenters/templates/components/wall.xml b/Web/Presenters/templates/components/wall.xml index d6b68b53..080996bd 100644 --- a/Web/Presenters/templates/components/wall.xml +++ b/Web/Presenters/templates/components/wall.xml @@ -1,5 +1,5 @@
-
+
{_wall} {tr("wall", $count)} From cf09251a9071bf8b84bb027a0b6fbbf0e72ea2ed Mon Sep 17 00:00:00 2001 From: mrilyew <99399973+mrilyew@users.noreply.github.com> Date: Fri, 23 May 2025 21:36:51 +0300 Subject: [PATCH 06/74] feat(ajax): show loading cursor --- Web/static/css/main.css | 4 ++++ Web/static/js/router.js | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Web/static/css/main.css b/Web/static/css/main.css index 0332d278..cc63a36f 100644 --- a/Web/static/css/main.css +++ b/Web/static/css/main.css @@ -14,6 +14,10 @@ body { line-height: 1.19; } +body.ajax_request_made { + cursor: progress; +} + body, .ovk-fullscreen-dimmer, .ovk-photo-view-dimmer { scrollbar-gutter: stable both-edges; } diff --git a/Web/static/js/router.js b/Web/static/js/router.js index 2a3a6c6a..4882926a 100644 --- a/Web/static/js/router.js +++ b/Web/static/js/router.js @@ -202,7 +202,7 @@ window.router = new class { if(this.prev_page_html && this.prev_page_html.pathname != location.pathname) { this.prev_page_html = null } - + const push_url = params.push_state ?? true const next_page_url = new URL(url) if(push_url) { @@ -210,6 +210,8 @@ window.router = new class { } else { history.replaceState({'from_router': 1}, '', url) } + + u('body').addClass('ajax_request_made') const parser = new DOMParser const next_page_request = await fetch(next_page_url, { @@ -227,6 +229,8 @@ window.router = new class { this.__closeMsgs() this.__unlinkObservers() + + u('body').removeClass('ajax_request_made') try { this.__appendPage(parsed_content) From 7bf7050cdcd3de42c8e95a953a11afdd6c7acd45 Mon Sep 17 00:00:00 2001 From: mrilyew <99399973+mrilyew@users.noreply.github.com> Date: Fri, 23 May 2025 21:43:10 +0300 Subject: [PATCH 07/74] feat(tips): add delay --- Web/static/js/al_mentions.js | 1 + Web/static/js/al_wall.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Web/static/js/al_mentions.js b/Web/static/js/al_mentions.js index d324cca6..595b04b9 100644 --- a/Web/static/js/al_mentions.js +++ b/Web/static/js/al_mentions.js @@ -23,6 +23,7 @@ tippy.delegate("body", { target: '.mention', theme: "light vk", content: "⌛", + delay: 300, allowHTML: true, interactive: true, interactiveDebounce: 500, diff --git a/Web/static/js/al_wall.js b/Web/static/js/al_wall.js index 6568ba51..1f6c0902 100644 --- a/Web/static/js/al_wall.js +++ b/Web/static/js/al_wall.js @@ -825,6 +825,7 @@ tippy.delegate("body", { target: '.client_app', theme: "light vk", content: "⌛", + delay: 400, allowHTML: true, interactive: true, interactiveDebounce: 500, @@ -864,6 +865,7 @@ tippy.delegate('body', { target: `.post-like-button[data-type]:not([data-likes="0"])`, theme: "special vk", content: "⌛", + delay: 400, allowHTML: true, interactive: true, interactiveDebounce: 500, From 7c887e9f9cb038b357398d1030e22ce7f3ca1d84 Mon Sep 17 00:00:00 2001 From: mrilyew <99399973+mrilyew@users.noreply.github.com> Date: Fri, 23 May 2025 21:46:12 +0300 Subject: [PATCH 08/74] fix(docs): set correct margins --- Web/static/css/main.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Web/static/css/main.css b/Web/static/css/main.css index cc63a36f..730df906 100644 --- a/Web/static/css/main.css +++ b/Web/static/css/main.css @@ -4174,11 +4174,12 @@ hr { justify-content: center; border-radius: 2px; height: 17px; - padding: 2px 0px; + padding: 3px 0px; } .docListViewItem .doc_icon.no_image span { color: #6b6b6b; + font-weight: bold; } .doc_icon.no_image span::before { From 1cacf6a8b54bd9dec685c8d5a0463d46e6123e8b Mon Sep 17 00:00:00 2001 From: mrilyew <99399973+mrilyew@users.noreply.github.com> Date: Fri, 23 May 2025 22:42:55 +0300 Subject: [PATCH 09/74] feat(docs): ux changes --- Web/Presenters/DocumentsPresenter.php | 6 ++-- Web/Presenters/templates/Documents/List.xml | 33 ++++++++++----------- Web/static/css/main.css | 2 +- 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/Web/Presenters/DocumentsPresenter.php b/Web/Presenters/DocumentsPresenter.php index b003b932..78f17bfc 100644 --- a/Web/Presenters/DocumentsPresenter.php +++ b/Web/Presenters/DocumentsPresenter.php @@ -73,10 +73,10 @@ final class DocumentsPresenter extends OpenVKPresenter $this->template->count = $docs->size(); $this->template->docs = iterator_to_array($docs->page($page, OPENVK_DEFAULT_PER_PAGE)); $this->template->locale_string = "you_have_x_documents"; - if ($owner_id < 0) { - $this->template->locale_string = "group_has_x_documents"; - } elseif ($current_tab != 0) { + if ($current_tab != 0) { $this->template->locale_string = "x_documents_in_tab"; + } else if ($owner_id < 0) { + $this->template->locale_string = "group_has_x_documents"; } $this->template->canUpload = $owner_id == $this->user->id || $this->template->group->canBeModifiedBy($this->user->identity); diff --git a/Web/Presenters/templates/Documents/List.xml b/Web/Presenters/templates/Documents/List.xml index ad9a9948..5007de25 100644 --- a/Web/Presenters/templates/Documents/List.xml +++ b/Web/Presenters/templates/Documents/List.xml @@ -20,28 +20,25 @@ {block content} {var $is_gallery = $current_tab == 3 || $current_tab == 4}
- -
-
- -
- - {$tab["name"]} - {$tab["count"]} - +
-
+
{tr($locale_string, $count)}.
{_post_as_group} + {_post_as_group} -