1343
This commit is contained in:
1 parent
3ac06f87d8
commit
4d98e5ca1e
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;
|
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 d = date ? new Date(date) : new Date();
|
||||||
const year = d.getFullYear().toString();
|
const year = d.getFullYear().toString();
|
||||||
const dateStr = d.toISOString().slice(0, 10);
|
const dateStr = d.toISOString().slice(0, 10);
|
||||||
@@ -23,9 +23,8 @@ function computeDirPath(title: string, date?: string): string {
|
|||||||
.replace(/[^\w一-鿿㐀-䶿]+/g, "-")
|
.replace(/[^\w一-鿿㐀-䶿]+/g, "-")
|
||||||
.replace(/^-+|-+$/g, "")
|
.replace(/^-+|-+$/g, "")
|
||||||
.toLowerCase() || "post";
|
.toLowerCase() || "post";
|
||||||
// 加时间戳避免同标题同天冲突
|
const uniquePart = slug || Date.now().toString(36);
|
||||||
const ts = Date.now().toString(36);
|
return path.join(CONTENT_DIR, year, `${dateStr}-${titlePart}-${uniquePart}`);
|
||||||
return path.join(CONTENT_DIR, year, `${dateStr}-${titlePart}-${ts}`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const sessions = new Map<number, Session>();
|
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 {
|
export function initSessionDir(chatId: number, title: string, date?: string): void {
|
||||||
const s = getSession(chatId);
|
const s = getSession(chatId);
|
||||||
if (!s.dirPath) {
|
if (!s.dirPath) {
|
||||||
s.dirPath = computeDirPath(title, date);
|
s.dirPath = computeDirPath(title, date, s.slug);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user