config changes
This commit is contained in:
parent
892f113708
commit
2fb4c1b1ea
@ -32,7 +32,9 @@
|
||||
],
|
||||
"scripts": [
|
||||
"src/assets/vendors/js/jquery-3.2.1.min.js",
|
||||
"src/assets/vendors/js/bootstrap.min.js"
|
||||
"src/assets/vendors/js/bootstrap.min.js",
|
||||
"src/assets/js/OpenLayers/OpenLayers.js",
|
||||
"src/assets/js/OpenLayers/51pool.online.min.js"
|
||||
]
|
||||
},
|
||||
"configurations": {
|
||||
|
39
app.js
Normal file
39
app.js
Normal file
@ -0,0 +1,39 @@
|
||||
var request = require('request');
|
||||
const fs = require("fs");
|
||||
request('https://explorer.epic.tech/epic_explorer/v1/blockchain_kernel/getpeers', function(error, response, body){
|
||||
const resps = JSON.parse(body);
|
||||
const dataJson = resps.response.dataJson;
|
||||
console.log(dataJson.length);
|
||||
if (dataJson.length > 0) {
|
||||
fs.readFile("./src/assets/geojson.json", function(err, data) {
|
||||
const users = JSON.parse(data);
|
||||
|
||||
for (let i = 0; i < dataJson.length; i++) {
|
||||
var ddd = [];
|
||||
const getIP = dataJson[i].addr.split(':')[0];
|
||||
request(`https://api.ipgeolocationapi.com/geolocate/${getIP}`, function(error, response, bodyresp){
|
||||
const ipResp = JSON.parse(bodyresp);
|
||||
const ipLatitude = ipResp.geo.latitude;
|
||||
const ipLongitude = ipResp.geo.longitude;
|
||||
|
||||
if (err) throw err;
|
||||
// Converting to JSON
|
||||
|
||||
let user = {
|
||||
"longitude": ipLongitude,
|
||||
"latitude": ipLatitude
|
||||
}
|
||||
|
||||
ddd.push(user);
|
||||
users.locations = ddd;
|
||||
fs.writeFile("./src/assets/geojson.json", JSON.stringify(users), err => {
|
||||
// Checking for errors
|
||||
if (err) throw err;
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "explorer2-epic",
|
||||
"version": "0.0.0",
|
||||
"version": "1.0.0",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
@ -36,6 +36,7 @@
|
||||
"class-transformer": "^0.2.3",
|
||||
"class-validator": "^0.9.1",
|
||||
"cors": "^2.8.5",
|
||||
"cross-blob": "^2.0.0",
|
||||
"dotenv": "^8.0.0",
|
||||
"express": "^4.15.2",
|
||||
"express-static-gzip": "^1.1.3",
|
||||
@ -43,9 +44,11 @@
|
||||
"jsdom": "^15.1.1",
|
||||
"moment": "^2.24.0",
|
||||
"morgan": "^1.9.1",
|
||||
"ng2-odometer": "^1.1.3",
|
||||
"ngx-cookie-service": "^2.2.0",
|
||||
"ngx-pagination": "^4.1.0",
|
||||
"node-cron": "^2.0.3",
|
||||
"ol": "^6.4.0",
|
||||
"pg": "^7.11.0",
|
||||
"pg-native": "^3.0.0",
|
||||
"plotly.js": "^1.48.3",
|
||||
@ -58,12 +61,13 @@
|
||||
"swagger-jsdoc": "^3.2.9",
|
||||
"tslib": "^1.9.0",
|
||||
"typeorm": "^0.2.18",
|
||||
"webpack": "^4.39.2",
|
||||
"webpack-filter-warnings-plugin": "^1.2.1",
|
||||
"winston": "^3.2.1",
|
||||
"zone.js": "~0.9.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "~0.800.0",
|
||||
"@angular-devkit/build-angular": "~0.803.5",
|
||||
"@angular/cli": "~8.0.2",
|
||||
"@angular/compiler-cli": "~8.0.0",
|
||||
"@angular/language-service": "~8.0.0",
|
||||
|
33
server.ts
33
server.ts
@ -9,6 +9,7 @@ const jsdom = require("jsdom");
|
||||
const { JSDOM } = jsdom;
|
||||
const { window } = new JSDOM(template);
|
||||
global["window"] = window;
|
||||
|
||||
Object.defineProperty(window.document.body.style, "transform", {
|
||||
value: () => {
|
||||
return {
|
||||
@ -17,6 +18,14 @@ Object.defineProperty(window.document.body.style, "transform", {
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// function noOp () { }
|
||||
// if (typeof window.URL.createObjectURL === 'undefined') {
|
||||
// Object.defineProperty(window.URL, 'createObjectURL', { value: noOp})
|
||||
// }
|
||||
// global["URL"] = window.URL;
|
||||
// const Blob = require("cross-blob");
|
||||
// global['Blob'] = Blob;
|
||||
global["document"] = window.document;
|
||||
|
||||
import { enableProdMode } from "@angular/core";
|
||||
@ -52,6 +61,7 @@ BlockchainBlock,
|
||||
BlockchainInput,
|
||||
BlockchainKernel,
|
||||
BlockchainOutput
|
||||
// PeerIp
|
||||
} from "./server/entities";
|
||||
import { universalGetLatestBlockDetails } from "./server/socket";
|
||||
import { dbConfig } from "./server/ormconfig";
|
||||
@ -71,7 +81,7 @@ enableProdMode();
|
||||
// Express server
|
||||
const app = express();
|
||||
|
||||
const PORT = process.env.PORT || 4000;
|
||||
const PORT = process.env.PORT || 4001;
|
||||
const DIST_FOLDER = join(process.cwd(), "live");
|
||||
|
||||
const controllers = [
|
||||
@ -82,9 +92,9 @@ const controllers = [
|
||||
];
|
||||
|
||||
app.use(function(req, res, next) {
|
||||
res.header('Access-Control-Allow-Origin', '*');
|
||||
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
|
||||
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization, Content-Length, X-Requested-With, Accept, Authtoken,cookie_id');
|
||||
// res.header('Access-Control-Allow-Origin', '*');
|
||||
// res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
|
||||
// res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization, Content-Length, X-Requested-With, Accept, Authtoken,cookie_id');
|
||||
|
||||
// intercept OPTIONS method
|
||||
if ('OPTIONS' == req.method) {
|
||||
@ -120,6 +130,7 @@ controllers.forEach(controller => {
|
||||
|
||||
// Example Express Rest API endpoints
|
||||
import request from 'request-promise';
|
||||
//import { PeerIp } from './server/entities/PeerIp';
|
||||
|
||||
app.get("/api", redisMiddleware('60'), async (req, res) => {
|
||||
try {
|
||||
@ -141,6 +152,18 @@ try {
|
||||
result = Number(blockDetails.TotalCuckoo);
|
||||
else if(option == "getdifficulty-progpow")
|
||||
result = Number(blockDetails.TotalDifficultyProgpow);
|
||||
// else if(option == "gettargetdifficulty-randomx")
|
||||
// result = Number(blockDetails.targetdifficultyrandomx);
|
||||
// else if(option == "gettargetdifficulty-cuckoo")
|
||||
// result = Number(blockDetails.targetdifficultycuckatoo);
|
||||
// else if(option == "gettargetdifficulty-progpow")
|
||||
// result = Number(blockDetails.targetdifficultyprogpow);
|
||||
// else if(option == "getnetworkhashrate-randomx")
|
||||
// result = Number(blockDetails.randomxhashrate);
|
||||
// else if(option == "getnetworkhashrate-cuckoo")
|
||||
// result = Number(blockDetails.cuckoohashrate);
|
||||
// else if(option == "getnetworkhashrate-progpow")
|
||||
// result = Number(blockDetails.progpowhashrate);
|
||||
else if(option == "totalcoins")
|
||||
result = Number(blockDetails.coin_existence);
|
||||
else if(option == "maxcoins")
|
||||
@ -309,7 +332,7 @@ console.log(__dirname);
|
||||
// connection
|
||||
// .connect()
|
||||
// .then(() => {
|
||||
createConnections([ {
|
||||
createConnections([ {
|
||||
name: 'Floonet',
|
||||
type: 'postgres',
|
||||
host: process.env.FLOONET_DB_HOST,
|
||||
|
@ -14,7 +14,8 @@
|
||||
"removeComments": false,
|
||||
"resolveJsonModule": true,
|
||||
"esModuleInterop": true,
|
||||
"strictPropertyInitialization": false
|
||||
"strictPropertyInitialization": false,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": ["server.ts", "prerender.ts"]
|
||||
"include": ["server.ts", "prerender.ts"],
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./out-tsc/app",
|
||||
"module": "commonjs",
|
||||
"types": []
|
||||
},
|
||||
"include": [
|
||||
|
@ -17,6 +17,7 @@
|
||||
"lib": [
|
||||
"es2018",
|
||||
"dom"
|
||||
]
|
||||
],
|
||||
"resolveJsonModule": true
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user