feat: 可配置站点 URL 风格
- 新增 urlStyle 工具与测试:postPath/userPath/sitePagePath 统一生成链接 - 管理端新增 UrlStylePanel 设置面板,settings 服务与 handler 适配 - 全站路由链接与 JSON-LD/sitemap 切换为统一 URL 生成 - middleware 与相关组件适配
This commit is contained in:
@@ -12,6 +12,8 @@ import {
|
||||
import { fileExtBadge, fileKind } from "@/lib/fileKind";
|
||||
import { toast } from "@/lib/toast";
|
||||
import Modal from "@/components/Modal";
|
||||
import { postPath } from "@/lib/urlStyle";
|
||||
import { useUrlStyle } from "@/components/SiteBrandProvider";
|
||||
|
||||
function formatSize(n: number) {
|
||||
if (n < 1024) return `${n} B`;
|
||||
@@ -86,7 +88,8 @@ export default function PostAttachments({
|
||||
loggedIn: boolean;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const loginHref = `/login?redirect=${encodeURIComponent(`/post/${postId}`)}`;
|
||||
const urlStyle = useUrlStyle();
|
||||
const loginHref = `/login?redirect=${encodeURIComponent(postPath(urlStyle, postId))}`;
|
||||
const [busyId, setBusyId] = useState<number | null>(null);
|
||||
const [pending, setPending] = useState<PostAttachment | null>(null);
|
||||
const [unlockedIds, setUnlockedIds] = useState<number[]>([]);
|
||||
|
||||
Reference in New Issue
Block a user