Skip to content

Commit

Permalink
Update hive menu, hive/calc and golos/backup
Browse files Browse the repository at this point in the history
  • Loading branch information
denis-skripnik committed Dec 3, 2020
1 parent c92b2ec commit 8fdabc0
Show file tree
Hide file tree
Showing 18 changed files with 80 additions and 49 deletions.
11 changes: 7 additions & 4 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
php_flag display_startup_errors on
php_flag display_errors on
php_flag html_errors on
php_flag display_startup_errors off
php_flag display_errors off
php_flag html_errors off
php_flag log_errors on
php_flag ignore_repeated_errors off
php_flag ignore_repeated_source off
Expand Down Expand Up @@ -32,6 +32,9 @@ RewriteCond %{HTTP_HOST} ^(www\.)?viz\.dpos\.space$ [NC]
RewriteCond %{REQUEST_URI} !^/viz-manual/
RewriteRule ^(.*)$ viz-manual/$1 [L]

#Редирект на https
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule (.*) https://%{HTTP_HOST}/$1 [L,R=301]

Options +FollowSymLinks
Options -Indexes
Expand Down Expand Up @@ -79,4 +82,4 @@ ExpiresByType text/css "access plus 7 days"
ExpiresByType image/gif "access plus 7 days"
ExpiresByType image/jpeg "access plus 7 days"
ExpiresByType image/png "access plus 7 days"
</IfModule>
</IfModule>
Binary file not shown.
Binary file not shown.
5 changes: 3 additions & 2 deletions blockchains/golos/apps/backup/content.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php if (!defined('NOTLOAD')) exit('No direct script access allowed');
$amount_account = 'golos-backup';
$amount_account = 'null';
return '<h2>Список действий</h2>
<ol><li>Перейдите на страницу своего аккаунта в <a href="https://golos.id" target="_blank">golos.id</a>;</li>
<li>Отправьте 3 GBG или 5 GOLOS на аккаунт @'.$amount_account.'. Заметка (memo):<br />
posts;<br></li>
posts;<br>
<strong>ВНИМАНИЕ: донаты не принимаются (только ликвид)</strong></li>
<li>Введите логин в форме ниже</li>
<li>Выберите вариант получения репостов в списке материалов.</li></ol>
<h2><strong>Важно:</strong></h2>
Expand Down
31 changes: 7 additions & 24 deletions blockchains/golos/apps/backup/page/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,40 +30,23 @@
</form>';

require $_SERVER['DOCUMENT_ROOT'].'/vendor/autoload.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/helpers.php';
require_once __DIR__.'/get_account_history_chunk.php';
require_once __DIR__.'/functions.php';

use GrapheneNodeClient\Commands\Single;
use GrapheneNodeClient\Commands\CommandQueryData;
use GrapheneNodeClient\Commands\Single\GetAccountHistoryCommand;
$rowCount = 0;

$connector_class = CONNECTORS_MAP['golos'];
$commandQuery = new CommandQueryData();

$query = ['select_ops' => ['transfer']];
$method_data = [
'0' => ($amount_account ?? $amount_account ?? ""), //authors
'1' => -1, //from
'2' => 10000, //limit max 2000
'3' => $query,
];
$startWith = $_REQUEST['start'] ?? 300000000;

$commandQuery->setParams($method_data);
$res = getAccountHistoryChunk($amount_account, $startWith, ['select_ops' => ['transfer', 'transfer_to_vesting','claim','transfer_from_tip','transfer_to_tip','invite','invite_claim']]);

if(!empty($connector_class)){
$connector = new $connector_class();
}
$mass = $res['result'];

if(!empty($connector)){
$command = new GetAccountHistoryCommand($connector);
}
$res = $command->execute($commandQuery);
$mass = $res['result'];
krsort($mass);

