From 9bf01c0a3381abaa7f2a32e777322be870f0c615 Mon Sep 17 00:00:00 2001 From: Andrew Gundersen Date: Wed, 3 Feb 2021 10:55:42 -0600 Subject: [PATCH 1/7] cleaning some things up --- gcloud.json | 12 -- src/App.vue | 5 +- src/assets/logo.png | Bin 6849 -> 0 bytes src/audio.ts | 201 ----------------------- src/background.ts | 103 +++--------- src/components/messenger/index.vue | 34 ++-- src/components/voiceBackground/index.vue | 127 -------------- src/main.ts | 2 - src/router/index.ts | 8 +- testAudio.js | 114 ------------- testServer.js | 44 ----- ws.py | 92 ----------- 12 files changed, 48 insertions(+), 694 deletions(-) delete mode 100644 gcloud.json delete mode 100644 src/assets/logo.png delete mode 100644 src/audio.ts delete mode 100644 src/components/voiceBackground/index.vue delete mode 100644 testAudio.js delete mode 100644 testServer.js delete mode 100644 ws.py diff --git a/gcloud.json b/gcloud.json deleted file mode 100644 index 5c68549..0000000 --- a/gcloud.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "type": "service_account", - "project_id": "crimata", - "private_key_id": "3a324fa3fcca4cea589e4b5007f4142db4b3a84d", - "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCxFJOjhIkYlyhn\nHjtpFC5EOwzNFZem6k6SS7zcgWbNLe9mcBsiTKCjpxItzkIo0pnT32yqw+AKsqpv\n6+LVyzzjfB7vtEUflvg6KgmYMS4ixOTCEbN3e2qj1t2RnITXZR2VGSGdoKKyqZm0\ntWrmexQvSN20cByL1vfxD3E69oYFGhVraa0zmm94WXHAzofT6DkvGdrbK1s1G9jI\nG3mdQ1jN71tghyloeHL+R/1iKQoZFYTkVe6yWvccSNAZelt/5sciCKRTCArXj89X\nLwU6jGOKIsyqx3BeUyWaSS59xpnGX3meSf5Q9U+j45ePUiqO6TTleF+kWiBwjUpp\nfeYcwEIDAgMBAAECggEAElkN9R7p75zV6F1XDYu0QYiWyncmx/o2Gu1zC6vywWa1\ni/korpSe/mX0ub9J1p3/p1balRUHlUQu6brYvYs56140fGTC1sOXQ7uQU+8glySs\niTk5TbOBeKluOsSrdP/6oTTB6Wm4AegVz4YOpgPxsvaLVkNZidnDxfvyIQhjGYsO\nsvRaw48eEmGOa1uvDhgvPOxiDp5YEdxqSue/7ylzjBdKecDyLgTSDDf/p+FwIx5B\n2d/0uRgQBaAk6D/DNOvN8GrYyakFmlDjE72nrBGAJq50UyV6THOSDk+8cK+2QiS1\nEDCFufj+7Dk1EBfBFUFY8ZBB/pphpEWyLoFl7NzGCQKBgQDaj/KOOcj6BkkTj1WM\nRW3KhOE3nhsCQEgQGCflpycEAZj6J7ktBG2/4teDt9sr+Epx8ymnQCZa9pmysdrD\nU0aWku1qUx0IUKTtZbAEbB+AnrWYDYkIWU8kRUUvNHNTBg43VyuohV9wprPih138\nHWMeNac82/XICz2A3rv+Xkx8KwKBgQDPaaEEGWVs3nIhf/p3M3/xWNKt8fhAERpG\n0YpTjgHW3FQFYjiCTTIcuLO3qsDGmfIAB9tL37s2Y3e2wKBGUj/o69Fr7sWVPdsX\nJtUc0+KiG2Bs0hsyZPdk9UQiQX8y2eq1NZW7vEoxWso1bM64WURB5N8ocWePNJJx\nL2Oe75rtiQKBgQDLfQQOiRxmNF3rOSMkAywyRr9NQgXRdbniSiszNQotP7OHDF7q\n29m2suOGfjIv4O6m4wdf8WkEfd4hsleETc9Ft6wVtyYrrLGxWWCk7WnzHVDjLY7s\n2AHIOjostf+9R8EKoz1BnFN8laibev71EQNMiBWZow1VX6m2hymurWs2mwKBgQCb\nuY3n2v14qOb92e1+U89KsEq1yMd/qpeU9jwqEaO14wS+aglNY5ItWEuuqWhFdE3q\n0ftHUzpnUnUOZD+xrI1JXsyEgegc7i0xi7lUBI3S8kUKTxGWW5IXXcKDCbPrxQtg\ndFPweSUnOyg4xnHKnVMPOjyGS+bZ8TnF+zOLoBAtKQKBgF6hAOIwF1DheXT4p8xS\nlSGhl8dBxjsJDVwbnFWQceGzGnq1e3ncy/UItt42UCDVRWTH4r7pQ9eKyd/3foUD\n6KDIcCrYo2KJh6ZNFJ67XF30U+TuEg5U/9jTbWqDOwYVXcMcnzQE4ZiGBxVHL6xr\nNc8FRW5+7xh4zNfzhGUGt5kt\n-----END PRIVATE KEY-----\n", - "client_email": "crimata-service-account@crimata.iam.gserviceaccount.com", - "client_id": "102914612880037864172", - "auth_uri": "https://accounts.google.com/o/oauth2/auth", - "token_uri": "https://oauth2.googleapis.com/token", - "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", - "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/crimata-service-account%40crimata.iam.gserviceaccount.com" -} diff --git a/src/App.vue b/src/App.vue index 00294f1..1c8217a 100644 --- a/src/App.vue +++ b/src/App.vue @@ -5,11 +5,12 @@ diff --git a/src/components/voiceBackground/index.vue b/src/components/voiceBackground/index.vue deleted file mode 100644 index 124a541..0000000 --- a/src/components/voiceBackground/index.vue +++ /dev/null @@ -1,127 +0,0 @@ - - - diff --git a/src/main.ts b/src/main.ts index bc2fa9d..531bb90 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,7 +1,6 @@ import { createApp } from "vue"; import App from "./App.vue"; import router from "./router"; -import store from "./store"; // animation library import anime from "animejs"; @@ -11,7 +10,6 @@ import mitt from "mitt"; const emitter = mitt(); createApp(App) - .use(store) .use(router) .provide("animejs", anime) .provide("mitt", emitter) diff --git a/src/router/index.ts b/src/router/index.ts index cbb87ab..b44e9eb 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,4 +1,10 @@ -import { createRouter, createWebHistory, createWebHashHistory, RouteRecordRaw } from "vue-router"; +import { + createRouter, + createWebHistory, + createWebHashHistory, + RouteRecordRaw +} from "vue-router"; + import HomeIndex from "../views/home/index.vue"; const routes: Array = [ diff --git a/testAudio.js b/testAudio.js deleted file mode 100644 index 6a92222..0000000 --- a/testAudio.js +++ /dev/null @@ -1,114 +0,0 @@ -const fs = require('fs'); -// const portAudio = require('naudiodon'); -// Imports the Google Cloud client library -const speech = require('@google-cloud/speech'); -const portAudio = require('naudiodon'); - -// Create a stream to pipe into the AudioOutput -// Note that this does not strip the WAV header so a click will be heard at the beginning -const rs = fs.createReadStream('rawAudio.wav'); -const WebSocket = require("ws") -// Start piping data and start streaming -const {Writable} = require('stream'); -const ws = new WebSocket("ws://localhost:8080"); -//const duplex = WebSocket.createWebSocketStream(ws, { encoding: 'binary' }); - -const audioChunks = []; -const audioInputStreamTransform = new Writable({ - write(chunk, encoding, next) { - console.log(chunk) - // ws send chunk - // audioChunks.push(chunk); - // ws.send(chunk) - next(); - }, - - final() { - console.log(audioChunks) - // ws.send("stop") - // stop ws transer - }, -}); - - -// Creates a client -const client = new speech.SpeechClient(); - -/** - * TODO(developer): Uncomment the following lines before running the sample. - */ -const filename = './rawAudio.wav'; -const encoding = 'LINEAR16'; -const sampleRateHertz = 44100; -const languageCode = 'en-US'; - -const config = { - encoding: encoding, - sampleRateHertz: sampleRateHertz, - languageCode: languageCode, -}; -const audio = { - content: fs.readFileSync(filename).toString('base64'), -}; - -// const request = { -// config: config, -// audio: audio, -// }; - -// Detects speech in the audio file -async function test() { - const [response] = await client.recognize(request); - const transcription = response.results - .map(result => result.alternatives[0].transcript) - .join('\n'); - console.log('Transcription: ', transcription); -} - -// test(); - -const request = { - config, - interimResults: true, -}; - -const speechCallback = (data) => { - console.log( - `Transcription: ${data.results[0].alternatives[0].transcript}` - ) -} - -const recognizeStream = client -.streamingRecognize(request) -.on('error', err => { - if (err.code === 11) { - // restartStream(); - } else { - console.error('API request error ' + err); - } -}) -.on('data', speechCallback); - -// Create an instance of AudioIO with inOptions (defaults are as below), which will return a ReadableStream -const audioOptions = { - channelCount: 1, - sampleFormat: portAudio.sampleFormat16Bit, - sampleRate: 16000, - deviceId: -1, // Use -1 or omit the deviceId to select the default device - closeOnError: false // Close the stream if an audio error is detected, if set false then just log the error -} - -const audioData = []; -const ai = new portAudio.AudioIO({ - inOptions: audioOptions -}); -// ai.on('data', (d) => { -// audioData.push(d.toString('binary')) -// }) -ai.pipe(audioInputStreamTransform) -ai.start(); -setTimeout(() => { - ai.quit(); -}, 2000) - - diff --git a/testServer.js b/testServer.js deleted file mode 100644 index 03e4a04..0000000 --- a/testServer.js +++ /dev/null @@ -1,44 +0,0 @@ -const WebSocket = require("ws"); - -const testMessage = { - content: 'Hello from test server!' , - context: 'test message', - subContext: '', - modifiers: 'ai', - id: "0", - time: 'test' -} -const wss = new WebSocket.Server({ - port: 8080 - // perMessageDeflate: { - // zlibDeflateOptions: { - // // See zlib defaults. - // chunkSize: 1024, - // memLevel: 7, - // level: 3 - // }, - // zlibInflateOptions: { - // chunkSize: 10 * 1024 - // }, - // // Other options settable: - // clientNoContextTakeover: true, // Defaults to negotiated value. - // serverNoContextTakeover: true, // Defaults to negotiated value. - // serverMaxWindowBits: 10, // Defaults to negotiated value. - // // Below options specified as default values. - // concurrencyLimit: 10, // Limits zlib concurrency for perf. - // threshold: 1024 // Size (in bytes) below which messages - // // should not be compressed. - // } -}); - -wss.on("connection", function connection(ws, req) { - ws.on("message", function incoming(message) { - console.log(message) - // const parsed = JSON.parse(message) - // console.log(parsed) - }); - - const ip = req.socket.remoteAddress; - console.log("received connection from", ip); - ws.send(JSON.stringify(testMessage)); -}); diff --git a/ws.py b/ws.py deleted file mode 100644 index 939d01c..0000000 --- a/ws.py +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env python - -# WS server example - -import asyncio -import websockets - -# Imports the Google Cloud client library -from google.cloud import speech - -# Instantiates a client -client = speech.SpeechClient() - - -# config = speech.RecognitionConfig( -# encoding=speech.RecognitionConfig.AudioEncoding.LINEAR16, -# sample_rate_hertz=16000, -# language_code="en-US", -# ) - -# streaming_config = speech.StreamingRecognitionConfig(config=config) - -# def transcribe(stream): - -# requests = ( -# speech.StreamingRecognizeRequest(audio_content=chunk) for chunk in stream -# ) - -# # Detects speech in the audio file -# responses = client.streaming_recognize( -# config=config, -# requests=requests -# ) - -# for response in responses: -# # Once the transcription has settled, the first result will contain the -# # is_final result. The other results will be for subsequent portions of -# # the audio. -# for result in response.results: -# print("Finished: {}".format(result.is_final)) -# print("Stability: {}".format(result.stability)) -# alternatives = result.alternatives -# # The alternatives are ordered from most likely to least. -# for alternative in alternatives: -# print("Confidence: {}".format(alternative.confidence)) -# print(u"Transcript: {}".format(alternative.transcript)) - - -speechtotext_client = speech.SpeechClient() - -config = speech.RecognitionConfig( - audio_channel_count=1, - encoding=speech.RecognitionConfig.AudioEncoding.LINEAR16, - sample_rate_hertz=44100, - language_code="en-US", -) - -# Transcribe an audio file. -def transcribe(content): - input(content) - input(type(content)) - - content = speech.RecognitionAudio(content=content) - - # Detects speech in the audio file - response = speechtotext_client.recognize(config=config, audio=content) - input(f"Response: {response}") - - for result in response.results: - return result.alternatives[0].transcript - - -async def session(websocket, path): - buf = [] - - while True: - chunk = await websocket.recv() - - if chunk == "stop": - break - - buf.append(chunk) - - input(f"Buffer sample: {buf[0]}") - audio = b"".join(buf) - - transcribe(audio) - - -start_server = websockets.serve(session, "localhost", 8080) -asyncio.get_event_loop().run_until_complete(start_server) -asyncio.get_event_loop().run_forever() From 0f37cf98b1095841c8ee7b86be9c6be7da067697 Mon Sep 17 00:00:00 2001 From: Andrew Gundersen Date: Wed, 3 Feb 2021 19:36:58 -0600 Subject: [PATCH 2/7] added login page --- public/favicon.ico | Bin 4286 -> 0 bytes src/App.vue | 36 +++-- src/background.ts | 26 ++-- src/components/login/index.vue | 23 ++++ src/components/messenger/mockMessages.ts | 161 ----------------------- src/main.ts | 22 ++-- src/{router/index.ts => router.ts} | 16 ++- src/views/{home/index.vue => home.vue} | 7 +- src/views/login.vue | 17 +++ src/views/{user => }/register.vue | 0 src/views/user/login.vue | 0 testServer.js | 44 +++++++ tsconfig.json | 1 + 13 files changed, 149 insertions(+), 204 deletions(-) delete mode 100644 public/favicon.ico create mode 100644 src/components/login/index.vue delete mode 100644 src/components/messenger/mockMessages.ts rename src/{router/index.ts => router.ts} (52%) rename src/views/{home/index.vue => home.vue} (90%) create mode 100644 src/views/login.vue rename src/views/{user => }/register.vue (100%) delete mode 100644 src/views/user/login.vue create mode 100644 testServer.js diff --git a/public/favicon.ico b/public/favicon.ico deleted file mode 100644 index df36fcfb72584e00488330b560ebcf34a41c64c2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4286 zcmds*O-Phc6o&64GDVCEQHxsW(p4>LW*W<827=Unuo8sGpRux(DN@jWP-e29Wl%wj zY84_aq9}^Am9-cWTD5GGEo#+5Fi2wX_P*bo+xO!)p*7B;iKlbFd(U~_d(U?#hLj56 zPhFkj-|A6~Qk#@g^#D^U0XT1cu=c-vu1+SElX9NR;kzAUV(q0|dl0|%h|dI$%VICy zJnu2^L*Te9JrJMGh%-P79CL0}dq92RGU6gI{v2~|)p}sG5x0U*z<8U;Ij*hB9z?ei z@g6Xq-pDoPl=MANPiR7%172VA%r)kevtV-_5H*QJKFmd;8yA$98zCxBZYXTNZ#QFk2(TX0;Y2dt&WitL#$96|gJY=3xX zpCoi|YNzgO3R`f@IiEeSmKrPSf#h#Qd<$%Ej^RIeeYfsxhPMOG`S`Pz8q``=511zm zAm)MX5AV^5xIWPyEu7u>qYs?pn$I4nL9J!=K=SGlKLXpE<5x+2cDTXq?brj?n6sp= zphe9;_JHf40^9~}9i08r{XM$7HB!`{Ys~TK0kx<}ZQng`UPvH*11|q7&l9?@FQz;8 zx!=3<4seY*%=OlbCbcae?5^V_}*K>Uo6ZWV8mTyE^B=DKy7-sdLYkR5Z?paTgK-zyIkKjIcpyO z{+uIt&YSa_$QnN_@t~L014dyK(fOOo+W*MIxbA6Ndgr=Y!f#Tokqv}n<7-9qfHkc3 z=>a|HWqcX8fzQCT=dqVbogRq!-S>H%yA{1w#2Pn;=e>JiEj7Hl;zdt-2f+j2%DeVD zsW0Ab)ZK@0cIW%W7z}H{&~yGhn~D;aiP4=;m-HCo`BEI+Kd6 z={Xwx{TKxD#iCLfl2vQGDitKtN>z|-AdCN|$jTFDg0m3O`WLD4_s#$S diff --git a/src/App.vue b/src/App.vue index 1c8217a..13dae39 100644 --- a/src/App.vue +++ b/src/App.vue @@ -5,24 +5,22 @@ diff --git a/src/background.ts b/src/background.ts index 931f915..e2d0712 100644 --- a/src/background.ts +++ b/src/background.ts @@ -1,4 +1,9 @@ -import { app, protocol, BrowserWindow, ipcMain } from "electron"; +import { + app, + protocol, + BrowserWindow, + ipcMain +} from "electron"; import { createProtocol } from "vue-cli-plugin-electron-builder/lib"; import installExtension, { VUEJS_DEVTOOLS } from "electron-devtools-installer"; import * as path from "path"; @@ -26,21 +31,16 @@ function createWindow() { maximizable: false, // Postition at launch - x: 100, - y: 100, + x: 10, + y: 10, webPreferences: { devTools: false, - - nodeIntegration: - (process.env.ELECTRON_NODE_INTEGRATION as unknown) as boolean, - - preload: path.join(__dirname, "preload.js") - } }); + if (process.env.WEBPACK_DEV_SERVER_URL) { // Load the url of the dev server if in development mode win.loadURL(process.env.WEBPACK_DEV_SERVER_URL as string); @@ -53,6 +53,7 @@ function createWindow() { } + // Websockets config. win.webContents.on('did-finish-load', () => { // Define the websocket @@ -90,6 +91,7 @@ function createWindow() { win.on("closed", () => { win = null; }); + } // Quit when all windows are closed. @@ -126,13 +128,17 @@ app.on("ready", async () => { // Exit cleanly on request from parent process in development mode. if (isDevelopment) { + + // For windows. if (process.platform === "win32") { process.on("message", data => { if (data === "graceful-exit") { app.quit(); } }); - } else { + } + + else { process.on("SIGTERM", () => { app.quit(); }); diff --git a/src/components/login/index.vue b/src/components/login/index.vue new file mode 100644 index 0000000..5fb8776 --- /dev/null +++ b/src/components/login/index.vue @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/src/components/messenger/mockMessages.ts b/src/components/messenger/mockMessages.ts deleted file mode 100644 index 8bda834..0000000 --- a/src/components/messenger/mockMessages.ts +++ /dev/null @@ -1,161 +0,0 @@ -import { Message } from "@/types/message/index"; - -const Messages: Message[] = [ - { - content: "Welcome", - context: "ai", - subContext: "", - modifier: "ai", - id: "2", - time: "" - }, - { - content: - "add friend", - context: "launch", - subContext: "", - modifier: "sf", - id: "1", - time: "" - }, - { - content: "Did you mean to addcontact?", - context: "addcontact", - subContext: "", - modifier: "ai", - id: "5", - time: "" - }, - { - content: "yes", - context: "fulfill", - subContext: "", - modifier: "sf", - id: "6", - time: "" - }, - - { - content: "Hey Anna, did you get the paper done?", - context: "Mesage from Tommy McConville", - subContext: "New Conversation", - modifier: "ai", - id: "3", - time: "" - }, - { - content: "Hey do you know Enrique Hernandez?", - context: "Message from Crimata", - subContext: "", - modifier: "ai", - id: "7", - time: "" - }, - - { - content: "Yes posting it online soon.", - context: "You to Tommy McConville", - subContext: "", - modifier: "sf", - id: "4", - time: "" - }, - { - content: "Hey do you know Enrique Hernandez?", - context: "Message from Crimata", - subContext: "", - modifier: "ai", - id: "8", - time: "" - }, - { - content: "Hey Anna, did you get the paper done?", - context: "Message from Tommy McConville", - subContext: "", - modifier: "ai", - id: "9", - time: "" - }, - { - content: "Hey Anna, did you get the paper done?", - context: "Message from Tommy McConville", - subContext: "", - modifier: "ai", - id: "10", - time: "" - }, - { - content: "Yes posting it online soon.", - context: "Message from Tommy McConville", - subContext: "", - modifier: "sf", - id: "11", - time: "" - }, - { - content: - "I can be there at 5 pm tomorrow to greet you at a Chick file with my almond and chive salad.", - context: "You to Tommy McConville", - subContext: "", - modifier: "sf", - id: "12", - time: "" - }, - { - content: "Hey Anna, did you get the paper done?", - context: "Message from Tommy McConville", - subContext: "", - modifier: "ai", - id: "13", - time: "" - }, - { - content: "Hey Anna, did you get the paper done?", - context: "Message from Tommy McConville", - subContext: "", - modifier: "ai", - id: "14", - time: "" - }, - { - content: "Yes posting it online soon.", - context: "You to Tommy McConville", - subContext: "", - modifier: "sf", - id: "15", - time: "" - }, - { - content: "Sweet, thanks!", - context: "Message from Tommy McConville", - subContext: "", - modifier: "ai", - id: "16", - time: "" - }, - { - content: "Hey do you know Enrique Hernandez?", - context: "Message from Crimata AI", - subContext: "", - modifier: "ai", - id: "17", - time: "" - }, - { - content: "Yes posting it online soon.", - context: "You to Tommy McConville", - subContext: "", - modifier: "sf", - id: "18", - time: "" - }, - { - content: "Sweet, thanks!", - context: "Message from Tommy McConville", - subContext: "", - modifier: "ai", - id: "19", - time: "" - }, -]; -export default Messages; diff --git a/src/main.ts b/src/main.ts index 531bb90..c03e8b6 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,16 +1,18 @@ -import { createApp } from "vue"; +// src/main.ts + import App from "./App.vue"; import router from "./router"; -// animation library -import anime from "animejs"; - -// event handler library import mitt from "mitt"; +import anime from "animejs"; +import { createApp } from "vue"; + +// Handle events. const emitter = mitt(); -createApp(App) - .use(router) - .provide("animejs", anime) - .provide("mitt", emitter) - .mount("#app"); +const app = createApp(App) + +app.use(router) +app.provide("animejs", anime) +app.provide("mitt", emitter) +app.mount("#app"); diff --git a/src/router/index.ts b/src/router.ts similarity index 52% rename from src/router/index.ts rename to src/router.ts index b44e9eb..07537f3 100644 --- a/src/router/index.ts +++ b/src/router.ts @@ -5,18 +5,28 @@ import { RouteRecordRaw } from "vue-router"; -import HomeIndex from "../views/home/index.vue"; +import Home from "./views/home.vue"; +import Login from "./views/login.vue"; +// Define the routes (/*) for the app here. const routes: Array = [ + { path: "/", name: "Home", - component: HomeIndex + component: Home }, + + { + path: "/login", + name: "Login", + component: Login + }, + ]; const router = createRouter({ - history: process.env.IS_ELECTRON ? createWebHashHistory() : createWebHistory(process.env.BASE_URL), + history: createWebHashHistory(), routes }); diff --git a/src/views/home/index.vue b/src/views/home.vue similarity index 90% rename from src/views/home/index.vue rename to src/views/home.vue index a0a4eda..b65ef78 100644 --- a/src/views/home/index.vue +++ b/src/views/home.vue @@ -3,10 +3,15 @@ diff --git a/src/views/login.vue b/src/views/login.vue new file mode 100644 index 0000000..7226a87 --- /dev/null +++ b/src/views/login.vue @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/src/views/user/register.vue b/src/views/register.vue similarity index 100% rename from src/views/user/register.vue rename to src/views/register.vue diff --git a/src/views/user/login.vue b/src/views/user/login.vue deleted file mode 100644 index e69de29..0000000 diff --git a/testServer.js b/testServer.js new file mode 100644 index 0000000..03e4a04 --- /dev/null +++ b/testServer.js @@ -0,0 +1,44 @@ +const WebSocket = require("ws"); + +const testMessage = { + content: 'Hello from test server!' , + context: 'test message', + subContext: '', + modifiers: 'ai', + id: "0", + time: 'test' +} +const wss = new WebSocket.Server({ + port: 8080 + // perMessageDeflate: { + // zlibDeflateOptions: { + // // See zlib defaults. + // chunkSize: 1024, + // memLevel: 7, + // level: 3 + // }, + // zlibInflateOptions: { + // chunkSize: 10 * 1024 + // }, + // // Other options settable: + // clientNoContextTakeover: true, // Defaults to negotiated value. + // serverNoContextTakeover: true, // Defaults to negotiated value. + // serverMaxWindowBits: 10, // Defaults to negotiated value. + // // Below options specified as default values. + // concurrencyLimit: 10, // Limits zlib concurrency for perf. + // threshold: 1024 // Size (in bytes) below which messages + // // should not be compressed. + // } +}); + +wss.on("connection", function connection(ws, req) { + ws.on("message", function incoming(message) { + console.log(message) + // const parsed = JSON.parse(message) + // console.log(parsed) + }); + + const ip = req.socket.remoteAddress; + console.log("received connection from", ip); + ws.send(JSON.stringify(testMessage)); +}); diff --git a/tsconfig.json b/tsconfig.json index c9e770c..3a86ecc 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -31,6 +31,7 @@ ] }, "include": [ + "src/*.ts", "src/**/*.ts", "src/**/*.tsx", "src/**/*.vue", From a3365c544d8e5ae1793267bc6d03e8af449ade38 Mon Sep 17 00:00:00 2001 From: Andrew Gundersen Date: Thu, 4 Feb 2021 11:29:35 -0600 Subject: [PATCH 3/7] splash and login screens --- src/background.ts | 10 +++++-- src/components/splash/index.vue | 46 +++++++++++++++++++++++++++++++++ src/router.ts | 7 +++++ src/views/splash.vue | 17 ++++++++++++ 4 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 src/components/splash/index.vue create mode 100644 src/views/splash.vue diff --git a/src/background.ts b/src/background.ts index e2d0712..3e36280 100644 --- a/src/background.ts +++ b/src/background.ts @@ -27,7 +27,7 @@ function createWindow() { win = new BrowserWindow({ width: 350, height: 520, - resizable: false, + resizable: true, maximizable: false, // Postition at launch @@ -35,7 +35,13 @@ function createWindow() { y: 10, webPreferences: { - devTools: false, + devTools: true, + + nodeIntegration: + (process.env.ELECTRON_NODE_INTEGRATION as unknown) as boolean, + + preload: path.join(__dirname, "preload.js") + } }); diff --git a/src/components/splash/index.vue b/src/components/splash/index.vue new file mode 100644 index 0000000..33afe3f --- /dev/null +++ b/src/components/splash/index.vue @@ -0,0 +1,46 @@ + + + + + \ No newline at end of file diff --git a/src/router.ts b/src/router.ts index 07537f3..bc2a7ed 100644 --- a/src/router.ts +++ b/src/router.ts @@ -7,12 +7,19 @@ import { import Home from "./views/home.vue"; import Login from "./views/login.vue"; +import Splash from "./views/splash.vue"; // Define the routes (/*) for the app here. const routes: Array = [ { path: "/", + name: "Splash", + component: Splash + }, + + { + path: "/home", name: "Home", component: Home }, diff --git a/src/views/splash.vue b/src/views/splash.vue new file mode 100644 index 0000000..4615508 --- /dev/null +++ b/src/views/splash.vue @@ -0,0 +1,17 @@ + + + \ No newline at end of file From 8c6c557552b26654d08bdc12d44eeecd3c3bf43e Mon Sep 17 00:00:00 2001 From: Andrew Gundersen Date: Thu, 4 Feb 2021 11:35:25 -0600 Subject: [PATCH 4/7] trying to fix render bug for non-home views --- src/components/login/index.vue | 8 +++++--- src/router.ts | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/login/index.vue b/src/components/login/index.vue index 5fb8776..a36f970 100644 --- a/src/components/login/index.vue +++ b/src/components/login/index.vue @@ -4,16 +4,18 @@ \ No newline at end of file diff --git a/src/components/splash/index.vue b/src/components/splash/index.vue index 33afe3f..3b0a133 100644 --- a/src/components/splash/index.vue +++ b/src/components/splash/index.vue @@ -1,24 +1,47 @@ @@ -61,6 +55,41 @@ export default defineComponent({ \ No newline at end of file diff --git a/src/preload.ts b/src/preload.ts index 87f3b68..b0cd4b9 100644 --- a/src/preload.ts +++ b/src/preload.ts @@ -7,10 +7,13 @@ declare global { ipcRenderer: typeof ipcRenderer; } } + window.ipcRenderer = ipcRenderer; process.once("loaded", () => { + window.addEventListener("message", event => { + // do something with custom event const message = event.data; @@ -25,6 +28,11 @@ process.once("loaded", () => { if (message.myTypeField === "update-recorder") { ipcRenderer.send("update-recorder", message.record); } - }); -}); + if (message.myTypeField === "submit-creds") { + ipcRenderer.send("submit-creds", message) + } + + }); + +}); \ No newline at end of file diff --git a/src/router.ts b/src/router.ts index 1523954..9e4c6d3 100644 --- a/src/router.ts +++ b/src/router.ts @@ -19,7 +19,7 @@ const routes: Array = [ }, { - path: "/home", + path: "/sdf", name: "Home", component: Home }, @@ -37,4 +37,4 @@ const router = createRouter({ routes }); -export default router; +export default router; \ No newline at end of file