Skip to content

Commit

Permalink
v6.00.39-dev-pre-rev-23 (#166)
Browse files Browse the repository at this point in the history
* TODO

TODO

* zingchart upgrade, refactoring / optimizations

zingchart upgrade, refactoring / optimizations

* UX

UX

* fixes

fixes

* fixes / notes

fixes / notes
  • Loading branch information
taoteh1221 authored Sep 10, 2024
1 parent b902ea2 commit cadbc26
Show file tree
Hide file tree
Showing 27 changed files with 152 additions and 127 deletions.
11 changes: 6 additions & 5 deletions CONTRIBUTING.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ CONTRIBUTION GUIDELINES (FOR DEVELOPERS):
----------------------------------------------------------------------
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!
!!!!
===> Keep an eye out for EFFECTS ON any 3rd party libraries using the 'unload' eventListener,
===> as it's being FULLY DEPRECIATED / DISABLED in chrome by the end of 2024:
===> https://developer.chrome.com/docs/web-platform/deprecating-unload
!!!!
===> WHEN DEBUGGING PHP, LEAVE "$ct['dev']['debug_php_errors']" IN "developer-config.php" SET
===> LIKE SO, TO ALWAYS LOG ALL PARSE / FATAL PHP ERRORS DURING TESTING: (E_ERROR | E_PARSE)
!!!!
Expand All @@ -114,10 +118,7 @@ CONTRIBUTION GUIDELINES (FOR DEVELOPERS):
!!!!
===> config.php (and plug-conf.php for plugins) MUST only contain STATIC VALUES,
===> as all configs are saved to / run from the cache file: /cache/secured/ct_conf_XXXXXXXXX.dat
!!!!
===> DO *NOT* UPGRADE ZingCart, as it can be BUGGY occasionally for auto-resizing on page showing,
===> AND we FORCE the BRANDING LINK to show EVEN IN A LOCALHOST environment (with custom tweaks)
!!!!
!!!!
===> May come in handy for writing PHP unit tests (in /app-lib/php/inline/debugging/):
===> https://stackoverflow.com/questions/861254/iterate-over-properties-of-a-php-class
!!!!
Expand Down
4 changes: 2 additions & 2 deletions DOCUMENTATION-ETC/CONFIG-EXAMPLE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ $ct['conf']['charts_alerts']['tracked_markets'] = array(
// MANA
'mana-2||binance||btc||both',
'mana-3||kucoin||btc||none',
'mana-4||ethfinex||usd||none',
'mana-4||bitfinex||usd||none',
'mana-5||binance||eth||none',


Expand Down Expand Up @@ -2670,7 +2670,7 @@ $ct['conf']['assets'] = array(

'usd' => array(
'coinbase' => 'MANA-USD',
'ethfinex' => 'tMNAUSD',
'bitfinex' => 'tMNAUSD',
'presale_usd_value' => 'mana',
),

Expand Down
17 changes: 12 additions & 5 deletions DOCUMENTATION-ETC/TODO.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ GENERAL REMINDERS
----------------------------------------------------------------------
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!
!!!!
===> Keep an eye out for EFFECTS ON any 3rd party libraries using the 'unload' eventListener,
===> as it's being FULLY DEPRECIATED / DISABLED in chrome by the end of 2024:
===> https://developer.chrome.com/docs/web-platform/deprecating-unload
!!!!
===> WHEN DEBUGGING PHP, LEAVE "$ct['dev']['debug_php_errors']" IN "developer-config.php" SET
===> LIKE SO, TO ALWAYS LOG ALL PARSE / FATAL PHP ERRORS DURING TESTING: (E_ERROR | E_PARSE)
!!!!
Expand All @@ -50,9 +54,6 @@ GENERAL REMINDERS
!!!!
===> config.php (and plug-conf.php for plugins) MUST only contain STATIC VALUES,
===> as all configs are saved to / run from the cache file: /cache/secured/ct_conf_XXXXXXXXX.dat
!!!!
===> DO *NOT* UPGRADE ZingCart, as it can be BUGGY occasionally for auto-resizing on page showing,
===> AND we FORCE the BRANDING LINK to show EVEN IN A LOCALHOST environment (with custom tweaks)
!!!!
===> May come in handy for writing PHP unit tests (in /app-lib/php/inline/debugging/):
===> https://stackoverflow.com/questions/861254/iterate-over-properties-of-a-php-class
Expand Down Expand Up @@ -194,7 +195,7 @@ P̵̫̊h̴̪̑ì̶̯s̵̫̀h̸̠̆i̶̔͜n̸̞͒g̶̳̏ ̸̺͐a̴͎̓n̷̜̕d̴
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


Test LINUX Desktop Edition FIRST, as Windows 11 forced updates have been borking up dual boot / bitlocker setups a ton the past few months (lol)
Test LINUX Desktop Edition FIRST, as Windows 11 forced updates have been borking up dual boot / bitlocker setups a ton the past few months (lol)


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~DO AN APP RELEASE AT THIS POINT IN THIS LIST~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -203,6 +204,12 @@ Test LINUX Desktop Edition FIRST, as Windows 11 forced updates have been borking
Do a bitcoin opentimestamp of the v6.00.39 release.


Add any other 'required api key' notices, near the top of the external data function. This is a VERY RELIABLE PLACE to have ALL of the checks, as we ALWAYS use the external data function to get API data.


Fix EVERYTHING in ALL documentation, where we moved settings over to different sections.


Add bitcoin as a 'primary currency' option (like we can do for eth / sol).


Expand Down
6 changes: 4 additions & 2 deletions DOCUMENTATION-ETC/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6785,9 +6785,9 @@ AND MIGRATE YOUR EXISTING CUSTOM SETTINGS TO THE NEW FORMAT.

-BUG FIX: Miscellaneous fixes

-Refactoring / optimization of ENTIRE markets API data parsing logic (for 'Add New Asset' feature, in admin 'Portfolio Assets' WEB INTERFACE)
-Upgraded Jupiter Aggregator exchange API, including case-sensitive support for asset IDs, addition of market trade volume data, and asset search

-Upgraded Jupiter Aggregator exchange API, including case-sensitive support for asset IDs, and the addition of market trade volume data
-Refactoring / optimization of ENTIRE markets API data parsing logic (for 'Add New Asset' feature, in admin 'Portfolio Assets' WEB INTERFACE)

-Added Admin Config settings for: Portfolio Assets (adding / removing assets and markets is FINALLY available in the interface now)

Expand All @@ -6801,6 +6801,8 @@ AND MIGRATE YOUR EXISTING CUSTOM SETTINGS TO THE NEW FORMAT.

-Upgraded Idex exchange API to v4

-Upgraded ZingChart to v2.9.15

-Upgraded Kraken exchange API

IMPORTANT *UPGRADE* NOTICES:
Expand Down
2 changes: 1 addition & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ AED / ARS / AUD / BDT / BRL / BTC / CAD / CHF / CLP / CZK / DAI / DKK / ETH / EU

Support for over 70 exchanges (contact me to request more):

aevo_futures / alphavantage_stock / binance / binance_us / bit2c / bitbns / bitfinex / bitflyer / bitmart / bitmex / bitmex_u20 / bitmex_z20 / bitso / bitstamp / btcmarkets / btcturk / buyucoin / bybit / cex / coinbase / coindcx / coinex / coingecko_aed / coingecko_ars / coingecko_bdt / coingecko_btc / coingecko_clp / coingecko_czk / coingecko_dkk / coingecko_eth / coingecko_gel / coingecko_hkd / coingecko_huf / coingecko_idr / coingecko_inr / coingecko_kwd / coingecko_lkr / coingecko_myr / coingecko_ngn / coingecko_nis / coingecko_nok / coingecko_nzd / coingecko_php / coingecko_pkr / coingecko_pln / coingecko_rmb / coingecko_rub / coingecko_sar / coingecko_sek / coingecko_sgd / coingecko_terminal / coingecko_thb / coingecko_twd / coingecko_uah / coingecko_usd / coingecko_vnd / coinspot / crypto.com / ethfinex / gateio / gemini / hitbtc / huobi / idex / jupiter_ag / korbit / kraken / kucoin / loopring_amm / luno / okcoin / okex / poloniex / presale_usd_value / unocoin / upbit / wazirx / zebpay
aevo_futures / alphavantage_stock / binance / binance_us / bit2c / bitbns / bitfinex / bitflyer / bitmart / bitmex / bitmex_u20 / bitmex_z20 / bitso / bitstamp / btcmarkets / btcturk / buyucoin / bybit / cex / coinbase / coindcx / coinex / coingecko_aed / coingecko_ars / coingecko_bdt / coingecko_btc / coingecko_clp / coingecko_czk / coingecko_dkk / coingecko_eth / coingecko_gel / coingecko_hkd / coingecko_huf / coingecko_idr / coingecko_inr / coingecko_kwd / coingecko_lkr / coingecko_myr / coingecko_ngn / coingecko_nis / coingecko_nok / coingecko_nzd / coingecko_php / coingecko_pkr / coingecko_pln / coingecko_rmb / coingecko_rub / coingecko_sar / coingecko_sek / coingecko_sgd / coingecko_terminal / coingecko_thb / coingecko_twd / coingecko_uah / coingecko_usd / coingecko_vnd / coinspot / crypto.com / gateio / gemini / hitbtc / huobi / idex / jupiter_ag / korbit / kraken / kucoin / loopring_amm / luno / okcoin / okex / poloniex / presale_usd_value / unocoin / upbit / wazirx / zebpay


Nearly Unlimited Assets Supported (whatever assets exist on supported exchanges).
Expand Down
2 changes: 1 addition & 1 deletion TROUBLESHOOTING.txt
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ AED / ARS / AUD / BDT / BRL / BTC / CAD / CHF / CLP / CZK / DAI / DKK / ETH / EU

Support for over 70 exchanges (contact me to request more):

aevo_futures / alphavantage_stock / binance / binance_us / bit2c / bitbns / bitfinex / bitflyer / bitmart / bitmex / bitmex_u20 / bitmex_z20 / bitso / bitstamp / btcmarkets / btcturk / buyucoin / bybit / cex / coinbase / coindcx / coinex / coingecko_aed / coingecko_ars / coingecko_bdt / coingecko_btc / coingecko_clp / coingecko_czk / coingecko_dkk / coingecko_eth / coingecko_gel / coingecko_hkd / coingecko_huf / coingecko_idr / coingecko_inr / coingecko_kwd / coingecko_lkr / coingecko_myr / coingecko_ngn / coingecko_nis / coingecko_nok / coingecko_nzd / coingecko_php / coingecko_pkr / coingecko_pln / coingecko_rmb / coingecko_rub / coingecko_sar / coingecko_sek / coingecko_sgd / coingecko_terminal / coingecko_thb / coingecko_twd / coingecko_uah / coingecko_usd / coingecko_vnd / coinspot / crypto.com / ethfinex / gateio / gemini / hitbtc / huobi / idex / jupiter_ag / korbit / kraken / kucoin / loopring_amm / luno / okcoin / okex / poloniex / presale_usd_value / unocoin / upbit / wazirx / zebpay
aevo_futures / alphavantage_stock / binance / binance_us / bit2c / bitbns / bitfinex / bitflyer / bitmart / bitmex / bitmex_u20 / bitmex_z20 / bitso / bitstamp / btcmarkets / btcturk / buyucoin / bybit / cex / coinbase / coindcx / coinex / coingecko_aed / coingecko_ars / coingecko_bdt / coingecko_btc / coingecko_clp / coingecko_czk / coingecko_dkk / coingecko_eth / coingecko_gel / coingecko_hkd / coingecko_huf / coingecko_idr / coingecko_inr / coingecko_kwd / coingecko_lkr / coingecko_myr / coingecko_ngn / coingecko_nis / coingecko_nok / coingecko_nzd / coingecko_php / coingecko_pkr / coingecko_pln / coingecko_rmb / coingecko_rub / coingecko_sar / coingecko_sek / coingecko_sgd / coingecko_terminal / coingecko_thb / coingecko_twd / coingecko_uah / coingecko_usd / coingecko_vnd / coinspot / crypto.com / gateio / gemini / hitbtc / huobi / idex / jupiter_ag / korbit / kraken / kucoin / loopring_amm / luno / okcoin / okex / poloniex / presale_usd_value / unocoin / upbit / wazirx / zebpay


Nearly Unlimited Assets Supported (whatever assets exist on supported exchanges).
Expand Down
4 changes: 2 additions & 2 deletions app-lib/js/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2541,7 +2541,7 @@ $(elm_id).html("<div style='margin: " + loading_height + "em; line-height: " + (
$(elm_id).html(data); // Load response into the passed element id


// Resets / inits after 0.75 seconds (to give rendering time to finish)
// Resets / inits after 1.25 seconds (to give rendering time to finish)
setTimeout(function() {

// Highlightjs
Expand All @@ -2568,7 +2568,7 @@ $(elm_id).html("<div style='margin: " + loading_height + "em; line-height: " + (

}

}, 750);
}, 1250);

},

Expand Down
8 changes: 6 additions & 2 deletions app-lib/js/jquery/jquery-javascript-combined.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@

// Loop the js Array
foreach ($js as $js_file) {
// Load the content of the js file
$js_content .= "\n\n\n\n" . '/******* COMBINED JAVASCRIPT FILE: '.$js_file.' *******/ ' . "\n\n\n\n" . file_get_contents($js_file);

$file_contents = file_get_contents($js_file);

// Load the content of the js file
$js_content .= "\n\n\n\n" . '/******* COMBINED JAVASCRIPT FILE: '.$js_file.' *******/ ' . "\n\n\n\n" . $file_contents;

}

// print the js content
Expand Down
16 changes: 14 additions & 2 deletions app-lib/js/root-javascript-combined.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,20 @@

// Loop the js Array
foreach ($js as $js_file) {
// Load the content of the js file
$js_content .= "\n\n\n\n" . '/******* COMBINED JAVASCRIPT FILE: '.$js_file.' *******/ ' . "\n\n\n\n" . file_get_contents($js_file);

$file_contents = file_get_contents($js_file);

// Force zingchart BRANDING LINK to ALWAYS SHOW, even on localhost / 127.0.0.1 (local user's machine)
// (DESKTOP EDITIONS RUN AS LOCALHOST, BUT WE WANT TO DISPLAY THEIR BRANDING FOR LICENSING REQUIREMENTS)
if ( $js_file == 'zingchart.min.js' ) {
$file_contents = preg_replace("/localhost/i", "sameforlocalhost", $file_contents);
$file_contents = preg_replace("/127\.0\.0\.1/i", "0.0.0.0", $file_contents);
}


// Load the content of the js file
$js_content .= "\n\n\n\n" . '/******* COMBINED JAVASCRIPT FILE: '.$js_file.' *******/ ' . "\n\n\n\n" . $file_contents;

}

// print the js content
Expand Down
4 changes: 2 additions & 2 deletions app-lib/js/zingchart.min.js

Large diffs are not rendered by default.

29 changes: 1 addition & 28 deletions app-lib/php/classes/core/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,6 @@ class ct_api {
),


'ethfinex' => array(
'markets_endpoint' => 'https://api-pub.bitfinex.com/v2/tickers?symbols=ALL',
'markets_nested_path' => false, // Delimit multiple depths with >
'all_markets_support' => '0', // false|true[IF key name is the ID]|market_info_key_name
'search_endpoint' => false, // false|[API endpoint with all market pairings]
),


'bitflyer' => array(
'markets_endpoint' => 'https://api.bitflyer.com/v1/getticker?product_code=[MARKET]',
'markets_nested_path' => false, // Delimit multiple depths with >
Expand Down Expand Up @@ -543,10 +535,6 @@ function etherscan($block_info) {

global $ct;

if ( trim($ct['conf']['ext_apis']['etherscan_api_key']) == '' ) {
return false;
}

$url = 'https://api.etherscan.io/api?module=proxy&action=eth_blockNumber&apikey=' . $ct['conf']['ext_apis']['etherscan_api_key'];

$response = @$ct['cache']->ext_data('url', $url, $ct['conf']['power']['blockchain_stats_cache_time']);
Expand Down Expand Up @@ -2666,21 +2654,6 @@ function market($asset_symb, $sel_exchange, $mrkt_id, $pair=false) {


elseif ( $sel_exchange == 'alphavantage_stock' ) {


if ( trim($ct['conf']['ext_apis']['alphavantage_api_key']) == null ) {

$ct['gen']->log(
'notify_error',
'"alphavantage_api_key" (free API key) is not configured in Admin Config EXTERNAL APIS section',
false,
'alphavantage_api_key'
);

return false;

}


$result = array(
'alphavantage_asset' => preg_replace("/\.(.*)/i", "", $data["01. symbol"]),
Expand Down Expand Up @@ -2761,7 +2734,7 @@ function market($asset_symb, $sel_exchange, $mrkt_id, $pair=false) {



elseif ( $sel_exchange == 'bitfinex' || $sel_exchange == 'ethfinex' ) {
elseif ( $sel_exchange == 'bitfinex' ) {

$finex_price = $data[( sizeof($data) - 4 )];

Expand Down
6 changes: 1 addition & 5 deletions app-lib/php/classes/core/asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -1503,11 +1503,7 @@ function market_id_parse($exchange_key, $market_id, $known_pairing=false, $known
elseif ( $exchange_key == 'bybit' && substr($cleaned_market_id, 0, 4) == '1000' ) {
$cleaned_market_id = substr($cleaned_market_id, 4);
}
elseif (
$exchange_key == 'bitfinex' && substr($cleaned_market_id, 0, 1) == 't'
||
$exchange_key == 'ethfinex' && substr($cleaned_market_id, 0, 1) == 't'
) {
elseif ( $exchange_key == 'bitfinex' && substr($cleaned_market_id, 0, 1) == 't' ) {
$cleaned_market_id = substr($cleaned_market_id, 1);
}

Expand Down
27 changes: 27 additions & 0 deletions app-lib/php/classes/core/cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -2766,6 +2766,33 @@ function ext_data($mode, $request_params, $ttl, $api_server=null, $post_encoding

$endpoint_tld_or_ip = $ct['gen']->get_tld_or_ip($api_endpoint);


if ( $endpoint_tld_or_ip == 'alphavantage.co' && trim($ct['conf']['ext_apis']['alphavantage_api_key']) == '' ) {

$ct['gen']->log(
'notify_error',
'"alphavantage_api_key" (free API key) is not configured in Admin Config EXTERNAL APIS section',
false,
'alphavantage_api_key'
);

return false;

}
elseif ( $endpoint_tld_or_ip == 'etherscan.io' && trim($ct['conf']['ext_apis']['etherscan_api_key']) == '' ) {

$ct['gen']->log(
'notify_error',
'"etherscan_api_key" (free API key) is not configured in Admin Config EXTERNAL APIS section',
false,
'etherscan_api_key'
);

return false;

}


// IPV6 friendly filename (no illegal filename characters)
$safe_name = $ct['gen']->safe_name($endpoint_tld_or_ip);

Expand Down
25 changes: 8 additions & 17 deletions app-lib/php/classes/core/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -2705,26 +2705,17 @@ function sanitize_string($method, $ext_key, $data, $mysqli_connection=false) {
// ***WHEN HASHES / DIGESTS ARE RUN THROUGH THE HEXIDECIMAL DECODER FURTHER DOWN IN THIS FUNCTION***)
if (

// QR Code Generator (GET / POST, for crypto addresses)
$ext_key == 'qr_code_crypto_address'
// Security tokens, WITH 'token' IN NAME
stristr($ext_key, 'token')

// General security token (GET ONLY, for user area [NOT logged into admin])
|| strtolower($method) == 'get' && $ext_key == 'token'
// Security tokens, WITH 'nonce' IN NAME
|| stristr($ext_key, 'nonce')

// Admin hashed nonce security tokens (GET ONLY...for EXPIRED logout link UX, WE *CAN SAFELY* SKIP $ct['gen']->admin_logged_in() REQUIREMENT)
|| strtolower($method) == 'get' && $ext_key == 'admin_nonce'
// Admin 2FA setup security token
|| $ext_key == '2fa_setup'

// Admin 2FA setup security token (GET ONLY)
|| $ct['gen']->admin_logged_in() && strtolower($method) == 'get' && $ext_key == '2fa_setup'

// Admin iframe security tokens (GET ONLY)
|| $ct['gen']->admin_logged_in() && strtolower($method) == 'get' && $ext_key == 'iframe_nonce'

// Admin hashed nonce security tokens (POST ONLY)
|| $ct['gen']->admin_logged_in() && strtolower($method) == 'post' && $ext_key == 'admin_nonce'

// Admin medium security level's hashed nonce security token (POST ONLY)
|| $ct['gen']->admin_logged_in() && strtolower($method) == 'post' && $ext_key == 'medium_security_nonce'
// QR Code Generator (for crypto addresses)
|| $ext_key == 'qr_code_crypto_address'

) {
return $data;
Expand Down
Loading

0 comments on commit cadbc26

Please sign in to comment.