panews-creator

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
Authenticated creator workflow via
https://universal-api.panewslab.com
. All endpoints require a
PA-User-Session
header.
通过
https://universal-api.panewslab.com
实现已认证的创作者工作流。所有端点都需要
PA-User-Session
请求头。

When to Use

适用场景

  • The task needs an authenticated creator session
  • The user wants to check creator eligibility, manage a column application, upload images, or create/update/delete an article
  • The task changes PANews state
  • 任务需要已认证的创作者会话
  • 用户需要检查创作者资格、管理专栏申请、上传图片,或创建/更新/删除文章
  • 任务会改变PANews的状态

Do Not Use When

不适用场景

  • The task is public read-only article or ranking lookup
  • The user wants a rendered PANews webpage instead of creator API actions
  • There is no valid
    PA-User-Session
    and the request cannot proceed without one
  • 任务为公开只读的文章或排行榜查询
  • 用户需要的是渲染后的PANews网页而非创作者API操作
  • 没有有效的
    PA-User-Session
    ,且请求无法在无会话的情况下进行

Language

语言设置

LanguageValue
Simplified Chinese
zh
Traditional Chinese
zh-hant
English
en
Japanese
ja
Korean
ko
语言取值
简体中文
zh
繁体中文
zh-hant
英文
en
日语
ja
韩语
ko

Standard Workflow

标准工作流

  1. Validate session →
    get-current-user
  2. Get full context →
    get-creator-context
  3. No approved column → run column application flow (
    apply-column
    )
  4. Has approved column → search tags (
    GET /tags
    ) → convert Markdown to HTML → execute article operations
