0
0
Fork 0

ログのアレを直したりとか

This commit is contained in:
Xeltica 2020-09-16 00:39:47 +09:00
parent 9b55163f1c
commit 139d7cc699
4 changed files with 4 additions and 10 deletions

View file

@ -59,7 +59,6 @@ router.get('/', async ctx => {
const user = token ? await getUserByMisshaiToken(token) : undefined; const user = token ? await getUserByMisshaiToken(token) : undefined;
const isAvailable = user && await apiAvailable(user.host, user.token); const isAvailable = user && await apiAvailable(user.host, user.token);
console.log(isAvailable);
if (user && isAvailable) { if (user && isAvailable) {
await ctx.render('mypage', { await ctx.render('mypage', {
user, user,
@ -176,8 +175,6 @@ router.get('/legacy-auth', async ctx => {
return; return;
} }
console.log(host);
const { accessToken, user } = await api<{ accessToken: string, user: Record<string, unknown> }>(host, 'auth/session/userkey', { const { accessToken, user } = await api<{ accessToken: string, user: Record<string, unknown> }>(host, 'auth/session/userkey', {
appSecret, token, appSecret, token,
}); });

View file

@ -15,7 +15,7 @@ export const initDb = async (force = false): Promise<Connection> => {
return Promise.resolve(conn); return Promise.resolve(conn);
} catch (e) { } catch (e) {
// noop // noop
console.warn('connection is not fonud, so create'); console.warn('connection is not found, so create');
} }
} }

View file

@ -12,17 +12,17 @@ export const send = async (user: User): Promise<void> => {
text, text,
}, user.token); }, user.token);
if (res.error) { if (res.error) {
throw res.error; throw res.error || res;
} }
} else if (user.alertMode === 'notification') { } 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', { const res = await api(user.host, 'notifications/create', {
header: 'みす廃あらーと', header: 'みす廃あらーと',
icon: 'https://i.imgur.com/B991yTl.png', icon: 'https://i.imgur.com/B991yTl.png',
body: text, body: text,
}, user.token); }, user.token);
if (res.error) { if (res.error) {
throw res.error; throw res.error || res;
} }
} else { } else {
console.info(`will not send ${user.username}@${user.host}'s misshaialert`); console.info(`will not send ${user.username}@${user.host}'s misshaialert`);

View file

@ -2,11 +2,8 @@ import cron from 'node-cron';
import delay from 'delay'; import delay from 'delay';
import { Users } from '../models'; import { Users } from '../models';
import { api } from './misskey';
import { format } from '../functions/format';
import { deleteUser } from '../functions/users'; import { deleteUser } from '../functions/users';
import { updateScore } from '../functions/update-score'; import { updateScore } from '../functions/update-score';
import { getScores } from '../functions/get-scores';
import { send } from './send'; import { send } from './send';
export default (): void => { export default (): void => {