From 50bed23d373e538cc69664662bd5af33ff966c9c Mon Sep 17 00:00:00 2001 From: "Lin, Hung-Shin" Date: Thu, 5 Oct 2023 14:22:47 +0800 Subject: [PATCH] fix: remove unnecessary console log --- app/src/components/AuthenticationPart.vue | 1 - app/src/components/TerminalPart.vue | 2 +- app/src/router.js | 1 - app/src/utils/auth.js | 3 +-- app/src/utils/session.js | 1 - server/src/api/socket.js | 3 --- server/src/auth/googleStrategy.js | 3 --- server/tests/utils/auth.test.js | 2 -- 8 files changed, 2 insertions(+), 14 deletions(-) diff --git a/app/src/components/AuthenticationPart.vue b/app/src/components/AuthenticationPart.vue index 5163eca..e2148e7 100644 --- a/app/src/components/AuthenticationPart.vue +++ b/app/src/components/AuthenticationPart.vue @@ -64,7 +64,6 @@ async function check() { } function handleRegister() { - console.log('register', username.value, email.value, password.value) register(username.value, email.value, password.value) .then((isSuccess) => { if (isSuccess) { diff --git a/app/src/components/TerminalPart.vue b/app/src/components/TerminalPart.vue index bdedd4d..ed09178 100644 --- a/app/src/components/TerminalPart.vue +++ b/app/src/components/TerminalPart.vue @@ -46,7 +46,7 @@ function resizeScreen() { // 窗口大小改变时,触发xterm的resize方法使自适应 fitAddon.fit() } catch (e) { - console.log('e', e.message) + console.error('e', e.message) } } window.addEventListener('resize', resizeScreen) diff --git a/app/src/router.js b/app/src/router.js index 86a7894..40dd4dc 100644 --- a/app/src/router.js +++ b/app/src/router.js @@ -28,7 +28,6 @@ const router = createRouter({ }) router.beforeEach(async (to, from, next) => { - console.log(to, from) const loggedIn = await isLoggedIn() // Check if the route requires authentication if (to.meta.requiresAuth && !loggedIn) { diff --git a/app/src/utils/auth.js b/app/src/utils/auth.js index deb5e9d..8e6a478 100644 --- a/app/src/utils/auth.js +++ b/app/src/utils/auth.js @@ -8,8 +8,7 @@ export async function isLoggedIn() { export const login = async (username, password) => { try { - const res = await api.post('/auth/login', { username, password }) - console.log(res.data) + await api.post('/auth/login', { username, password }) return true } catch (err) { if (err.response?.status === 401) { diff --git a/app/src/utils/session.js b/app/src/utils/session.js index ada7725..0869c70 100644 --- a/app/src/utils/session.js +++ b/app/src/utils/session.js @@ -38,7 +38,6 @@ class SessionManager { } handleHintUpdate(event) { - console.log(event) this.hints.value = [...this.hints.value, ...event] } diff --git a/server/src/api/socket.js b/server/src/api/socket.js index df98867..4bdc6bb 100644 --- a/server/src/api/socket.js +++ b/server/src/api/socket.js @@ -27,8 +27,6 @@ export function pushToSession(sessionId, event, ...args) { } async function connectClient(socket) { - console.log('Connected to the client.') - const user = socket.request.session?.passport?.user if (!user) { socket.send('User not found.') @@ -85,7 +83,6 @@ async function connectClient(socket) { listenToSession(session.id, socketCallback) socket.on('disconnect', () => { - console.log('Disconnected from the client.') stream.socket.write('exit\n') removeFromSession(session.id, socketCallback) stream.destroy() diff --git a/server/src/auth/googleStrategy.js b/server/src/auth/googleStrategy.js index 3a6e63a..2edb2e2 100644 --- a/server/src/auth/googleStrategy.js +++ b/server/src/auth/googleStrategy.js @@ -4,8 +4,6 @@ import config from '../config.js' import User from '../models/user.js' function verify(issuer, profile, cb) { - console.log('Get a google login:', profile) - process.nextTick(async () => { const email = profile.emails[0]?.value if (!email) { @@ -20,7 +18,6 @@ function verify(issuer, profile, cb) { id: profile.id, displayName: profile.displayName, } - console.log('Existing user:', user) if (!user) { user = new User({ email, diff --git a/server/tests/utils/auth.test.js b/server/tests/utils/auth.test.js index 3df34ed..4254ed8 100644 --- a/server/tests/utils/auth.test.js +++ b/server/tests/utils/auth.test.js @@ -33,12 +33,10 @@ test('check valid email', () => { ] validEmails.forEach((email) => { - console.log(email) expect(isValidEmail(email)).toBe(true) }) invalidEmails.forEach((email) => { - console.log(email) expect(isValidEmail(email)).toBe(false) }) })