Giter VIP home page Giter VIP logo

tw-mobile-sync's Introduction

TiddlyWiki5 Mobile Sync

Sync data between Mobile HTML (TidGi-Mobile/Tiddloid/Quine2) <-> Desktop App (TidGi-Desktop/NodeJS Server).

Install

From CPL.

Or from Github Release.

Why this plugin

To enjoy the REST API of TiddlyWiki and privacy of local stored data, we choose to use TidGi on the Desktop.

We can open localhost wiki on the Tiddloid or on a browser on the Mobile, but it's not possible to sync data back to the desktop, if the ip of desktop wiki has changed. (Mobile don't know where is the desktop wiki to sync back.) So we need a plugin to keep track of the known ip of the desktop wiki, allow user to click on a desktop ip and sync data back to that desktop wiki.

And you may write some tiddlers in the subway when you getting home, these tiddlers may have conflict with the one in your home's desktop wiki, we need this plugin to handle it.

Usage

See Demo site or src/readme.tid.

How this works (TODO)

和手机同步的插件,不做成 saver,就是做成一个按钮,以保证不和 saver 冲突。

保存一个服务器列表和相应的最近同步时间(如果服务器重启 wifi 之后 ip 变了,时间会归古) 在手机上点击同步按钮后,筛选本地创建或修改时间晚于同步时间的条目,以及上次同步时间,POST 给 nodejs 端的 API。 nodejs 端写一个服务端 api 来接收 POST 请求,如果服务端修改时间都早于上次同步时间,就用客户端的覆盖,如果服务端有晚于上次同步时间的要被覆盖了,就用 conflict mark 把两边的内容合到一起去,然后用 server send 来催促界面更新。 然后服务端同样返回一个 JSON 列表,把覆盖操作后的,上次同步以来的条目返回给 HTML 端,HTML 端同样覆盖内容到本地。

如果有冲突的地方是字段内容就麻烦了,比如 modify time 就肯定会冲突。所以干脆忽略字段的冲突,用一个配置项来规定字段冲突时使用哪一边的,默认用手机端的。

如果能用 git 获取到上一个版本,则用 https://www.npmjs.com/package/node-diff3 圈定比较准确的冲突范围给用户看。实际上冲突应该不多,所以这个应该不常运行。

按下同步按钮后会弹出一个服务器列表,可以新建。然后每个服务器上有一个绿灯表示可连通(所以还需要一个 get 的 status API 表示已安装同步插件) 还显示上次同步时间到现在的距离。

也可以在移动端修改条目之前,将内容存放在一个 state tiddler 里,从而用上三路消歧。

tw-mobile-sync's People

Contributors

linonetwo avatar renovate-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

tw-mobile-sync's Issues

feature: 添加太记HTTP API的开启提示

Description 描述

没开启HTTP API或者关闭鉴权会提示连接失败,然后排查该问题对于小白来说不容易。

Additional Context 额外上下文

No response

在手机端tiddloid中更改某一个条目的title字段,点击同步后,未同步原条目,而是新建了新的条目。

  1. 描述:

    • 在手机端更改条目名称,比如把一个条目的名称 “111” 改为 “222” ,然后点击同步,电脑上的条目 “111” 未改变,但直接增加了一个新的条目 “222” 。此时手机端只有一个修改过的条目 “222” ,电脑端有两个条目——条目 “111” 和条目 “222” 。这可能是因为tw-mobile-sync插件把 “修改过名称的条目” 当作 “刚创建的新条目” 同步了。
  2. 问题:

    1. 插件是根据title字段的值来对应“原条目”和“修改后的条目”吗?
    2. 为什么不根据对于每一个条目而言都独一无二的created字段的值来对应“原条目”和“修改后的条目”呢?
  3. 请求

    • 能否同步“修改过名称的条目”呢

empty server

$:/state/tw-mobile-sync/server/existed/scan-qr-widget-open

offline

生成offline文件会报错

本地上使用是不会报错的。但我推上去,生成的网站会报错。

3~S(%4NFH 4BR}467OM1 R

image

后面我删除了这个插件也同样会报错。

因为我想生成offline文件,然后用https://github.com/tiddly-gittly/TW5-T-ONLINE的一些配置文件。就出现上面的问题了。正常直接使用太记默认模板不会出现上面的问题。(应该吧,因为我不怎么用这个插件。唯一一个用的是私人wiki。)更新的时候或许可以排查一下这个问题。

从 git 获取数据源

因为之后可能让墨鱼插件、每日任务不会更新 modified 字段,所以可能没法靠它来识别了,需要靠 git 的信息来识别。

需要考虑有人一直不提交git、压缩commit的特殊情况。也可以用桌面端的 sqlite 来记录。

Error: Failed to fetch

browser-background-sync.js:1 tw-html-nodejs-sync can't connect to tw nodejs side. Error: Failed to fetch

移动端不应该一直 fetch client-info,这是桌面端用的

exclude pdf

they are too large

and tiddloid not support showing pdf

SSE

get client info can use this instead of poll

Failed to load resource: net::ERR_NAME_NOT_RESOLVED

tw-mobile-sync can't connect to tw nodejs side. Error: Failed to fetch
getConnectedClientStatus @ browser-background-sync.js:11
await in getConnectedClientStatus (async)
onSyncStart @ browser-background-sync.js:11
eval @ browser-background-sync.js:11

GET http://tw-mobile-sync/client-info net::ERR_NAME_NOT_RESOLVED
getConnectedClientStatus @ browser-background-sync.js:11
onSyncStart @ browser-background-sync.js:11
eval @ browser-background-sync.js:11

Dependency Dashboard

This issue provides visibility into Renovate updates and their statuses. Learn more

This repository currently has no open or pending branches.


  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.