Skip to content

Commit

Permalink
Merge branch 'instance_mtn' into pure-openvk
Browse files Browse the repository at this point in the history
  • Loading branch information
tretdm authored Oct 28, 2023
2 parents 3f1c9cd + 137aa37 commit 5e9b1c3
Show file tree
Hide file tree
Showing 77 changed files with 772 additions and 310 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ tmp/*
!tmp/themepack_artifacts/.gitkeep
themepacks/*
!themepacks/.gitkeep
!themepacks/openvk_modern
!themepacks/modern
!themepacks/midnight
storage/*
!storage/.gitkeep

.idea
.idea
33 changes: 21 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# <img align="right" src="https://github.com/openvk/openvk/raw/master/Web/static/img/logo_shadow.png" alt="openvk" title="openvk" width="15%">OpenVK
# <img align="right" src="https://github.com/openvk/openvk/raw/master/Web/static/img/logo_shadow.png" alt="openvk" title="openvk" width="15%">Astorium

_[Русский](README_RU.md)_

_**Astorium** - fork based on [OpenVK OSS project](https://github.com/openvk/openvk) and designed for your needs and requirements._

**OpenVK** is an attempt to create a simple CMS that ~~cosplays~~ imitates old VKontakte. Code provided here is not stable yet.

VKontakte belongs to Pavel Durov and VK Group.
Expand All @@ -16,19 +18,26 @@ We will release OpenVK as soon as it's ready. As for now, you can:

## Instances

A list of instances can be found in [our wiki of this repository](https://github.com/openvk/openvk/wiki/Instances).
* **[openvk.su](https://openvk.su/)**
* **[openvk.uk](https://openvk.uk)** ([mirror](https://t.me/openvk/1609))
* **[openvk.co](http://openvk.co)** (mirror [without TLS](https://t.me/openvk/1654))
* [social.fetbuk.ru](http://social.fetbuk.ru/)
* [vepurovk.xyz](http://vepurovk.xyz/)
* [vepurovk.fun](http://vepurovk.fun/) (mirror without TLS)
* [ovk.tinelix.ru](https://ovk.tinelix.ru)
* [mirror without TLS](http://ovk.tinelix.ru)

## Can I create my own OpenVK instance?
## Can I create my own Tinelix Astorium / OpenVK instance?

Yes! And you are very welcome to.

However, OVK makes use of Chandler Application Server. This software requires extensions, that may not be provided by your hosting provider (namely, sodium and yaml. these extensions are available on most of ISPManager hostings).
However, Astorium (like OpenVK) makes use of Chandler Application Server. This software requires extensions, that may not be provided by your hosting provider (namely, sodium and yaml. these extensions are available on most of ISPManager hostings).

If you want, you can add your instance to the list above so that people can register there.

### Installation procedure

1. Install PHP 7.4, web-server, Composer, Node.js, Yarn and [Chandler](https://github.com/openvk/chandler)
1. Install PHP 7.4, web-server, Composer, Node.js 10+, Yarn and [Chandler](https://github.com/openvk/chandler)

* PHP 8.1 is supported too, however it was not tested carefully, so be aware.

Expand All @@ -41,7 +50,7 @@ If you want, you can add your instance to the list above so that people can regi
3. Install [commitcaptcha](https://github.com/openvk/commitcaptcha) and OpenVK as Chandler extensions like this:

```bash
git clone https://github.com/openvk/openvk /path/to/chandler/extensions/available/openvk
git clone https://github.com/tinelix/astorium /path/to/chandler/extensions/available/openvk
git clone https://github.com/openvk/commitcaptcha /path/to/chandler/extensions/available/commitcaptcha
```

Expand All @@ -57,21 +66,22 @@ ln -s /path/to/chandler/extensions/available/openvk /path/to/chandler/extensions
7. Copy `openvk-example.yml` to `openvk.yml` and change options to your liking
8. Run `composer install` in OpenVK directory
9. Run `composer install` in commitcaptcha directory
10. Move to `Web/static/js` and execute `yarn install`
10. Move to `Web/static/js` and execute `yarn install` or `yarnpkg install`
11. Set `openvk` as your root app in `chandler.yml`
12. Set permissions for all `сhandler` directories to 0777 (all read, write and execute permissions) if different

Once you are done, you can login as a system administrator on the network itself (no registration required):

* **Login**: `[email protected]`
* **Password**: `admin`
* It is recommended to change the password of the built-in account or disable it.
* It is highly 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)).

### Looking for Docker or Kubernetes deployment?
See `install/automated/docker/README.md` and `install/automated/kubernetes/README.md` for Docker and Kubernetes deployment instructions.

### If my website uses OpenVK, should I release it's sources?
### If my website uses Astorium / OpenVK, should I release it's sources?

It depends. You can keep the sources to yourself if you do not plan to distribute your website binaries. If your website software must be distributed, it can stay non-OSS provided the OpenVK is not used as a primary application and is not modified. If you modified OpenVK for your needs or your work is based on it and you are planning to redistribute this, then you should license it under terms of any LGPL-compatible license (like OSL, GPL, LGPL etc).

Expand All @@ -88,6 +98,5 @@ You may reach out to us via:

**Attention**: bug tracker, board, Telegram and Matrix chat are public places, ticketing system is being served by volunteers. If you need to report something that should not be immediately disclosed to general public (for instance, a vulnerability), please contact us directly via this email: **openvk [at] tutanota [dot] com**

<a href="https://codeberg.org/OpenVK/openvk">
<img alt="Get it on Codeberg" src="https://codeberg.org/Codeberg/GetItOnCodeberg/media/branch/main/get-it-on-blue-on-white.png" height="60">
</a>
## DISCLAIMER
OpenVK and Astorium is not affiliated with or endorsed by VK PLC.
31 changes: 21 additions & 10 deletions README_RU.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# <img align="right" src="https://github.com/openvk/openvk/raw/master/Web/static/img/logo_shadow.png" alt="openvk" title="openvk" width="15%">OpenVK
# <img align="right" src="https://github.com/openvk/openvk/raw/master/Web/static/img/logo_shadow.png" alt="openvk" title="openvk" width="15%">Astorium

_[English](README.md)_

_**Astorium** - форк, основанный на [OSS-проекте OpenVK](https://github.com/openvk/openvk) и разработан для своих нужд и потребностей._

**OpenVK** — это попытка создать простую CMS, которая ~~косплеит~~ имитирует старый ВКонтакте. На данный момент, представленный здесь исходный код проекта пока не является стабильным.

ВКонтакте принадлежит Павлу Дурову и VK Group.
Expand All @@ -16,19 +18,28 @@ _[English](README.md)_

## Инстанции

Список инстанций находится в [нашей вики этого репозитория](https://github.com/openvk/openvk/wiki/Instances-(RU)).
* **[openvk.su](https://openvk.su/)**
* **[openvk.uk](https://openvk.uk)** ([зеркало](<https://t.me/openvk/1609>))
* **[openvk.co](http://openvk.co)** (зеркало [без TLS](<https://t.me/openvk/1654>))
* [social.fetbuk.ru](http://social.fetbuk.ru/)
* [vepurovk.xyz](http://vepurovk.xyz/)
* **[vepurovk.fun](http://vepurovk.fun)** (зеркало без TLS)
* [ovk.tinelix.ru](https://ovk.tinelix.ru)
* [зеркало без TLS](http://ovk.tinelix.ru)

## Могу ли я создать свою собственную инстанцию OpenVK?
## Могу ли я создать свою собственную инстанцию Astorium / OpenVK?

Да! И всегда пожалуйста.

Однако, OpenVK использует Chandler Application Server. Это программное обеспечение требует расширений, которые могут быть не предоставлены вашим хостинг-провайдером (а именно, sodium и yaml. Эти расширения доступны на большинстве хостингов ISPManager).
Однако, Astorium использует Chandler Application Server. Это программное обеспечение требует расширений, которые могут быть не предоставлены вашим хостинг-провайдером (а именно, sodium и yaml. Эти расширения доступны на большинстве хостингов ISPManager).

Если хотите, вы можете добавить вашу инстанцию в список выше, чтобы люди могли зарегистрироваться там.

### Процедура установки

1. Установите PHP 7.4, веб-сервер, Composer, Node.js, Yarn и [Chandler](https://github.com/openvk/chandler)
1. Установите PHP 7.4, веб-сервер, Composer, Node.js 10+, Yarn и [Chandler](https://github.com/openvk/chandler)

_Для граждан РФ крайне важен [переход Composer на аполитический репозиторий](https://stackoverflow.com/a/76131122)._

* PHP 8 еще **не** тестировался, поэтому не стоит ожидать, что он будет работать (UPD: он не работает).

Expand Down Expand Up @@ -59,19 +70,20 @@ ln -s /path/to/chandler/extensions/available/openvk /path/to/chandler/extensions
9. Запустите `composer install` в директории commitcaptcha
10. Перейдите в `Web/static/js` и выполните `yarn install`
11. Установите `openvk` в качестве корневого приложения в файле `chandler.yml`
12. Выставите права во всех директориях `chandler` на 0777 (все права на чтение, запись и выполнение), если отличается

После этого вы можете войти как системный администратор в саму сеть (регистрация не требуется):

* **Логин**: `[email protected]`
* **Пароль**: `admin`
* Перед использованием встроенной учетной записи рекомендуется сменить пароль или отключить её.
* Перед использованием встроенной учетной записи настоятельно рекомендуется сменить пароль или отключить её.

💡Запутались? Полное руководство по установке доступно [здесь](https://docs.openvk.uk/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` соответственно.

### Если мой сайт использует OpenVK, должен ли я публиковать его исходные тексты?
### Если мой сайт использует Astorium / OpenVK, должен ли я публиковать его исходные тексты?

Это зависит от обстоятельств. Вы можете оставить исходные тексты при себе, если не планируете распространять бинарники вашего сайта. Если программное обеспечение вашего сайта должно распространяться, оно может оставаться не-OSS при условии, что OpenVK не используется в качестве основного приложения и не модифицируется. Если вы модифицировали OpenVK для своих нужд или ваша работа основана на нем и вы планируете ее распространять, то вы должны лицензировать ее на условиях любой совместимой с LGPL лицензии (например, OSL, GPL, LGPL и т.д.).

Expand All @@ -88,6 +100,5 @@ ln -s /path/to/chandler/extensions/available/openvk /path/to/chandler/extensions

**Внимание**: баг-трекер, форум, Telegram- и Matrix-чат являются публичными местами, и жалобы в OVK обслуживается волонтерами. Если вам нужно сообщить о чем-то, что не должно быть раскрыто широкой публике (например, сообщение об уязвимости), пожалуйста, свяжитесь с нами напрямую по этому адресу: **openvk [собачка] tutanota [точка] com**.

<a href="https://codeberg.org/OpenVK/openvk">
<img alt="Get it on Codeberg" src="https://codeberg.org/Codeberg/GetItOnCodeberg/media/branch/main/get-it-on-blue-on-white.png" height="60">
</a>
## ДИСКЛЕЙМЕР
OpenVK и Astorium никак не связаны с компанией ООО "ВК" или не одобрены ею.
50 changes: 15 additions & 35 deletions VKAPI/Handlers/Video.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,47 +11,27 @@

final class Video extends VKAPIRequestHandler
{
function get(int $owner_id, string $videos, int $offset = 0, int $count = 30, int $extended = 0): object
function get(string $videos, int $offset = 0, int $count = 30, int $extended = 0): object
{
$this->requireUser();

if ($videos) {
$vids = explode(',', $videos);

foreach($vids as $vid)
{
$id = explode("_", $vid);

$items = [];

$video = (new VideosRepo)->getByOwnerAndVID(intval($id[0]), intval($id[1]));
if($video) {
$items[] = $video->getApiStructure();
}
}

return (object) [
"count" => count($items),
"items" => $items
];
} else {
if ($owner_id > 0)
$user = (new UsersRepo)->get($owner_id);
else
$this->fail(1, "Not implemented");

$videos = (new VideosRepo)->getByUser($user, $offset + 1, $count);
$videosCount = (new VideosRepo)->getUserVideosCount($user);

$vids = explode(',', $videos);

foreach($vids as $vid)
{
$id = explode("_", $vid);

$items = [];
foreach ($videos as $video) {

$video = (new VideosRepo)->getByOwnerAndVID(intval($id[0]), intval($id[1]));
if($video) {
$items[] = $video->getApiStructure();
}

return (object) [
"count" => $videosCount,
"items" => $items
];
}

return (object) [
"count" => count($items),
"items" => $items
];
}
}
2 changes: 1 addition & 1 deletion Web/Models/Entities/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function getURL(): string
default:
case "default":
case "basic":
return "http://" . $_SERVER['HTTP_HOST'] . "/blob_" . substr($hash, 0, 2) . "/$hash.$this->fileExtension";
return $settings->protocol ?? ovk_scheme() . "://" . $_SERVER['HTTP_HOST'] . "/blob_" . substr($hash, 0, 2) . "/$hash.$this->fileExtension";
break;
case "accelerated":
return "http://" . $_SERVER['HTTP_HOST'] . "/openvk-datastore/$hash.$this->fileExtension";
Expand Down
2 changes: 1 addition & 1 deletion Web/Presenters/WallPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ function renderMakePost(int $wall): void
$this->flashFail("err", tr("failed_to_publish_post"), tr("post_is_too_big"));
}

foreach($photos as $photo)
foreach((array)$photos as $photo)
$post->attach($photo);

if(sizeof($videos) > 0)
Expand Down
2 changes: 1 addition & 1 deletion Web/Presenters/templates/@CanonicalListView.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@
{/ifset}
{/if}
</div>
</div>
</div>
6 changes: 3 additions & 3 deletions Web/Presenters/templates/@layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@
</p>
</div>

<div n:if="OPENVK_ROOT_CONF['openvk']['preferences']['bellsAndWhistles']['testLabel']" id="test-label">FOR TESTING PURPOSES ONLY</div>

<div class="notifications_global_wrap"></div>
<div class="dimmer"></div>

Expand Down Expand Up @@ -203,6 +201,7 @@
{var $menuLinksAvaiable = sizeof(OPENVK_ROOT_CONF['openvk']['preferences']['menu']['links']) > 0 && $thisUser->getLeftMenuItemStatus('links')}
<div n:if="$canAccessAdminPanel || $canAccessHelpdesk || $menuLinksAvaiable" class="menu_divider"></div>
<a href="/admin" class="link" n:if="$canAccessAdminPanel" title="{_admin} [Alt+Shift+A]" accesskey="a">{_admin}</a>
<a href="/pma" class="link" n:if="$canAccessAdminPanel" title="{_db} [Alt+Shift+A]" accesskey="a">{_db}</a>
<a href="/support/tickets" class="link" n:if="$canAccessHelpdesk">{_helpdesk}
{if $helpdeskTicketNotAnsweredCount > 0}
(<b>{$helpdeskTicketNotAnsweredCount}</b>)
Expand Down Expand Up @@ -297,6 +296,7 @@
{if !OPENVK_ROOT_CONF['openvk']['preferences']['security']['disablePasswordRestoring']}<a href="/restore">{_forgot_password}</a>{/if}
</form>
{/ifset}
<div n:if="OPENVK_ROOT_CONF['openvk']['preferences']['bellsAndWhistles']['testLabel']" id="test-label">FOR TESTING PURPOSES ONLY</div>
</div>
</div>
{ifset $thisUser}
Expand Down Expand Up @@ -360,7 +360,7 @@
{/foreach}
<a href="/language" class="link">all languages &raquo;</a>
</p>
<p>OpenVK <a href="/about:openvk">{php echo OPENVK_VERSION}</a> | PHP: {phpversion()} | DB: {$dbVersion}</p>
<p> <a href="/about:openvk">Astorium {php echo OPENVK_VERSION}</a> | Powered by <a href="https://github.com/openvk/openvk">OpenVK</a> | <a href="https://tinelix.ru">tinelix.ru</a> | <a href="https://github.com/tinelix/openvk">GitHub</a></p>
<p n:ifcontent>
{php echo OPENVK_ROOT_CONF["openvk"]["appearance"]["motd"]}
</p>
Expand Down
13 changes: 8 additions & 5 deletions Web/Presenters/templates/About/Invite.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
{/block}

{block content}
{_you_can_invite}<br><br>
<center>
<input type="text" readonly value="https://{$_SERVER["HTTP_HOST"]}/reg?ref={rawurlencode($thisUser->getRefLinkId())}" size="50" />
</center>
<p>{_you_can_invite_2}</p>
{var $canAccessAdminPanel = $thisUser->getChandlerUser()->can("access")->model("admin")->whichBelongsTo(NULL)}
<div n:if="$canAccessAdminPanel">
{_you_can_invite}<br><br>
<center>
<input type="text" readonly value="https://{$_SERVER["HTTP_HOST"]}/reg?ref={rawurlencode($thisUser->getRefLinkId())}" size="50" />
</center>
<p>{_you_can_invite_2}</p>
</div>
{/block}
Loading

0 comments on commit 5e9b1c3

Please sign in to comment.