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 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<string, unknown> }>(host, 'auth/session/userkey', {
appSecret, token,
});

View file

@ -15,7 +15,7 @@ export const initDb = async (force = false): Promise<Connection> => {
return Promise.resolve(conn);
} catch (e) {
// 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,
}, 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`);

View file

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