This commit is contained in:
syuilo 2025-04-29 15:20:34 +09:00
parent 6365e30931
commit 25a4ba935a
6 changed files with 24 additions and 11 deletions

8
locales/index.d.ts vendored
View File

@ -5409,6 +5409,14 @@ export interface Locale extends ILocale {
*
*/
"realtimeMode": string;
/**
*
*/
"turnItOn": string;
/**
*
*/
"turnItOff": string;
"_chat": {
/**
*

View File

@ -1347,6 +1347,8 @@ goToDeck: "デッキへ戻る"
federationJobs: "連合ジョブ"
driveAboutTip: "ドライブでは、過去にアップロードしたファイルの一覧が表示されます。<br>\nートに添付する際に再利用したり、あとで投稿するファイルを予めアップロードしておくこともできます。<br>\n<b>ファイルを削除すると、今までそのファイルを使用した全ての場所(ノート、ページ、アバター、バナー等)からも見えなくなるので注意してください。</b><br>\nフォルダを作って整理することもできます。"
realtimeMode: "リアルタイムモード"
turnItOn: "オンにする"
turnItOff: "オフにする"
_chat:
noMessagesYet: "まだメッセージはありません"

View File

@ -387,12 +387,6 @@ export async function mainBoot() {
// 個人宛てお知らせが発行されたとき
main.on('announcementCreated', onAnnouncementCreated);
// トークンが再生成されたとき
// このままではMisskeyが利用できないので強制的にサインアウトさせる
main.on('myTokenRegenerated', () => {
signout();
});
}
}

View File

@ -82,7 +82,7 @@ export const store = markRaw(new Pizzax('base', {
},
realtimeMode: {
where: 'device',
default: false,
default: true,
},
recentlyUsedEmojis: {
where: 'device',

View File

@ -150,12 +150,11 @@ function onNotification(notification: Misskey.entities.Notification, isClient =
if ($i) {
if (store.s.realtimeMode) {
const connection = useStream().useChannel('main', null, 'UI');
const connection = useStream().useChannel('main');
connection.on('notification', onNotification);
}
globalEvents.on('clientNotification', notification => onNotification(notification, true));
//#region Listen message from SW
if ('serviceWorker' in navigator) {
swInject();
}

View File

@ -150,8 +150,18 @@ function toggleIconOnly() {
}
}
function toggleRealtimeMode() {
store.set('realtimeMode', !store.s.realtimeMode);
function toggleRealtimeMode(ev: MouseEvent) {
os.popupMenu([{
type: 'label',
text: i18n.ts.realtimeMode,
}, {
text: store.s.realtimeMode ? i18n.ts.turnItOff : i18n.ts.turnItOn,
icon: store.s.realtimeMode ? 'ti ti-bolt-off' : 'ti ti-bolt',
action: () => {
store.set('realtimeMode', !store.s.realtimeMode);
window.location.reload();
},
}], ev.currentTarget ?? ev.target);
}
function openAccountMenu(ev: MouseEvent) {