Skip to content

Commit

Permalink
Run ESLint
Browse files Browse the repository at this point in the history
  • Loading branch information
Tara Matthew committed Oct 12, 2023
1 parent 9e0a66b commit 42d073f
Show file tree
Hide file tree
Showing 12 changed files with 379 additions and 379 deletions.
8 changes: 4 additions & 4 deletions client/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
presets: [
"@vue/cli-plugin-babel/preset"
]
};
62 changes: 31 additions & 31 deletions client/src/assets/ClipLoader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,40 @@
<script>
export default {
name: 'ClipLoader',
name: "ClipLoader",
props: {
loading: {
type: Boolean,
default: true
},
props: {
loading: {
type: Boolean,
default: true
},
color: {
type: String,
default: '#5dc596'
},
type: String,
default: "#5dc596"
},
size: {
type: String,
default: '50px'
},
radius: {
type: String,
default: '100%'
}
},
computed: {
spinnerStyle () {
return {
height: this.size,
width: this.size,
borderWidth: '5px',
borderStyle: 'solid',
borderColor: this.color + ' ' + this.color + ' transparent',
borderRadius: this.radius,
background: 'transparent'
}
}
}
}
type: String,
default: "50px"
},
radius: {
type: String,
default: "100%"
}
},
computed: {
spinnerStyle () {
return {
height: this.size,
width: this.size,
borderWidth: "5px",
borderStyle: "solid",
borderColor: this.color + " " + this.color + " transparent",
borderRadius: this.radius,
background: "transparent"
};
}
}
};
</script>

<style>
Expand Down
12 changes: 6 additions & 6 deletions client/src/components/ChatCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@

<script>
export default {
name: "ChatCard",
props: {
userId: String,
isActive: Boolean
},
}
name: "ChatCard",
props: {
userId: String,
isActive: Boolean
},
};
</script>

<style scoped>
Expand Down
48 changes: 24 additions & 24 deletions client/src/components/ChatListHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,31 @@
</div>
</template>

<script>
import ChatCard from './ChatCard.vue';
<script>
import ChatCard from "./ChatCard.vue";
export default {
name: "ChatListHeader",
components: {
ChatCard
},
props: {
users: {
type: Array,
required: true
},
activeUser: {
type: String,
default: null
}
},
methods: {
switchChat(userId) {
this.$emit('switch', userId);
}
}
};
</script>
export default {
name: "ChatListHeader",
components: {
ChatCard
},
props: {
users: {
type: Array,
required: true
},
activeUser: {
type: String,
default: null
}
},
methods: {
switchChat(userId) {
this.$emit("switch", userId);
}
}
};
</script>

<style scoped>
.chat-list-header {
Expand Down
38 changes: 19 additions & 19 deletions client/src/components/MessageForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,29 @@
</template>

<script>
import { defineComponent } from 'vue'
import { defineComponent } from "vue";
export default defineComponent({
name: 'MessageForm',
data() {
return {
text: '',
isFocused: false
}
},
name: "MessageForm",
data() {
return {
text: "",
isFocused: false
};
},
methods: {
onSubmit() {
const text = this.text.trim();
if (text.trim() === '') {
return;
}
methods: {
onSubmit() {
const text = this.text.trim();
if (text.trim() === "") {
return;
}
this.$emit('sendMessage', text);
this.text = '';
},
},
})
this.$emit("sendMessage", text);
this.text = "";
},
},
});
</script>

Expand Down
20 changes: 10 additions & 10 deletions client/src/components/ToastMessage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@

<script>
export default {
props: {
toastmsg: {
type: String,
required: true,
},
toastType: {
type: String,
required: true,
},
},
props: {
toastmsg: {
type: String,
required: true,
},
toastType: {
type: String,
required: true,
},
},
};
</script>

Expand Down
14 changes: 7 additions & 7 deletions client/src/main.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import "bootstrap"
import "bootstrap/dist/css/bootstrap.min.css"
import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import "bootstrap";
import "bootstrap/dist/css/bootstrap.min.css";

import VueCookies from 'vue3-cookies'
import VueCookies from "vue3-cookies";

createApp(App).use(VueCookies).use(router).mount('#app')
createApp(App).use(VueCookies).use(router).mount("#app");
44 changes: 22 additions & 22 deletions client/src/router/index.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import { createRouter, createWebHashHistory } from 'vue-router'
import Home from '../views/Home.vue'
import { createRouter, createWebHashHistory } from "vue-router";
import Home from "../views/Home.vue";

const routes = [
{
path: '/',
name: 'Home',
component: Home
},
{
path: '/docs',
name: 'Docs',
component: () => import('../views/Docs.vue')
},
{
path: '/chat',
name: 'Chat',
component: () => import('../views/Chat.vue')
}
]
{
path: "/",
name: "Home",
component: Home
},
{
path: "/docs",
name: "Docs",
component: () => import("../views/Docs.vue")
},
{
path: "/chat",
name: "Chat",
component: () => import("../views/Chat.vue")
}
];

const router = createRouter({
history: createWebHashHistory(process.env.BASE_URL),
routes
})
history: createWebHashHistory(process.env.BASE_URL),
routes
});

export default router
export default router;
44 changes: 22 additions & 22 deletions client/src/utils/crypto.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
const forge = require("node-forge");

function encryptMessage(message, publicKey) {
const key = forge.random.getBytesSync(32);
const iv = forge.random.getBytesSync(16);
const key = forge.random.getBytesSync(32);
const iv = forge.random.getBytesSync(16);

const cipher = forge.cipher.createCipher("AES-CBC", key);
cipher.start({ iv });
cipher.update(forge.util.createBuffer(message));
cipher.finish();
const encrypted = cipher.output;
const cipher = forge.cipher.createCipher("AES-CBC", key);
cipher.start({ iv });
cipher.update(forge.util.createBuffer(message));
cipher.finish();
const encrypted = cipher.output;

return {
encrypted: encrypted.getBytes(),
key: publicKey.encrypt(key),
iv: iv,
};
return {
encrypted: encrypted.getBytes(),
key: publicKey.encrypt(key),
iv: iv,
};
}

function decryptMessage(message, privateKey) {
const key = privateKey.decrypt(message.key);
const { encrypted, iv } = message;
const key = privateKey.decrypt(message.key);
const { encrypted, iv } = message;

const decipher = forge.cipher.createDecipher("AES-CBC", key);
decipher.start({ iv });
decipher.update(forge.util.createBuffer(encrypted));
decipher.finish();
const decipher = forge.cipher.createDecipher("AES-CBC", key);
decipher.start({ iv });
decipher.update(forge.util.createBuffer(encrypted));
decipher.finish();

const decrypted = decipher.output.toString();
return decrypted;
const decrypted = decipher.output.toString();
return decrypted;
}

module.exports = {
encryptMessage,
decryptMessage,
encryptMessage,
decryptMessage,
};
Loading

0 comments on commit 42d073f

Please sign in to comment.