[nextjs]SNS Server-25(myapp35)Β 

πŸ‘‰πŸ» νšŒμ›κ°€μž… 및 둜그인과 κ΄€λ ¨λœ κΈ°λŠ₯μž…λ‹ˆλ‹€.
These are features related to sign-up and login.

πŸ‘‰πŸ» pinaforeμ—μ„œ κ²€μƒ‰λœ κ³„μ •μ˜ ν”„λ‘œν•„μ—μ„œ μž„μ‹œλ°μ΄ν„°λ₯Ό λ°μ΄ν„°λ² μ΄μŠ€λ°μ΄ν„°λ‘œ λ°”κΏ‰λ‹ˆλ‹€.(ν”„λ‘œν•„ + μž‘μ„±ν•œκΈ€)
Replace the temporary data with database data in the profile of the account found on Pinafore (including the profile and posts).

πŸ‘‰πŸ» FOLLOW와 FOLLOWERS값은 gotosocialκ³Ό mastodonμ—μ„œ μ£Όμ§€ μ•ŠλŠ” κ°’μœΌλ‘œ λ‚΄ 둜컬 μ„œλ²„(aloy)μ—μ„œ κ°€μ Έμ™”μŠ΅λ‹ˆλ‹€.
The “FOLLOW” and “FOLLOWERS” values ​​are not provided by GoToSocial or Mastodon; I retrieved them from my local server (aloy).

πŸ‘‰πŸ» user1으둜 λ‘œκ·ΈμΈν•˜λ©΄ user1의 FOLLOW와 FOLLOWERS값이 pinafore.socialμ—μ„œ 확인 λ©λ‹ˆλ‹€.
When you log in as user1, the “Following” and “Followers” counts for user1 are displayed on pinafore.social.

πŸ‘‰πŸ» κ·Έλž˜μ„œ pinafore.socialμ—μ„œ ν™•μΈν•˜λŠ”κ±°λž‘ ν•΄λ‹Ή snsμ›Ήμ‚¬μ΄νŠΈ κ°’κ³Ό λ‹€λ₯Ό 수 μžˆμŠ΅λ‹ˆλ‹€.
Therefore, the values ​​shown on pinafore.social may differ from those on the actual social media website.

πŸ‘‰πŸ» 전체 μ½”λ“œλŠ” κΉƒν—ˆλΈŒμ—μ„œ 확인 ν•  수 μžˆμŠ΅λ‹ˆλ‹€.
You can find the full code on GitHub.

https://github.com/gideonslife01/flm-nextjs

πŸ“ 전체 ν”„λ‘œμ νŠΈ ꡬ쑰 / Overall Project Structure

