diff --git a/CHANGELOG.md b/CHANGELOG.md index 65bc83c..28a12a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ CHANGELOG ======================== -# v1.7.10 (06/09/2023) +# v1.7.10 (08/09/2023) * NEW: Subscription type chooser interface (hourly/bandwidth) * NEW: Slider for hourly subscription on range of 1-30 days @@ -10,6 +10,7 @@ CHANGELOG * NEW: GetHourAllocation() routine in sentinel.py * ADD: INACTIVE_DIALOG_BG_COLOR in konstants.py MeileColors class * ADD: user defined TIMEOUT for HTTPRequests adapter +* ADD: Persistent RPC when changed within settings so restart not needed * UPDATE: SubsFinalResult data to include hour subscription data and expirary data * UPDATE: add variable to root.get_data_used(..., root.expirary_date) (meile.kv) * UPDATE: Check in get_subscriptions() if sub is hourly, if so compute nodeQuota list @@ -19,6 +20,7 @@ CHANGELOG * UPDATE: subscribe() in wallet.py to handle hourly subscriptions * CHANGE: Size of location pin * FIX: Last country card in left pane being cut off by bottom navbar +* FIX: Bandwdith bar hour hourly subs using UTC offeset from localtime * REMOVE: FullImage/2 from meile.kv and interfaces.py * REMOVE: \, \ from meile.kv @@ -91,27 +93,47 @@ CHANGELOG # v1.4.1 (29/01/2023) * NEW: Toast Message for Rating sent or errored out + * NEW: Version control in Help Screen + * NEW: Mac OS X App Bundle Release + * FIX: Logic in Rating and Location retrieval + * FIX: MapView Cache folder now located in ~/.meile.gui instead of CWD (fixes App Bundle) + * FIX: Wallet logic + * UPDATE: Sentinel-CLI for CosmWasm Sentinel Network Upgrade + * UPDATE: Packager Installer installs App Bundle to Desktop + * UPDATE: Improved HTTPs requests using requests adapter # v1.4.0 (17/01/2023) + * NEW: First Windows Binary Release (Pre-release) + * NEW: gsudo Packaged with Windows binary + * NEW: Wireguard binary packaged with Meile binary + * NEW: HTTPSRequests Adapater for max retries and timeout on API Calls + * NEW: Packaging wexpect binary and collection bundle with app + * CHANGE: Swtiched from pexpect wrapper library to wexpect wrapper library for windows compatability + * CHANGE: Re-worked Ratings/Node Locations Logic + * CHANGE: Removed WARP support for Windows Users + * CHANGE: Updated Help version number routine to a constant + * CHANGE: Pyinstaller .spec file for Windows build. Changes from Linux/ OS X Version to include release for Windows. + * CHANGE: MapView cache now loads in .meile-gui home folder location instead of CWD + * CHANGE: Icon logo for Kivy and for Task Bar and Desktop Icon # v1.3.0 (06/12/2022) diff --git a/src/cli/sentinel.py b/src/cli/sentinel.py index 4540358..537e6a3 100644 --- a/src/cli/sentinel.py +++ b/src/cli/sentinel.py @@ -4,7 +4,9 @@ import re import requests from urllib3.exceptions import InsecureRequestWarning -from datetime import datetime +from datetime import datetime,timedelta +import time + from treelib import Tree @@ -37,6 +39,8 @@ def __init__(self, node_tree): def get_nodes(self, latency, *kwargs): AllNodesInfo = [] print("Running sentinel-cli with latency: %s" % latency) + CONFIG = MeileConfig.read_configuration(MeileConfig.CONFFILE) + self.RPC = CONFIG['network'].get('rpc', HTTParams.RPC) nodeCMD = [sentinelcli, "query", "nodes", "--node", self.RPC, "--limit", "20000", "--timeout", "%s" % latency] proc = Popen(nodeCMD, stdout=PIPE) @@ -195,6 +199,8 @@ def get_subscriptions(self, ADDRESS): SubsNodesInfo = [] SubsFinalResult = [] print("Geting Subscriptions... %s" % ADDRESS) + CONFIG = MeileConfig.read_configuration(MeileConfig.CONFFILE) + self.RPC = CONFIG['network'].get('rpc', HTTParams.RPC) subsCMD = [sentinelcli, "query", "subscriptions", "--node", self.RPC, "--limit", "1000", "--address" ,ADDRESS] proc = Popen(subsCMD, stdout=PIPE) @@ -243,7 +249,7 @@ def get_subscriptions(self, ADDRESS): continue if int(SubsResult[NodeKeys.SubsInfoKeys[6]][k]) > 0: - nodeQuota = self.GetHourAllocation(SubsResult[NodeKeys.SubsInfoKeys[6]][k], SubsResult[NodeKeys.SubsInfoKeys[2]][k]) + SubsResult[NodeKeys.SubsInfoKeys[2]][k],nodeQuota = self.GetHourAllocation(SubsResult[NodeKeys.SubsInfoKeys[6]][k], SubsResult[NodeKeys.SubsInfoKeys[2]][k]) else: nodeQuota = self.GetQuota(SubsResult[NodeKeys.SubsInfoKeys[0]][k]) @@ -268,6 +274,8 @@ def get_subscriptions(self, ADDRESS): def GetQuota(self, id): + CONFIG = MeileConfig.read_configuration(MeileConfig.CONFFILE) + self.RPC = CONFIG['network'].get('rpc', HTTParams.RPC) quotaCMD = [sentinelcli, 'query', 'allocations', '--node', self.RPC, '--page', '1', id] proc = Popen(quotaCMD, stdout=PIPE) h=1 @@ -294,6 +302,9 @@ def GetHourAllocation(self, hours, idate): nodeQuota.append(str(hours) + "hrs") inactive_date = idate.lstrip().rstrip().split('.')[0] inactive_date = datetime.strptime(inactive_date, '%Y-%m-%d %H:%M:%S') + ts = time.time() + utc_offset = float((datetime.fromtimestamp(ts) - datetime.utcfromtimestamp(ts)).total_seconds()/3600) + inactive_date = inactive_date + timedelta(hours=utc_offset) now = datetime.now() subdelta = inactive_date - now remaining_hours = round(float(subdelta.total_seconds())/3600,3) @@ -303,9 +314,9 @@ def GetHourAllocation(self, hours, idate): if remaining_hours <= 0: return None else: - print(f"inactive_date: {idate}, time_remaining: {remaining_hours}, time_consumed: {consumed}") + print(f"inactive_date: {str(inactive_date)}, time_remaining: {remaining_hours}, time_consumed: {consumed}") nodeQuota.append(str(round(consumed,2)) + "hrs") - return nodeQuota + return str(inactive_date),nodeQuota def disconnect(v2ray): if v2ray: diff --git a/src/cli/wallet.py b/src/cli/wallet.py index 62125a2..894a7f2 100644 --- a/src/cli/wallet.py +++ b/src/cli/wallet.py @@ -113,6 +113,7 @@ def create(self, wallet_name, keyring_passphrase, seed_phrase): def subscribe(self, KEYNAME, NODE, DEPOSIT, GB, hourly): CONFIG = MeileConfig.read_configuration(MeileConfig.CONFFILE) PASSWORD = CONFIG['wallet'].get('password', '') + self.RPC = CONFIG['network'].get('rpc', HTTParams.RPC) ofile = open(ConfParams.SUBSCRIBEINFO, "wb") if not KEYNAME: @@ -272,24 +273,6 @@ def grpc_unsubscribe(self, privkey, subId): message = f"Error creating or broadcasting unsubscribe tx message: {str(e)}" return {'hash' : tx_hash, 'success' : tx_success, 'message' : message} - - def check_active_subscriptions(self, address): - Request = HTTPRequests.MakeRequest() - http = Request.hadapter() - endpoint = HTTParams.APIURL + HTTParams.SESSIONS_API_URL % address - - try: - r = http.get(endpoint) - json_data = r.json() - - if len(json_data['sessions']) == 0: - return {'session' : False, 'data' : None} - else: - return {'session' : True, 'data' : { 'status' : json_data['sessions'][0]['status'], 'status_at' : json_data['sessions'][0]['status_at'] } } - - except Exception as e: - print(str(e)) - return None def ParseUnSubscribe(self): @@ -308,6 +291,7 @@ def connect(self, ID, address, type): CONFIG = MeileConfig.read_configuration(MeileConfig.CONFFILE) PASSWORD = CONFIG['wallet'].get('password', '') KEYNAME = CONFIG['wallet'].get('keyname', '') + self.RPC = CONFIG['network'].get('rpc', HTTParams.RPC) cliCMD = "%s connect --home %s --keyring-backend file --keyring-dir %s --chain-id %s --node %s --gas-prices %s --gas %d --gas-adjustment %f --yes --from '%s' %s %s" % (sentinelcli, ConfParams.BASEDIR, ConfParams.KEYRINGDIR, diff --git a/src/ui/widgets.py b/src/ui/widgets.py index 4c4c320..5bf82bb 100644 --- a/src/ui/widgets.py +++ b/src/ui/widgets.py @@ -30,6 +30,7 @@ import asyncio from copy import deepcopy from datetime import datetime, timedelta +import time import main.main as Meile from typedef.konstants import IBCTokens, HTTParams, MeileColors @@ -538,9 +539,12 @@ def get_data_used(self, allocated, consumed, node_address, expirary_date): def compute_consumed_hours(self, allocated, expirary_date): - allocated = allocated.split('hrs')[0].rstrip().lstrip() + allocated = allocated.split('hrs')[0].rstrip().lstrip() now = datetime.now() expirary_date = datetime.strptime(expirary_date,'%b %d %Y, %I:%M %p') + ts = time.time() + utc_offset = float((datetime.fromtimestamp(ts) - datetime.utcfromtimestamp(ts)).total_seconds()/3600) + expirary_date = expirary_date + timedelta(hours=utc_offset) sub_date = expirary_date - timedelta(hours=float(allocated)) subdelta = now - sub_date remaining_hours = round(float(subdelta.total_seconds())/3600,3)