1343
This commit is contained in:
1 parent
4b4387cf57
commit
8ef2f7613f
5 files changed
+4
-30
No files matched your search
@@ -1,25 +0,0 @@
|
||||
---
|
||||
title: 测试
|
||||
date: '2026-06-22'
|
||||
slug: '20260622133641'
|
||||
draft: false
|
||||
categories:
|
||||
- 生活
|
||||
tags: []
|
||||
author: 小赵
|
||||
layout: post
|
||||
---
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
[animation.gif.mp4](1782106624376-CgACAgQA.mp4)
|
||||
|
||||
|
||||
|
||||
[file](1782106633158-BAACAgQA.mp4)
|
||||
|
||||
|
||||
测试在 Linux 写作
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 83 KiB |
Binary file not shown.
Binary file not shown.
@@ -15,7 +15,7 @@ export interface Session {
|
||||
dirPath: string;
|
||||
}
|
||||
|
||||
function computeDirPath(title: string, date?: string): string {
|
||||
function computeDirPath(title: string, date?: string, slug?: string): string {
|
||||
const d = date ? new Date(date) : new Date();
|
||||
const year = d.getFullYear().toString();
|
||||
const dateStr = d.toISOString().slice(0, 10);
|
||||
@@ -23,9 +23,8 @@ function computeDirPath(title: string, date?: string): string {
|
||||
.replace(/[^\w一-鿿㐀-䶿]+/g, "-")
|
||||
.replace(/^-+|-+$/g, "")
|
||||
.toLowerCase() || "post";
|
||||
// 加时间戳避免同标题同天冲突
|
||||
const ts = Date.now().toString(36);
|
||||
return path.join(CONTENT_DIR, year, `${dateStr}-${titlePart}-${ts}`);
|
||||
const uniquePart = slug || Date.now().toString(36);
|
||||
return path.join(CONTENT_DIR, year, `${dateStr}-${titlePart}-${uniquePart}`);
|
||||
}
|
||||
|
||||
const sessions = new Map<number, Session>();
|
||||
@@ -75,7 +74,7 @@ export function undoLastChunk(chatId: number): boolean {
|
||||
export function initSessionDir(chatId: number, title: string, date?: string): void {
|
||||
const s = getSession(chatId);
|
||||
if (!s.dirPath) {
|
||||
s.dirPath = computeDirPath(title, date);
|
||||
s.dirPath = computeDirPath(title, date, s.slug);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user