0
0
Fork 0

style: use space indentation

feat: no new users allowed
fix: change base language to Korean
fix: change gacha to random text from devs
This commit is contained in:
아르페 2024-02-02 01:35:17 +09:00
parent 320dfc0696
commit b6a3b0cd53
35 changed files with 335 additions and 367 deletions

View file

@ -16,35 +16,9 @@ export const misskeyAppInfo = {
permission: [
'read:account',
'write:account',
'read:blocks',
'write:blocks',
'read:drive',
'write:drive',
'read:favorites',
'write:favorites',
'read:following',
'write:following',
'read:messaging',
'write:messaging',
'read:mutes',
'write:mutes',
'write:notes',
'read:notifications',
'write:notifications',
'read:reactions',
'write:reactions',
'write:votes',
'read:pages',
'write:pages',
'write:page-likes',
'read:page-likes',
'read:user-groups',
'write:user-groups',
'read:channels',
'write:channels',
'read:gallery',
'write:gallery',
'read:gallery-likes',
'write:gallery-likes',
],
} as const;

View file

@ -24,5 +24,5 @@ export class UserSetting {
useRanking?: boolean;
@IsOptional()
appendHashtag?: boolean;
appendHashtag?: boolean;
}

View file

@ -180,8 +180,12 @@ router.get('(.*)', async (ctx) => {
async function login(ctx: Context, user: Record<string, unknown>, host: string, token: string) {
const isNewcomer = !(await getUser(user.username as string, host));
await upsertUser(user.username as string, host, token);
if (isNewcomer) {
await die(ctx, 'noNewUserAllowed', 403);
return;
}
await upsertUser(user.username as string, host, token);
const u = await getUser(user.username as string, host);
if (!u) {

View file

@ -38,23 +38,23 @@ export const work = async () => {
await calculateAllRating(groupedUsers);
}
catch (e) {
printLog('Misskey Tools with LycheeBridge 레이팅 계산에 실패했습니다.', 'error');
printLog(e instanceof Error ? errorToString(e) : JSON.stringify(e, null, ' '), 'error');
Store.dispatch({ nowCalculating: false });
printLog('Misskey Tools with LycheeBridge 레이팅 계산에 실패했습니다.', 'error');
printLog(e instanceof Error ? errorToString(e) : JSON.stringify(e, null, ' '), 'error');
Store.dispatch({ nowCalculating: false });
}
finally {
Store.dispatch({ nowCalculating: false });
printLog(`${users.length}개의 계정 레이팅 계산이 완료되었습니다.`);
Store.dispatch({ nowCalculating: false });
printLog(`${users.length}개의 계정 레이팅 계산이 완료되었습니다.`);
}
try {
printLog(`${users.length}개의 계정에 알림을 전송하고 있습니다.`);
printLog(`${users.length}개의 계정에 알림을 전송하고 있습니다.`);
await sendAllAlerts(groupedUsers);
} catch (e) {
printLog('Misskey Tools with LycheeBridge 알림 전송에 실패했습니다.', 'error');
printLog(e instanceof Error ? errorToString(e) : JSON.stringify(e, null, ' '), 'error');
} finally {
printLog('Misskey Tools with LycheeBridge 알림 전송이 완료되었습니다.');
printLog('Misskey Tools with LycheeBridge 알림 전송이 완료되었습니다.');
}
};
@ -75,10 +75,10 @@ const calculateRating = async (host: string, users: User[]) => {
// ユーザーが削除されている場合、レコードからも消してとりやめ
printLog(`${toAcct(user)} 게정이 삭제, 정지, 또는 토큰이 제거된 것으로 보이며, 시스템에서 계정이 제거되었습니다.`, 'warn');
await deleteUser(user.username, user.host);
continue;
continue;
} else {
printLog(`Misskey 오류: ${JSON.stringify(e.error)}`, 'error');
continue;
continue;
}
} else if (e instanceof TimedOutError) {
printLog(`${user.host} 인스턴스로의 연결에 실패하여 레이팅 계산을 중단합니다.`, 'error');
@ -105,7 +105,7 @@ const sendAlerts = async (host: string, users: User[]) => {
.map(user => {
const count = userScoreCache.get(toAcct(user));
if (count == null) return null;
if (count.notesCount - (user.prevNotesCount ?? 0) <= 1) return null;
if (count.notesCount - (user.prevNotesCount ?? 0) <= 1) return null;
return {
user,
count,
@ -121,31 +121,31 @@ const sendAlerts = async (host: string, users: User[]) => {
// 通知
for (const {user, count, message} of models.filter(m => m.user.alertMode === 'notification' || m.user.alertMode === 'both')) {
try {
try {
await sendNotificationAlert(message, user);
} catch (e) {
printLog('Misskey Tools with LycheeBridge 알림 전송에 실패했습니다.', 'error');
} catch (e) {
printLog('Misskey Tools with LycheeBridge 알림 전송에 실패했습니다.', 'error');
printLog(e instanceof Error ? errorToString(e) : JSON.stringify(e, null, ' '), 'error');
} finally {
if (user.alertMode === 'notification') {
await updateScore(user, count);
}
}
} finally {
if (user.alertMode === 'notification') {
await updateScore(user, count);
}
}
}
// アラート
for (const {user, count, message} of models.filter(m => m.user.alertMode === 'note' || m.user.alertMode === 'both')) {
try {
try {
await sendNoteAlert(message, user);
} catch (e) {
printLog('Misskey Tools with LycheeBridge 알림 전송에 실패했습니다.', 'error');
printLog(e instanceof Error ? errorToString(e) : JSON.stringify(e, null, ' '), 'error');
} finally {
await Promise.all([
updateScore(user, count),
delay(1000),
]);
}
} catch (e) {
printLog('Misskey Tools with LycheeBridge 알림 전송에 실패했습니다.', 'error');
printLog(e instanceof Error ? errorToString(e) : JSON.stringify(e, null, ' '), 'error');
} finally {
await Promise.all([
updateScore(user, count),
delay(1000),
]);
}
}
printLog(`${host} 인스턴스의 사용자 ${users.length}명의 알림 전송이 완료되었습니다.`);

View file

@ -1,41 +1,41 @@
doctype html
html
head
meta(charset="UTF-8")
meta(name="viewport", content="width=device-width, initial-scale=1.0")
block meta
- const title = t ? `${t} | Misskey Tools`: 'Misskey Tools with LycheeBridge';
- const desc = d || '🌠 연합우주의 모든 Misskey 사용자를 위한 다양한 도구 모음집 🚀';
title= title
meta(name='description' content=desc)
meta(property='og:title' content=title)
meta(property='og:site_name' content='Misskey Tools with LycheeBridge')
meta(property='og:description' content=desc)
meta(property='og:type' content='website')
meta(property='og:image' content="https://tools.phater.live/assets/misskey.png")
link(rel="icon", href="/assets/lcb.png", type="image/png")
link(rel="preload", href="/assets/otadesign_rounded.woff")
link(rel="preload", href="/assets/otadesign_rounded.woff2")
link(rel="preload", href="/assets/PretendardJPVariable.woff2")
script(src='https://kit.fontawesome.com/a4464bc6cd.js' crossorigin='anonymous')
link(rel="stylesheet", href="/assets/style.css")
body
#app: .loading 불러오는 중입니다...
head
meta(charset="UTF-8")
meta(name="viewport", content="width=device-width, initial-scale=1.0")
block meta
- const title = t ? `${t} | Misskey Tools`: 'Misskey Tools with LycheeBridge';
- const desc = d || '🌠 연합우주의 모든 Misskey 사용자를 위한 다양한 도구 모음집 🚀';
title= title
meta(name='description' content=desc)
meta(property='og:title' content=title)
meta(property='og:site_name' content='Misskey Tools with LycheeBridge')
meta(property='og:description' content=desc)
meta(property='og:type' content='website')
meta(property='og:image' content="https://tools.phater.live/assets/misskey.png")
link(rel="icon", href="/assets/lcb.png", type="image/png")
link(rel="preload", href="/assets/otadesign_rounded.woff")
link(rel="preload", href="/assets/otadesign_rounded.woff2")
link(rel="preload", href="/assets/PretendardJPVariable.woff2")
script(src='https://kit.fontawesome.com/a4464bc6cd.js' crossorigin='anonymous')
link(rel="stylesheet", href="/assets/style.css")
body
#app: .loading 불러오는 중입니다...
if token
script.
const token = '#{token}';
const previousToken = localStorage.getItem('token');
const accounts = JSON.parse(localStorage.getItem('accounts') || '[]');
if (previousToken && !accounts.includes(previousToken)) {
accounts.push(previousToken);
}
localStorage.setItem('accounts', JSON.stringify(accounts));
localStorage.setItem('token', token);
history.replaceState(null, null, '/');
if token
script.
const token = '#{token}';
const previousToken = localStorage.getItem('token');
const accounts = JSON.parse(localStorage.getItem('accounts') || '[]');
if (previousToken && !accounts.includes(previousToken)) {
accounts.push(previousToken);
}
localStorage.setItem('accounts', JSON.stringify(accounts));
localStorage.setItem('token', token);
history.replaceState(null, null, '/');
if error
script.
window.__misshaialert = { error: '#{error}' };
if error
script.
window.__misshaialert = { error: '#{error}' };
script(src=`/assets/fe.${version}.js` async defer)
script(src=`/assets/fe.${version}.js` async defer)

View file

@ -1,13 +1,13 @@
doctype html
html
head
meta(charset="UTF-8")
body
p 클라이언트에 문제가 발생했습니다. 해결을 위해 브라우저에 있는 데이터를 제거했습니다.
p 3초 뒤에 메인 페이지로 자동으로 돌아갑니다...
hr
p There's a problem in client and deleted data on device to solve it.
p You will be redirected to the top in 3 seconds.
script.
localStorage.clear();
setTimeout(() => location.href = '/', 3000);
head
meta(charset="UTF-8")
body
p 클라이언트에 문제가 발생했습니다. 해결을 위해 브라우저에 있는 데이터를 제거했습니다.
p 3초 뒤에 메인 페이지로 자동으로 돌아갑니다...
hr
p There's a problem in client and deleted data on device to solve it.
p You will be redirected to the top in 3 seconds.
script.
localStorage.clear();
setTimeout(() => location.href = '/', 3000);