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 => {