"use client"; import React from "react"; import { Copy } from "lucide-react"; import { useCloud } from "@/context/CloudContext"; import { WorkspaceShell } from "@/components/WorkspaceShell"; import { NavbarPublic } from "@/components/NavbarPublic"; export default function DevelopersPage() { const { token, currentUser, notify } = useCloud(); const sampleToken = token ? `${token.slice(0, 28)}...` : ""; const content = (
Developer Hub • /developers

Tích hợp REST API & Bearer Token

Sử dụng Session Token hiện tại của bạn hoặc X-API-Key để tự động hóa việc tải lên, liệt kê và tải xuống tệp từ terminal hoặc ứng dụng CI/CD bên ngoài.

{token && (

BEARER TOKEN CỦA BẠN (Hiệu lực 7 ngày)

{token}

)}
{[ { title: "1. Liệt kê danh sách tệp (theo quyền User/Admin)", method: "GET /api/files", code: `curl -s "http://localhost:8080/api/files" \\\n -H "Authorization: Bearer ${sampleToken}"`, }, { title: "2. Tải tệp mới lên Upload ThTuanIT (Turbo Upload)", method: "POST /api/upload", code: `curl -X POST "http://localhost:8080/api/upload" \\\n -H "Authorization: Bearer ${sampleToken}" \\\n -F "path=media/video.mp4" \\\n -F "file=@./video.mp4"`, }, { title: "3. Đổi tên / Di chuyển đường dẫn tệp (Zero-Copy Hash)", method: "PUT /api/files", code: `curl -X PUT "http://localhost:8080/api/files" \\\n -H "Authorization: Bearer ${sampleToken}" \\\n -H "Content-Type: application/json" \\\n -d '{"old_path":"media/video.mp4","new_path":"archive/video-2026.mp4"}'`, }, { title: "4. Tải tệp xuống hoặc Streaming HTTP Range", method: "GET /api/download", code: `curl -L "http://localhost:8080/api/download?path=111.mp4" \\\n -H "Authorization: Bearer ${sampleToken}" \\\n -o 111.mp4`, }, ].map((snip, idx) => (

{snip.title}

{snip.method}
                {snip.code}
              
))}
); if (!currentUser) { return (
{content}
); } return {content}; }