[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