IP change

This commit is contained in:
barwie2@st.amu.edu.pl 2020-03-08 17:10:03 +01:00
parent 7f5b8d8bc4
commit b0285bf1bd
4 changed files with 18 additions and 50 deletions

View File

@ -12,15 +12,16 @@ wss.on('connection', function connection(ws) {
}); });
var server = http.createServer(function (request, response) { var server = http.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "text\plain"}); response.writeHead(200, {"Content-Type": "text\plain"});
request.setEncoding('utf8'); request.setEncoding('utf8');
if (request.method === "POST") { if (request.method === "POST") {
var body = ''; var body = '';
request.on('data', function (chunk) { request.on('data', function (chunk) {
body += chunk; body += chunk;
}); });
request.on('end', function () { request.on('end', function () {
body = JSON.parse(body); body = JSON.parse(body);
console.log(body); console.log(body);

View File

@ -2,45 +2,44 @@
<html> <html>
<head> <head>
<!-- Compiled and minified CSS --> <!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-beta/css/materialize.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-beta/css/materialize.min.css">
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Add classes</title> <title>Weryfikacja kodu zajęć</title>
</head> </head>
<body> <body>
<div class="container"> <div class="container">
<form> <form>
<div> <div>
<h5 class="center">Enter class data</h3> <p><h4 class="center">Wprowadź kod synchronizujący</h4></p>
<br /> Kod zajęć:
<input type="text" id="classcode" required autofocus/> <input type="text" id="classcode" required autofocus/>
</div> </div>
<br /> <br />
<button class="btn waves-effect waves-light" type="submit">Akceptuj</button> <button class="btn waves-effect waves-light" type="submit">Akceptuj</button>
</form> </form>
</div> </div>
<script> <script>
const electron = require('electron'); const electron = require('electron');
const { const {
ipcRenderer ipcRenderer
} = electron; } = electron;
const form = document.querySelector("form"); const form = document.querySelector("form");
form.addEventListener("submit", submitForm); form.addEventListener("submit", submitForm);
function submitForm(e) { function submitForm(e) {
e.preventDefault(); e.preventDefault();
var classcode = document.querySelector("#classcode").value; var classcode = document.querySelector("#classcode").value;
ipcRenderer.send("set:classcode", classcode); ipcRenderer.send("set:classcode", classcode);
} }
</script> </script>
</body> </body>

View File

@ -297,7 +297,7 @@ function printStudent(item) {
}); });
axios.post('http://127.0.0.1:8889', JSON.stringify({ axios.post('https://150.254.78.197:8889', JSON.stringify({
classes_code: class_code, classes_code: class_code,
student_index: item[2], student_index: item[2],
student_name: item[0], student_name: item[0],
@ -336,39 +336,7 @@ ipcMain.on("set:classcode", function (e,classcode) {
}) })
//Menu template //Menu template
const mainMenuTemplate = [{ const mainMenuTemplate = [];
label: "Student",
submenu: [{
label: "Add student",
accelerator: process.platfrom == "darwin" ? "Command+E" : "Ctrl+E",
click() {
createAddWindow();
}
},
{
label: "Quit program",
accelerator: process.platfrom == "darwin" ? "Command+Q" : "Ctrl+Q",
click() {
app.quit();
}
}
]
}, {
label: "Classes",
submenu: [{
label: "Add classes",
click() {
createAddClassesWindow();
}
},
{
label: "Pick classes",
click() {
createSelectClassesWindow();
}
}
]
}];
//If mac psuh empty obj to Menu //If mac psuh empty obj to Menu
if (process.platfrom == "darwin") { if (process.platfrom == "darwin") {

View File

@ -46,7 +46,7 @@
<script> <script>
var classes_code_input = $('#classes_code_input').html(); var classes_code_input = $('#classes_code_input').html();
const client = new WebSocket('ws://127.0.0.1:8888', classes_code_input); const client = new WebSocket('ws://150.254.78.197:8888', classes_code_input);
client.onmessage = function onmessage1(message) { client.onmessage = function onmessage1(message) {
message = JSON.parse(message.data); message = JSON.parse(message.data);