diff --git a/html/index.html b/html/index.html
new file mode 100644
index 0000000..ef6177e
--- /dev/null
+++ b/html/index.html
@@ -0,0 +1,19 @@
+
+
+ CPGC
+
+
+ Hello, world!
+
+
+
+
+
diff --git a/index.js b/index.js
index c3c46c9..9963da1 100644
--- a/index.js
+++ b/index.js
@@ -1,5 +1,9 @@
const { platform, EOL } = require('os');
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 = () => {
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) => {
- if(l == '.git')
- console.log(true);
+ if(l == '.git') {
+ 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);
+
diff --git a/package-lock.json b/package-lock.json
index 3526f5e..ff5e8d4 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5,9 +5,9 @@
"requires": true,
"dependencies": {
"@types/node": {
- "version": "10.14.18",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.18.tgz",
- "integrity": "sha512-ryO3Q3++yZC/+b8j8BdKd/dn9JlzlHBPdm80656xwYUdmPkpTGTjkAdt6BByiNupGPE8w0FhBgvYy/fX9hRNGQ==",
+ "version": "10.14.21",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.21.tgz",
+ "integrity": "sha512-nuFlRdBiqbF+PJIEVxm2jLFcQWN7q7iWEJGsBV4n7v1dbI9qXB8im2pMMKMCUZe092sQb5SQft2DHfuQGK5hqQ==",
"dev": true
},
"ajv": {
@@ -231,9 +231,9 @@
}
},
"electron": {
- "version": "6.0.9",
- "resolved": "https://registry.npmjs.org/electron/-/electron-6.0.9.tgz",
- "integrity": "sha512-lFpSmDNyjpvJFwEnK897Soone3DV7D3ASFUb315H2VTVZSbKib9Kbrsovxf4c+e1q5hTdaONsGIm3Lb4CXIW1g==",
+ "version": "6.0.12",
+ "resolved": "https://registry.npmjs.org/electron/-/electron-6.0.12.tgz",
+ "integrity": "sha512-70ODZa1RP6K0gE9IV9YLCXPSyhLjXksCuYSSPb3MljbfwfHo5uE6X0CGxzm+54YuPdE2e7EPnWZxOOsJYrS5iQ==",
"dev": true,
"requires": {
"@types/node": "^10.12.18",
@@ -422,9 +422,9 @@
}
},
"hosted-git-info": {
- "version": "2.8.4",
- "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.4.tgz",
- "integrity": "sha512-pzXIvANXEFrc5oFFXRMkbLPQ2rXRoDERwDLyrcUxGhaZhgP54BBSl9Oheh7Vv0T090cszWBxPjkQQ5Sq1PbBRQ==",
+ "version": "2.8.5",
+ "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.5.tgz",
+ "integrity": "sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg==",
"dev": true
},
"http-signature": {
diff --git a/package.json b/package.json
index 12a0e74..9fa0918 100644
--- a/package.json
+++ b/package.json
@@ -17,6 +17,6 @@
},
"homepage": "https://github.com/ayush123460/cpgc#readme",
"devDependencies": {
- "electron": "^6.0.9"
+ "electron": "^6.0.12"
}
}