foreach ($mass as $datas) {
$op = $datas[1]['op'];
$tokens3 = "5.000 GOLOS";
if ($op['1']['from'] === pageUrl()[2] && $op['1']['to'] === $amount_account && (($op['1']['amount'] ?? $op['1']['amount'] ?? "") === $tokens3 or ($op['1']['amount'] ?? $op['1']['amount'] ?? "") === "3.000 GBG") && $op['1']['memo'] === "posts") {
if ($op['1']['from'] === pageUrl()[2] && $op['1']['to'] === $amount_account && (($op['1']['amount'] ?? $op['1']['amount'] ?? "") === $tokens3) && $op['1']['memo'] === "posts") {
if (isset($op) ){
$contentformat = pageUrl()[4];
if ($contentformat == 'Markdown') {
Expand Down
8 changes: 4 additions & 4 deletions blockchains/golos/apps/backup/page/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function generator($app_dir) {

// открываем файл, если файл не существует,
//делается попытка создать его
$filename = $put1.$postnum."_".$class_content['permlink'];
$filename = $put1.$class_content['id']."_".$class_content['permlink'];
$fp = fopen($filename.".txt", "w");

// записываем в файл текст
Expand All @@ -129,7 +129,7 @@ function generator($app_dir) {
} else if (pageUrl()[3] == 'yes3') {
// открываем файл, если файл не существует,
//делается попытка создать его
$filename = $put1.'/'.$postnum."_".$class_content['permlink'];
$filename = $put1.'/'.$class_content['id']."_".$class_content['permlink'];
$fp = fopen($filename.".txt", "w");
// записываем в файл текст
fwrite($fp, "Заголовок: ".$class_content['title']."\r\n"."Текст:"."\r\n".$class_content['body']."\r\n"."Теги:"."\r\n");
Expand Down Expand Up @@ -213,7 +213,7 @@ function html_generator($app_dir) {
if ($content['author'] == pageUrl()[2]) {
// открываем файл, если файл не существует,
//делается попытка создать его
$filename = $app_dir."/users/".pageUrl()[2]."/".$postnum."_".$content['permlink'];
$filename = $app_dir."/users/".pageUrl()[2]."/".$content['id']."_".$content['permlink'];
$fp = fopen($filename.".html", "w");

$markdown_text = generate_html_text($content['body']);
Expand All @@ -237,7 +237,7 @@ function html_generator($app_dir) {
} else if (pageUrl()[3] == 'yes3') {
// открываем файл, если файл не существует,
//делается попытка создать его
$filename = $app_dir."/users/".pageUrl()[2]."/".$postnum."_".$content['permlink'];
$filename = $app_dir."/users/".pageUrl()[2]."/".$content['id']."_".$content['permlink'];
$fp = fopen($filename.".html", "w");

$markdown_text = generate_html_text($content['body']);
Expand Down
37 changes: 37 additions & 0 deletions blockchains/golos/apps/backup/page/get_account_history_chunk.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

require_once $_SERVER['DOCUMENT_ROOT'].'/vendor/autoload.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/helpers.php';

use GrapheneNodeClient\Commands\CommandQueryData;
use GrapheneNodeClient\Commands\Single\GetAccountHistoryCommand;

function getAccountHistoryChunk($author, $startWith = -1, $query)
{

static $limitMax = 100;

$startWith = (int) $startWith;

$limit = $startWith < $limitMax ? $startWith : $limitMax;

$data = [
'0' => $author,
'1' => $startWith,
'2' => $limit,
'3' => $query,
];

$commandQuery = new CommandQueryData();
$commandQuery->setParams($data);

$connectorClass = CONNECTORS_MAP['golos'];

$connector = new $connectorClass();

$command = new GetAccountHistoryCommand($connector);

$result = $command->execute($commandQuery);

return $result;
}
6 changes: 3 additions & 3 deletions blockchains/golos/apps/profiles/page/userinfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,17 +346,17 @@
if ($uia != false) {
$content .= '<table><thead><tr><th>Название</th><th>Основной баланс</th><th>TIP-баланс</th></tr></thead></tbody>';
foreach ($uia as $token => $balances) {
if ((float)$balances['balance'] != 0 && (float)$balances['tip_balance'] != 0 || (float)$balances['balance'] != 0 && (float)$balances['tip_balance'] == 0 || (float)$balances['balance'] == 0 && (float)$balances['tip_balance'] != 0) {
$content .= '<tr>
<td>'.$token.'</td>
<td>'.$balances['balance'].'</td>
<td>'.$balances['tip_balance'].'</td>
</tr>';
}
}
$content .= '</tbody></table>';
} else {
$content .= '<p>У этого аккаунта нет UIA активов, которые он когда-либо получал.</p>';
$content .= '<p><br>
У этого аккаунта нет UIA активов, которые он когда-либо получал.<br>
</p>';
}
$content .= '<p align="center"><a href="#contents">К меню</a></p>
<h2><a name="data2">Профиль</a></h2>
Expand Down
3 changes: 2 additions & 1 deletion blockchains/hive/apps/accounts/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"title": "Мои аккаунты Hive",
"description": "Сервис авторизации в блокчейне Hive. Сохранение нескольких аккаунтов и выбор из них текущего.",
"in_menu": "Аккаунты"
"in_menu": "Аккаунты",
"category": "no_category"
}
3 changes: 2 additions & 1 deletion blockchains/hive/apps/backup/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"title": "Бекап постов в Hive",
"description": "Резервное копирование постов в Hive.",
"in_menu": "Бекап постов"
"in_menu": "Бекап постов",
"category": "tools"
}
5 changes: 2 additions & 3 deletions blockchains/hive/apps/calc/ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@
$RewardFund_mass = $RewardFund_res['result'];
$config_res = $config_command->execute($config_commandQuery);
$config_mass = $config_res['result'];

// Расчет hive_per_vests
$tvfs = (float)$mass3['total_vesting_fund_steem'];
$tvfs = (float)$mass3['total_vesting_fund_hive'];
$tvsh = (float)$mass3['total_vesting_shares'];

$hive_per_vests = 1000000 * $tvfs / $tvsh;
Expand Down Expand Up @@ -59,7 +58,7 @@
$mass3 = $res3['result'];

// Расчет hive_per_vests
$tvfs = (float)$mass3['total_vesting_fund_steem'];
$tvfs = (float)$mass3['total_vesting_fund_hive'];
$tvsh = (float)$mass3['total_vesting_shares'];

$hive_per_vests = 1000000 * $tvfs / $tvsh;
Expand Down
3 changes: 2 additions & 1 deletion blockchains/hive/apps/calc/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"title": "Калькулятор для блокчейна Hive",
"description": "Рассчёт стоимости апвота, GESTS в СГ и другие параметры блокчейна Hive.",
"in_menu": "Блокчейн-калькулятор"
"in_menu": "Блокчейн-калькулятор",
"category": "tools"
}
3 changes: 2 additions & 1 deletion blockchains/hive/apps/manage/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"title": "Управление блокчейном и аккаунтом Hive",
"description": "Сервис управления аккаунтом (изменение профиля) и блокчейном (делегаты, комитет) в Hive.",
"in_menu": "Управление"
"in_menu": "Управление",
"category": "no_category"
}
3 changes: 2 additions & 1 deletion blockchains/hive/apps/post/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"title": "Публикация постов",
"description": "Сервис публикации постов в блокчейне Golos",
"in_menu": "Публикация постов"
"in_menu": "Публикация постов",
"category": "no_category"
}
3 changes: 2 additions & 1 deletion blockchains/hive/apps/profiles/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"title": "Просмотр профилей",
"description": "Просмотрщик профилей в блокчейне Hive",
"in_menu": "Профили"
"in_menu": "Профили",
"category": "no_category"
}
3 changes: 2 additions & 1 deletion blockchains/hive/apps/randomblockchain/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"title": "Генератор случайных чисел randomblockchain для Hive",
"description": "Генератор случайных чисел с использованием блоков блокчейна Hive.",
"in_menu": "ГСЧ"
"in_menu": "ГСЧ",
"category": "tools"
}
3 changes: 2 additions & 1 deletion blockchains/hive/apps/wallet/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"title": "Кошелёк",
"description": "Кошелёк с возможностью просмотра и работы с балансами блокчейна Hive.",
"in_menu": "Кошелёк"
"in_menu": "Кошелёк",
"category": "no_category"
}
2 changes: 1 addition & 1 deletion menu.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"viz":{"name":"Viz","services":{"no_category":{"name":"","accounts":"Аккаунты","manage":"Управление","profiles":"Профили","projects":"Проекты","wallet":"Кошелёк","exchange":"Обмен"},"tools":{"name":"Инструменты","awards":"Награждение","calc":"Блокчейн-калькулятор","custom-generator":"custom генератор","randomblockchain":"ГСЧ","search":"Поиск viz-links"},"reytings":{"name":"Рейтинги","top":"Топ пользователей","witnesses-rewards":"Награды делегатов"},"info":{"name":"Информация","explorer":"Блок-эксплорер","buy":"Купить VIZ","help":"Справка"}}},"golos":{"name":"Golos","services":{"reytings":{"name":"Рейтинги","activities":"Активность за сутки","donates":"Топы донатов","referrers":"Топ пригласителей","top":"Топы пользователей","witnesses-rewards":"Награды делегатов"},"tools":{"name":"Инструменты","backup":"Бекап постов","calc":"Блокчейн-калькулятор","polls":"Опросы","randomblockchain":"ГСЧ","swap":"Swap"},"no_category":{"name":"","accounts":"Аккаунты","profiles":"Профили","wallet":"кошелёк","post":"Добавить пост","explorer":"Блок-эксплорер","manage":"Управление","help":"Справка"}}},"steem":{"name":"Steem","services":{"no_category":{"name":"","accounts":"Аккаунты","wallet":"Кошелёк","profiles":"Профили","post":"Публикация постов","manage":"Управление"},"tools":{"name":"Инструменты","randomblockchain":"ГСЧ","calc":"Блокчейн-калькулятор","backup":"Бекап постов"}}},"hive":{"name":"Hive","services":{"":{"name":null,"profiles":"Профили","wallet":"Кошелёк","randomblockchain":"ГСЧ","post":"Публикация постов","manage":"Управление","calc":"Блокчейн-калькулятор","backup":"Бекап постов","accounts":"Аккаунты"}}},"minter":{"name":"Minter","services":{"no_category":{"name":"","randomblockchain":"ГСЧ","profiles":"Профили"}}},"cyber":{"name":"Cyber","services":{"no_category":{"name":"","profiles":"Профили","wallet":"Кошелёк","validators":"Валидаторы","explorer":"Блок-эксплорер","accounts":"Аккаунты"},"tools":{"name":"Инструменты","linker":"Линкер","randomblockchain":"ГСЧ","ipfs":"IPFS"}}}}
{"viz":{"name":"Viz","services":{"no_category":{"name":"","accounts":"Аккаунты","manage":"Управление","profiles":"Профили","projects":"Проекты","wallet":"Кошелёк","exchange":"Обмен"},"tools":{"name":"Инструменты","awards":"Награждение","calc":"Блокчейн-калькулятор","custom-generator":"custom генератор","randomblockchain":"ГСЧ","search":"Поиск viz-links"},"reytings":{"name":"Рейтинги","top":"Топ пользователей","witnesses-rewards":"Награды делегатов"},"info":{"name":"Информация","explorer":"Блок-эксплорер","buy":"Купить VIZ","help":"Справка"}}},"golos":{"name":"Golos","services":{"reytings":{"name":"Рейтинги","activities":"Активность за сутки","donates":"Топы донатов","referrers":"Топ пригласителей","top":"Топы пользователей","witnesses-rewards":"Награды делегатов"},"tools":{"name":"Инструменты","backup":"Бекап постов","calc":"Блокчейн-калькулятор","polls":"Опросы","randomblockchain":"ГСЧ","swap":"Swap"},"no_category":{"name":"","accounts":"Аккаунты","profiles":"Профили","wallet":"кошелёк","post":"Добавить пост","explorer":"Блок-эксплорер","manage":"Управление","help":"Справка"}}},"steem":{"name":"Steem","services":{"no_category":{"name":"","accounts":"Аккаунты","wallet":"Кошелёк","profiles":"Профили","post":"Публикация постов","manage":"Управление"},"tools":{"name":"Инструменты","randomblockchain":"ГСЧ","calc":"Блокчейн-калькулятор","backup":"Бекап постов"}}},"hive":{"name":"Hive","services":{"tools":{"name":"Инструменты","calc":"Блокчейн-калькулятор","randomblockchain":"ГСЧ","backup":"Бекап постов"},"no_category":{"name":"","profiles":"Профили","accounts":"Аккаунты","wallet":"Кошелёк","post":"Публикация постов","manage":"Управление"}}},"minter":{"name":"Minter","services":{"no_category":{"name":"","randomblockchain":"ГСЧ","profiles":"Профили"}}},"cyber":{"name":"Cyber","services":{"no_category":{"name":"","profiles":"Профили","wallet":"Кошелёк","validators":"Валидаторы","explorer":"Блок-эксплорер","accounts":"Аккаунты"},"tools":{"name":"Инструменты","linker":"Линкер","randomblockchain":"ГСЧ","ipfs":"IPFS"}}}}

0 comments on commit 8fdabc0

Please sign in to comment.