1.0.1
This commit is contained in:
parent
4f665124a3
commit
b9e8ac5f64
3 changed files with 46 additions and 5 deletions
|
@ -1,6 +1,9 @@
|
|||
export default {
|
||||
version: '1.0.0',
|
||||
version: '1.0.1',
|
||||
changelog: [
|
||||
'初版'
|
||||
'ホスト名の先頭に@を入れたり、末尾に:443を入れるなどして二重登録できてしまう不具合を修正',
|
||||
'MiAuth をサポートしないインスタンスであることを示すメッセージを表示するよう修正',
|
||||
'いくつかのステータス・コードのミスを修正',
|
||||
'利用規約に従うようメッセージを追記'
|
||||
],
|
||||
};
|
|
@ -9,16 +9,51 @@ import { api } from './misskey';
|
|||
|
||||
export const router = new Router<DefaultState, Context>();
|
||||
|
||||
export const sessionHostCache: Record<string, string> = { };
|
||||
const sessionHostCache: Record<string, string> = { };
|
||||
const ipAccessCount: Record<string, { time: number, count: number }> = {};
|
||||
|
||||
const freshIpAccessCount = (time: number) => {
|
||||
for (const ips of Object.keys(ipAccessCount)) {
|
||||
if (time - ipAccessCount[ips].time > 2000) {
|
||||
delete ipAccessCount[ips];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const welcomeMessage = [
|
||||
'ついついノートしすぎていませんか?',
|
||||
'Misskey, しすぎていませんか?',
|
||||
'今日、何ノート書いた?',
|
||||
'10000 ノートは初心者、そう思っていませんか?',
|
||||
'息するように Misskey、そんなあなたへ。',
|
||||
'あなたは真の Misskey 廃人ですか?'
|
||||
];
|
||||
|
||||
const scoldingMessage = [
|
||||
'さてはリロードを繰り返しているな?',
|
||||
'何パターンあるか調べようとしてることはバレてんだぞ',
|
||||
'何度もリロードして楽しいかい?',
|
||||
'はいはいわかったから早うログインしな!',
|
||||
'君には他にやるべきことがあるんじゃないか?',
|
||||
];
|
||||
|
||||
router.get('/', async ctx => {
|
||||
const time = new Date().getTime();
|
||||
freshIpAccessCount(time);
|
||||
if (!ipAccessCount[ctx.ip]) {
|
||||
ipAccessCount[ctx.ip] = { count: 0, time };
|
||||
} else {
|
||||
ipAccessCount[ctx.ip] = { count: ipAccessCount[ctx.ip].count + 1, time };
|
||||
}
|
||||
await ctx.render('welcome', {
|
||||
usersCount: await getUserCount(),
|
||||
welcomeMessage: ipAccessCount[ctx.ip].count > 5 ? scoldingMessage[Math.floor(Math.random() * scoldingMessage.length)] : welcomeMessage[Math.floor(Math.random() * welcomeMessage.length)],
|
||||
});
|
||||
});
|
||||
|
||||
router.get('/login', async ctx => {
|
||||
let host = ctx.query.host as string | undefined;
|
||||
ctx.mac;
|
||||
if (!host) {
|
||||
await die(ctx, 'ホストを空欄にしてはいけない');
|
||||
return;
|
||||
|
|
|
@ -2,11 +2,14 @@ extends _base
|
|||
|
||||
block content
|
||||
section
|
||||
h2 ついついノートしすぎていませんか?
|
||||
h2= welcomeMessage
|
||||
p Misskey は楽しいものです。気がついたら1日中入り浸っていることも多いでしょう。
|
||||
p
|
||||
strong みす廃あらーと
|
||||
| をあなたの Misskey アカウントにインストールして、今日のあなたの Misskey 活動を把握しましょう。
|
||||
p 始める前に、
|
||||
a(href="/terms") 利用規約
|
||||
| を読んでください。
|
||||
strong ログインボタンを押した時点で、規約に従ったものとみなします。
|
||||
form(action="/login", method="get")
|
||||
.xd-inputs
|
||||
input.xd-input(type="text" placeholder="ホスト名(例: misskey.io)" name="host" required)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue