Compare commits

...

5 commits

Author SHA1 Message Date
31db422578
Merge f672e5001a into ee0dd8c749 2025-02-19 21:55:07 +03:00
n1rwana
ee0dd8c749
fix(away.php): fix link checking (#949)
* Фикс проверки заблокированных ссылок

* fix(away.php): syntax

---------

Co-authored-by: mrilyew <99399973+mrilyew@users.noreply.github.com>
Co-authored-by: veselcraft <veselcraft@icloud.com>
2025-02-16 16:47:48 +03:00
ayato
6d721eb8b9
fix(messagebox): make dialogue content scrollable and remove height from dialogue header and action boxes (#1230)
Sometimes dialogue boxes get too long and end up going off the screen, making the content impossible to see. This change fixes that by allowing the dialogue content to scroll. It also removes some height restrictions from the header and action sections since they didn’t seem to serve a clear purpose (to me) and might have been causing layout issues.
2025-02-16 16:21:46 +03:00
ayato
00b408c299
fix(locale-en): change the phrasing for undoing a friend request (#1228)
"friends_leave_in_flw" is used to reject someone's request. This string is used to cancel an outgoing request.
2025-02-04 18:48:57 +03:00
mrilyew
7d0dbb26ed fix(editing): use post instead of get
fixes #1224
2025-02-03 17:26:16 +03:00
7 changed files with 32 additions and 18 deletions

View file

@ -43,7 +43,7 @@ class BannedLink extends RowModel
public function getRegexpRule(): string
{
return addslashes("/" . $this->getDomain() . $this->getRawRegexp() . "/");
return "/^" . $this->getDomain() . "\/" . $this->getRawRegexp() . "$/i";
}
public function getRawRegexp(): string

View file

@ -7,6 +7,7 @@ namespace openvk\Web\Models\Repositories;
use Chandler\Database\DatabaseConnection as DB;
use Nette\Database\Table\{ActiveRow, Selection};
use openvk\Web\Models\Entities\BannedLink;
use function Symfony\Component\Translation\t;
class BannedLinks
{
@ -48,7 +49,7 @@ class BannedLinks
public function isDomainBanned(string $domain): bool
{
return sizeof($this->bannedLinks->where(["link" => $domain, "regexp_rule" => ""])) > 0;
return sizeof($this->bannedLinks->where(["domain" => $domain, "regexp_rule" => ""])) > 0;
}
public function genLinks($rules): \Traversable
@ -61,16 +62,17 @@ class BannedLinks
public function genEntries($links, $uri): \Traversable
{
foreach ($links as $link) {
if (preg_match($link->getRegexpRule(), $uri)) {
if (preg_match($link->getRegexpRule(), $uri))
yield $link->getId();
else if ($this->isDomainBanned($link->getDomain()))
yield $link->getId();
}
}
}
public function check(string $url): ?array
{
$uri = strstr(str_replace(["https://", "http://"], "", $url), "/", true);
$domain = str_replace("www.", "", $uri);
$uri = str_replace(["https://", "http://"], "", $url);
$domain = explode("/", str_replace("www.", "", $uri))[0];
$rules = $this->getByDomain($domain);
if (is_null($rules)) {

View file

@ -515,7 +515,7 @@ final class AdminPresenter extends OpenVKPresenter
if ($link) {
$link->setDomain($new_domain ?? $this->postParam("link"));
$link->setReason($new_reason);
$link->setRegexp_rule($this->postParam("regexp"));
$link->setRegexp_rule(mb_strlen(trim($this->postParam("regexp"))) > 0 ? $this->postParam("regexp") : "");
$link->save();
} else {
if (!$new_domain) {
@ -525,7 +525,7 @@ final class AdminPresenter extends OpenVKPresenter
$link = new BannedLink();
$link->setDomain($new_domain);
$link->setReason($new_reason);
$link->setRegexp_rule($this->postParam("regexp"));
$link->setRegexp_rule(mb_strlen(trim($this->postParam("regexp"))) > 0 ? $this->postParam("regexp") : "");
$link->setInitiator($this->user->identity->getId());
$link->save();

View file

@ -11,12 +11,10 @@ final class AwayPresenter extends OpenVKPresenter
{
public function renderAway(): void
{
$checkBanEntries = (new BannedLinks())->check($this->queryParam("to") . "/");
if (OPENVK_ROOT_CONF["openvk"]["preferences"]["susLinks"]["warnings"]) {
if (sizeof($checkBanEntries) > 0) {
$checkBanEntries = (new BannedLinks)->check($this->queryParam("to"));
if (OPENVK_ROOT_CONF["openvk"]["preferences"]["susLinks"]["warnings"])
if (sizeof($checkBanEntries) > 0)
$this->pass("openvk!Away->view", $checkBanEntries[0]);
}
}
header("HTTP/1.0 302 Found");
header("X-Robots-Tag: noindex, nofollow, noarchive");

View file

@ -38,7 +38,6 @@ body.dimmed > .dimmer #absolute_territory {
}
.ovk-diag-head {
height: 25%;
padding: 5px;
background-color: #757575;
border-bottom: 1px solid #3e3e3e;
@ -49,11 +48,12 @@ body.dimmed > .dimmer #absolute_territory {
.ovk-diag-body {
padding: 20px;
overflow-y: auto;
max-height: 80vh
}
.ovk-diag-action {
padding: 10px;
height: 25%;
background-color: #d4d4d4;
text-align: right;
}

View file

@ -42,8 +42,22 @@ window.OVKAPI = new class {
return
}
const url = `/method/${method}?auth_mechanism=roaming&${new URLSearchParams(params).toString()}&v=5.200`
const res = await fetch(url)
const form_data = new FormData
Object.entries(params).forEach(fd => {
form_data.append(fd[0], fd[1])
})
const __url_params = new URLSearchParams
__url_params.append("v", "5.200")
if(window.openvk.current_id != 0) {
__url_params.append("auth_mechanism", "roaming")
}
const url = `/method/${method}?${__url_params.toString()}`
const res = await fetch(url, {
method: "POST",
body: form_data,
})
const json_response = await res.json()
if(json_response.response) {

View file

@ -318,7 +318,7 @@
"follower" = "Follower";
"friends_add" = "Add to friends";
"friends_delete" = "Remove from friends";
"friends_reject" = "Reject request";
"friends_reject" = "Cancel request";
"friends_accept" = "Accept request";
"friends_leave_in_flw" = "Leave in followers";
"friends_add_msg" = "Now you're friends.";