diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index ddc730d6..04a1b344 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -1 +1 @@
-custom: "https://openvk.su/donate"
\ No newline at end of file
+custom: "https://ovk.to/donate"
diff --git a/.github/workflows/build-base.yaml b/.github/workflows/build-base.yaml
index 728c96b9..b053d398 100644
--- a/.github/workflows/build-base.yaml
+++ b/.github/workflows/build-base.yaml
@@ -24,12 +24,18 @@ jobs:
id: buildx
uses: docker/setup-buildx-action@v2
+ - name: Change repository string to lowercase
+ id: repositorystring
+ uses: Entepotenz/change-string-case-action-min-dependencies@v1.1.0
+ with:
+ string: ${{ github.repository }}
+
- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build cli image
run: |
- IMAGE_NAME=ghcr.io/${{ github.repository }}/$BASE_IMAGE_NAME:$BASE_IMAGE_VERSION-cli
+ IMAGE_NAME=ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/$BASE_IMAGE_NAME:$BASE_IMAGE_VERSION-cli
docker buildx build --platform linux/amd64,linux/arm64 -t $IMAGE_NAME . --push -f install/automated/docker/base-php-cli.Dockerfile --build-arg VERSION=$BASE_IMAGE_VERSION
@@ -47,12 +53,18 @@ jobs:
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
+
+ - name: Change repository string to lowercase
+ id: repositorystring
+ uses: Entepotenz/change-string-case-action-min-dependencies@v1.1.0
+ with:
+ string: ${{ github.repository }}
- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
-
+
- name: Build apache image
run: |
- IMAGE_NAME=ghcr.io/${{ github.repository }}/$BASE_IMAGE_NAME:$BASE_IMAGE_VERSION-apache
+ IMAGE_NAME=ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/$BASE_IMAGE_NAME:$BASE_IMAGE_VERSION-apache
docker buildx build --platform linux/amd64,linux/arm64 -t $IMAGE_NAME . --push -f install/automated/docker/base-php-apache.Dockerfile --build-arg VERSION=$BASE_IMAGE_VERSION
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index d4645520..24363f97 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -36,12 +36,18 @@ jobs:
id: buildx
uses: docker/setup-buildx-action@v2
+ - name: Change repository string to lowercase
+ id: repositorystring
+ uses: Entepotenz/change-string-case-action-min-dependencies@v1.1.0
+ with:
+ string: ${{ github.repository }}
+
- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build base image
run: |
- IMAGE_ID=ghcr.io/${{ github.repository }}/$BASE_IMAGE_NAME
+ IMAGE_ID=ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/$BASE_IMAGE_NAME
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
@@ -49,16 +55,16 @@ jobs:
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
- docker buildx build --platform linux/amd64,linux/arm64 -t $IMAGE_ID:$VERSION . --push -f install/automated/docker/openvk.Dockerfile --build-arg GITREPO=${{ github.repository }}
+ docker buildx build --platform linux/amd64,linux/arm64 -t $IMAGE_ID:$VERSION . --push -f install/automated/docker/openvk.Dockerfile --build-arg GITREPO=${{ steps.repositorystring.outputs.lowercase }}
- name: Build MariaDB primary image
run: |
- IMAGE_NAME=ghcr.io/${{ github.repository }}/$DB_IMAGE_NAME:$DB_VERSION-primary
+ IMAGE_NAME=ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/$DB_IMAGE_NAME:$DB_VERSION-primary
docker buildx build --platform linux/amd64,linux/arm64 -t $IMAGE_NAME . --push -f install/automated/docker/mariadb-primary.Dockerfile --build-arg VERSION=$DB_VERSION
- name: Build MariaDB event image
run: |
- IMAGE_NAME=ghcr.io/${{ github.repository }}/$EVENT_IMAGE_NAME:$DB_VERSION-eventdb
+ IMAGE_NAME=ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/$EVENT_IMAGE_NAME:$DB_VERSION-eventdb
docker buildx build --platform linux/amd64,linux/arm64 -t $IMAGE_NAME . --push -f install/automated/docker/mariadb-eventdb.Dockerfile --build-arg VERSION=$DB_VERSION
\ No newline at end of file
diff --git a/Email/hello.eml.latte b/Email/hello.eml.latte
index 48fd562e..8ae66499 100644
--- a/Email/hello.eml.latte
+++ b/Email/hello.eml.latte
@@ -12,7 +12,7 @@
- Добро пожаловать в OpenVK! Приятного времяприпровождения, надеюсь вам понравится.
Если появились вопросы, касаемые нашего сайта, пишите сюда
+ Добро пожаловать в OpenVK! Приятного времяприпровождения, надеюсь вам понравится.
Если появились вопросы, касаемые нашего сайта, пишите сюда
|
diff --git a/README.md b/README.md
index 7a2c91b5..82df13e7 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# OpenVK
+# OpenVK
_[Русский](README_RU.md)_
@@ -6,7 +6,7 @@ _[Русский](README_RU.md)_
VKontakte belongs to Pavel Durov and VK Group.
-To be honest, we don't know whether if it even works. However, this version is maintained and we will be happy to accept your bugreports [in our bug tracker](https://github.com/openvk/openvk/projects/1). You should also be able to submit them using [ticketing system](https://openvk.su/support?act=new) (you will need an OpenVK account for this).
+To be honest, we don't know whether if it even works. However, this version is maintained and we will be happy to accept your bugreports [in our bug tracker](https://github.com/openvk/openvk/projects/1). You should also be able to submit them using [ticketing system](https://ovk.to/support?act=new) (you will need an OpenVK account for this).
## When's the release?
@@ -26,6 +26,14 @@ However, OVK makes use of Chandler Application Server. This software requires ex
If you want, you can add your instance to the list above so that people can register there.
+### System requirements
+
+Here is our minimum hardware recommendation:
+
+* **CPU: Recent** (AMD Zen2 or equivalent) quad-core 2GHz+ CPU
+* **RAM:** At least 2GB RAM (we recommend 6GB or 8GB for OpenVK with Kafka)
+* **Minimum database space:** 10GB
+
### Installation procedure
1. Install PHP 7.4, web-server, Composer, Node.js, Yarn and [Chandler](https://github.com/openvk/chandler)
@@ -66,7 +74,7 @@ Once you are done, you can login as a system administrator on the network itself
* **Password**: `admin`
* It is recommended to change the password of the built-in account or disable it.
-💡 Confused? Full installation walkthrough is available [here](https://docs.openvk.uk/openvk_engine/centos8_installation/) (CentOS 8 [and](https://almalinux.org/) [family](https://yum.oracle.com/oracle-linux-isos.html)).
+💡 Confused? Full installation walkthrough is available [here](https://docs.ovk.to/openvk_engine/centos8_installation/) (CentOS 8 [and](https://almalinux.org/) [family](https://yum.oracle.com/oracle-linux-isos.html)).
### Looking for Docker or Kubernetes deployment?
See `install/automated/docker/README.md` and `install/automated/kubernetes/README.md` for Docker and Kubernetes deployment instructions.
@@ -80,7 +88,7 @@ It depends. You can keep the sources to yourself if you do not plan to distribut
You may reach out to us via:
* [Bug Tracker](https://github.com/openvk/openvk/projects/1)
-* [Ticketing System](https://openvk.su/support?act=new)
+* [Ticketing System](https://ovk.to/support?act=new)
* Telegram Chat: Go to [our channel](https://t.me/openvkenglish) and open discussion in our channel menu.
* [Reddit](https://www.reddit.com/r/openvk/)
* [GitHub Discussions](https://github.com/openvk/openvk/discussions)
diff --git a/README_RU.md b/README_RU.md
index 7de91c39..fa09cabe 100644
--- a/README_RU.md
+++ b/README_RU.md
@@ -1,4 +1,4 @@
-# OpenVK
+# OpenVK
_[English](README.md)_
@@ -6,7 +6,7 @@ _[English](README.md)_
ВКонтакте принадлежит Павлу Дурову и VK Group.
-Честно говоря, мы даже не знаем, работает ли она вообще. Однако, эта версия поддерживается, и мы будем рады принять ваши сообщения об ошибках [в нашем баг-трекере](https://github.com/openvk/openvk/projects/1). Вы также можете отправлять их через [вкладку "Помощь"](https://openvk.su/support?act=new) (для этого вам понадобится учетная запись OpenVK).
+Честно говоря, мы даже не знаем, работает ли она вообще. Однако, эта версия поддерживается, и мы будем рады принять ваши сообщения об ошибках [в нашем баг-трекере](https://github.com/openvk/openvk/projects/1). Вы также можете отправлять их через [вкладку "Помощь"](https://ovk.to/support?act=new) (для этого вам понадобится учетная запись OpenVK).
## Когда выйдет релизная версия?
@@ -66,7 +66,7 @@ ln -s /path/to/chandler/extensions/available/openvk /path/to/chandler/extensions
* **Пароль**: `admin`
* Перед использованием встроенной учетной записи рекомендуется сменить пароль или отключить её.
-💡Запутались? Полное руководство по установке доступно [здесь](https://docs.openvk.uk/openvk_engine/centos8_installation/) (CentOS 8 [и](https://almalinux.org/ru/) [семейство](https://yum.oracle.com/oracle-linux-isos.html)).
+💡Запутались? Полное руководство по установке доступно [здесь](https://docs.ovk.to/openvk_engine/centos8_installation/) (CentOS 8 [и](https://almalinux.org/ru/) [семейство](https://yum.oracle.com/oracle-linux-isos.html)).
# Установка в Docker/Kubernetes
Подробные иструкции можно найти в `install/automated/docker/README.md` и `install/automated/kubernetes/README.md` соответственно.
@@ -80,7 +80,7 @@ ln -s /path/to/chandler/extensions/available/openvk /path/to/chandler/extensions
Вы можете связаться с нами через:
* [Баг-трекер](https://github.com/openvk/openvk/projects/1)
-* [Помощь в OVK](https://openvk.su/support?act=new)
+* [Помощь в OVK](https://ovk.to/support?act=new)
* Telegram-чат: Перейдите на [наш канал](https://t.me/openvk) и откройте обсуждение в меню нашего канала.
* [Reddit](https://www.reddit.com/r/openvk/)
* [GitHub Discussions](https://github.com/openvk/openvk/discussions)
diff --git a/ServiceAPI/Apps.php b/ServiceAPI/Apps.php
index 6504c23e..a09dc49f 100644
--- a/ServiceAPI/Apps.php
+++ b/ServiceAPI/Apps.php
@@ -1,8 +1,11 @@
withdrawCoins();
$resolve($coins);
}
+
+ function getRegularToken(string $clientName, bool $acceptsStale, callable $resolve, callable $reject): void
+ {
+ $token = NULL;
+ $stale = true;
+ if($acceptsStale)
+ $token = (new APITokens)->getStaleByUser($this->user->getId(), $clientName);
+
+ if(is_null($token)) {
+ $stale = false;
+ $token = new APIToken;
+ $token->setUser($this->user);
+ $token->setPlatform($clientName ?? (new WhichBrowser\Parser(getallheaders()))->toString());
+ $token->save();
+ }
+
+ $resolve([
+ 'is_stale' => $stale,
+ 'token' => $token->getFormattedToken(),
+ ]);
+ }
}
\ No newline at end of file
diff --git a/VKAPI/Handlers/Audio.php b/VKAPI/Handlers/Audio.php
index 413a2a3a..004daef4 100644
--- a/VKAPI/Handlers/Audio.php
+++ b/VKAPI/Handlers/Audio.php
@@ -485,7 +485,7 @@ final class Audio extends VKAPIRequestHandler
$this->requireUser();
$this->willExecuteWriteAction();
- if(!is_null($album_id))
+ if(!is_null($album_id))
$this->fail(10, "album_id not implemented");
// TODO get rid of dups
diff --git a/VKAPI/Handlers/Friends.php b/VKAPI/Handlers/Friends.php
index 56af8d11..51046be4 100644
--- a/VKAPI/Handlers/Friends.php
+++ b/VKAPI/Handlers/Friends.php
@@ -147,7 +147,7 @@ final class Friends extends VKAPIRequestHandler
return $response;
}
- function getRequests(string $fields = "", int $offset = 0, int $count = 100, int $extended = 0): object
+ function getRequests(string $fields = "", int $out = 0, int $offset = 0, int $count = 100, int $extended = 0): object
{
if ($count >= 1000)
$this->fail(100, "One of the required parameters was not passed or is invalid.");
@@ -158,9 +158,18 @@ final class Friends extends VKAPIRequestHandler
$offset++;
$followers = [];
- foreach($this->getUser()->getFollowers($offset, $count) as $follower) {
- $followers[$i] = $follower->getId();
- $i++;
+ if ($out != 0) {
+ foreach($this->getUser()->getFollowers($offset, $count) as $follower) {
+ $followers[$i] = $follower->getId();
+ $i++;
+ }
+ }
+ else
+ {
+ foreach($this->getUser()->getRequests($offset, $count) as $follower) {
+ $followers[$i] = $follower->getId();
+ $i++;
+ }
}
$response = $followers;
diff --git a/VKAPI/Handlers/Groups.php b/VKAPI/Handlers/Groups.php
index ffa4fedd..f83079ec 100644
--- a/VKAPI/Handlers/Groups.php
+++ b/VKAPI/Handlers/Groups.php
@@ -347,7 +347,10 @@ final class Groups extends VKAPIRequestHandler
!empty($topics) ? $club->setEveryone_Can_Create_Topics($topics) : NULL;
!empty($adminlist) ? $club->setAdministrators_List_Display($adminlist) : NULL;
!empty($topicsAboveWall) ? $club->setDisplay_Topics_Above_Wall($topicsAboveWall) : NULL;
- !empty($hideFromGlobalFeed) ? $club->setHide_From_Global_Feed($hideFromGlobalFeed) : NULL;
+
+ if (!$club->isHidingFromGlobalFeedEnforced()) {
+ !empty($hideFromGlobalFeed) ? $club->setHide_From_Global_Feed($hideFromGlobalFeed) : NULL;
+ }
in_array($audio, [0, 1]) ? $club->setEveryone_can_upload_audios($audio) : NULL;
diff --git a/VKAPI/Handlers/Users.php b/VKAPI/Handlers/Users.php
index 5ad59541..f6e5823f 100644
--- a/VKAPI/Handlers/Users.php
+++ b/VKAPI/Handlers/Users.php
@@ -246,6 +246,9 @@ final class Users extends VKAPIRequestHandler
"notes_count" => (new Notes)->getUserNotesCount($usr)
];
break;
+ case "guid":
+ $response[$i]->guid = $usr->getChandlerGUID();
+ break;
}
}
diff --git a/VKAPI/Handlers/Utils.php b/VKAPI/Handlers/Utils.php
index 5350a64f..a1c4f3b5 100644
--- a/VKAPI/Handlers/Utils.php
+++ b/VKAPI/Handlers/Utils.php
@@ -22,7 +22,7 @@ final class Utils extends VKAPIRequestHandler
"object_id" => (int) substr($screen_name, strlen("club")),
"type" => "group"
];
- }
+ } else $this->fail(104, "Not found");
} else {
$user = (new Users)->getByShortURL($screen_name);
if($user) {
@@ -39,8 +39,17 @@ final class Utils extends VKAPIRequestHandler
"type" => "group"
];
}
-
- return (object) [];
+
+ $this->fail(104, "Not found");
}
}
+
+ function resolveGuid(string $guid): object
+ {
+ $user = (new Users)->getByChandlerUserId($guid);
+ if (is_null($user))
+ $this->fail(104, "Not found");
+
+ return $user->toVkApiStruct($this->getUser());
+ }
}
diff --git a/VKAPI/README.md b/VKAPI/README.md
index 75918afc..08c8408b 100644
--- a/VKAPI/README.md
+++ b/VKAPI/README.md
@@ -5,7 +5,7 @@ exceptions. It is still a work-in-progress functionality.
**Note**: requests to API are routed through
openvk.Web.Presenters.VKAPIPresenter, this dir contains only handlers.
-[Documentation for API clients](https://docs.openvk.uk/openvk_engine/api/description/)
+[Documentation for API clients](https://docs.ovk.to/openvk_engine/api/description/)
## Implementing API methods
diff --git a/Web/Models/Entities/Club.php b/Web/Models/Entities/Club.php
index a46eb573..dc1c356e 100644
--- a/Web/Models/Entities/Club.php
+++ b/Web/Models/Entities/Club.php
@@ -152,6 +152,11 @@ class Club extends RowModel
return (bool) $this->getRecord()->hide_from_global_feed;
}
+ function isHidingFromGlobalFeedEnforced(): bool
+ {
+ return (bool) $this->getRecord()->enforce_hiding_from_global_feed;
+ }
+
function getType(): int
{
return $this->getRecord()->type;
diff --git a/Web/Models/Entities/Photo.php b/Web/Models/Entities/Photo.php
index 4cba7734..3ea46939 100644
--- a/Web/Models/Entities/Photo.php
+++ b/Web/Models/Entities/Photo.php
@@ -114,7 +114,7 @@ class Photo extends Media
return true;
}
- function crop(real $left, real $top, real $width, real $height): void
+ function crop(float $left, float $top, float $width, float $height): void
{
if(isset($this->changes["hash"]))
$hash = $this->changes["hash"];
diff --git a/Web/Models/Entities/Traits/TSubscribable.php b/Web/Models/Entities/Traits/TSubscribable.php
index 802bc427..7d1c0d28 100644
--- a/Web/Models/Entities/Traits/TSubscribable.php
+++ b/Web/Models/Entities/Traits/TSubscribable.php
@@ -39,4 +39,25 @@ trait TSubscribable
$sub->delete();
return false;
}
+
+ function changeFlags(User $user, int $flags, bool $reverse): bool
+ {
+ $ctx = DatabaseConnection::i()->getContext();
+ $data = [
+ "follower" => $reverse ? $this->getId() : $user->getId(),
+ "model" => static::class,
+ "target" => $reverse ? $user->getId() : $this->getId(),
+ ];
+ $sub = $ctx->table("subscriptions")->where($data);
+
+ bdump($data);
+
+ if (!$sub)
+ return false;
+
+ $sub->update([
+ 'flags' => $flags
+ ]);
+ return true;
+ }
}
diff --git a/Web/Models/Entities/User.php b/Web/Models/Entities/User.php
index 4f1fbff1..933ab486 100644
--- a/Web/Models/Entities/User.php
+++ b/Web/Models/Entities/User.php
@@ -592,6 +592,16 @@ class User extends RowModel
return $this->_abstractRelationCount("get-followers");
}
+ function getRequests(int $page = 1, int $limit = 6): \Traversable
+ {
+ return $this->_abstractRelationGenerator("get-requests", $page, $limit);
+ }
+
+ function getRequestsCount(): int
+ {
+ return $this->_abstractRelationCount("get-requests");
+ }
+
function getSubscriptions(int $page = 1, int $limit = 6): \Traversable
{
return $this->_abstractRelationGenerator("get-subscriptions-user", $page, $limit);
diff --git a/Web/Models/Repositories/APITokens.php b/Web/Models/Repositories/APITokens.php
index 592688a8..8a9f2870 100644
--- a/Web/Models/Repositories/APITokens.php
+++ b/Web/Models/Repositories/APITokens.php
@@ -23,4 +23,13 @@ class APITokens extends Repository
return $token;
}
+
+ function getStaleByUser(int $userId, string $platform, bool $withRevoked = false): ?APIToken
+ {
+ return $this->toEntity($this->table->where([
+ 'user' => $userId,
+ 'platform' => $platform,
+ 'deleted' => $withRevoked,
+ ])->fetch());
+ }
}
diff --git a/Web/Models/Repositories/Users.php b/Web/Models/Repositories/Users.php
index 8e29d866..e826f3b3 100644
--- a/Web/Models/Repositories/Users.php
+++ b/Web/Models/Repositories/Users.php
@@ -44,9 +44,14 @@ class Users
return $alias->getUser();
}
+ function getByChandlerUserId(string $cid): ?User
+ {
+ return $this->toUser($this->users->where("user", $cid)->fetch());
+ }
+
function getByChandlerUser(?ChandlerUser $user): ?User
{
- return $user ? $this->toUser($this->users->where("user", $user->getId())->fetch()) : NULL;
+ return $user ? $this->getByChandlerUserId($user->getId()) : NULL;
}
function find(string $query, array $pars = [], string $sort = "id DESC"): Util\EntityStream
diff --git a/Web/Models/sql/get-followers.tsql b/Web/Models/sql/get-followers.tsql
index 552aafb8..b07b1c69 100644
--- a/Web/Models/sql/get-followers.tsql
+++ b/Web/Models/sql/get-followers.tsql
@@ -1,5 +1,5 @@
(SELECT DISTINCT(follower) AS __id FROM
- (SELECT follower FROM subscriptions WHERE target=? AND model="openvk\\Web\\Models\\Entities\\User") u0
+ (SELECT follower, flags FROM subscriptions WHERE target=? AND model="openvk\\Web\\Models\\Entities\\User") u0
LEFT JOIN
(SELECT target FROM subscriptions WHERE follower=? AND model="openvk\\Web\\Models\\Entities\\User") u1
ON u0.follower = u1.target WHERE u1.target IS NULL) u2
diff --git a/Web/Models/sql/get-requests.tsql b/Web/Models/sql/get-requests.tsql
new file mode 100755
index 00000000..0220e340
--- /dev/null
+++ b/Web/Models/sql/get-requests.tsql
@@ -0,0 +1,6 @@
+ (SELECT DISTINCT(follower) AS __id FROM
+ (SELECT follower FROM subscriptions WHERE target=? AND flags=0 AND model="openvk\\Web\\Models\\Entities\\User") u0
+ LEFT JOIN
+ (SELECT target FROM subscriptions WHERE follower=? AND flags=0 AND model="openvk\\Web\\Models\\Entities\\User") u1
+ ON u0.follower = u1.target WHERE u1.target IS NULL) u2
+INNER JOIN profiles ON profiles.id = u2.__id
\ No newline at end of file
diff --git a/Web/Presenters/AboutPresenter.php b/Web/Presenters/AboutPresenter.php
index 73e4da7f..49ff1c32 100644
--- a/Web/Presenters/AboutPresenter.php
+++ b/Web/Presenters/AboutPresenter.php
@@ -145,6 +145,6 @@ final class AboutPresenter extends OpenVKPresenter
function renderDev(): void
{
- $this->redirect("https://docs.openvk.uk/");
+ $this->redirect("https://docs.ovk.to/");
}
}
diff --git a/Web/Presenters/AdminPresenter.php b/Web/Presenters/AdminPresenter.php
index 3d864e56..b8f480ca 100644
--- a/Web/Presenters/AdminPresenter.php
+++ b/Web/Presenters/AdminPresenter.php
@@ -48,6 +48,13 @@ final class AdminPresenter extends OpenVKPresenter
if(!OPENVK_ROOT_CONF["openvk"]["preferences"]["commerce"])
$this->flash("warn", tr("admin_commerce_disabled"), tr("admin_commerce_disabled_desc"));
}
+
+ private function warnIfLongpoolBroken(): void
+ {
+ bdump(is_writable(CHANDLER_ROOT . '/tmp/events.bin'));
+ if(file_exists(CHANDLER_ROOT . '/tmp/events.bin') == false || is_writable(CHANDLER_ROOT . '/tmp/events.bin') == false)
+ $this->flash("warn", tr("admin_longpool_broken"), tr("admin_longpool_broken_desc", CHANDLER_ROOT . '/tmp/events.bin'));
+ }
private function searchResults(object $repo, &$count)
{
@@ -76,7 +83,7 @@ final class AdminPresenter extends OpenVKPresenter
function renderIndex(): void
{
-
+ $this->warnIfLongpoolBroken();
}
function renderUsers(): void
@@ -154,6 +161,7 @@ final class AdminPresenter extends OpenVKPresenter
$club->setShortCode($this->postParam("shortcode"));
$club->setVerified(empty($this->postParam("verify") ? 0 : 1));
$club->setHide_From_Global_Feed(empty($this->postParam("hide_from_global_feed") ? 0 : 1));
+ $club->setEnforce_Hiding_From_Global_Feed(empty($this->postParam("enforce_hiding_from_global_feed") ? 0 : 1));
$club->save();
break;
case "ban":
@@ -681,7 +689,8 @@ final class AdminPresenter extends OpenVKPresenter
$this->template->obj_type = $obj_type;
}
- $this->template->logs = (new Logs)->search($filter);
+ $logs = iterator_to_array((new Logs)->search($filter));
+ $this->template->logs = $logs;
$this->template->object_types = (new Logs)->getTypes();
}
}
diff --git a/Web/Presenters/GroupPresenter.php b/Web/Presenters/GroupPresenter.php
index a0d1ce47..88844fbe 100644
--- a/Web/Presenters/GroupPresenter.php
+++ b/Web/Presenters/GroupPresenter.php
@@ -233,7 +233,10 @@ final class GroupPresenter extends OpenVKPresenter
$club->setEveryone_Can_Create_Topics(empty($this->postParam("everyone_can_create_topics")) ? 0 : 1);
$club->setDisplay_Topics_Above_Wall(empty($this->postParam("display_topics_above_wall")) ? 0 : 1);
$club->setEveryone_can_upload_audios(empty($this->postParam("upload_audios")) ? 0 : 1);
- $club->setHide_From_Global_Feed(empty($this->postParam("hide_from_global_feed")) ? 0 : 1);
+
+ if (!$club->isHidingFromGlobalFeedEnforced()) {
+ $club->setHide_From_Global_Feed(empty($this->postParam("hide_from_global_feed") ? 0 : 1));
+ }
$website = $this->postParam("website") ?? "";
if(empty($website))
diff --git a/Web/Presenters/UserPresenter.php b/Web/Presenters/UserPresenter.php
index 2b8c3087..baf8f046 100644
--- a/Web/Presenters/UserPresenter.php
+++ b/Web/Presenters/UserPresenter.php
@@ -329,9 +329,12 @@ final class UserPresenter extends OpenVKPresenter
$user = $this->users->get((int) $this->postParam("id"));
if(!$user) exit("Invalid state");
- $user->toggleSubscription($this->user->identity);
+ if ($this->postParam("act") == "rej")
+ $user->changeFlags($this->user->identity, 0b10000000, true);
+ else
+ $user->toggleSubscription($this->user->identity);
- $this->redirect($user->getURL());
+ $this->redirect($_SERVER['HTTP_REFERER']);
}
function renderSetAvatar() {
diff --git a/Web/Presenters/VKAPIPresenter.php b/Web/Presenters/VKAPIPresenter.php
index 963c9ccc..d82194cf 100644
--- a/Web/Presenters/VKAPIPresenter.php
+++ b/Web/Presenters/VKAPIPresenter.php
@@ -234,8 +234,14 @@ final class VKAPIPresenter extends OpenVKPresenter
}
try {
- settype($val, $parameter->getType()->getName());
- $params[] = $val;
+ // Проверка типа параметра
+ $type = $parameter->getType();
+ if (($type && !$type->isBuiltin()) || is_null($val)) {
+ $params[] = $val;
+ } else {
+ settype($val, $parameter->getType()->getName());
+ $params[] = $val;
+ }
} catch (\Throwable $e) {
// Just ignore the exception, since
// some args are intended for internal use
@@ -286,17 +292,31 @@ final class VKAPIPresenter extends OpenVKPresenter
$this->fail(28, "Invalid 2FA code", "internal", "acquireToken");
}
- $platform = $this->requestParam("client_name");
-
- $token = new APIToken;
- $token->setUser($user);
- $token->setPlatform($platform ?? (new WhichBrowser\Parser(getallheaders()))->toString());
- $token->save();
+ $token = NULL;
+ $tokenIsStale = true;
+ $platform = $this->requestParam("client_name");
+ $acceptsStale = $this->requestParam("accepts_stale");
+ if($acceptsStale == "1") {
+ if(is_null($platform))
+ $this->fail(101, "accepts_stale can only be used with explicitly set client_name", "internal", "acquireToken");
+
+ $token = (new APITokens)->getStaleByUser($uId, $platform);
+ }
+
+ if(is_null($token)) {
+ $tokenIsStale = false;
+
+ $token = new APIToken;
+ $token->setUser($user);
+ $token->setPlatform($platform ?? (new WhichBrowser\Parser(getallheaders()))->toString());
+ $token->save();
+ }
$payload = json_encode([
"access_token" => $token->getFormattedToken(),
"expires_in" => 0,
"user_id" => $uId,
+ "is_stale" => $tokenIsStale,
]);
$size = strlen($payload);
@@ -304,4 +324,42 @@ final class VKAPIPresenter extends OpenVKPresenter
header("Content-Length: $size");
exit($payload);
}
+
+ function renderOAuthLogin() {
+ $this->assertUserLoggedIn();
+
+ $client = $this->queryParam("client_name");
+ $postmsg = $this->queryParam("prefers_postMessage") ?? '0';
+ $stale = $this->queryParam("accepts_stale") ?? '0';
+ $origin = NULL;
+ $url = $this->queryParam("redirect_uri");
+ if(is_null($url) || is_null($client))
+ exit("Error: redirect_uri and client_name params are required.");
+
+ if($url != "about:blank") {
+ if(!filter_var($url, FILTER_VALIDATE_URL))
+ exit("Error: Invalid URL passed to redirect_uri.");
+
+ $parsedUrl = (object) parse_url($url);
+ if($parsedUrl->scheme != 'https' && $parsedUrl->scheme != 'http')
+ exit("Error: redirect_uri should either point to about:blank or to a web resource.");
+
+ $origin = "$parsedUrl->scheme://$parsedUrl->host";
+ if(!is_null($parsedUrl->port ?? NULL))
+ $origin .= ":$parsedUrl->port";
+
+ $url .= strpos($url, '?') === false ? '?' : '&';
+ } else {
+ $url .= "#";
+ if($postmsg == '1') {
+ exit("Error: prefers_postMessage can only be set if redirect_uri is not about:blank");
+ }
+ }
+
+ $this->template->clientName = $client;
+ $this->template->usePostMessage = $postmsg == '1';
+ $this->template->acceptsStale = $stale == '1';
+ $this->template->origin = $origin;
+ $this->template->redirectUri = $url;
+ }
}
diff --git a/Web/Presenters/templates/@layout.xml b/Web/Presenters/templates/@layout.xml
index a90fdc36..803ebdd0 100644
--- a/Web/Presenters/templates/@layout.xml
+++ b/Web/Presenters/templates/@layout.xml
@@ -180,9 +180,9 @@
{_edit_button}
{_my_page}
{_my_friends}
-
@@ -198,9 +198,9 @@
{_my_groups}
{_my_feed}
{_my_feedback}
- {if $thisUser->getNotificationsCount() > 0}
+
({$thisUser->getNotificationsCount()})
- {/if}
+
{_my_apps}
{_my_settings}
@@ -405,13 +405,6 @@
{script "js/al_notifs.js"}
{/ifset}
- {if OPENVK_ROOT_CONF['openvk']['preferences']['bellsAndWhistles']['fartscroll']}
-
-
- {/if}
-
diff --git a/Web/Presenters/templates/@listView.xml b/Web/Presenters/templates/@listView.xml
index f2342a85..4b2dd9ff 100644
--- a/Web/Presenters/templates/@listView.xml
+++ b/Web/Presenters/templates/@listView.xml
@@ -49,7 +49,7 @@
{include description, x => $dat}
{/ifset}
-
+ |
{include actions, x => $dat}
|
diff --git a/Web/Presenters/templates/About/Version.xml b/Web/Presenters/templates/About/Version.xml
index 47fc7ed6..6b9d25f4 100644
--- a/Web/Presenters/templates/About/Version.xml
+++ b/Web/Presenters/templates/About/Version.xml
@@ -255,17 +255,6 @@
Disabled
-
-
- Fartscroll
- |
-
- {php echo OPENVK_ROOT_CONF["openvk"]["preferences"]["bellsAndWhistles"]["fartscroll"] ? "Enabled" : "Disabled"}
- |
-
- Disabled
- |
-
NDA Test Label
diff --git a/Web/Presenters/templates/Admin/Club.xml b/Web/Presenters/templates/Admin/Club.xml
index a8f3ad50..2837da57 100644
--- a/Web/Presenters/templates/Admin/Club.xml
+++ b/Web/Presenters/templates/Admin/Club.xml
@@ -58,13 +58,17 @@
- isVerified()} checked {/if} />
+
- isHideFromGlobalFeedEnabled()} checked {/if} />
+
+
+
+
+
|
diff --git a/Web/Presenters/templates/Group/Followers.xml b/Web/Presenters/templates/Group/Followers.xml
index 67e6af9c..7a1654d2 100644
--- a/Web/Presenters/templates/Group/Followers.xml
+++ b/Web/Presenters/templates/Group/Followers.xml
@@ -54,8 +54,8 @@
- {_gender}: |
- {$user->isFemale() ? tr("female"): tr("male")} |
+ {_pronouns}: |
+ {$x->isFemale() ? tr("female") : ($x->isNeutral() ? tr("neutral") : tr("male"))} |
{_registration_date}: |
diff --git a/Web/Presenters/templates/Report/View.xml b/Web/Presenters/templates/Report/View.xml
index 4a0682d1..6731ee53 100644
--- a/Web/Presenters/templates/Report/View.xml
+++ b/Web/Presenters/templates/Report/View.xml
@@ -23,7 +23,7 @@