Commit 7726d45f authored by Mihkel Putrinš's avatar Mihkel Putrinš

get user info thru fs

parent 22caca01
var app = require('app')
var fs = require('fs')
var ipc = require('ipc')
var BrowserWindow = require('browser-window')
var onlineStatusWindow
var user_url = 'https://entu.keeleressursid.ee/api2/user'
var auth_url = user_url + '/auth'
app.on('ready', function() {
authWindow = new BrowserWindow({ width: 900, height: 600, show: true })
authWindow.loadUrl(auth_url)
console.log('ready')
authWindow.webContents.savePage('./user.json', 'HTMLOnly', function(err) {
if (err) {
console.log("err", err)
} else {
console.log("Save page successfully")
fs.readFile('./user.json', 'utf8', function(err, data) {
console.log( JSON.stringify(JSON.parse(data), null, 4))
fs.unlink('./user.json', function (err) {
if (err) throw err
console.log('successfully deleted user.json')
})
})
}
})
})
ipc.on('online-status-changed', function(event, status) {
console.log(status)
})
ipc.on('message', function(event, message) {
// console.log('event: ' + JSON.stringify(event, null, 4))
console.log('message: ' + message)
})
ipc.on('user', function(event, data) {
// console.log('event: ' + JSON.stringify(event, null, 4))
console.log('data: ' + JSON.stringify(data, null, 4))
})
......@@ -2,51 +2,16 @@
"name": "Panustaja",
"description": "Ressursikataloogi upitamiseks keeleressurside Entu repositooriumisse.",
"version": "1.0.1",
"main": "./source/index.html",
"main": "./main/main.js",
"license": "CC-SA",
"private": true,
"repository": {
"type": "git",
"url": "git@gitlab.keeleressursid.ee:indrek-jentson/uploader.git"
"url": "git@gitlab.keeleressursid.ee:michelek/panustaja.git"
},
"dependencies": {
"os-utils": "*",
"jquery": "2.1.3",
"moment": "2.9.0",
"marked": "0.3.3",
"font-awesome": "4.3.0"
},
"window": {
"show_in_taskbar": true,
"icon": "./source/images/murakas.png",
"toolbar": false,
"frame": true,
"show": true,
"position": "center",
"min_width": 1000,
"min_height": 500,
"width": 1100,
"height": 700
},
"platformOverrides": {
"win": {
"window": {
"toolbar": false
}
},
"osx": {
"window": {
"toolbar": false
}
},
"linux": {
"window": {
"toolbar": false
}
}
},
"webkit": {
"plugin": true
},
"chromium-args": "--ignore-gpu-blacklist"
"moment": "2.9.0",
"request": "^2.65.0"
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment