Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/api/routes/posts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,13 @@ app.post(

// REST-first: WebSocket は本文を送らず存在通知のみ送る
// クライアントはこの通知を受けて REST API (/posts/:id や /posts?...) で本文を取得する
const objId = objectId || String((post as Record<string, unknown>)._id ?? "");
const objId = objectId ||
String((post as Record<string, unknown>)._id ?? "");
broadcast({
type: "hasUpdate",
payload: { kind: "newPost", id: objId },
});

// ローカルのフォロワーへ個別に軽量通知
const account = await db.findAccountByUserName(author);
const followers = account?.followers ?? [];
Expand Down
6 changes: 4 additions & 2 deletions app/client/src/components/AddServerForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ export function AddServerForm(props: AddServerFormProps) {
label="サーバーURL"
placeholder="http://example.com"
value={url()}
onInput={(e: Event & { currentTarget: HTMLInputElement }) => setUrl(e.currentTarget.value)}
onInput={(e: Event & { currentTarget: HTMLInputElement }) =>
setUrl(e.currentTarget.value)}
disabled={isLoading()}
required
/>
Expand All @@ -50,7 +51,8 @@ export function AddServerForm(props: AddServerFormProps) {
label="パスワード"
placeholder="パスワード"
value={password()}
onInput={(e: Event & { currentTarget: HTMLInputElement }) => setPassword(e.currentTarget.value)}
onInput={(e: Event & { currentTarget: HTMLInputElement }) =>
setPassword(e.currentTarget.value)}
disabled={isLoading()}
required
/>
Expand Down
36 changes: 2 additions & 34 deletions app/client/src/components/Application.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { createEffect, createSignal, onCleanup, onMount, Show } from "solid-js";
import { createEffect, createSignal, onMount, Show } from "solid-js";
import { useAtom } from "solid-jotai";
import { selectedAppState } from "../states/app.ts";
import { selectedRoomState } from "../states/chat.ts";
import { activeAccount, accounts as accountsAtom } from "../states/account.ts";
import { activeAccount } from "../states/account.ts";
import { Home } from "./Home.tsx";
import Profile from "./Profile.tsx";
import { Microblog } from "./Microblog.tsx";
Expand All @@ -12,15 +12,12 @@ import UnifiedToolsContent from "./home/UnifiedToolsContent.tsx";
import Header from "./header/header.tsx";
import { connectWebSocket, registerUser } from "../utils/ws.ts";
import { getDomain } from "../utils/config.ts";
import { topUpKeyPackagesBulk } from "./e2ee/api.ts";

export function Application() {
const [selectedApp] = useAtom(selectedAppState);
const [selectedRoom] = useAtom(selectedRoomState);
const [account] = useAtom(activeAccount);
const [allAccounts] = useAtom(accountsAtom);
const [isMobile, setIsMobile] = createSignal(false);
let topUpTimer: number | undefined;

// モバイルかどうかを判定
onMount(() => {
Expand All @@ -41,35 +38,6 @@ export function Application() {
if (user) {
registerUser(`${user.userName}@${getDomain()}`);
}

// Top up KeyPackages for all configured accounts (bulk) instead of only the active one.
const accs = allAccounts();
if (accs && accs.length > 0) {
const payload = accs.map((a) => ({ userName: a.userName, accountId: a.id }));
// Run immediately and stop periodic top-up if uploads were performed.
void (async () => {
try {
const uploaded = await topUpKeyPackagesBulk(payload);
if (uploaded && topUpTimer) {
clearInterval(topUpTimer);
topUpTimer = undefined;
}
} catch (e) {
console.warn("topUpKeyPackagesBulk failed:", e);
}
})();
if (topUpTimer) clearInterval(topUpTimer);
topUpTimer = setInterval(() => {
void topUpKeyPackagesBulk(payload);
}, 300_000);
} else if (topUpTimer) {
clearInterval(topUpTimer);
topUpTimer = undefined;
}
});

onCleanup(() => {
if (topUpTimer) clearInterval(topUpTimer);
});

// チャットページかつスマホ版かつチャンネルが選択されている場合にヘッダーが非表示の場合のクラス名を生成
Expand Down
Loading