{"id":10727,"date":"2026-09-22T08:35:40","date_gmt":"2026-09-21T23:35:40","guid":{"rendered":"https:\/\/www.freelifemakers.org\/wordpress\/?p=10727"},"modified":"2026-09-22T14:27:50","modified_gmt":"2026-09-22T05:27:50","slug":"nextjs-sns-server-35","status":"publish","type":"post","link":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/2026\/09\/22\/nextjs-sns-server-35\/","title":{"rendered":"[nextjs]SNS Server-35(myapp45)\u00a0"},"content":{"rendered":"\n<p>\ud83d\udc49\ud83c\udffb myapp45\uc5d0\uc11c\ub294 SNS \ud398\uc774\uc9c0\uc5d0 \uae00 \uc0ad\uc81c \ubc84\ud2bc\uc744 \ucd94\uac00\ud569\ub2c8\ub2e4.<br>In myapp45, a delete button for posts is added.<\/p>\n\n\n\n<p>\ud83d\udc49\ud83c\udffb \uae00\uc0ad\uc81c\uc2dc \uc62c\ubc14\ub978 \ud0a4\ub85c \uc0ad\uc81c\uac00\ub2a5\ud558\ub3c4\ub85d \uc218\uc815\ud588\uc2b5\ub2c8\ub2e4.<br>Modified the post deletion process to ensure deletion is possible using the correct key.<\/p>\n\n\n\n<p>&#8212; \ub85c\uadf8\uc778 \uad6c\ud604\uc2dc \ud0a4 \uacbd\ub85c \ubcc0\uacbd\ub41c \ubd80\ubd84<br>Changes to key paths during login implementation<\/p>\n\n\n\n<p>\ud83d\udc49\ud83c\udffb \ud604\uc7ac \ub85c\uceec\uc740 \uae00 \uc800\uc7a5 \uc0ad\uc81c\uac00 \ub418\ub098 \uae00\ubc30\ub2ec \uae30\ub2a5\uacfc pinafore\uc5d0\uc11c \uae00 \uc0ad\uc81c\uae30\ub2a5\uc740 \uc544\uc9c1 \uad6c\ud604\uc911\uc785\ub2c8\ub2e4.<br>Currently, saving and deleting posts works in the local environment, but the post delivery function and the post deletion feature in Pinafore are still under development.<\/p>\n\n\n\n<p>&#8212; activitypub : app\/api\/v1\/statuses\/route.ts<\/p>\n\n\n\n<p>&#8212; local : users\/[username]\/route.ts<\/p>\n\n\n\n<p>\ud83d\udc49\ud83c\udffb \uc804\uccb4 \ucf54\ub4dc\ub294 \uae43\ud5c8\ube0c\uc5d0\uc11c \ud655\uc778 \ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<br>You can find the full code on GitHub.<\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/gideonslife01\/flm-nextjs\">https:\/\/github.com\/gideonslife01\/flm-nextjs<\/a><\/p>\n\n\n\n<p>\ud83d\udcc1 \uc804\uccb4 \ud504\ub85c\uc81d\ud2b8 \uad6c\uc870 \/ Overall Project Structure<\/p>\n\n\n\n<pre class=\"wp-block-code\" style=\"font-size:14px\"><code>myapp project\/  \n\u251c\u2500\u2500 app\/  (Next.js App Router)\n\u2502   \u251c\u2500\u2500 .well-known\/webfinger\/route.ts  -> webfinger\n\u2502   \u251c\u2500\u2500 api\/follow\/route.ts    -> Follow API(temporary)\n\u2502   \u251c\u2500\u2500 api\/announce\/route.ts  -> Boost(Announcement)\n\u2502   \u251c\u2500\u2500 api\/like\/route.ts.     -> Like API\n\u2502   \u251c\u2500\u2500 api\/posts\/route.ts     -> Writing API\n\u2502   \u251c\u2500\u2500 api\/timeline\/route.ts  -> Timeline API\n\u2502   \u251c\u2500\u2500 api\/followinglist\/route.ts  -> followinglist API\n\u2502   \u251c\u2500\u2500 api\/followerslist\/route.ts  -> followerslist API\n\u2502   \u251c\u2500\u2500 <span style=\"background-color: initial; font-size: inherit; text-align: initial; color: initial;\">api\/v1\/instance<\/span>\/route.ts -> auth\n\u2502   \u251c\u2500\u2500 api\/v1\/apps\/route.ts.    -> auth\n\u2502   \u251c\u2500\u2500 api\/v1\/accounts\/verify_credentials\/route.ts -> auth\n\u2502   \u251c\u2500\u2500 api\/v1\/statuses\/route.ts -> Write Post\n\u2502   \u251c\u2500\u2500 <span style=\"background-color: initial; font-size: inherit; text-align: initial; color: initial;\">api\/v1\/timelines\/home\/route.ts<\/span> -> timeline\n\u2502   \u251c\u2500\u2500 <span style=\"background-color: initial; font-size: inherit; text-align: initial; color: initial;\">oauth\/authorize\/route.ts<\/span> -> auth\n\u2502   \u251c\u2500\u2500 <span style=\"background-color: initial; font-size: inherit; text-align: initial; color: initial;\">oauth\/token\/route.ts<\/span> -> auth\n\u2502   \u251c\u2500\u2500 <span style=\"background-color: initial; font-size: inherit; text-align: initial; color: initial;\">api\/v1\/search\/home\/route.ts<\/span> -> search\n\u2502   \u251c\u2500\u2500 <span style=\"background-color: initial; font-size: inherit; text-align: initial; color: initial;\">api\/v2\/search\/home\/route.ts<\/span> -> search\n\u2502   \u251c\u2500\u2500 api\/v1\/accounts\/&#91;id]\/followers\/route.ts -> followers\n\u2502   \u251c\u2500\u2500 api\/v1\/accounts\/&#91;id]\/following\/route.ts -> following\n\u2502   \u251c\u2500\u2500 api\/auth\/signup\/route.ts        -> Signup\n\u2502   \u251c\u2500\u2500 api\/auth\/login\/route.ts         -> Login\n\u2502   \u251c\u2500\u2500<strong> <\/strong>api\/auth\/logout\/route.ts        -> Logout\n\u2502   \u251c\u2500\u2500<strong> <\/strong>api\/auth\/refresh\/route.ts       -> Refresh Token\n\u2502   \u251c\u2500\u2500<strong> <\/strong>api\/auth\/me\/route.tsx           -> Login Check<strong>\n<\/strong>\u2502   \u251c\u2500\u2500 auth\/signup\/page.tsx            -> Signup UI\n\u2502   \u251c\u2500\u2500 auth\/signup\/page.tsx            -> Login UI\n\u2502   \u251c\u2500\u2500 users\/&#91;username]\/\n\u2502   \u2502   \u251c\u2500\u2500 statuses\/&#91;id]\/route.ts -> Indivisual Post\n\u2502   \u2502   \u251c\u2500\u2500 route.ts               -> Acotr Information\n\u2502   \u2502   \u251c\u2500\u2500 followers\/route.ts     -> Followers List\n\u2502   \u2502   \u251c\u2500\u2500 following\/route.ts     -> Following List\n\u2502   \u2502   \u251c\u2500\u2500 inbox\/route.ts         -> Inbox\n\u2502   \u2502   \u2514\u2500\u2500 outbox\/route.ts        -> outbox\n\u2502   \u251c\u2500\u2500 usersui\/&#91;username]\/\n\u2502   \u2502   \u251c\u2500\u2500 page.tsx               -> Timeline UI(Server, 404)\n\u2502   \u2502   \u251c\u2500\u2500 ClientPage.tsx.        -> Timeline UI(Client,Call Active Themes)\n\u2502   \u2502   \u2514\u2500\u2500 _components\/themes\/\n\u2502   \u2502       \u251c\u2500\u2500 themeex\/ThemeexTheme.tsx   -> Example Theme\n\u2502   \u2502       \u251c\u2500\u2500 pinafore\/PinaforeTheme.tsx -> Theme 1\n\u2502   \u2502       \u251c\u2500\u2500 pinafore\/FollowersList.tsx -> Theme 1, FollowersList\n\u2502   \u2502       \u251c\u2500\u2500 pinafore\/FollowingList.tsx -> Theme 1, FollowingList\n\u2502   \u2502       \u251c\u2500\u2500 pinafore\/NotificationsList.tsx -> Theme 1, NotificationsList\n\u2502   \u2502       \u251c\u2500\u2500 mastodon\/MastodonTheme.tsx -> Theme 2\n\u2502   \u2502       \u2514\u2500\u2500 minimal\/MinimaltTheme.tsx  -> Theme 3\n\u2502   \u251c\u2500\u2500 layout.tsx, page.tsx, globals.css\n\u2502   \u2514\u2500\u2500 favicon.ico\n\u251c\u2500\u2500 lib\/\n\u2502   \u251c\u2500\u2500 theme.tsx              -> Theme Provider\n\u2502   \u251c\u2500\u2500 watchThemes.ts         -> Check real-time theme changes\n\u2502   \u251c\u2500\u2500 auth.ts                -> Authentication, User Management\n\u2502   \u251c\u2500\u2500 ap.ts                  -> Follow,Undo,Create,Likes,Announce\n\u2502   \u2514\u2500\u2500 db.ts                  -> DB connection\n\u251c\u2500\u2500 data\/\n\u2502   \u251c\u2500\u2500 keys\/userIDs\/          -> private.pem, public.pem(New)\n\u2502   \u2514\u2500\u2500 keys\/                  -> private.pem, public.pem(legacy)\n\u251c\u2500\u2500 data.sqlite                -> Database(1\/3)\n\u251c\u2500\u2500 data.sqlite-wal            -> Database(2\/3)\n\u251c\u2500\u2500 data.sqlite-shm            -> Database(3\/3)\n\u251c\u2500\u2500 Caddyfile                  -> https \n\u251c\u2500\u2500 instrumentation.ts         -> Background Server\n\u2514\u2500\u2500 package.json<\/code><\/pre>\n\n\n\n<p>\ud83d\udcc1 \ud504\ub85c\uc81d\ud2b8 \uc2dc\uc791 \/ Project Start<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-freelifemakers-org wp-block-embed-freelifemakers-org\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"BXCP5HKSKc\"><a href=\"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/2026\/09\/03\/nextjs-project-summary\/\">[nextjs]\ud504\ub85c\uc81d\ud2b8\uc694\uc57d\/project summary(myapp30+)<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"&#8220;[nextjs]\ud504\ub85c\uc81d\ud2b8\uc694\uc57d\/project summary(myapp30+)&#8221; &#8212; freelifemakers.org\" src=\"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/2026\/09\/03\/nextjs-project-summary\/embed\/#?secret=J3CeyGhF0B#?secret=BXCP5HKSKc\" data-secret=\"BXCP5HKSKc\" width=\"560\" height=\"315\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\ud83d\udcc1 \ub808\uac70\uc2dc \ud0a4\ub97c user1\uc73c\ub85c \ubcc0\uacbd<br>Change the legacy key to user1.<\/p>\n\n\n\n<p>&#8212; \uc5f0\ubc29\uc11c\ubc84\uc5d0 \uc791\uc131\ub41c \uae00\uc740 \ub808\uac70\uc2dc\ud0a4\ub85c \uc791\uc131\uc774 \ub418\uc5b4 \uc788\uc2b5\ub2c8\ub2e4.<br>Posts created on the federation server are written using legacy keys.<\/p>\n\n\n\n<p>&#8212; \ud604\uc7ac user1\uc758 \ud0a4\ub294 \uc0c8\ub85c \ubc1c\uae09\ub41c \uc0c1\ud0dc\uc785\ub2c8\ub2e4.<br>The key for user1 has currently been newly issued.<\/p>\n\n\n\n<p>&#8212; \uadf8\ub798\uc11c \ub450\ud0a4\uac00 \ub9de\uc9c0\uc54a\uc544 \uc0c8\ub85c \ubc1c\uae09\ub41c \ud0a4\ub97c \ubc31\uc5c5\ud558\uace0 \ub808\uac70\uc2dc\ud0a4\ub85c \ub300\uccb4 \ud569\ub2c8\ub2e4.<br>Since the key did not match, I backed up the newly issued key and replaced it with the legacy key.<\/p>\n\n\n\n<pre class=\"wp-block-code\" style=\"font-size:14px\"><code># \uc2e0\uaddc\ud0a4 \ubc31\uc5c5 \ubc0f \ub808\uac70\uc2dc\ud0a4\ub97c user1 \ud0a4 \ub514\ub809\ud1a0\ub9ac\ub85c \ubcf5\uc0ac\n# Back up the new key and copy the legacy key to the user1 key directory.\n\n# \ubc31\uc5c5 \/ backup\nmyapp45 % cp data\/keys\/user1\/private.pem data\/keys\/user1\/private.pem.bak\nmyapp45 % cp data\/keys\/user1\/public.pem data\/keys\/user1\/public.pem.bak\n\n# \ub808\uac70\uc2dc\ud0a4\ub97c user1 \ud0a4 \ub514\ub809\ud1a0\ub9ac\ub85c \ubcf5\uc0ac\n# Copy the legacy key to the user1 key directory.\nmyapp45 % cp data\/keys\/private.pem data\/keys\/user1\/private.pem\n% cp data\/keys\/public.pem data\/keys\/user1\/public.pem\n\n# \ud655\uc778 \/ check\nmyapp45 % diff data\/keys\/private.pem data\/keys\/user1\/private.pem &amp;&amp; echo \"\u2705 same key\" || echo \"\u274c diffrent key\"\n\u2705 <strong>same key<\/strong>\nmyapp45 % \n\n# DB\ub3c4 \uc218\uc815 \/ # DB also updated\nsqlite3 db.sqlite \"UPDATE users SET public_key = '$(cat data\/keys\/user1\/public.pem)' WHERE username='user1';\"<\/code><\/pre>\n\n\n\n<p>\ud83d\udcc1 \ucf54\ub4dc \uc218\uc815 \/ Code modification<\/p>\n\n\n\n<p>\ud83d\udca1 \uc544\ub798\uc758 \ud14c\ub9c8\ud30c\uc77c \uc218\uc815 \uc774\uc804\uae4c\uc9c0 \ub2e8\ub77d\uc740 \ub0b4\uac00 \uc791\uc131\ud55c \uae00\uc5d0 \uc0ad\uc81c\ubc84\ud2bc\uc744 \ubcf4\uc5ec\uc8fc\ub294 \uae30\ub2a5\uc744 \uad6c\ud604\ud569\ub2c8\ub2e4. <br>The section below, prior to the theme file modification, implements a feature that displays a delete button on posts I have written.<\/p>\n\n\n\n<p>\u2714\ufe0f API &#8211; app\/api\/posts\/route.ts <\/p>\n\n\n\n<p>&#8212; \ub77c\uc6b0\ud2b8 \uc218\uc815, \ubaa8\ub4e0 \ud568\uc218\ub97c \ud1a0\ud070\uc744 \uc801\uc6a9\ud558\ub3c4\ub85d \uc218\uc815<br>Modified routes and updated all functions to implement token-based authentication.<\/p>\n\n\n\n<p>&#8212; inbox_posts \ud14c\uc774\ube14\ub3c4 \ub0b4\uc6a9\ub3c4 \uc0ad\uc81c\ud558\ub3c4\ub85d \uc218\uc815<br>Modified to delete both the inbox_posts table and its contents.<\/p>\n\n\n\n<pre class=\"wp-block-code\" style=\"font-size:14px\"><code>export async function GET(req: Request) {\n  const { searchParams } = new URL(req.url);\n\n  \/\/ \u2705 myapp45 - \ud1a0\ud070 \uc801\uc6a9 \/ token apply\n  let username = searchParams.get('username');\n  const auth = req.headers.get('Authorization') || '';\n  const token = auth.replace('Bearer ', '').trim();\n  if (token) {\n    const oauth = db.prepare('SELECT username FROM oauth_tokens WHERE access_token=?').get(token) as any;\n    if (oauth?.username) username = oauth.username; \/\/ If you have a token username &gt; tokenuser\n  }\n  if (!username) return NextResponse.json({ error: 'username required' }, { status: 401 });\n... ...\n}\n\nexport async function POST(req: Request) {\n  let { content, username } = await req.json();\n\n  \/\/ \u2705 myapp45 - apply token\n  const auth = req.headers.get('Authorization') || '';\n  const token = auth.replace('Bearer ', '').trim();\n  if (token) {\n    const oauth = db.prepare('SELECT username FROM oauth_tokens WHERE access_token=?').get(token) as any;\n    if (oauth?.username) username = oauth.username; \/\/ \ud1a0\ud070 \uc788\uc73c\uba74 \ud1a0\ud070 \uc720\uc800\ub85c \ub36e\uc5b4\uc4f0\uae30!\n  }\n  if (!username) return NextResponse.json({ error: '\ub85c\uadf8\uc778 \ud544\uc694 \/ username required' }, { status: 400 });\n  if (!content) return NextResponse.json({ error: '\ub0b4\uc6a9 \uc5c6\uc74c \/ Content required' }, { status: 400 });\n...... }\n\n\nexport async function PUT(req: Request) {\n    \/\/ \u2705 myapp45 - apply token\n  let { id, content, username } = await req.json();\n  const auth = req.headers.get('Authorization') || '';\n  const token = auth.replace('Bearer ', '').trim();\n  if (token) {\n    const oauth = db.prepare('SELECT username FROM oauth_tokens WHERE access_token=?').get(token) as any;\n    if (oauth?.username) username = oauth.username; \/\/ \ud1a0\ud070 \uc788\uc73c\uba74 \ud1a0\ud070 \uc720\uc800\ub85c \ub36e\uc5b4\uc4f0\uae30!\n  }\n... ...\n}\n\nexport async function DELETE(req: Request) {\n  const { searchParams } = new URL(req.url);\n  let id = searchParams.get('id'); \/\/ defalut method is GET\n  let username = searchParams.get('username');\n\n  \/\/ \u2705 myapp45 - apply token\n  const auth = req.headers.get('Authorization') || '';\n  const token = auth.replace('Bearer ', '').trim();\n  if (token) {\n    const oauth = db.prepare('SELECT username FROM oauth_tokens WHERE access_token=?').get(token) as any;\n    if (oauth?.username) username = oauth.username; \/\/ \ud1a0\ud070 \uc788\uc73c\uba74 \ud1a0\ud070 \uc720\uc800\ub85c \ub36e\uc5b4\uc4f0\uae30!\n  }\n... ...\n  \/\/ \u2705 myapp45 - inbox_posts \uc0ad\uc81c \/ Delete inbox_posts\n  db.prepare('DELETE FROM inbox_posts WHERE original_id LIKE ? OR id LIKE ? OR original_id = ?').run(`%${id}%`, `%${id}%`, id);\n\n... ...\n}\n<\/code><\/pre>\n\n\n\n<p>\u2714\ufe0f API &#8211; \/app\/api\/timeline\/route.ts<\/p>\n\n\n\n<p>&#8212; app\/usersui\/[username]\/ClientPage.tsx\uc5d0\uc11c \ud638\ucd9c\ud558\ub294 API<br>API called by app\/usersui\/[username]\/ClientPage.tsx<\/p>\n\n\n\n<p>&#8212;  isMine , isBoostedPost<\/p>\n\n\n\n<p>&#8212; isBoostedPost\ub294 \uc7ac\ud655\uc778 \uc608\uc815<br>isBoostedPost is subject to re-verification.<\/p>\n\n\n\n<pre class=\"wp-block-code\" style=\"font-size:14px\"><code>... ...\n  const enriched = timeline.map((p: any) =&gt; {\n    \n    \/\/ \u2705 myapp45 - \ub2e4\ub978 \uc0ac\ub786\uc774 \ubd80\uc2a4\ud2b8\ud55c \uae00 \uccb4\ud06c \ucd94\uac00 \/ Added a check for posts boosted by others.\n    \/\/ - inbox_posts \ud14c\uc774\ube14 \uac80\uc0c9\uc778 \uacbd\uc6b0 \/ In the case of a search on the `inbox_posts` table\n    const isBoostedPost = p.source === 'inbox' &amp;&amp; !!p.original_id &amp;&amp; p.original_id !== p.id;\n\n    \/\/ - posts \ud14c\uc774\ube14 \uac80\uc0c9\uc778 \uacbd\uc6b0 \/ In the case of a search on the `posts` table\n    const isMine = p.source === 'mine';\n... ...\n    return {\n    ...p,\n      fullId,\n      isMyBoost,\n      boostCount,\n      isMyLike,\n      likeCount,\n      isBoostedPost, \/\/ inbox_posts \uc911 \ubd80\uc2a4\ud2b8\uc778\uc9c0 \ud655\uc778 \/ Check if the inbox_posts item is a boost.\n      isMine, \/\/ \ub0b4\uac00 \uc4f4 \uae00\ub9cc \uc0ad\uc81c \uac00\ub2a5 \/ You can only delete posts you have written.\n    };\n  });\n\n<\/code><\/pre>\n\n\n\n<p>\u2714\ufe0f API &#8211; users\/[username]\/route.ts<\/p>\n\n\n\n<p>&#8212; lib\/ap.ts \ud568\uc218\ub97c \uc0ac\uc6a9\ud558\ub3c4\ub85d \uc218\uc815<br>Modified to use the function in lib\/ap.ts<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>... ...\nimport  { <strong>getPublicKeyPemForServing<\/strong> }  from '@\/lib\/ap'; \n\nexport async function GET(_req: Request, { params }: { params: Promise&lt;{ username: string }&gt; }) {\n  const { username } = await params;\n  const domain = 'aloy-horizon.duckdns.org';\n  \/\/const pubkey = fs.readFileSync(path.join(process.cwd(), 'data\/keys\/public.pem'), 'utf8');\n<strong>  const pubkey = getPublicKeyPemForServing(username); <\/strong>\n... ...\n}<\/code><\/pre>\n\n\n\n<p>\u2714\ufe0f UI &#8211; \/app\/usersui\/[username]\/_components\/themes\/pinafore\/PinaforeTheme.tsx<\/p>\n\n\n\n<p>&#8212; \ud14c\ub9c8\ud30c\uc77c \uc785\ub2c8\ub2e4. \/ This is a theme file.<\/p>\n\n\n\n<pre class=\"wp-block-code\" style=\"font-size:14px\"><code>... ...\n\/\/ \u2705 myapp45 - timeline == iniitialTimeline(like alias, not type)\nexport function PinaforeTheme({ timeline : initialTimeline, username, initialView, onBoost, onLike }: any) {\n... ....\n \/\/ \u2705 myapp45 - initialTimeline \uac12\uc774 \ubc14\ub00c\uba74 UI \ub2e4\uc2dc \uadf8\ub9ac\uae30\n  \/\/ Redraw the UI when the initialTimeline value changes.\n  const &#91;timeline, setTimeline] = useState&lt;any&#91;]&gt;(initialTimeline || &#91;]);\n  useEffect(() =&gt; { setTimeline(initialTimeline || &#91;]); }, &#91;initialTimeline]);\n... ...\n\/\/ \u2705 myapp45: \uc0ad\uc81c \ud578\ub4e4\ub7ec  \/ Delete handler\nconst handleDelete = async (postId: string) =&gt; {\n  if (!confirm('\uc0ad\uc81c\ud560\uae4c? \/ Delete?')) return;\n  try {\n    \/\/ \uae30\uc874 DELETE \ub77c\uc6b0\ud2b8 \uc0ac\uc6a9 \/ Use the existing DELETE route.\n    const res = await fetch(`\/api\/posts?id=${postId}&amp;username=${currentUser}`, { \n      method: 'DELETE', \n      credentials: 'include' \n    });\n    if (res.ok) {\n      setTimeline((prev: any&#91;]) =&gt; prev.filter((t: any) =&gt; t.id !== postId));\n      console.log(`\ud83d\uddd1\ufe0f Delete ${postId} ok`);\n    } else {\n      alert('\uc0ad\uc81c \uc2e4\ud328 \/ Deletion failed');\n    }\n  } catch {\n    alert('\uc0ad\uc81c \uc2e4\ud328 \/ Deletion failed');\n  }\n};\n... ...\n                  &lt;div className=\"status-header\"&gt;\n                    {\/* - Actor *\/}\n                    &lt;b&gt;{getDisplayName(p.actor)}&lt;\/b&gt;\n                    \n                    {\/* - boosted- *\/}\n                    &lt;span className=\"status-time\"&gt;{new Date(p.created_at).toLocaleString()}&lt;\/span&gt;\n                    {p.source === 'inbox' &amp;&amp; &lt;span className=\"boost-label\"&gt;\ud83d\udd01 boosted&lt;\/span&gt;}\n\n                    {\/* - \u2705 myapp45 - Delete Posts - *\/}\n<strong>                    {currentUser &amp;&amp; p.isMine &amp;&amp; (\n                      &lt;button onClick={() =&gt; handleDelete(p.id)} style={{ color: '#e0245e', marginLeft: 'auto' }}&gt;\n                        \ud83d\uddd1 Delete\n                      &lt;\/button&gt;<\/strong>\n                    )}\n                  &lt;\/div&gt;\n}\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\ud83d\udca1 \uc5ec\uae30\uc11c \ubd80\ud130\ub294 \uc624\ub958 \uc218\uc815\uc744 \uc704\ud574\uc11c \ud30c\uc77c \uc218\uc815\ub41c \ubd80\ubd84\uc785\ub2c8\ub2e4.<br>The following section contains modifications made to the file to fix errors.<\/p>\n\n\n\n<p>\u2714\ufe0f lib\/ap.ts<\/p>\n\n\n\n<p>&#8212; \uc678\ubd80\uc5d0\uc11c \ud568\uc218 \uc0ac\uc6a9\uac00\ub2a5\ud558\ub3c4\ub85d export\ud568\uc218 \ucd94\uac00<br>Added an export function to make the function accessible from the outside.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ \u2705 myapp31 - \uc0ac\uc6a9\uc790\ubcc4 \uacf5\uac1c\ud0a4 \uac00\uc838\uc624\uae30 \/ Get user-specific public key\nfunction getPublicKey(username: string): string {\n  const userKeyPath = path.join(process.cwd(), `data\/keys\/${username}\/public.pem`);\n  const legacyKeyPath = path.join(process.cwd(), 'data\/keys\/public.pem');\n  const directPath = path.join(process.cwd(), `data\/keys\/${username}.pub.pem`);\n  \n  try {\n    if (fs.existsSync(userKeyPath)) {\n      return fs.readFileSync(userKeyPath, 'utf8');\n    }\n    if (fs.existsSync(legacyKeyPath)) {\n      return fs.readFileSync(legacyKeyPath, 'utf8');\n    }\n    if (fs.existsSync(directPath)) {\n      return fs.readFileSync(directPath, 'utf8');\n    }\n    \/\/ DB\uc5d0\uc11c fallback! \/ Fallback from DB!\n    const user = db.prepare('SELECT public_key FROM users WHERE username = ?').get(username) as any;\n    if (user?.public_key) return user.public_key;\n  } catch (e) {\n    console.error(`\ud83d\udd11 public \ud0a4 \ub85c\ub4dc \uc2e4\ud328 \/ Public key load failed for ${username}:`, e);\n  }\n  throw new Error(`Public key not found for ${username}`);\n}\n\n\/\/ \u2705 myapp45 - for mastodon\n<strong>export function getPublicKeyPemForServing(username: string): string {<\/strong>\n  return getPublicKey(username); \/\/ \ud30c\uc77c \uc6b0\uc120! DB fallback\n<strong>}<\/strong>\n\n\/\/ \u2705 \uacf5\uc6a9 - \uc11c\uba85 + \uc804\uc1a1 \/ Shared Use - Sign and send\nasync function signAndSend(inbox: string, doc: any, username: string) {\n  const actorId = `https:\/\/${DOMAIN}\/users\/${username}`;\n  const privateKey = getPrivateKey(username);\n  const body = JSON.stringify(doc);\n  const url = new URL(inbox);\n  \n  const digest = `SHA-256=${crypto.createHash('sha256').update(body).digest('base64')}`;\n  const date = new Date().toUTCString();\n  \/\/ \u2705 myapp45 - search \ud3ec\ud568 + \uc18c\ubb38\uc790 post!\n <strong> const target = `${url.pathname}${url.search}`;<\/strong>\n  const signingString = `(request-target): post ${<strong>target<\/strong>}\\nhost: ${url.host}\\ndate: ${date}\\ndigest: ${digest}`;\n  \n  const signer = crypto.createSign('sha256');\n  signer.update(signingString);\n  const signature = signer.sign(privateKey, 'base64');\n\n  const keyId = `${actorId}#main-key`;\n  \/\/ \u2705 myapp45 - algorithm \ucd94\uac00 \ub9c8\uc2a4\ud1a0\ub3c8 \ud544\uc218\n  const sigHeader = `keyId=\"${keyId}\",headers=\"(request-target) host date digest\",signature=\"${signature}\",<strong>algorithm=\"rsa-sha256<\/strong>\"`;\n\n  console.log(`\ud83d\udd10 SIGN ${username} -&gt; ${inbox}\\n${signingString}\\n`); \/\/ \ub514\ubc84\uadf8\uc6a9!\n\n  const res = await fetch(inbox, {\n    method: 'POST',\n    headers: {\n      'Content-Type': 'application\/activity+json',\n      'Date': date,\n      'Digest': digest,\n      'Signature': sigHeader,\n      'Host': url.host\n    },\n    body\n  });\n\n  const text = await res.text();\n  return { res, text, body, doc };\n}<\/code><\/pre>\n\n\n\n<p>\u2714\ufe0f users\/[username]\/route.ts<\/p>\n\n\n\n<p>&#8212; lib\/ap.ts\ud30c\uc77c\uc744 \uc0ac\uc6a9\ud558\ub3c4\ub85d \uc218\uc815\ud568.<br>Modified to use the lib\/ap.ts file.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>... ...\n<strong>import  { getPublicKeyPemForServing }  from '@\/lib\/ap'; <\/strong>\n... ...\nexport async function GET(_req: Request, { params }: { params: Promise&lt;{ username: string }&gt; }) {\n... ...\n  \/\/const pubkey = fs.readFileSync(path.join(process.cwd(), 'data\/keys\/public.pem'), 'utf8');\n  <strong>const pubkey = getPublicKeyPemForServing(username); <\/strong>\n... ...\n}<\/code><\/pre>\n\n\n\n<p>\ud83d\udcc1 \ud14c\uc2a4\ud2b8 \/ Test<\/p>\n\n\n\n<p>\ud83d\udca1 \ud604\uc7ac \ub85c\uceec\uc11c\ubc84\uc5d0\uc11c \uae00 \uc800\uc7a5 \uc0ad\uc81c \uae30\ub2a5\uc740 \uc815\uc0c1\uc801\uc73c\ub85c \uc791\ub3d9\ud569\ub2c8\ub2e4.<br>The functions for saving and deleting posts are currently working correctly on the local server.<\/p>\n\n\n\n<p>\ud83d\udca1 \uc544\uc9c1 \ud2b9\uc815\uc11c\ubc84\uc5d0 \uae00\ubc30\ub2ec\uc774 \ub418\uc9c0 \uc54a\ub294 \ubb38\uc81c  \ub0b4 \uae00 \uc0ad\uc81c\uc2dc \ubc30\ub2ec\ub41c \uc5f0\ubc29\uc11c\ubc84\uc758 \uae00\uc774 \uc0ad\uc81c \ub418\uc9c0 \uc54a\ub294 \ubb38\uc81c\uac00 \uc788\uc2b5\ub2c8\ub2e4.<br>There are currently issues where posts are not being delivered to certain servers, and where posts delivered to federated servers are not deleted when the original post is removed.<\/p>\n\n\n\n<p>\u2714\ufe0f \ub85c\uadf8\uc778 \ud6c4 \uc0ad\uc81c \ubc84\ud2bc \uc801\uc6a9<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"414\" src=\"https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/09\/myapp45-aloy-post-jpg.jpg\" alt=\"\" class=\"wp-image-10791\" srcset=\"https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/09\/myapp45-aloy-post-jpg.jpg 800w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/09\/myapp45-aloy-post-jpg-300x155.jpg 300w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/09\/myapp45-aloy-post-jpg-768x397.jpg 768w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/09\/myapp45-aloy-post-jpg-400x207.jpg 400w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">local server<\/figcaption><\/figure>\n\n\n\n<p>\u2714\ufe0f \uae00 \ubc30\ub2ec\ud655\uc778 \/ Message Delivery Confirmation<\/p>\n\n\n\n<p>&#8212;  \ud604\uc7ac\ub294 gotosocial\ub9cc \ubc30\ub2ec\ub428 \/ Currently, only GoToSocial is being deployed.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"605\" src=\"https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/09\/myapp45-delivery-gotosocial-jpg.png\" alt=\"\" class=\"wp-image-10792\" srcset=\"https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/09\/myapp45-delivery-gotosocial-jpg.png 800w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/09\/myapp45-delivery-gotosocial-jpg-300x227.png 300w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/09\/myapp45-delivery-gotosocial-jpg-768x581.png 768w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/09\/myapp45-delivery-gotosocial-jpg-400x303.png 400w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"411\" src=\"https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/09\/myapp45-post-serverlog-jpg.jpg\" alt=\"\" class=\"wp-image-10794\" srcset=\"https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/09\/myapp45-post-serverlog-jpg.jpg 800w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/09\/myapp45-post-serverlog-jpg-300x154.jpg 300w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/09\/myapp45-post-serverlog-jpg-768x395.jpg 768w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/09\/myapp45-post-serverlog-jpg-400x206.jpg 400w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">\uae00\ubc30\ub2ec \/ post delivery<\/figcaption><\/figure>\n\n\n\n<p>\u2714\ufe0f \uae00 \uc0ad\uc81c \/ delte post<\/p>\n\n\n\n<p>&#8212; \uc5f0\ubc29\uae00 \uc0ad\uc81c\ub294 \ud604\uc7ac \uc694\uccad\ub9cc \uc804\ub2ec\ub428.<br>The request to delete the syndicated post has been forwarded.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"403\" src=\"https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/09\/myapp45-delete-serverlog-jpg.jpg\" alt=\"\" class=\"wp-image-10796\" srcset=\"https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/09\/myapp45-delete-serverlog-jpg.jpg 800w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/09\/myapp45-delete-serverlog-jpg-300x151.jpg 300w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/09\/myapp45-delete-serverlog-jpg-768x387.jpg 768w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/09\/myapp45-delete-serverlog-jpg-400x202.jpg 400w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">server log<\/figcaption><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>\uc694\ud55c\ubcf5\uc74c 8\uc7a5 32\uc808 \/ John 8:32<\/p>\n\n\n\n<p>&#8220;\uadf8\ub9ac\uace0 \ub108\ud76c\ub294 \uc9c4\ub9ac\ub97c \uc54c\uac8c \ub420 \uac83\uc774\uba70, \uc9c4\ub9ac\uac00 \ub108\ud76c\ub97c \uc790\uc720\ub86d\uac8c \ud560 \uac83\uc774\ub2e4.&#8221;<\/p>\n\n\n\n<p>&#8220;Then you will know the truth ,and the truth will set you free&#8221;<\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\ud83d\udc49\ud83c\udffb myapp45\uc5d0\uc11c\ub294 SNS \ud398\uc774\uc9c0\uc5d0 \uae00 \uc0ad\uc81c \ubc84\ud2bc\uc744 \ucd94\uac00\ud569\ub2c8\ub2e4.In myapp45, a delete button for posts is added. \ud83d\udc49\ud83c\udffb \uae00\uc0ad\uc81c\uc2dc \uc62c\ubc14\ub978 \ud0a4\ub85c \uc0ad\uc81c\uac00\ub2a5\ud558\ub3c4\ub85d \uc218\uc815\ud588\uc2b5\ub2c8\ub2e4.Modified the post deletion process to ensure deletion is possible using the correct key. &#8212; \ub85c\uadf8\uc778 \uad6c\ud604\uc2dc \ud0a4 \uacbd\ub85c \ubcc0\uacbd\ub41c \ubd80\ubd84Changes to key paths during login implementation \ud83d\udc49\ud83c\udffb \ud604\uc7ac \ub85c\uceec\uc740 \uae00 \uc800\uc7a5 \uc0ad\uc81c\uac00 \ub418\ub098 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":10791,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28,27,1,7],"tags":[],"class_list":["post-10727","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news","category-nextjs","category-uncategorized","category-website","has-thumbnail"],"_links":{"self":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/10727","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=10727"}],"version-history":[{"count":67,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/10727\/revisions"}],"predecessor-version":[{"id":10800,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/10727\/revisions\/10800"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/media\/10791"}],"wp:attachment":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=10727"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=10727"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=10727"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}