memos 从入门到删库跑路

技术 · 01-06 · 635 人浏览
memos 从入门到删库跑路

memos是一个类似flomo的轻量笔记软件,使用golang编写,笔记格式使用Markdown,数据库使用sqlite存储,官方自带Docker image,非常适合自用做简单的笔记或者文本分享服务。

官网 https://usememos.com/
源码 https://github.com/usememos/memos

![memos_demo_op]()

安装

推荐使用Docker进行安装

version: "3.0"
services:
  memos:
    image: neosmemo/memos:latest
    container_name: memos
    volumes:
      - /var/memos/:/var/opt/memos #修改/var/memos 到常用的文件存储路径,便于定期备份
    ports:
      - 5230:5230

自定义的配置

1. memos 隐藏 askai 按钮

#版本 0.11.2
header > div.w-full.px-2.py-2.flex.flex-col.justify-start.items-start.shrink-0.space-y-2 > button:nth-child(4) {display:none;}

2. Drafts app发送到Memos的Action

访问下面Drafts官网进行安装 https://directory.getdrafts.com/a/2HU
首次运行时提示要求输入API地址,将我的帐号下面完整的URL贴进去。

3. 使用露霞文楷字体

本地已经安装了露霞文楷字体

body{font-family: "LXGW WenKai", sans-serif !important;}

更多参考 https://immmmm.com/memos-diy-style/

Chrome 插件

https://chrome.google.com/webstore/detail/memos-bber/cbhjebjfccgchgbmfbobjmebjjckgofe/

删库跑路

使用了一段时间后,还是感觉自己笔记太分散了,回去折腾Obsidian,跑路之前要进行备份导出,使用如下脚本导出markdown文件,资源中的文件无法直接导出。

#!/usr/bin/env python3
import requests
import os

#配置信息,修改成自己地址, 注意
host = "http://192.168.2.2:8090"
openId = "e184c398-8849-4126-b3cb-c47413c0127d"

url = "https://{host}/api/memo?openId={openId}".format(host=host,openId=openId)

payload={}
headers = {}

#创建memos文件夹
if not os.path.exists: os.mkdir("memos")

#创建请求
response = requests.request("GET", url, headers=headers, data=payload)

if response.status_code == 200:
    print("memos data downloaded...")
    memo_list = response.json()["data"]
    for memo in memo_list:
        with open(os.path.join("memos",str(memo["id"]).zfill(3)+".md"), "w",encoding="utf-8") as mdfile:
            print("writing:" + "memos/"+str(memo["id"]).zfill(3)+".md")
            mdfile.write(memo["content"])
selfhost
Theme Jasmine by Kent Liao