使用MedleyText与Syncthink自建云笔记

时间:2023-03-08 20:36:36

随着学习加深,做的笔记越来越多,而使用云笔记怕万一平台关闭(如360网盘啥的)还需要导出笔记费时费力,并且多平台兼容性未知。还是自己搭建放心省事。

MedleyText介绍

MedleyText为markdown编辑器。功能较少,支持图片、富文本格式,笔记中可嵌入代码块以及可自定义的键盘快捷键。目前在使用中不支持表格等信息。基本满足日常使用。已支持超过40种编程语言自动语法高亮。支持 linux windows mac os

MedleyText在使用本地笔记时完全免费,没有任何限制。并且看官网更新日志也比较频繁。其余缺陷可能会后续加入。

官方网址:https://medleytext.net/

使用MedleyText与Syncthink自建云笔记

Syncthing介绍

Syncthing是一款跨平台、开源的数据同步工具。官方支持 Linux、Windows、Mac OS X、FreeBSD、Solaris 等系统,并且有第三方的 iOSAndroid 应用。

官方网址:https://syncthing.net/

下载安装MedleyText

windows下载,进入首页后直接点击for windows即可

使用MedleyText与Syncthink自建云笔记

mac linux平台下载,进入页面中部有其他平台的下载网址。

使用MedleyText与Syncthink自建云笔记

目前软件没有中文的支持。不过很简洁的页面初中英语水平就可以看懂了。

下载安装后设置工作目录即可开始写笔记

使用MedleyText与Syncthink自建云笔记

并且支持导入导出功能

使用MedleyText与Syncthink自建云笔记

Syncthing下载安装

syncthing分为两种客户端形式。syncthing并不是类似于网盘的云存储,而是类似于rsync的同步软件。所以要想实现云笔记功能需要有中转的服务器。

使用MedleyText与Syncthink自建云笔记

本文在搭建同步笔记是,使用的是闲置阿里云与多台pc。

编号 作用 平台
1 中转存储 centos 7
2 pc1 window 10
3 pc2 window 10

centos安装syncthing

下载后解压得到二级制文件。需要先运行一次让Syncthing自动生成初始配置文件,会看到如下输出。

[root@localhost ~]# syncthing
[monitor] 20:37:05 INFO: Starting syncthing
[start] 20:37:05 INFO: Generating ECDSA key and certificate for syncthing...
[7NYBG] 20:37:05 INFO: syncthing v0.14.11 "Dysprosium Dragonfly" (go1.7.3 linux-amd64) jenkins@build.syncthing.net 2016-11-15 06:23:48 UTC
[7NYBG] 20:37:05 INFO: My ID: 7NYBGD4-AL5FI6M-6P5ULKJ-QSPFASO-T57T4QW-WETWQXT-CAGTJ2I-3PFQGQP
[7NYBG] 20:37:06 INFO: Single thread hash performance is 154 MB/s using minio/sha256-simd (95 MB/s using crypto/sha256).
[7NYBG] 20:37:06 INFO: Default folder created and/or linked to new config
[7NYBG] 20:37:06 INFO: Defaults saved. Edit /root/.config/syncthing/config.xml to taste or use the GUI
[7NYBG] 20:37:06 INFO: Ready to synchronize sxdwy-d7npj (readwrite)
[7NYBG] 20:37:06 INFO: Using discovery server https://discovery-v4-2.syncthing.net/v2/?id=DVU36WY-H3LVZHW-E6LLFRE-YAFN5EL-HILWRYP-OC2M47J-Z4PE62Y-ADIBDQC
[7NYBG] 20:37:06 INFO: Using discovery server https://discovery-v4-3.syncthing.net/v2/?id=VK6HNJ3-VVMM66S-HRVWSCR-IXEHL2H-U4AQ4MW-UCPQBWX-J2L2UBK-NVZRDQZ
[7NYBG] 20:37:06 INFO: Using discovery server https://discovery-v4-4.syncthing.net/v2/?id=LYXKCHX-VI3NYZR-ALCJBHF-WMZYSPK-QG6QJA3-MPFYMSO-U56GTUK-NA2MIAW
[7NYBG] 20:37:06 INFO: Using discovery server https://discovery-v6-2.syncthing.net/v2/?id=DVU36WY-H3LVZHW-E6LLFRE-YAFN5EL-HILWRYP-OC2M47J-Z4PE62Y-ADIBDQC
[7NYBG] 20:37:06 INFO: Using discovery server https://discovery-v6-3.syncthing.net/v2/?id=VK6HNJ3-VVMM66S-HRVWSCR-IXEHL2H-U4AQ4MW-UCPQBWX-J2L2UBK-NVZRDQZ
[7NYBG] 20:37:06 INFO: Using discovery server https://discovery-v6-4.syncthing.net/v2/?id=LYXKCHX-VI3NYZR-ALCJBHF-WMZYSPK-QG6QJA3-MPFYMSO-U56GTUK-NA2MIAW
[7NYBG] 20:37:06 INFO: TCP listener ([::]:22000) starting
[7NYBG] 20:37:06 INFO: Completed initial scan (rw) of folder sxdwy-d7npj
[7NYBG] 20:37:06 INFO: Loading HTTPS certificate: open /root/.config/syncthing/https-cert.pem: no such file or directory
[7NYBG] 20:37:06 INFO: Creating new HTTPS certificate
[7NYBG] 20:37:07 INFO: GUI and API listening on 127.0.0.1:8384
[7NYBG] 20:37:07 INFO: Access the GUI via the following URL: http://127.0.0.1:8384/
[7NYBG] 20:37:07 INFO: Device 7NYBGD4-AL5FI6M-6P5ULKJ-QSPFASO-T57T4QW-WETWQXT-CAGTJ2I-3PFQGQP is "xiaoz" at [dynamic]
[7NYBG] 20:37:11 INFO: Automatic upgrade (current "v0.14.11" < latest "v0.14.12")
[7NYBG] 20:37:17 INFO: Detected 0 NAT devices

默认监听为localhost,修改其配置文件使其监听外网ip,配置文件默认在~/.config/syncthing/config.xml

 65     <gui enabled="true" tls="true" debugging="false">
66 <address>0.0.0.0:8384</address>
67 <user>admin</user>
68 <password>$2a$10$3Ie73SO5aFTashNssqNBYu9NsRRrfvcGk2r5ajRAC2cJJFjFTVJVi</password>
69 <apikey>QzYb7oe46vjLixojyYeqpmAyHJigvypo</apikey>
70 <theme>default</theme>
71 </gui>

访问ip:8384

使用MedleyText与Syncthink自建云笔记

window平台,下载运行即可。

配置笔记同步

创建中转存储文件夹

mkdir -pv /data/medley

在每个客户端添加远程主机

使用MedleyText与Syncthink自建云笔记

设置设备名和中转存储的设备ID即可。

在每个客户端添加要同步的目录

在客户端(因syncthing没有客户端的概念这里指的是写笔记的电脑)上添加要同步的文件夹。本文为E:/medley

使用MedleyText与Syncthink自建云笔记

添加完成后,服务端会受到每个客户端的创建文件请求,不要选择自动接受,这样达不到同步一致性。一次选择终点存储保存的目录为之前创建的目录。

使用MedleyText与Syncthink自建云笔记

创建完成后会将有笔记的工作目录中的文件同步至阿里云,之后阿里云同步到另外一台pc机。此时就可达到一款免费的云笔记。