mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-21 15:56:10 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
b260d7447a
5 changed files with 30 additions and 12 deletions
|
|
@ -319,6 +319,7 @@ ${accountHTML}
|
|||
writeText(window.siyuan.config.repo.key);
|
||||
});
|
||||
modelMainElement.querySelector("#token").addEventListener("click", () => {
|
||||
showMessage(window.siyuan.languages.copied);
|
||||
writeText(window.siyuan.config.api.token);
|
||||
});
|
||||
modelMainElement.querySelector("#exportData").addEventListener("click", () => {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,16 @@
|
|||
export const writeText = async (text: string) => {
|
||||
try {
|
||||
// navigator.clipboard.writeText 抛出异常不进入 catch,这里需要先处理移动端复制
|
||||
if ("android" === window.siyuan.config.system.container && window.JSAndroid) {
|
||||
|
||||
window.JSAndroid.writeClipboard(text);
|
||||
return;
|
||||
}
|
||||
if ("ios" === window.siyuan.config.system.container && window.webkit?.messageHandlers) {
|
||||
window.webkit.messageHandlers.setClipboard.postMessage(text);
|
||||
return;
|
||||
}
|
||||
|
||||
navigator.clipboard.writeText(text);
|
||||
} catch (e) {
|
||||
if (window.siyuan.config.system.container === "ios" && window.webkit?.messageHandlers) {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ require (
|
|||
github.com/patrickmn/go-cache v2.1.0+incompatible
|
||||
github.com/qiniu/go-sdk/v7 v7.13.0
|
||||
github.com/radovskyb/watcher v1.0.7
|
||||
github.com/siyuan-note/dejavu v0.0.0-20220616034124-40a031c36730
|
||||
github.com/siyuan-note/dejavu v0.0.0-20220616050739-e25262132c10
|
||||
github.com/siyuan-note/encryption v0.0.0-20220612074546-f1dd94fe8676
|
||||
github.com/siyuan-note/filelock v0.0.0-20220615164210-064676f342aa
|
||||
github.com/vmihailenco/msgpack/v5 v5.3.5
|
||||
|
|
@ -109,7 +109,8 @@ require (
|
|||
|
||||
replace github.com/mattn/go-sqlite3 => github.com/88250/go-sqlite3 v1.14.13-0.20220412041952-88c3aaa8595e
|
||||
|
||||
//replace github.com/siyuan-note/dejavu => D:\88250\dejavu
|
||||
replace github.com/siyuan-note/dejavu => D:\88250\dejavu
|
||||
|
||||
//replace github.com/88250/lute => D:\gogogo\src\github.com\88250\lute
|
||||
//replace github.com/88250/enumfonts => D:\88250\enumfonts
|
||||
//replace github.com/88250/pdfcpu => D:\88250\pdfcpu
|
||||
|
|
|
|||
|
|
@ -419,10 +419,6 @@ github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJ
|
|||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw=
|
||||
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20220615164826-201b6516adf3 h1:pWPKLb4bpv5Cj8jErsuVKAvXqmudz+0XVfVWZjVxGJc=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20220615164826-201b6516adf3/go.mod h1:0XMLF+6gtwqr3ZJTk3nZmNbmQ4xNdaoP9RXKDR2ggkw=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20220616034124-40a031c36730 h1:leFyjVzzx8/6upv6ciFl3tVZtTkXGi+71NESaMeuC30=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20220616034124-40a031c36730/go.mod h1:0XMLF+6gtwqr3ZJTk3nZmNbmQ4xNdaoP9RXKDR2ggkw=
|
||||
github.com/siyuan-note/encryption v0.0.0-20220612074546-f1dd94fe8676 h1:QB9TjJQFhXhZ6dAtPpY02DlzHAQm1C+WqZq6OadG8mI=
|
||||
github.com/siyuan-note/encryption v0.0.0-20220612074546-f1dd94fe8676/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw=
|
||||
github.com/siyuan-note/filelock v0.0.0-20220615164210-064676f342aa h1:6bXZdsdA5EU1NUChdFV4EwH8nvYUis0H1TxwgadLM38=
|
||||
|
|
@ -657,8 +653,6 @@ golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBc
|
|||
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20211020174200-9d6173849985/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220614162138-6c1b26c55098 h1:PgOr27OhUx2IRqGJ2RxAWI4dJQ7bi9cSrB82uzFzfUA=
|
||||
golang.org/x/sys v0.0.0-20220614162138-6c1b26c55098/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c h1:aFV+BgZ4svzjfabn8ERpuB4JI4N6/rdy1iusx77G3oU=
|
||||
golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import (
|
|||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
|
|
@ -214,13 +215,23 @@ func indexRepoBeforeCloudSync() {
|
|||
}
|
||||
|
||||
start := time.Now()
|
||||
_, err = repo.Index("[Auto] Cloud sync", nil, nil)
|
||||
latest, err := repo.Latest()
|
||||
index, err := repo.Index("[Auto] Cloud sync", nil, nil)
|
||||
if nil != err {
|
||||
util.LogErrorf("index repo before cloud sync failed: %s", err)
|
||||
return
|
||||
}
|
||||
elapsed := time.Since(start).Milliseconds()
|
||||
if 7000 < elapsed {
|
||||
util.LogWarnf("index repo before cloud sync elapsed [%dms]", elapsed)
|
||||
elapsed := time.Since(start)
|
||||
if nil != latest && latest.ID != index.ID {
|
||||
// 对新创建的快照需要更新备注,加入耗时统计
|
||||
index.Memo = fmt.Sprintf("[Auto] Cloud sync, completed in [%.2fs]", elapsed.Seconds())
|
||||
err = repo.PutIndex(index)
|
||||
if nil != err {
|
||||
util.LogErrorf("put index into repo before cloud sync failed: %s", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
if 7000 < elapsed.Milliseconds() {
|
||||
util.LogWarnf("index repo before cloud sync elapsed [%dms]", elapsed.Milliseconds())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue