Skip to content

希望能支持Memos #1301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
huluohu opened this issue Aug 21, 2024 · 7 comments
Open

希望能支持Memos #1301

huluohu opened this issue Aug 21, 2024 · 7 comments

Comments

@huluohu
Copy link

huluohu commented Aug 21, 2024

希望能支持Memos裁剪,这是一个可以自托管的轻量笔记项目。

项目地址:https://github.com/usememos/memos
API文档:https://memos.apidocumentation.com/reference

@lilixxs
Copy link

lilixxs commented Jan 21, 2025

API 有无具体使用的流程?

@huluohu
Copy link
Author

huluohu commented Jan 21, 2025

大概的情况如下:

1、Memos提供AccessToken访问api的方式,token有用户自己在管理后台创建
2、调用接口时,使用Basic Auth方式,把token放在header里,例如:

curl https://demo.usememos.com/api/v1/memos \
   -H "Accept: application/json" \
   -H "Authorization: Bearer {YOUR_ACCESS_TOKEN}"

3、创建一篇笔记(新增)

curl --request POST \
  --url https://memos.apidocumentation.com/api/v1/memos \
  --data '{
  "content": "",
  "visibility": "VISIBILITY_UNSPECIFIED",
  "resources": [
    {
      "name": "",
      "uid": "",
      "filename": "",
      "content": "",
      "externalLink": "",
      "type": "",
      "size": "",
      "memo": ""
    }
  ],
  "relations": [
    {
      "memo": "",
      "relatedMemo": "",
      "type": "TYPE_UNSPECIFIED"
    }
  ]
}'

4、创建一个附件(新增)

curl --request POST \
  --url https://memos.apidocumentation.com/api/v1/resources \
  --data '{
  "name": "",
  "uid": "",
  "filename": "",
  "content": "",
  "externalLink": "",
  "type": "",
  "size": "",
  "memo": ""
}'

@lilixxs
Copy link

lilixxs commented Jan 21, 2025

用 postman 基本测试了一下,感觉 API 挺简洁的

  1. 验证直接是 BEARER TOKEN 就行,而且 TOKEN 可以设置成永久有效
  2. 导入内容支持直接导入 markdown 格式的字符串,支持的语法很丰富

一些小笔记:https://www.yuque.com/lilixxs-mzhpq/kxm5pt/psgpd9rwtrmu0hg2

基本流程

  1. {{baseUrl}}/api/v1/auth/status 验证用户 & 获取用户昵称、头像图片
  2. {{baseUrl}}/api/v1/memos 传markdown格式的字符串

@huluohu
Copy link
Author

huluohu commented Jan 22, 2025

赞,期待早日支持

@lilixxs
Copy link

lilixxs commented Jan 22, 2025

@huluohu 可以先试试,解压之后浏览器用开发者模式加载,添加账户选一长串英文带有memos 的那个选项

之后有时间再优化
现在的问题:Host地址校验规则不太好、添加的文本不支持加标签、接口限制单篇memo最多8192个字符、汉化有点问题

web-clipper-chrome.zip

web-clipper-firefox.zip

@huluohu
Copy link
Author

huluohu commented Jan 23, 2025

好的,感谢感谢!

@lilixxs
Copy link

lilixxs commented Jan 24, 2025

@huluohu 已经提交 PR #1327

新版程序:解压之后浏览器用开发者模式加载,添加账户选 Memos

web-clipper-firefox.zip
web-clipper-chrome.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants