From 3acbb6521be7af1aee1a1210b9ff78bee68d9a44 Mon Sep 17 00:00:00 2001
From: j-bitmaker <51827834+j-bitmaker@users.noreply.github.com>
Date: Fri, 29 Dec 2023 15:50:18 +0300
Subject: [PATCH] getbans
---
js/satolist.js | 66 ++++++++++++++++++++++++++++++++++++++++++++-
localization/en.js | 7 ++++-
localization/ru.js | 7 ++++-
proxy16/node/rpc.js | 8 ++++--
4 files changed, 83 insertions(+), 5 deletions(-)
diff --git a/js/satolist.js b/js/satolist.js
index e62c6dabfb..ad4078515e 100644
--- a/js/satolist.js
+++ b/js/satolist.js
@@ -8609,6 +8609,65 @@ Platform = function (app, listofnodes) {
},
+ getbans : function(clbk){
+
+ var address = self.app.platform.sdk.address && self.app.platform.sdk.address.pnet().address;
+
+ console.log('getbans', address);
+
+ var params = [address];
+
+ self.app.api.rpc('getbans', params).then(d => {
+
+ console.log('DDDD', d);
+
+ var ban = d && d[0];
+
+ if (ban && ban.reason){
+
+ var showBanDialog = content => {
+
+ console.log('dddd', content);
+
+ console.log('currentblock', self.currentBlock);
+
+ var endDate = new Date(new Date().getTime() - (ban.ending - self.currentBlock) * 60 * 1000);
+
+
+ var formattedDate = convertDate(dateToStr(endDate));
+
+ new dialog({
+ html: self.app.localization.e('accountBanned') + '
' + self.app.localization.e('reason') + '
' + self.app.localization.e('lowstar_reason_' + ban.reason) + '.
' + self.app.localization.e('unlockDate') + '
' + formattedDate + '
' + self.app.localization.e('accountBannedActions'),
+ btn1text: 'OK',
+
+ class: 'zindex one',
+
+ })
+
+ self.app.platform.sdk.user.blocked = true;
+
+ if (clbk)
+ clbk();
+
+ }
+
+ self.app.api.rpc('getcontents', [ban.contentid]).then(showBanDialog)
+ .catch(e => {
+
+ showBanDialog(null, e);
+
+ })
+
+
+
+ }
+
+
+
+ })
+
+ },
+
getfullfb: function (clbk, update) {
self.sdk.users.getone(app.user.address.value, (user, error) => {
@@ -8808,6 +8867,8 @@ Platform = function (app, listofnodes) {
reputationBlockedMe : function(address, count){
+ if (self.app.platform.sdk.user.blocked) return true;
+
if(!address) address = self.app.user.address.value
return self.app.platform.sdk.user.itisme(address) && self.app.platform.sdk.user.reputationBlocked(address, count)
@@ -14638,12 +14699,15 @@ Platform = function (app, listofnodes) {
return self.app.api.rpc('getnodeinfo').then(d => {
+ debugger;
+
var t = deep(d, 'time') || 0
self.currentBlock = 0
self.timeDifference = 0;
try{
+
self.currentBlock = deep(d, 'lastblock.height') || localStorage['lastblock'] || 0
localStorage['lastblock'] = self.currentBlock
}catch(e){
@@ -22535,7 +22599,7 @@ Platform = function (app, listofnodes) {
setTimeout(function(){
self.sdk.tags.cloud()
- self.sdk.node.get.time()
+ self.sdk.node.get.time(self.sdk.user.getbans);
}, 1000)
self.sdk.videos.init()
diff --git a/localization/en.js b/localization/en.js
index 4298f3d030..0e1987019e 100644
--- a/localization/en.js
+++ b/localization/en.js
@@ -2782,4 +2782,9 @@ _l.registration_blocked = _l.lockedaccount
_l.horizontalSearchUsers = "Accounts"
_l.information = "Information"
_l.sendcoins = "Send PKOIN"
-_l.notificationsTurnOffQ = 'Are you sure you want to turn off notifications from this user?'
\ No newline at end of file
+_l.notificationsTurnOffQ = 'Are you sure you want to turn off notifications from this user?'
+
+_l.accountBanned = "Your account has been blocked for actions contrary to the Bastyon rules.";
+_l.reason = "Reason: ";
+_l.accountBannedActions = "You can't post, comment, and do other similar activities, but you can continue to use your wallet.";
+_l.unlockDate = "Unlock date:";
\ No newline at end of file
diff --git a/localization/ru.js b/localization/ru.js
index 1c77b12570..447e862427 100644
--- a/localization/ru.js
+++ b/localization/ru.js
@@ -2567,4 +2567,9 @@ _l.registration_blocked = _l.lockedaccount
_l.horizontalSearchUsers = "Пользователи"
_l.information = "Информация"
_l.sendcoins = "Отправить PKOIN"
-_l.notificationsTurnOffQ = 'Вы действительно хотите отключить уведомления от данного пользователя?'
\ No newline at end of file
+_l.notificationsTurnOffQ = 'Вы действительно хотите отключить уведомления от данного пользователя?'
+
+_l.accountBanned = "Ваш аккаут заблокирован за действия, противорчающие правилам пользования Bastyon. ";
+_l.reason = "Причина: ";
+_l.accountBannedActions = "Вы не можете публиковать сообщения, комментировать и совершать другие подобные действия, но можете продолжать использовать свой кошелек.";
+_l.unlockDate = "Дата снятия блокировки:";
\ No newline at end of file
diff --git a/proxy16/node/rpc.js b/proxy16/node/rpc.js
index 2986c32d40..a538e45001 100644
--- a/proxy16/node/rpc.js
+++ b/proxy16/node/rpc.js
@@ -143,7 +143,9 @@ const publics = {
getalljury: true,
getjuryassigned: true,
getjurymoderators: true,
- getaccountearning : true
+ getaccountearning : true,
+
+ getbans : true
}
@@ -512,7 +514,9 @@ RpcClient.callspec = {
getalljury: '',
getjuryassigned: 'str',
getjurymoderators: 'str',
- getaccountearning : 'str int int'
+ getaccountearning : 'str int int',
+
+ getbans: 'str'
};
var slice = function(arr, start, end) {