-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Buddy Deck
committed
Nov 7, 2019
1 parent
4451846
commit efbcc35
Showing
4 changed files
with
105 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
#!/bin/bash | ||
|
||
url=https://api.eosnewyork.io | ||
if [ "$1" = "" ]; then | ||
url=$1 | ||
fi | ||
|
||
account_name='eosnewyorkio' | ||
content=$(cleos -u https://api.eosnewyork.io get account ${account_name} --json) | ||
cpu_max=$(jq -r '.cpu_limit.max' <<< "${content}") | ||
net_max=$(jq -r '.net_limit.max' <<< "${content}") | ||
net_weight=$(jq -r '.net_weight' <<< "${content}") | ||
cpu_weight=$(jq -r '.cpu_weight' <<< "${content}") | ||
|
||
cpu_weight_eos=`echo - | awk '{print '"$cpu_weight"' / 10000}'` | ||
net_weight_eos=`echo - | awk '{print '"$net_weight"' / 10000}'` | ||
|
||
max_cpu_per_eos=`echo - | awk '{print '"$cpu_max"' / '"$cpu_weight_eos"'}'` | ||
max_net_per_eos=`echo - | awk '{print '"$net_max"' / '"$net_weight_eos"'}'` | ||
|
||
#!/bin/bash | ||
|
||
url=https://api.eosnewyork.io | ||
if [ "$1" = "" ]; then | ||
url=$1 | ||
fi | ||
|
||
account_name='eosnewyorkio' | ||
content=$(cleos -u https://api.eosnewyork.io get account ${account_name} --json) | ||
cpu_max=$(jq -r '.cpu_limit.max' <<< "${content}") | ||
net_max=$(jq -r '.net_limit.max' <<< "${content}") | ||
net_weight=$(jq -r '.net_weight' <<< "${content}") | ||
cpu_weight=$(jq -r '.cpu_weight' <<< "${content}") | ||
|
||
cpu_weight_eos=`echo - | awk '{print '"$cpu_weight"' / 10000}'` | ||
net_weight_eos=`echo - | awk '{print '"$net_weight"' / 10000}'` | ||
|
||
max_cpu_per_eos=`echo - | awk '{print '"$cpu_max"' / '"$cpu_weight_eos"'}'` | ||
max_net_per_eos=`echo - | awk '{print '"$net_max"' / '"$net_weight_eos"'}'` | ||
|
||
mongo EOS --eval 'db.max_resource_per_eos.insert({"date": ISODate(), "max_cpu_per_eos": '"$max_cpu_per_eos"', "max_net_per_eos": '"$max_net_per_eos"'})' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,97 +1,98 @@ | ||
import React, { Component } from 'react' | ||
import CssBaseline from '@material-ui/core/CssBaseline' | ||
import Header from './Header' | ||
import Footer from './Footer' | ||
import Home from './Home' | ||
import Faq from './Faq' | ||
import Disclaimer from './Disclaimer' | ||
import Links from './Links' | ||
import { MuiThemeProvider, createMuiTheme } from '@material-ui/core/styles' | ||
import { Route } from 'react-router-dom' | ||
import { WWW_STR, EOS_NETWORK } from '../config.js' | ||
import React, { Component } from "react"; | ||
import CssBaseline from "@material-ui/core/CssBaseline"; | ||
import Header from "./Header"; | ||
import Footer from "./Footer"; | ||
import Home from "./Home"; | ||
import Faq from "./Faq"; | ||
import Disclaimer from "./Disclaimer"; | ||
import Links from "./Links"; | ||
import { MuiThemeProvider, createMuiTheme } from "@material-ui/core/styles"; | ||
import { Route } from "react-router-dom"; | ||
import { WWW_STR, EOS_NETWORK } from "../config.js"; | ||
|
||
const theme = createMuiTheme({ | ||
typography: { | ||
fontFamily: [ | ||
'"Barlow Semi Condensed"', | ||
'sans-serif' | ||
].join(','), | ||
fontFamily: ['"Barlow Semi Condensed"', "sans-serif"].join(",") | ||
}, | ||
palette: { | ||
primary: { | ||
light: '#A4BDC3', | ||
main: '#1B5A6C', | ||
dark: '#3a93a5' | ||
light: "#A4BDC3", | ||
main: "#1B5A6C", | ||
dark: "#3a93a5" | ||
}, | ||
secondary: { | ||
main: '#A4BDC3' | ||
main: "#A4BDC3" | ||
}, | ||
text: { | ||
primary: '#323233', | ||
secondary: '#7B7D7D' | ||
primary: "#323233", | ||
secondary: "#7B7D7D" | ||
}, | ||
background: { | ||
paper: '#FFFFFF', | ||
default: '#EDEDED' | ||
paper: "#FFFFFF", | ||
default: "#EDEDED" | ||
} | ||
} | ||
}) | ||
}); | ||
|
||
class App extends Component { | ||
|
||
constructor(props) { | ||
super(props); | ||
let net = EOS_NETWORK; | ||
|
||
let hostName = window.location.host.toLowerCase().replace(WWW_STR, ""); | ||
let subdomain = hostName.split(".")[0]; | ||
console.info(subdomain) | ||
if(! subdomain.startsWith(net) && ! subdomain.startsWith("localhost")) { | ||
console.info(subdomain); | ||
if (!subdomain.startsWith(net) && !subdomain.startsWith("localhost")) { | ||
net = subdomain; | ||
} | ||
this.state = { | ||
network: net, | ||
network: net | ||
}; | ||
this.handleNetworkChange = this.handleNetworkChange.bind(this); | ||
} | ||
|
||
handleNetworkChange(network) { | ||
let urlPrefix = window.location.protocol + "//" + WWW_STR; | ||
// remove www. from host | ||
let hostName = window.location.host.toLowerCase().replace(WWW_STR, ""); | ||
let urlSuffix = hostName + window.location.pathname + window.location.search; | ||
// remove www. from host | ||
let hostName = window.location.host.toLowerCase().replace(WWW_STR, ""); | ||
let urlSuffix = | ||
hostName + window.location.pathname + window.location.search; | ||
let url = urlPrefix + urlSuffix; | ||
if ( network !== EOS_NETWORK) { | ||
if (network !== EOS_NETWORK) { | ||
url = urlPrefix + network + "." + urlSuffix; | ||
} | ||
else { | ||
} else { | ||
// remove subdomain if network is eos | ||
url = url.replace(this.state.network + ".", "") | ||
url = url.replace(this.state.network + ".", ""); | ||
} | ||
this.setState({ | ||
network: network, | ||
network: network | ||
}); | ||
window.location.replace(url); | ||
} | ||
|
||
render() { | ||
|
||
document.title = `${this.state.network.toUpperCase()} Charge` | ||
document.title = `${this.state.network.toUpperCase()} Charge (Under Construction)`; | ||
return ( | ||
<MuiThemeProvider theme={theme}> | ||
<CssBaseline /> | ||
<Header handleNetworkChange={this.handleNetworkChange} network={this.state.network}/> | ||
<main> | ||
<Route path="/" exact | ||
render={(props) => <Home {...props} network={this.state.network} />} /> | ||
<CssBaseline /> | ||
<Header | ||
handleNetworkChange={this.handleNetworkChange} | ||
network={this.state.network} | ||
/> | ||
<main> | ||
<Route | ||
path="/" | ||
exact | ||
render={props => <Home {...props} network={this.state.network} />} | ||
/> | ||
<Route path="/faq" component={Faq} /> | ||
<Route path="/disclaimer" component={Disclaimer} /> | ||
<Route path="/links" component={Links} /> | ||
</main> | ||
<Footer /> | ||
<Footer /> | ||
</MuiThemeProvider> | ||
) | ||
); | ||
} | ||
} | ||
|
||
export default App | ||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters