Merge 31ec1ee996 into 6718a54f6f
This commit is contained in:
commit
e0931c4085
3 changed files with 38 additions and 17 deletions
|
|
@ -22,6 +22,7 @@
|
|||
- Fix: デッキのタイムラインカラムで「センシティブなファイルを含むノートを表示」設定が使用できなかった問題を修正
|
||||
- Fix: Encode RSS urls with escape sequences before fetching allowing query parameters to be used
|
||||
- Fix: リンク切れを修正
|
||||
- Fix: 別アカウントを指定してノートを投稿した場合でも自分のアカウントの実績が解除されてしまう問題を修正
|
||||
|
||||
### Server
|
||||
- Enhance: 起動前の疎通チェックで、DBとメイン以外のRedisの疎通確認も行うように
|
||||
|
|
|
|||
|
|
@ -835,17 +835,24 @@ async function post(ev?: MouseEvent) {
|
|||
miLocalStorage.setItem('hashtags', JSON.stringify(unique(hashtags_.concat(history))));
|
||||
}
|
||||
posting.value = false;
|
||||
postAccount.value = null;
|
||||
|
||||
incNotesCount();
|
||||
if (notesCount === 1) {
|
||||
claimAchievement('notes1');
|
||||
const isMe = postAccount.value?.id === $i.id;
|
||||
|
||||
if (isMe) {
|
||||
incNotesCount();
|
||||
if (notesCount === 1) {
|
||||
claimAchievement('notes1');
|
||||
}
|
||||
} else if ((postAccount.value?.notesCount ?? 0) <= 0) {
|
||||
claimAchievement('notes1', token);
|
||||
}
|
||||
|
||||
postAccount.value = null;
|
||||
|
||||
const text = postData.text ?? '';
|
||||
const lowerCase = text.toLowerCase();
|
||||
if ((lowerCase.includes('love') || lowerCase.includes('❤')) && lowerCase.includes('misskey')) {
|
||||
claimAchievement('iLoveMisskey');
|
||||
claimAchievement('iLoveMisskey', token);
|
||||
}
|
||||
if ([
|
||||
'https://youtu.be/Efrlqw8ytg4',
|
||||
|
|
@ -861,11 +868,11 @@ async function post(ev?: MouseEvent) {
|
|||
'https://open.spotify.com/track/5Odr16TvEN4my22K9nbH7l',
|
||||
'https://open.spotify.com/album/5bOlxyl4igOrp2DwVQxBco',
|
||||
].some(url => text.includes(url))) {
|
||||
claimAchievement('brainDiver');
|
||||
claimAchievement('brainDiver', token);
|
||||
}
|
||||
|
||||
if (props.renote && (props.renote.userId === $i.id) && text.length > 0) {
|
||||
claimAchievement('selfQuote');
|
||||
claimAchievement('selfQuote', token);
|
||||
}
|
||||
|
||||
const date = new Date();
|
||||
|
|
@ -873,10 +880,10 @@ async function post(ev?: MouseEvent) {
|
|||
const m = date.getMinutes();
|
||||
const s = date.getSeconds();
|
||||
if (h >= 0 && h <= 3) {
|
||||
claimAchievement('postedAtLateNight');
|
||||
claimAchievement('postedAtLateNight', token);
|
||||
}
|
||||
if (m === 0 && s === 0) {
|
||||
claimAchievement('postedAt0min0sec');
|
||||
claimAchievement('postedAt0min0sec', token);
|
||||
}
|
||||
});
|
||||
}).catch(err => {
|
||||
|
|
|
|||
|
|
@ -487,21 +487,34 @@ export const ACHIEVEMENT_BADGES = {
|
|||
*/
|
||||
} as const;
|
||||
|
||||
export const claimedAchievements: typeof ACHIEVEMENT_TYPES[number][] = ($i && $i.achievements) ? $i.achievements.map(x => x.name) : [];
|
||||
export const claimedAchievements: typeof ACHIEVEMENT_TYPES[number][] = ($i && $i.achievements) ? $i.achievements.map(x => x.name as typeof ACHIEVEMENT_TYPES[number]) : [];
|
||||
|
||||
const claimingQueue = new Set<string>();
|
||||
const claimingQueue = new Set<{
|
||||
name: typeof ACHIEVEMENT_TYPES[number];
|
||||
token?: string;
|
||||
}>();
|
||||
|
||||
export async function claimAchievement(type: typeof ACHIEVEMENT_TYPES[number]) {
|
||||
export async function claimAchievement(type: typeof ACHIEVEMENT_TYPES[number], token?: string) {
|
||||
if ($i == null) return;
|
||||
if ($i.movedTo) return;
|
||||
if (claimedAchievements.includes(type)) return;
|
||||
claimingQueue.add(type);
|
||||
claimedAchievements.push(type);
|
||||
// バックエンドにも実績を獲ったかどうかのチェックがあるのでtoken指定時は常に実績獲得を送信する
|
||||
if ((!token || token === $i.token) && claimedAchievements.includes(type)) return;
|
||||
|
||||
claimingQueue.add({
|
||||
name: type,
|
||||
token,
|
||||
});
|
||||
if (!token || $i.token !== token) {
|
||||
claimedAchievements.push(type);
|
||||
}
|
||||
await new Promise(resolve => setTimeout(resolve, (claimingQueue.size - 1) * 500));
|
||||
window.setTimeout(() => {
|
||||
claimingQueue.delete(type);
|
||||
claimingQueue.delete({
|
||||
name: type,
|
||||
token,
|
||||
});
|
||||
}, 500);
|
||||
misskeyApi('i/claim-achievement', { name: type });
|
||||
misskeyApi('i/claim-achievement', { name: type }, token);
|
||||
}
|
||||
|
||||
if (_DEV_) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue