laobenlang 发表于 2022-5-19 20:37:00

开源Markdown笔记软件Joplin,可自己搭建云笔记

<i class="pstatus"> 本帖最后由 laobenlang 于 2022-5-19 20:42 编辑 </i><br />
<br />
<font face="楷体, 楷体_GB2312"><font size="6"><font color="#ff0000">本人已经在论坛排重,近期无人分享本文中涉及的软件Joplin和webdav。</font></font></font><br />
<font face="楷体, 楷体_GB2312"><font size="6"><br />
</font></font><br />
<font face="楷体, 楷体_GB2312"><font size="6"><font color="#8b0000"><strong>写在前面:</strong></font></font></font><br />
<font face="楷体, 楷体_GB2312"><font size="6">1.本文为什么发在精品软件区?</font></font><br />
<font face="楷体, 楷体_GB2312"><font size="6">&nbsp; &nbsp;<font color="#008080">--主要以分享软件为主,所有软件皆为开源免费,不是本人编写。遇到问题可以直接在github上提单。</font></font></font><br />
<font face="楷体, 楷体_GB2312"><font size="6">2.本文初衷?</font></font><br />
<font face="楷体, 楷体_GB2312"><font size="6"> <font color="#008080"> -- 本人不爱学习,到现在为止,python,java,JavaScript,C++的各种语法已经记混了,为了不用记忆,常年依赖笔记软件。在单位和家中笔记不同步,这个很让我恼火,先后用过印象,坚果,有道云,百度云等软件,但是收费不开心!限流不开心!密码会被上传不开心!</font></font></font><br />
<font face="楷体, 楷体_GB2312"><font size="6"><font color="#008080">&nbsp; &nbsp; 为什么不能自己搞个服务器,自己同步笔记呢。</font></font></font><br />
<font face="楷体, 楷体_GB2312"><font size="6"><font color="#008080">&nbsp; &nbsp; 然后对比各种各样的私有云、支持同步笔记等软件。</font></font></font><br />
<font face="楷体, 楷体_GB2312"><font size="6"><font color="#008080">&nbsp; &nbsp; 终于我的笔记软件一路升级,从【eDiary】-&gt;【EssentialPIMPro(收费,可终身买断)】-&gt;【Joplin】。</font></font></font><br />
<br />
<font size="5">3.自己搭建云笔记优势?</font><br />
<font size="5">&nbsp;&nbsp;-- 安全、不限速、不限空间。啥都自己说了算。</font><br />
<font size="5"><br />
</font><br />
<font size="5">4.主要用到的软件?</font><br />
<font size="5">&nbsp;&nbsp;-- 笔记主体 Joplin</font><br />
<font size="5">&nbsp; &nbsp;&nbsp; &nbsp;服务器&nbsp;&nbsp;自家电脑(打电话给电信宽带要的公网IP)</font><br />
<font size="5">&nbsp; &nbsp;&nbsp; &nbsp;网盘软件 webdav</font><br />
<br />
<img id="aimg_SltTb" onclick="zoom(this, this.src, 0, 0, 0)" class="zoom" file="https://s1www.52pojie.org/2022/05/25/1.gif" onmouseover="img_onmouseoverfunc(this)" lazyloadthumb="1" border="0" alt="" /><img id="aimg_hBJWn" onclick="zoom(this, this.src, 0, 0, 0)" class="zoom" file="https://s1www.52pojie.org/2022/05/25/1.gif" onmouseover="img_onmouseoverfunc(this)" lazyloadthumb="1" border="0" alt="" /><img id="aimg_w5LtA" onclick="zoom(this, this.src, 0, 0, 0)" class="zoom" file="https://s1www.52pojie.org/2022/05/25/1.gif" onmouseover="img_onmouseoverfunc(this)" lazyloadthumb="1" border="0" alt="" /><br />
<br />
<br />
<font size="4">下面正题:</font><br />
<font size="4"><font color="#808000">a.自己搭建云笔记,你得有个服务器。</font></font><br />
<font size="4">&nbsp; &nbsp; 真正想要数据自由,你得有个自己的服务器,这个服务器最好是有公网IP的局域网主机。</font><br />
<font size="4">&nbsp; &nbsp; 路由器中直接吧dmz指向自己电脑即可。</font><br />
<font size="4">&nbsp; &nbsp; PS:家中有宽带,可以尝试打客服,直接选宽带业务,说我家装了个监控,需要个外网IP,不需要固定地址,动态公网IP就行了。</font><br />
<font size="4">&nbsp; &nbsp; 另外这个动态IP,每次拨号,地址会变。你如果不想动不动同步不了,最好自己申请个域名,然后写个脚本自动更新解析,我用的阿里云域名,python写个程序,开机自启动,每隔一小时检测下外网IP和域名解析IP是否一致。</font><br />
<br />
<font size="5">自动解析IP</font><br />
<div style="padding:15px 0;"><div style="font-size:12px;"> <em class="viewsource" style="cursor:pointer;font-size:12px;color:#369 !important;">纯文本查看</em> <em class="copycode" style="cursor:pointer;font-size:12px;color:#369 !important;">复制代码</em></div><pre class="brush: python; gutter: true">import requests

