close to mvp

master
Ayush Mukherjee 5 years ago
parent 6dffb4182a
commit fc39080041

@ -0,0 +1,19 @@
<html>
<head>
<title>CPGC</title>
</head>
<body>
Hello, world!
<p id="a"></p>
</body>
<script>
const electron = require('electron');
const ipc = electron.ipcRenderer;
ipc.on('send_username', function(event, args) {
console.log(args);
document.getElementById("a").innerHTML = args;
});
</script>
</html>

@ -1,5 +1,9 @@
const { platform, EOL } = require('os'); const { platform, EOL } = require('os');
const { execSync } = require('child_process'); const { execSync } = require('child_process');
const fs = require('fs');
const path = require('path');
const { app, BrowserWindow } = require('electron');
const ipc = require('electron').ipcMain;
const list_dir = () => { const list_dir = () => {
if(platform == 'linux') { if(platform == 'linux') {
@ -10,7 +14,51 @@ const list_dir = () => {
} }
var origin;
let user = execSync("git config --list").toString().split(EOL);
//console.log(user);
const m = list_dir().forEach((l) => { const m = list_dir().forEach((l) => {
if(l == '.git') if(l == '.git') {
console.log(true); origin = fs.open(path.join(__dirname, '.git/config'), 'r', function(err, file) {
if(err)
console.log(err + '1');
fs.readFile(file, function(err, data) {
if(err)
console.log(err);
let i = data.toString().indexOf('url') + 6;
let c = data.toString()[i];
origin = c;
while(c != '\n') {
i++;
c = data.toString()[i];
origin += c;
}
return origin;
});
});
}
});
console.log(user[0]);
let win;
function createWindow() {
win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
}); });
win.loadFile('html/index.html');
win.webContents.send('send_username', user[0]);
win.webContents.openDevTools()
}
app.on('ready', createWindow);

18
package-lock.json generated

@ -5,9 +5,9 @@
"requires": true, "requires": true,
"dependencies": { "dependencies": {
"@types/node": { "@types/node": {
"version": "10.14.18", "version": "10.14.21",
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.18.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.21.tgz",
"integrity": "sha512-ryO3Q3++yZC/+b8j8BdKd/dn9JlzlHBPdm80656xwYUdmPkpTGTjkAdt6BByiNupGPE8w0FhBgvYy/fX9hRNGQ==", "integrity": "sha512-nuFlRdBiqbF+PJIEVxm2jLFcQWN7q7iWEJGsBV4n7v1dbI9qXB8im2pMMKMCUZe092sQb5SQft2DHfuQGK5hqQ==",
"dev": true "dev": true
}, },
"ajv": { "ajv": {
@ -231,9 +231,9 @@
} }
}, },
"electron": { "electron": {
"version": "6.0.9", "version": "6.0.12",
"resolved": "https://registry.npmjs.org/electron/-/electron-6.0.9.tgz", "resolved": "https://registry.npmjs.org/electron/-/electron-6.0.12.tgz",
"integrity": "sha512-lFpSmDNyjpvJFwEnK897Soone3DV7D3ASFUb315H2VTVZSbKib9Kbrsovxf4c+e1q5hTdaONsGIm3Lb4CXIW1g==", "integrity": "sha512-70ODZa1RP6K0gE9IV9YLCXPSyhLjXksCuYSSPb3MljbfwfHo5uE6X0CGxzm+54YuPdE2e7EPnWZxOOsJYrS5iQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/node": "^10.12.18", "@types/node": "^10.12.18",
@ -422,9 +422,9 @@
} }
}, },
"hosted-git-info": { "hosted-git-info": {
"version": "2.8.4", "version": "2.8.5",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.4.tgz", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.5.tgz",
"integrity": "sha512-pzXIvANXEFrc5oFFXRMkbLPQ2rXRoDERwDLyrcUxGhaZhgP54BBSl9Oheh7Vv0T090cszWBxPjkQQ5Sq1PbBRQ==", "integrity": "sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg==",
"dev": true "dev": true
}, },
"http-signature": { "http-signature": {

@ -17,6 +17,6 @@
}, },
"homepage": "https://github.com/ayush123460/cpgc#readme", "homepage": "https://github.com/ayush123460/cpgc#readme",
"devDependencies": { "devDependencies": {
"electron": "^6.0.9" "electron": "^6.0.12"
} }
} }

Loading…
Cancel
Save