Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38,684 changes: 38,295 additions & 389 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
"axios": "^0.21.2",
"bootstrap": "^4.4.1",
"core-js": "^3.6.4",
"cors": "^2.8.5",
"easy-circular-progress": "^1.0.4",
"electron-root-path": "^1.0.16",
"express": "^4.17.2",
"fix-path": "^3.0.0",
"i": "^0.3.6",
"kill-port": "^1.6.0",
Expand Down Expand Up @@ -92,4 +94,4 @@
"> 1%",
"last 2 versions"
]
}
}
1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
<div id="app"></div>
<!-- built files will be auto injected -->
</body>

</html>
6 changes: 6 additions & 0 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const express = require('express');
const app = express();
const port=2000;

app.listen(port, () => console.log("app listening on port ", port));
console.log("IN EXPRESS")
2 changes: 1 addition & 1 deletion src/assets/css/tailwind.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ body::-webkit-scrollbar {
pointer-events: none;
position: fixed;
}
}
}
69 changes: 60 additions & 9 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,33 @@ const fixPath = require('fix-path');
import { rootPath } from 'electron-root-path';
const isDevelopment = process.env.NODE_ENV !== 'production'
const { exec } = require("child_process");
const cors = require('cors');

import path from 'path'

import { platform } from 'os';
import e from 'cors';
const express = require('express');
const exp = express();
const port = 2000;


exp.listen(port, () => console.log("app listening on port ", port));


var kill = require('tree-kill');

const cmd = "ipfs daemon"
var cmd = "ipfs daemon"


// Scheme must be registered before the app is ready
protocol.registerSchemesAsPrivileged([
{ scheme: 'app', privileges: { secure: true, standard: true } }
])

if(process.platform == "win32"){
if (process.platform == "win32") {
cmd = "cmd /c ipfs daemon"

}


Expand All @@ -36,6 +49,8 @@ exec(cmd, (error, data, getter) => {
console.log("data", data);

});


const root = rootPath;

console.log("root path")
Expand All @@ -52,23 +67,28 @@ console.log(dirPath)
if (process.platform == 'macos') {
jarPath.concat('/')
}

var jarPath = dirPath + '/rubix.jar';
// var jarPath = path.join(app.getAppPath(), '/rubix_api.jar')
// var jarPath = path.resolve(`${process.resourcesPath}/../bin/rubix_api.jar`);
// var jarPath = 'app://./rubix_api.jar'
// var jarPathProd = 'app://./resources/app.asar.unpacked/rubix_api.jar';
console.log("final jarpath here")
console.log(jarPath)

var child = require('child_process').spawn(
var child;
var jarProcesssPID=0;
function startJar(){
child = require('child_process').spawn(
'java', ['-jar', jarPath, '']
);

jarProcesssPID=child.pid
console.log("process ID of JAR")
console.log(jarProcesssPID)
console.log(child.pid)
child.stdout.on('data', (d) => {
console.log(d.toString())
})

}
startJar();
const nativeImage = require('electron').nativeImage;
var image = nativeImage.createFromPath(__dirname + '/build/icon.png');

Expand Down Expand Up @@ -105,7 +125,7 @@ async function createWindow() {
}

app.on('window-all-closed', () => {
kill(child.pid);
kill(jarProcesssPID);
app.quit()
})

Expand All @@ -125,6 +145,7 @@ app.on('ready', async () => {
}
}
createWindow()

})

// Exit cleanly on request from parent process in development mode.
Expand All @@ -140,4 +161,34 @@ if (isDevelopment) {
app.quit()
})
}
}
}exp.get("/checkipfs", function (req, res) {
res.set({
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "*",
"Access-Control-Allow-Headers": "'Access-Control-Allow-Headers: Origin, Content-Type, X-Auth-Token'",
});
const plat = process.platform
const cmd = plat == 'win32' ? 'tasklist | findstr ipfs.exe' : (plat == 'mac' ? 'ps -e | grep ipfs' : (plat == 'linux' ? 'ps -e | grep ipfs' : ''))
const proc = plat == 'win32' ? 'win' : (plat == 'darwin' ? 'mac' : (plat == 'linux' ? 'linux' : ''))
exec(cmd, (err, data) => {
if(data.includes('ipfs')){
res.status(200).send("TRUE")
}
else{
res.status(400).send("FALSE")
}
})
})
exp.get("/reset",function(req,res) {
res.set({
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "*",
"Access-Control-Allow-Headers": "'Access-Control-Allow-Headers: Origin, Content-Type, X-Auth-Token'",
});
kill(jarProcesssPID);
res.status(200).send("TRUE")

startJar();


})
7 changes: 5 additions & 2 deletions src/components/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
<div class="text-gray-400 bg-gray-900 body-font leading-normal tracking-normal" id="main-body">
<div class="flex flex-wrap">

<Sidebar />

<Sidebar />



<div class="w-full pl-0 lg:pl-64 min-h-screen">

<Navbar />

<div class="p-6 mb-20">
<div class="flex-container p-1 mb-20 break-words ">
<router-view />
</div>

Expand Down
47 changes: 47 additions & 0 deletions src/components/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,38 @@
<span class="ml-2 text-l tracking-wide truncate">Contacts</span>
</a>
</li>


<button


@click="restartJar()"
class="
text-white
border-0
py-2
px-8
focus:outline-none
rounded
text-lg
position:absolute
left:0
bottom:0

"

>
Refresh

</button>


</ul>
</div>
</div>
</div>
</div>

</template>

<script>
Expand All @@ -352,6 +379,23 @@ export default {
};
},
methods: {

restartJar(){
console.log("here1")
axios
.get("http://localhost:2000/reset")
.then((response) => {
console.log("here2")
console.log(response);

})
.catch(function (error) {
console.log("here3");
console.log(error);
});
}

,
syncCall() {
this.sync = "Syncing..";
axios
Expand Down Expand Up @@ -385,6 +429,8 @@ export default {
console.log(error);
});
},


},
mounted: function () {
window.setInterval(() => {
Expand All @@ -395,5 +441,6 @@ export default {
beforeMount() {
// this.dashboard()
},

};
</script>
Loading