class myIP:
    @staticmethod
    def getMyIp():
      data = requests.get('https://ip.tool.lu/')
      text = data.text

      return text.split('\n').strip().split(':').strip()</pre></div><br />
<br />
<div style="padding:15px 0;"><div style="font-size:12px;"> <em class="viewsource" style="cursor:pointer;font-size:12px;color:#369 !important;">纯文本查看</em> <em class="copycode" style="cursor:pointer;font-size:12px;color:#369 !important;">复制代码</em></div><pre class="brush: python; gutter: true">import time, datetime, os
import logging

from lib.aliyunDNSTools import Sample
from lib.DNSRecord import *
from lib.myip import *
loglevelflag = logging.INFO
logformatflag = &quot;%(asctime)s %(name)s:%(levelname)s:%(message)s&quot;


logging.basicConfig(filename=&quot;run.log&quot;, filemode=&quot;w&quot;, format=logformatflag, level=loglevelflag)
console = logging.StreamHandler()
console.setLevel(loglevelflag)
formatter = logging.Formatter(logformatflag)
console.setFormatter(formatter)
logging.getLogger('').addHandler(console)






class mainRunner :
    oldip = ''
    myip = ''
    needCheckDNS = False

    def __init__(self):
      try:
            self.oldip = myIP.getMyIp()
            self.needCheckDNS = True
      except:
            print(&quot;&gt;&gt;&gt;&quot; +datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f') + &quot;初始化获取IP失败!&quot;)
            logging.info(&quot;初始化获取IP失败!&quot;)
            pass

    def checkIPChange(self):
      try:
            self.myip = myIP.getMyIp()
            print(&quot;&gt;&gt;&gt;&quot; +datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f') +' oldip:' + self.oldip + ',newip:' + self.myip)
            logging.info(' oldip:' + self.oldip + ',newip:' + self.myip)
            if len(self.myip) &lt; 1:
                return False
            return self.myip != self.oldip
      except :
            print(&quot;&gt;&gt;&gt;&quot; + datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f') +&quot;检测IP变化时,获取IP失败!&quot;)
            logging.info(&quot;检测IP变化时,获取IP失败!&quot;)
            return False



    def checkDNS(self):
      try:
            retdata = Sample.getDNSRecord()
            dns = DNSRecord()
            dns.loadFromJson(retdata['body']['DomainRecords']['Record'])
            # print(dns)
            if dns.Value != self.myip:
                dns.Value = self.myip
                Sample.updateDNSRecord(dns)
            self.needCheckDNS = False
      except :
            print(&quot;&gt;&gt;&gt;&quot; +datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f') +'检测更新DNS时报错!')
            logging.info(&quot;检测更新DNS时报错!&quot;)

    def run(self):
      while True:
            tempFlage = self.checkIPChange()
            self.needCheckDNS = tempFlage or self.needCheckDNS

            if self.needCheckDNS:
                self.checkDNS()
            print(&quot;&gt;&gt;&gt;&quot; + datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f') +&quot;检测完成,开始休眠^_^&quot;)
            logging.info(&quot;检测完成,开始休眠^_^&quot;)
            time.sleep(60*60*1)
            # time.sleep(1)















</pre></div><br />
<br />
<font size="4"><font color="#808000">b.有了服务器,你得启动webdav服务。</font></font><br />
<font size="4">&nbsp; &nbsp;提供webdav服务的软件有很多,不少私有云盘都带着,我通过docker装过可道云,装过seafile,装过nextcloud。功能比较傻瓜,性能是真的差,同步慢的要死,慢慢慢慢慢慢慢慢慢慢慢死了。</font><br />
<font size="4">&nbsp; &nbsp;我找了个Github开源的一个,单纯提供webdav服务的程序,地址在这里(https://github.com/hacdias/webdav)</font><br />
<font size="4">&nbsp; &nbsp;下载完就一个exe文件,然后自己写个yaml就可以启动了,看看readme,半分钟搞定。</font><br />
<br />
<br />
yaml配置:<br />
<div style="padding:15px 0;"><div style="font-size:12px;"> <em class="viewsource" style="cursor:pointer;font-size:12px;color:#369 !important;">纯文本查看</em> <em class="copycode" style="cursor:pointer;font-size:12px;color:#369 !important;">复制代码</em></div><pre class="brush: xml; gutter: true">
# 监听任意网卡,多网卡可指定对应ip
address: 0.0.0.0
port: 8888
# 如果无需验证填 false
auth: true
# 如果不需要 https 则填 false
tls: false
# https证书和密钥,如果 tls 为 false,cert 和 key 不需要
cert: D:/XXXX.pem
key: D:/XXXX..key
# 访问前缀,建议默认
prefix: /

# 如果 auth 为 false 生效,文件共享的路径
scope: E:/workspace/webdav
# 是否允许修改
modify: true
rules: []

# 跨域设置
cors:
enabled: true
credentials: true
allowed_headers:
    - Depth
allowed_hosts:
    - http://localhost:888
allowed_methods:
    - GET
exposed_headers:
    - Content-Length
    - Content-Range

# 用户信息,如果 auth 为 true 生效
users:
- username: user
    password: 123
    scope: E:/XXXX/Joplin
</pre></div><br />
<br />
<font size="4"><font color="#808000">c.安装使用Joplin,笔记软件。</font></font><br />
<font size="4"><font color="#808000">&nbsp; &nbsp;</font></font><font size="4">打开 工具---选项---同步,选择webdav,URL填写你的服务器地址或者域名地址。</font><br />
<div style="padding:15px 0;"><div style="font-size:12px;"> <em class="viewsource" style="cursor:pointer;font-size:12px;color:#369 !important;">纯文本查看</em> <em class="copycode" style="cursor:pointer;font-size:12px;color:#369 !important;">复制代码</em></div><pre class="brush: html; gutter: true">http://www.xxxx.com:8888/</pre></div><br />
&nbsp;&nbsp;webdav用户名密码在yaml里面配置的。<br />
&nbsp;&nbsp;保存,走你~~~<br />
<br />
下载地址:<br />
打不开的可以打开下steam++加速器。<br />
joplin:<br />
https://github.com/laurent22/joplin<br />
webdav软件:<br />
https://github.com/hacdias/webdav

qwxa 发表于 2022-5-19 22:37:00

只是joplin的话,可以直接用onedrive的,不用找公网IP自建webdev

osmake 发表于 2022-5-23 10:40:00

joplin仍然有一个问题无法解决,你上传的图片无法从云端删除,按照这个软件的逻辑,是把你上传的图片按照他的格式保存一份(webdav或者自定义盘),然后再按照另外一个格式保存一份在系统盘,你删除的笔记在他两个保存的地方都不会同步删除,只能通过joplin客户端,导出所有笔记,然后把两个位置的文件全删除,再导入,再同步。<br />
因此,正常使用下不会出现什么问题。但如果有大量图片存入,内存只会越用越多,只能通过手动删除。<br />
详情内容github有,时间18,20年的提问

smallmouse228 发表于 2022-5-19 20:52:00

感谢分享!!!

旺仔大馒头 发表于 2022-5-19 20:52:00

第一次沙发,支持一下

oyes001 发表于 2022-5-19 20:57:00

先支持一下,感谢楼主的分享,学习学习

tian5i 发表于 2022-5-19 21:18:00

用Resilio Sync岂不是更方便?

柳岸红尘客 发表于 2022-5-19 21:26:00

感谢分享

RileyW 发表于 2022-5-19 21:31:00

感谢分享!!!

夏夜吉他 发表于 2022-5-19 21:39:00

先支持后欣赏!
页: [1] 2
查看完整版本: 开源Markdown笔记软件Joplin,可自己搭建云笔记