myapp project/  
β”œβ”€β”€ app/  (Next.js App Router)
β”‚   β”œβ”€β”€ .well-known/webfinger/route.ts  -> webfinger
β”‚   β”œβ”€β”€ api/follow/route.ts    -> Follow API(temporary)
β”‚   β”œβ”€β”€ api/announce/route.ts  -> Boost(Announcement)
β”‚   β”œβ”€β”€ api/like/route.ts.     -> Like API
β”‚   β”œβ”€β”€ api/posts/route.ts     -> Writing API
β”‚   β”œβ”€β”€ api/timeline/route.ts  -> Timeline API
β”‚   β”œβ”€β”€ api/v1/instance/route.ts -> auth
β”‚   β”œβ”€β”€ api/v1/apps/route.ts.    -> auth
β”‚   β”œβ”€β”€ api/v1/accounts/verify_credentials/route.ts -> auth
β”‚   β”œβ”€β”€ api/v1/statuses/route.ts -> Write Post
β”‚   β”œβ”€β”€ api/v1/timelines/home/route.ts -> timeline
β”‚   β”œβ”€β”€ oauth/authorize/route.ts -> auth
β”‚   β”œβ”€β”€ oauth/token/route.ts -> auth
β”‚   β”œβ”€β”€ api/v1/search/home/route.ts -> search
β”‚   β”œβ”€β”€ api/v2/search/home/route.ts -> search
β”‚   β”œβ”€β”€ users/[username]/
β”‚   β”‚   β”œβ”€β”€ statuses/[id]/route.ts -> Indivisual Post
β”‚   β”‚   β”œβ”€β”€ route.ts               -> Acotr Information
β”‚   β”‚   β”œβ”€β”€ followers/route.ts     -> Followers List
β”‚   β”‚   β”œβ”€β”€ following/route.ts     -> Following List
β”‚   β”‚   β”œβ”€β”€ inbox/route.ts         -> Inbox
β”‚   β”‚   └── outbox/route.ts        -> outbox
β”‚   β”œβ”€β”€ usersui/[username]/
β”‚   β”‚   β”œβ”€β”€ page.tsx               -> Timeline UI
β”‚   β”‚   └── _components/themes/
β”‚   β”‚       β”œβ”€β”€ themeex/ThemeexTheme.tsx   -> Example Theme
β”‚   β”‚       β”œβ”€β”€ pinafore/PinaforeTheme.tsx -> Theme 1
β”‚   β”‚       β”œβ”€β”€ mastodon/MastodonTheme.tsx -> Theme 2
β”‚   β”‚       └── minimal/MinimaltTheme.tsx  -> Theme 3
β”‚   β”œβ”€β”€ layout.tsx, page.tsx, globals.css
β”‚   └── favicon.ico
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ theme.tsx              -> Theme Provider
β”‚   β”œβ”€β”€ watchThemes.ts         -> Check real-time theme changes
β”‚   β”œβ”€β”€ auth.ts                -> Authentication, User Management
β”‚   β”œβ”€β”€ ap.ts                  -> Follow,Undo,Create,Likes,Announce
β”‚   └── db.ts                  -> DB connection
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ keys/userIDs/          -> private.pem, public.pem(New)
β”‚   └── keys/                  -> private.pem, public.pem(legacy)
β”œβ”€β”€ data.sqlite                -> Database(1/3)
β”œβ”€β”€ data.sqlite-wal            -> Database(2/3)
β”œβ”€β”€ data.sqlite-shm            -> Database(3/3)
β”œβ”€β”€ Caddyfile                  -> https 
β”œβ”€β”€ instrumentation.ts         -> Background Server
└── package.json

πŸ“ ν”„λ‘œμ νŠΈ μ‹œμž‘ / Project Start


πŸ“ μ½”λ“œ μˆ˜μ • / Code Modification

βœ”οΈ app/api/v1/accounts/[id]/route.ts

— 검색 ν›„ μƒμ„ΈνŽ˜μ΄μ§€ ν”„λ‘œν•„ μ˜μ—­
Profile section on the detail page after search

// βœ… myapp35 - app/api/v1/accounts/[id]/route.ts 
// - Profile info.

import { NextResponse } from 'next/server';
import db from '@/lib/db';

const DOMAIN = process.env.DOMAIN || 'aloy-horizon.duckdns.org';

export async function GET(req: Request, { params }: { params: Promise<{ id: string }> }) { ... ...}

export async function OPTIONS() {
  return new NextResponse(null, { status: 204, headers: { 'Access-Control-Allow-Origin': '*' } });
}

βœ”οΈ app/api/v1/accounts/[id]/statuses/route.ts

— 검색 ν›„ μƒμ„ΈνŽ˜μ΄μ§€ κΈ€ μ˜μ—­
Content area of ​​the details page after search

// βœ… myapp35 - app/api/v1/accounts/[id]/statuses/route.ts
// - pinafore s

import { NextResponse } from 'next/server';
import db from '@/lib/db';

const DOMAIN = process.env.DOMAIN || 'aloy-horizon.duckdns.org';

export async function GET(req: Request, { params }: { params: Promise<{ id: string }> }) { ... ... }

export async function OPTIONS() {
  return new NextResponse(null, { status: 204, headers: { 'Access-Control-Allow-Origin': '*' } });
}

πŸ“ ν…ŒμŠ€νŠΈ / Test

βœ”οΈ 리λͺ¨νŠΈ μ„œλ²„ / Remote Server

— λ§ˆμŠ€ν† λˆ / Mastodon

Mastodon

— κ³ νˆ¬μ†Œμ…œ / Gotosocial

Gotosocial

βœ”οΈ λ‘œμ»¬μ„œλ²„ / Local Server

Local Server

μš”ν•œλ³΅μŒ 8μž₯ 32절 / John 8:32

“그리고 λ„ˆν¬λŠ” 진리λ₯Ό μ•Œκ²Œ 될 것이며, 진리가 λ„ˆν¬λ₯Ό 자유둭게 ν•  것이닀.”

“Then you will know the truth ,and the truth will set you free”

Leave a Reply