Markdown to HTML command examples:
bash
npx --yes md4x draft.md -t html -o draft.html
bunx md4x draft.md -t html -o draft.html
Use whichever package runner exists in the current environment.
Copy this checklist and work through it:
text
PANews Creator Progress:
- [ ] Step 1: Validate the session
- [ ] Step 2: Inspect creator context and approved columns
- [ ] Step 3: If needed, complete or resubmit the column application
- [ ] Step 4: Upload assets and gather tag IDs
- [ ] Step 5: Convert Markdown to HTML with the available package runner
- [ ] Step 6: Create or update the article
- [ ] Step 7: Verify the API response before finishing
  1. 验证会话 →
    get-current-user
  2. 获取完整上下文 →
    get-creator-context
  3. 无已通过的专栏 → 执行专栏申请流程(
    apply-column
  4. 有已通过的专栏 → 搜索标签(
    GET /tags
    )→ 将Markdown转换为HTML → 执行文章操作
Markdown转HTML命令示例:
bash
npx --yes md4x draft.md -t html -o draft.html
bunx md4x draft.md -t html -o draft.html
使用当前环境中存在的任意包运行器即可。
复制以下检查清单并逐步执行:
text
PANews Creator进度:
- [ ] 步骤1:验证会话
- [ ] 步骤2:查看创作者上下文及已通过的专栏
- [ ] 步骤3:如有需要,完成或重新提交专栏申请
- [ ] 步骤4:上传资源并收集标签ID
- [ ] 步骤5:使用可用的包运行器将Markdown转换为HTML
- [ ] 步骤6:创建或更新文章
- [ ] 步骤7:完成前验证API响应

Session

会话管理

Resolve
PA-User-Session
from environment in order:
PANEWS_USER_SESSION
PA_USER_SESSION
PA_USER_SESSION_ID
. On
401
, discard and re-resolve.
按以下优先级从环境变量中获取
PA-User-Session
PANEWS_USER_SESSION
PA_USER_SESSION
PA_USER_SESSION_ID
。若返回
401
,则丢弃现有会话并重新获取。

Rules

规则

  • Validate the session before any mutating action
  • Never hand-write raw HTML article bodies; convert Markdown with a tool such as
    md4x
    first
  • Treat
    401
    as a hard stop: discard the session and re-resolve it
  • Only submit to
    PENDING
    when the user is ready to send the article for review; otherwise default to
    DRAFT
  • 在执行任何变更操作前先验证会话
  • 切勿手动编写原始HTML文章内容;需先使用
    md4x
    等工具转换Markdown
  • 401
    错误视为硬停止:丢弃现有会话并重新获取
  • 仅当用户准备好提交文章审核时,才将状态设为
    PENDING
    ;否则默认使用
    DRAFT

Scripts

脚本示例

bash
node {Skills Directory}/panews-creator/scripts/get-current-user.mjs [--session <value>]
node {Skills Directory}/panews-creator/scripts/get-creator-context.mjs [--session <value>]
node {Skills Directory}/panews-creator/scripts/upload-image.mjs <file-path> [--watermark] [--session <value>]
node {Skills Directory}/panews-creator/scripts/apply-column.mjs --name <name> --desc <desc> --picture <url> --links <url,...> [--session <value>]
node {Skills Directory}/panews-creator/scripts/apply-column.mjs --column-id <id> [--name] [--desc] [--picture] [--links] [--session <value>]
node {Skills Directory}/panews-creator/scripts/search-tags.mjs <keyword> [--take 20] [--skip 0] [--lang zh]
node {Skills Directory}/panews-creator/scripts/list-articles.mjs --column-id <id> [--status DRAFT|PENDING|PUBLISHED|REJECTED] [--take 20] [--skip 0] [--session <value>]
node {Skills Directory}/panews-creator/scripts/create-article.mjs --column-id <id> --lang <lang> --title <title> --desc <desc> --content-file <path> [--status DRAFT|PENDING] [--cover <url>] [--tags <id,...>] [--session <value>]
node {Skills Directory}/panews-creator/scripts/update-article.mjs --column-id <id> --article-id <id> [fields...] [--session <value>]
node {Skills Directory}/panews-creator/scripts/delete-article.mjs --column-id <id> --article-id <id> [--session <value>]
bash
node {Skills Directory}/panews-creator/scripts/get-current-user.mjs [--session <value>]
node {Skills Directory}/panews-creator/scripts/get-creator-context.mjs [--session <value>]
node {Skills Directory}/panews-creator/scripts/upload-image.mjs <file-path> [--watermark] [--session <value>]
node {Skills Directory}/panews-creator/scripts/apply-column.mjs --name <name> --desc <desc> --picture <url> --links <url,...> [--session <value>]
node {Skills Directory}/panews-creator/scripts/apply-column.mjs --column-id <id> [--name] [--desc] [--picture] [--links] [--session <value>]
node {Skills Directory}/panews-creator/scripts/search-tags.mjs <keyword> [--take 20] [--skip 0] [--lang zh]
node {Skills Directory}/panews-creator/scripts/list-articles.mjs --column-id <id> [--status DRAFT|PENDING|PUBLISHED|REJECTED] [--take 20] [--skip 0] [--session <value>]
node {Skills Directory}/panews-creator/scripts/create-article.mjs --column-id <id> --lang <lang> --title <title> --desc <desc> --content-file <path> [--status DRAFT|PENDING] [--cover <url>] [--tags <id,...>] [--session <value>]
node {Skills Directory}/panews-creator/scripts/update-article.mjs --column-id <id> --article-id <id> [fields...] [--session <value>]
node {Skills Directory}/panews-creator/scripts/delete-article.mjs --column-id <id> --article-id <id> [--session <value>]

Failure Handling

故障处理

  • If session validation fails with
    401
    , stop and obtain a fresh session before retrying
  • If there is no approved column, do not attempt article creation; complete the application flow first
  • If content formatting looks wrong, re-render the Markdown and inspect the generated HTML before submitting
  • If an article update or delete fails because the status is immutable, fetch the current article list and report the blocking state clearly
  • 若会话验证返回
    401
    失败,需停止操作并获取新会话后再重试
  • 若无已通过的专栏,请勿尝试创建文章;需先完成专栏申请流程
  • 若内容格式显示异常,需重新渲染Markdown并检查生成的HTML后再提交
  • 若因状态不可变导致文章更新或删除失败,请获取当前文章列表并清晰报告阻塞状态

References

参考文档

TopicDescriptionReference
SessionResolve, validate, and handle session errorssession
Column ApplicationsSubmit or resubmit a column applicationcolumns
TagsSearch tags by keyword to get IDs for article taggingtags
ArticlesList, create, update, delete column articlesarticles
Content FormatWrite in Markdown, convert it to HTML, pass it via --content-filecontent-format
UploadUpload images to PANews CDNupload
主题描述参考链接
会话会话的解析、验证及错误处理session
专栏申请提交或重新提交专栏申请columns
标签通过关键词搜索标签以获取文章标记所需的IDtags
文章列出、创建、更新、删除专栏文章articles
内容格式使用Markdown编写,转换为HTML后通过--content-file参数传递content-format
上传将图片上传至PANews CDNupload