MDShare Agent
Use MDShare as a lightweight anonymous Markdown publishing backend.
Service
- - Default base URL: INLINECODE0
- If the caller provides another deployment, use that instead.
- Keep public links and token-bearing links separate:
- Public link:
/s/{slug}
- Edit/manage page:
/e/{slug}#edit={token} or
/e/{slug}#manage={token}
- - Never expose
ownerToken or editorToken unless the user explicitly wants those links.
Core Workflows
Create a share
Send POST /api/shares with JSON:
CODEBLOCK0
Rules:
- -
expiresInHours should normally be one of 1, 24, 168, 720. - INLINECODE12 values:
-
OFF
-
AFTER_FIRST_VIEW_GRACE
-
AFTER_FIRST_VIEW_INSTANT
-
READ_ONLY
- INLINECODE18
Return these links to the user:
- - Public: INLINECODE19
- Manage: INLINECODE20
- Edit: only if
editorToken exists, INLINECODE22
Example using the default deployment:
- - Public: INLINECODE23
- Manage: INLINECODE24
- Edit: INLINECODE25
Read a public share
Call GET /api/shares/{slug}/public.
Possible states:
- -
available: content is returned - INLINECODE28 : password and/or confirm-view is required
- INLINECODE29
- INLINECODE30
- INLINECODE31
- INLINECODE32
If the state is gated, ask for the password only when needed and explain burn-after-read before confirming access.
Unlock a gated share
Send POST /api/shares/{slug}/public with JSON:
CODEBLOCK1
Use confirmView: true when the service says burn confirmation is required.
Read or edit through a token
Use header:
CODEBLOCK2
Call GET /api/shares/{slug}/manage to inspect the current share and role.
Save content
Send PATCH /api/shares/{slug}/manage with header x-share-token and JSON:
CODEBLOCK3
If the API returns 409 with conflict: true, do not overwrite silently. Summarize the conflict and ask whether to force-save.
Update settings
Owner token only. Send PATCH /api/shares/{slug}/settings with JSON:
CODEBLOCK4
If the response includes a new editorToken, regenerate the edit link.
Delete a share
Owner token only. Call DELETE /api/shares/{slug}/manage with x-share-token.
Behavior Guidance
- - Prefer simple defaults:
-
expiresInHours: 168
-
burnMode: OFF
-
editableMode: READ_ONLY
- - Treat password as optional. Empty string means no password.
- Preserve user Markdown exactly unless they explicitly ask for formatting or cleanup.
- When the user only wants a formatting preview, do not create a share link unless they ask.
- For sensitive content, remind the user that anyone with a manage link can modify or delete the share.
Reference
MDShare Agent
将MDShare用作轻量级匿名Markdown发布后端。
服务
- - 默认基础URL:https://share.yekyos.com
- 如果调用方提供了其他部署地址,则使用该地址。
- 将公开链接和含令牌链接分开:
- 公开链接:/s/{slug}
- 编辑/管理页面:/e/{slug}#edit={token} 或 /e/{slug}#manage={token}
- - 除非用户明确需要,否则绝不暴露ownerToken或editorToken。
核心工作流
创建分享
发送POST /api/shares,附带JSON:
json
{
markdownContent: # 标题\n\n正文,
expiresInHours: 24,
password: ,
burnMode: OFF,
editableMode: READ_ONLY
}
规则:
- - expiresInHours通常应为1、24、168、720之一。
- burnMode取值:
- OFF
- AFTER
FIRSTVIEW_GRACE
- AFTER
FIRSTVIEW_INSTANT
- READ_ONLY
- EDIT_LINK
向用户返回以下链接:
- - 公开:{baseUrl}/s/{slug}
- 管理:{baseUrl}/e/{slug}#manage={ownerToken}
- 编辑:仅当editorToken存在时,{baseUrl}/e/{slug}#edit={editorToken}
使用默认部署的示例:
- - 公开:https://share.yekyos.com/s/abc123xy
- 管理:https://share.yekyos.com/e/abc123xy#manage=
- 编辑:https://share.yekyos.com/e/abc123xy#edit=
读取公开分享
调用GET /api/shares/{slug}/public。
可能的状态:
- - available:返回内容
- gated:需要密码和/或确认查看
- expired
- burned
- deleted
- not_found
如果状态为gated,仅在需要时询问密码,并在确认访问前解释阅后即焚。
解锁受限分享
发送POST /api/shares/{slug}/public,附带JSON:
json
{
password: 可选密码,
confirmView: true
}
当服务提示需要焚毁确认时,使用confirmView: true。
通过令牌读取或编辑
使用请求头:
text
x-share-token:
调用GET /api/shares/{slug}/manage查看当前分享和角色。
保存内容
发送PATCH /api/shares/{slug}/manage,附带请求头x-share-token和JSON:
json
{
markdownContent: # 已更新\n\n内容,
lastKnownUpdatedAt: 2026-03-12T00:00:00.000Z,
force: false
}
如果API返回409且conflict: true,不要静默覆盖。总结冲突并询问是否强制保存。
更新设置
仅限所有者令牌。发送PATCH /api/shares/{slug}/settings,附带JSON:
json
{
expiresInHours: 168,
password: ,
burnMode: OFF,
editableMode: READ_ONLY
}
如果响应包含新的editorToken,则重新生成编辑链接。
删除分享
仅限所有者令牌。调用DELETE /api/shares/{slug}/manage,附带x-share-token。
行为指导
- expiresInHours: 168
- burnMode: OFF
- editableMode: READ_ONLY
- - 将密码视为可选。空字符串表示无密码。
- 除非用户明确要求格式化或清理,否则精确保留其Markdown内容。
- 当用户仅需要格式预览时,除非用户要求,否则不要创建分享链接。
- 对于敏感内容,提醒用户任何拥有管理链接的人都可以修改或删除该分享。
参考