diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..81ded28 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +# EditorConfig is awesome: https://EditorConfig.org + +[*] +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +charset = utf-8 +indent_style = space +indent_size = 2 diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..ee6d53c --- /dev/null +++ b/.prettierrc @@ -0,0 +1,3 @@ +trailingComma: es5 +singleQuote: true +jsxBracketSameLine: true diff --git a/src/Map.vue b/src/Map.vue index e1efae5..a42985a 100644 --- a/src/Map.vue +++ b/src/Map.vue @@ -83,32 +83,32 @@ @@ -325,11 +320,11 @@ body { } .expand + span::before { - content: "\25B6"; + content: '\25B6'; } .expand:checked + span::before { - content: "\25BC"; + content: '\25BC'; } .expand ~ .collapsible-content { diff --git a/src/StationRow.vue b/src/StationRow.vue index c419f17..c179f47 100644 --- a/src/StationRow.vue +++ b/src/StationRow.vue @@ -6,8 +6,8 @@ {{ formatTime(now - status.lastHeard, true) }} {{ formatTime(Math.round(status.avgDelta), true) }} {{ status.lastMicE }} - {{ status.lastVoltage || "" }} - {{ status.lastTemperature || "" }} + {{ status.lastVoltage || '' }} + {{ status.lastTemperature || '' }} {{ status.lastComment }} diff --git a/src/StatusScreen.vue b/src/StatusScreen.vue index d2eae71..4656354 100644 --- a/src/StatusScreen.vue +++ b/src/StatusScreen.vue @@ -26,14 +26,14 @@ @@ -132,7 +132,7 @@ table th { /* border magic for sticky header */ /* https://stackoverflow.com/questions/50361698/border-style-do-not-work-with-sticky-position-element */ th::before { - content: ""; + content: ''; position: absolute; left: 0; width: 100%; @@ -142,7 +142,7 @@ th::before { top: 1px; } th::after { - content: ""; + content: ''; position: absolute; left: 0; width: 100%; diff --git a/src/index.html b/src/index.html index dec93d0..671b940 100644 --- a/src/index.html +++ b/src/index.html @@ -1,7 +1,7 @@ - + -
+
diff --git a/src/index.js b/src/index.js index 4e85f76..2b5efc9 100644 --- a/src/index.js +++ b/src/index.js @@ -3,5 +3,5 @@ import App from './StatusScreen.vue'; new Vue({ el: '#app', - render: h => h(App), + render: (h) => h(App), }); diff --git a/src/server.js b/src/server.js index 9c60bf1..d8a86f2 100644 --- a/src/server.js +++ b/src/server.js @@ -1,41 +1,41 @@ -const WebSocket = require("ws"); -const net = require("net"); -const fs = require("fs"); +const WebSocket = require('ws'); +const net = require('net'); +const fs = require('fs'); const client = new net.Socket(); -const wss = new WebSocket.Server({ host: "127.0.0.1", port: 4321 }); +const wss = new WebSocket.Server({ host: '127.0.0.1', port: 4321 }); -wss.broadcast = function(data) { - wss.clients.forEach(client => { +wss.broadcast = function (data) { + wss.clients.forEach((client) => { if (client.readyState === WebSocket.OPEN) { client.send(data); } }); }; -client.connect(14580, "rotate.aprs2.net", () => - client.write("user KC1GDW pass -1 filter r/43.90/-72.15/75\r\n") +client.connect(14580, 'rotate.aprs2.net', () => + client.write('user KC1GDW pass -1 filter r/43.90/-72.15/75\r\n') ); function datestamp(date) { return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`; } -client.on("data", function(data) { - let str = data.toString("utf8").replace(/^\s+|\s+$/g, ""); +client.on('data', function (data) { + let str = data.toString('utf8').replace(/^\s+|\s+$/g, ''); console.log(str); // strip whitespace, then handle multiple APRS packets per TCP packet - str.split("\r\n").forEach(packet => { - if (!packet.startsWith("#")) { + str.split('\r\n').forEach((packet) => { + if (!packet.startsWith('#')) { // ignore comments let date = new Date(); // create log dir if it doesn't exist - if (!fs.existsSync("log")) fs.mkdirSync("log"); + if (!fs.existsSync('log')) fs.mkdirSync('log'); fs.appendFile( `log/log${datestamp(date)}.json`, - JSON.stringify([date, packet]) + "\n", - err => { + JSON.stringify([date, packet]) + '\n', + (err) => { if (err) throw err; } ); @@ -44,14 +44,14 @@ client.on("data", function(data) { }); }); -wss.on("connection", ws => { +wss.on('connection', (ws) => { let date = new Date(); let filename = `log/log${datestamp(date)}.json`; if (fs.existsSync(filename)) { fs.readFileSync(filename) .toString() - .split("\n") - .forEach(line => ws.send(line)); + .split('\n') + .forEach((line) => ws.send(line)); } });