gridcoin-community / Gridcoin-Site

Open source Gridcoin website
MIT License
15 stars 27 forks source link

Scripts gathering external website data #6

Open grctest opened 7 years ago

grctest commented 7 years ago

From @grctest on January 23, 2017 14:5

Could grab:

We need to change the cross site scripting security though & we shouldn't make the website too slow nor tacky/bulky.

Has to be JS, we don't have access to the underlying web server terminal.

Copied from original issue: grctest/Gridcoin-Site#18

grctest commented 7 years ago

From @startailcoon on January 24, 2017 17:24

As soon as I've completed the upgrade of Gridcoinstats I can supply the Gridcoin webpage with API access, trough JS, to the basic functions. This would include functions like latest block number and exchange prices (gathered by gridcoinstats).

Timeframe: 1-2 months

grctest commented 7 years ago

From @startailcoon on June 27, 2017 19:14

Two Public functions that can be used for the webpage for latest Projects status, Active (whitelisted) or Inactive and latest Block information on the chain.

Latest Projects Data: https://www.gridcoinstats.eu/API/api.php?a=getProjectData

Data: Array(
 "active"=>Array(name=>string, url=>string, lastActive=>date),
 "inactive"=>Array(name=>string, url=>string, lastActive=>date)
)

Latest Block Data: https://www.gridcoinstats.eu/API/api.php?a=getLastBlock Data: Array(id=>string, hash=>string, blockTime=>date, blockDiff=>double, totalBlockMinted=>double)

grctest commented 7 years ago

From @startailcoon on June 27, 2017 19:16

Coinmarketcap has a public API for grabbing the latest price feed for Gridcoin. https://api.coinmarketcap.com/v1/ticker/gridcoin/

[
    {
        "id": "gridcoin", 
        "name": "GridCoin", 
        "symbol": "GRC", 
        "rank": "92", 
        "price_usd": "0.0571596", 
        "price_btc": "0.00002416", 
        "24h_volume_usd": "486330.0", 
        "market_cap_usd": "22310121.0", 
        "available_supply": "390312753.0", 
        "total_supply": "390312753.0", 
        "percent_change_1h": "4.06", 
        "percent_change_24h": "-2.65", 
        "percent_change_7d": "-31.33", 
        "last_updated": "1498590012"
    }
]
grctest commented 7 years ago

From @startailcoon on June 27, 2017 19:23

Sample code to get this working with jQuery

    function loadBlocksData() {
      var request = $.ajax({
        url:'https://www.gridcoinstats.eu/API/api.php?a=getLastBlock',
        crossDomain: true,
        dataType: 'json',
      });
      request.done(function(data) {
        $('#blockDataDiv').append('Block ID: ' + data['id'] + ', Block Hash: ' + data['hash'] + ', Time: ' + data['blockTime']);
      });
    }

$(document).ready(function() {
     loadBlockHeaders();
});
grctest commented 7 years ago

This issue has arisen again regarding the slack invite portal being added to the gridcoin website.

grctest commented 7 years ago

From @barton2526 on August 16, 2017 1:41

I can change the cross site scripting file to accommodate these and the slack scripts.

grctest commented 7 years ago

Current XSS policy:

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
    <!-- Read this: www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html -->

    <!-- Most restrictive policy: -->
    <site-control permitted-cross-domain-policies="none"/>

    <!-- Least restrictive policy: -->
    <!--
    <site-control permitted-cross-domain-policies="all"/>
    <allow-access-from domain="*" to-ports="*" secure="false"/>
    <allow-http-request-headers-from domain="*" headers="*" secure="false"/>
    -->
</cross-domain-policy>

We can work with Rob to get this changed.

grctest commented 7 years ago

What scripts would people actually want implemented on the Gridcoin website?

barton2526 commented 5 years ago

With #175 we have our first external script pulling data into the site!