Adding install modules

This commit is contained in:
sairajzero 2021-07-22 19:54:38 +05:30
parent 53fcbbc84d
commit 02d6bd0ca3
7 changed files with 119 additions and 7 deletions

2
.gitignore vendored
View File

@ -1,4 +1,4 @@
node_modules/
package-lock.json
config.json
parameters.json
param.json

71
gen-param.html Normal file
View File

@ -0,0 +1,71 @@
<html>
<head>
<title>Gen Param</title>
</head>
<body>
<h2>Generate Parameters</h2>
<div>
<h4>This page will automatically generate param.json file</h4>
<div id="status"></div>
</div>
<script>
(function(fileName) {
var status = document.getElementById("status");
//Generate param
var param = {
screen: {
height: screen.height,
width: screen.width,
colorDepth: screen.colorDepth,
availHeight: screen.availHeight,
availWidth: screen.availWidth,
pixelDepth: screen.pixelDepth
},
navigator: {
userAgent: navigator.userAgent,
plugins: [],
mimeTypes: [],
cookieEnabled: navigator.cookieEnabled,
language: navigator.language
},
history: {
length: history.length
},
location: location.toString()
}
for (var i = 0; i < navigator.plugins.length; i++)
param.navigator.plugins[i] = {
name: navigator.plugins[i].name,
filename: navigator.plugins[i].filename,
description: navigator.plugins[i].description,
version: navigator.plugins[i].version
}
for (var i = 0; i < navigator.mimeTypes.length; i++) {
param.navigator.mimeTypes[i] = {
description: navigator.mimeTypes[i].description,
type: navigator.mimeTypes[i].type,
suffixes: navigator.mimeTypes[i].suffixes
}
}
console.log(param)
//Download the file
status.innerHTML += "<br/>Downloading file...";
status.innerHTML += "<br/>If the download doesnot start automatically, click ";
let anchor = document.createElement("a");
//anchor.style = "display: none";
anchor.href = window.URL.createObjectURL(new Blob([JSON.stringify(param)], {
type: "octet/stream"
}));
anchor.innerHTML = "here"
anchor.download = fileName;
status.appendChild(anchor);
anchor.click();
status.innerHTML += "<br/><b>Note: Save <i>param.json</i> file in SuperNodeStorage directory</b>"
})("param.json");
</script>
</body>
</html>

32
package.json Normal file
View File

@ -0,0 +1,32 @@
{
"name": "supernodestorage",
"version": "1.0.0",
"description": "Supernode Storage is a Cloud Storage program for FLO Dapps",
"main": "src/main.js",
"dependencies": {
"mysql": "^2.18.1",
"node-fetch": "^2.6.1",
"ws": "^7.5.0"
},
"devDependencies": {},
"scripts": {
"postinstall": "node post-install.js",
"start": "node launch.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ranchimall/SuperNodeStorage.git"
},
"keywords": [
"FLO",
"supernode",
"cloud",
"storage"
],
"author": "Sai Raj (https://github.com/sairajzero)",
"license": "MIT",
"bugs": {
"url": "https://github.com/ranchimall/SuperNodeStorage/issues"
},
"homepage": "https://github.com/ranchimall/SuperNodeStorage#readme"
}

11
post-install.js Normal file
View File

@ -0,0 +1,11 @@
let message =
`SupernodeStorage is installed.
To complete the setup:
1. Open gen-param.html and Download param.json to this directory
2. Copy config-sample.json to config.json and Edit the values
To start the node, Run:
npm start
`;
console.log(message)

View File

@ -128,7 +128,6 @@ function checkIfRequestSatisfy(request, data) {
}
module.exports = {
setParameters,
checkIfRequestSatisfy,
processRequestFromUser,
processIncomingData,

View File

@ -686,7 +686,6 @@ dataMigration.intimateAllNodes = function() {
//-----EXPORTS-----
module.exports = {
processTaskFromSupernode,
setBlockchainParameters,
forwardToNextNode,
dataMigration,
SUPERNODE_INDICATOR,

View File

@ -2,7 +2,7 @@
//fetch for node js (used in floBlockchainAPI.js)
global.fetch = require("node-fetch");
//Set browser parameters from parameters.json
const parameters = require('../parameters.json')
for(let p in parameters)
global[p] = parameters[p];
//Set browser paramaters from param.json
const param = require('../param.json')
for(let p in param)
global[p] = param[p];