From 139d7cc699469d40d2d50afa902820bcf2c5eaec Mon Sep 17 00:00:00 2001 From: Xeltica Date: Wed, 16 Sep 2020 00:39:47 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=AD=E3=82=B0=E3=81=AE=E3=82=A2=E3=83=AC?= =?UTF-8?q?=E3=82=92=E7=9B=B4=E3=81=97=E3=81=9F=E3=82=8A=E3=81=A8=E3=81=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/router.ts | 3 --- src/services/db.ts | 2 +- src/services/send.ts | 6 +++--- src/services/worker.ts | 3 --- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/server/router.ts b/src/server/router.ts index 89d838b..cc50b20 100644 --- a/src/server/router.ts +++ b/src/server/router.ts @@ -59,7 +59,6 @@ router.get('/', async ctx => { const user = token ? await getUserByMisshaiToken(token) : undefined; const isAvailable = user && await apiAvailable(user.host, user.token); - console.log(isAvailable); if (user && isAvailable) { await ctx.render('mypage', { user, @@ -176,8 +175,6 @@ router.get('/legacy-auth', async ctx => { return; } - console.log(host); - const { accessToken, user } = await api<{ accessToken: string, user: Record }>(host, 'auth/session/userkey', { appSecret, token, }); diff --git a/src/services/db.ts b/src/services/db.ts index 4cfc7c8..ab62265 100644 --- a/src/services/db.ts +++ b/src/services/db.ts @@ -15,7 +15,7 @@ export const initDb = async (force = false): Promise => { return Promise.resolve(conn); } catch (e) { // noop - console.warn('connection is not fonud, so create'); + console.warn('connection is not found, so create'); } } diff --git a/src/services/send.ts b/src/services/send.ts index 98621dd..d28a84d 100644 --- a/src/services/send.ts +++ b/src/services/send.ts @@ -12,17 +12,17 @@ export const send = async (user: User): Promise => { text, }, user.token); if (res.error) { - throw res.error; + throw res.error || res; } } else if (user.alertMode === 'notification') { - console.log(`send ${user.username}@${user.host}'s misshaialert as a notification`); + console.info(`send ${user.username}@${user.host}'s misshaialert as a notification`); const res = await api(user.host, 'notifications/create', { header: 'みす廃あらーと', icon: 'https://i.imgur.com/B991yTl.png', body: text, }, user.token); if (res.error) { - throw res.error; + throw res.error || res; } } else { console.info(`will not send ${user.username}@${user.host}'s misshaialert`); diff --git a/src/services/worker.ts b/src/services/worker.ts index 3976df4..d6fcdf1 100644 --- a/src/services/worker.ts +++ b/src/services/worker.ts @@ -2,11 +2,8 @@ import cron from 'node-cron'; import delay from 'delay'; import { Users } from '../models'; -import { api } from './misskey'; -import { format } from '../functions/format'; import { deleteUser } from '../functions/users'; import { updateScore } from '../functions/update-score'; -import { getScores } from '../functions/get-scores'; import { send } from './send'; export default (): void => {