Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
ddee980f24
16 changed files with 123 additions and 52 deletions
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"keywordsLimit": "Keywords Limit",
|
||||
"exportAsImage": "Export as image",
|
||||
"exportBySiYuan": "Export by SiYuan",
|
||||
"featureBetaStage": "This feature support is currently in the free public beta stage, and there is no clear charging plan yet, please know",
|
||||
|
@ -864,7 +865,7 @@
|
|||
"35": "Rebuilding index, please wait...",
|
||||
"36": "There is too much content in the historical document, in order not to affect performance, it has been switched to plain text display",
|
||||
"37": "Do not include spaces and special symbols in the name of the cloud sync directory",
|
||||
"38": "The number of mentioned keywords [%d] is too many, currently only supports up to [512] keywords",
|
||||
"38": "Too many keywords mentioned [%d], adjust if necessary [Settings - Search - Backlink Mentions - Keyword Limit]",
|
||||
"39": "Deleting index %s",
|
||||
"40": "Inserting index %s",
|
||||
"41": "Upload completed",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"keywordsLimit": "Límite de palabras clave",
|
||||
"exportAsImage": "Exportar como imagen",
|
||||
"exportBySiYuan": "Exportar por SiYuan",
|
||||
"featureBetaStage": "El soporte de esta función se encuentra actualmente en la etapa beta pública gratuita, y aún no hay un plan de carga claro, tenga en cuenta",
|
||||
|
@ -864,7 +865,7 @@
|
|||
"35": "Reconstruyendo el índice, por favor espere...",
|
||||
"36": "Hay demasiado contenido en el documento historico, para no afectar el rendimiento, se ha cambiado a visualizacion de texto sin formato",
|
||||
"37": "No incluyas espacios ni símbolos especiales en el nombre del directorio de sincronización con la nube",
|
||||
"38": "El número de palabras clave mencionadas [%d] son demasiados, actualmente solo admite hasta [512] palabras clave",
|
||||
"38": "Demasiadas palabras clave mencionadas [%d], ajústelas si es necesario [Configuración - Búsqueda - Menciones de backlinks - Límite de palabras clave]",
|
||||
"39": "Eliminando índice %s",
|
||||
"40": "Insertando índice %s",
|
||||
"41": "Carga completada",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"keywordsLimit": "Limite de mots clés",
|
||||
"exportAsImage": "Exporter en tant qu'image",
|
||||
"exportBySiYuan": "Exporter par SiYuan",
|
||||
"featureBetaStage": "La prise en charge de cette fonctionnalité est actuellement en phase de bêta publique gratuite et il n'y a pas encore de plan de facturation clair, veuillez savoir",
|
||||
|
@ -864,7 +865,7 @@
|
|||
"35": "Recréation de l'index, veuillez patienter...",
|
||||
"36": "Il y a trop de contenu dans le document historique, afin de ne pas affecter les performances, il a été basculé sur l'affichage en texte brut",
|
||||
"37": "N'incluez pas d'espaces et de symboles spéciaux dans le nom du répertoire de synchronisation cloud",
|
||||
"38": "Le nombre de mots-clés mentionnés [%d] est trop élevé, ne prend actuellement en charge que jusqu'à [512] mots-clés",
|
||||
"38": "Trop de mots-clés mentionnés [%d], ajustez si nécessaire [Paramètres - Recherche - Mentions de backlink - Limite de mots-clés]",
|
||||
"39": "Suppression de l'index %s",
|
||||
"40": "Insertion de l'index %s",
|
||||
"41": "Transfert complété",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"keywordsLimit": "關鍵字數量限制",
|
||||
"exportAsImage": "導出為圖片",
|
||||
"exportBySiYuan": "由思源筆記導出",
|
||||
"featureBetaStage": "該特性支持目前處於免費公測階段,目前尚未有明確的收費計劃,請悉知",
|
||||
|
@ -864,7 +865,7 @@
|
|||
"35": "正在重建索引,請稍等...",
|
||||
"36": "歷史文檔內容太多,為了不影響性能,已經切換為純文本顯示",
|
||||
"37": "雲端同步目錄的名稱請勿包含空格和特殊符號",
|
||||
"38": "提及關鍵字數量 [%d] 過多,目前最多僅支援搜索 [512] 個關鍵字",
|
||||
"38": "提及關鍵字數量 [%d] 過多,如有需要可以調整 [設置 - 搜索 - 反鏈提及 - 關鍵字數量限制]",
|
||||
"39": "正在刪除索引 %s",
|
||||
"40": "正在插入索引 %s",
|
||||
"41": "上傳完畢",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"keywordsLimit": "关键字数量限制",
|
||||
"exportAsImage": "导出为图片",
|
||||
"exportBySiYuan": "由思源笔记导出",
|
||||
"featureBetaStage": "该特性支持目前处于免费公测阶段,目前尚未有明确的收费计划,请悉知",
|
||||
|
@ -864,7 +865,7 @@
|
|||
"35": "正在重建索引,请稍等...",
|
||||
"36": "历史文档内容太多,为了不影响性能,已经切换为纯文本显示",
|
||||
"37": "云端同步目录的名称请勿包含空格和特殊符号",
|
||||
"38": "提及关键字数量 [%d] 过多,目前最多仅支持搜索 [512] 个关键字",
|
||||
"38": "提及关键字数量 [%d] 过多,如有需要可以调整 [设置 - 搜索 - 反链提及 - 关键字数量限制]",
|
||||
"39": "正在删除索引 %s",
|
||||
"40": "正在插入索引 %s",
|
||||
"41": "上传完毕",
|
||||
|
|
|
@ -149,6 +149,10 @@ export const query = {
|
|||
<span class="fn__space"></span>
|
||||
<input class="b3-switch fn__flex-center" id="backlinkMentionDoc" type="checkbox"${window.siyuan.config.search.backlinkMentionDoc ? " checked" : ""}/>
|
||||
</label>
|
||||
|
||||
${window.siyuan.languages.keywordsLimit}
|
||||
<span class="fn__space"></span>
|
||||
<input class="b3-text-field fn__flex-center fn__size200" id="backlinkMentionKeywordsLimit" type="number" min="1" max="10240" value="${window.siyuan.config.search.backlinkMentionKeywordsLimit}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="b3-label">
|
||||
|
@ -182,7 +186,10 @@ export const query = {
|
|||
<span class="fn__space"></span>
|
||||
<input class="b3-switch fn__flex-center" id="virtualRefDoc" type="checkbox"${window.siyuan.config.search.virtualRefDoc ? " checked" : ""}/>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
${window.siyuan.languages.keywordsLimit}
|
||||
<span class="fn__space"></span>
|
||||
<input class="b3-text-field fn__flex-center fn__size200" id="virtualRefKeywordsLimit" type="number" min="1" max="10240" value="${window.siyuan.config.search.virtualRefKeywordsLimit}">
|
||||
</div>
|
||||
<label class="fn__flex b3-label">
|
||||
<div class="fn__flex-1">
|
||||
|
@ -226,10 +233,12 @@ export const query = {
|
|||
backlinkMentionAlias: (query.element.querySelector("#backlinkMentionAlias") as HTMLInputElement).checked,
|
||||
backlinkMentionAnchor: (query.element.querySelector("#backlinkMentionAnchor") as HTMLInputElement).checked,
|
||||
backlinkMentionDoc: (query.element.querySelector("#backlinkMentionDoc") as HTMLInputElement).checked,
|
||||
backlinkMentionKeywordsLimit: parseInt((query.element.querySelector("#backlinkMentionKeywordsLimit") as HTMLInputElement).value),
|
||||
virtualRefName: (query.element.querySelector("#virtualRefName") as HTMLInputElement).checked,
|
||||
virtualRefAlias: (query.element.querySelector("#virtualRefAlias") as HTMLInputElement).checked,
|
||||
virtualRefAnchor: (query.element.querySelector("#virtualRefAnchor") as HTMLInputElement).checked,
|
||||
virtualRefDoc: (query.element.querySelector("#virtualRefDoc") as HTMLInputElement).checked,
|
||||
virtualRefKeywordsLimit: parseInt((query.element.querySelector("#virtualRefKeywordsLimit") as HTMLInputElement).value),
|
||||
}, response => {
|
||||
window.siyuan.config.search = response.data;
|
||||
});
|
||||
|
|
|
@ -77,6 +77,14 @@ const renderProvider = (provider: number) => {
|
|||
<option ${window.siyuan.config.sync.s3.pathStyle ? "" : "selected"} value="false">Virtual-hosted-style</option>
|
||||
<option ${window.siyuan.config.sync.s3.pathStyle ? "selected" : ""} value="true">Path-style</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="b3-label b3-label--noborder">
|
||||
<div>TLS verify</div>
|
||||
<div class="fn__hr"></div>
|
||||
<select class="b3-select fn__block" id="s3SkipTlsVerify">
|
||||
<option ${window.siyuan.config.sync.s3.skipTlsVerify ? "" : "selected"} value="false">Verify</option>
|
||||
<option ${window.siyuan.config.sync.s3.skipTlsVerify ? "selected" : ""} value="true">Skip</option>
|
||||
</select>
|
||||
</div>`;
|
||||
}
|
||||
return `${tip}
|
||||
|
@ -112,6 +120,14 @@ const renderProvider = (provider: number) => {
|
|||
<option ${window.siyuan.config.sync.s3.pathStyle ? "" : "selected"} value="false">Virtual-hosted-style</option>
|
||||
<option ${window.siyuan.config.sync.s3.pathStyle ? "selected" : ""} value="true">Path-style</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="b3-label b3-label--noborder fn__flex">
|
||||
<div class="fn__flex-center fn__size200">TLS Verify</div>
|
||||
<div class="fn__space"></div>
|
||||
<select class="b3-select fn__flex-1" id="s3SkipTlsVerify">
|
||||
<option ${window.siyuan.config.sync.s3.skipTlsVerify ? "" : "selected"} value="false">Verify</option>
|
||||
<option ${window.siyuan.config.sync.s3.skipTlsVerify ? "selected" : ""} value="true">Skip</option>
|
||||
</select>
|
||||
</label>`;
|
||||
} else if (provider === 3) {
|
||||
const tip = `<div class="b3-label b3-label--inner">
|
||||
|
@ -137,6 +153,14 @@ const renderProvider = (provider: number) => {
|
|||
<div>Password</div>
|
||||
<div class="fn__hr"></div>
|
||||
<input id="password" class="b3-text-field fn__block" value="${window.siyuan.config.sync.webdav.password}">
|
||||
</div>
|
||||
<div class="b3-label b3-label--noborder">
|
||||
<div>TLS verify</div>
|
||||
<div class="fn__hr"></div>
|
||||
<select class="b3-select fn__block" id="webdavSkipTlsVerify">
|
||||
<option ${window.siyuan.config.sync.webdav.skipTlsVerify ? "" : "selected"} value="false">Verify</option>
|
||||
<option ${window.siyuan.config.sync.webdav.skipTlsVerify ? "selected" : ""} value="true">Skip</option>
|
||||
</select>
|
||||
</div>`;
|
||||
}
|
||||
return `${tip}
|
||||
|
@ -154,6 +178,14 @@ const renderProvider = (provider: number) => {
|
|||
<div class="fn__flex-center fn__size200">Password</div>
|
||||
<div class="fn__space"></div>
|
||||
<input id="password" class="b3-text-field fn__flex-1" value="${window.siyuan.config.sync.webdav.password}">
|
||||
</label>
|
||||
<label class="b3-label b3-label--noborder fn__flex">
|
||||
<div class="fn__flex-center fn__size200">TLS Verify</div>
|
||||
<div class="fn__space"></div>
|
||||
<select class="b3-select fn__flex-1" id="webdavSkipTlsVerify">
|
||||
<option ${window.siyuan.config.sync.webdav.skipTlsVerify ? "" : "selected"} value="false">Verify</option>
|
||||
<option ${window.siyuan.config.sync.webdav.skipTlsVerify ? "selected" : ""} value="true">Skip</option>
|
||||
</select>
|
||||
</label>`;
|
||||
}
|
||||
return "";
|
||||
|
@ -222,6 +254,7 @@ const bindProviderEvent = () => {
|
|||
bucket: (providerPanelElement.querySelector("#bucket") as HTMLInputElement).value,
|
||||
pathStyle: (providerPanelElement.querySelector("#pathStyle") as HTMLInputElement).value === "true",
|
||||
region: (providerPanelElement.querySelector("#region") as HTMLInputElement).value,
|
||||
skipTlsVerify: (providerPanelElement.querySelector("#s3SkipTlsVerify") as HTMLInputElement).value === "true",
|
||||
};
|
||||
fetchPost("/api/sync/setSyncProviderS3", {s3}, () => {
|
||||
window.siyuan.config.sync.s3 = s3;
|
||||
|
@ -231,6 +264,7 @@ const bindProviderEvent = () => {
|
|||
endpoint: (providerPanelElement.querySelector("#endpoint") as HTMLInputElement).value,
|
||||
username: (providerPanelElement.querySelector("#username") as HTMLInputElement).value,
|
||||
password: (providerPanelElement.querySelector("#password") as HTMLInputElement).value,
|
||||
skipTlsVerify: (providerPanelElement.querySelector("#webdavSkipTlsVerify") as HTMLInputElement).value === "true",
|
||||
};
|
||||
fetchPost("/api/sync/setSyncProviderWebDAV", {webdav}, () => {
|
||||
window.siyuan.config.sync.webdav = webdav;
|
||||
|
|
4
app/src/types/index.d.ts
vendored
4
app/src/types/index.d.ts
vendored
|
@ -340,11 +340,13 @@ declare interface IConfig {
|
|||
secretKey: string
|
||||
bucket: string
|
||||
region: string
|
||||
skipTlsVerify: boolean
|
||||
}
|
||||
webdav: {
|
||||
endpoint: string
|
||||
username: string
|
||||
password: string
|
||||
skipTlsVerify: boolean
|
||||
}
|
||||
},
|
||||
lang: string
|
||||
|
@ -414,10 +416,12 @@ declare interface IConfig {
|
|||
backlinkMentionAlias: boolean
|
||||
backlinkMentionAnchor: boolean
|
||||
backlinkMentionDoc: boolean
|
||||
backlinkMentionKeywordsLimit: boolean
|
||||
virtualRefName: boolean
|
||||
virtualRefAlias: boolean
|
||||
virtualRefAnchor: boolean
|
||||
virtualRefDoc: boolean
|
||||
virtualRefKeywordsLimit: boolean
|
||||
},
|
||||
stat: {
|
||||
treeCount: number
|
||||
|
|
|
@ -45,15 +45,17 @@ type Search struct {
|
|||
Memo bool `json:"memo"`
|
||||
Custom bool `json:"custom"`
|
||||
|
||||
BacklinkMentionName bool `json:"backlinkMentionName"`
|
||||
BacklinkMentionAlias bool `json:"backlinkMentionAlias"`
|
||||
BacklinkMentionAnchor bool `json:"backlinkMentionAnchor"`
|
||||
BacklinkMentionDoc bool `json:"backlinkMentionDoc"`
|
||||
BacklinkMentionName bool `json:"backlinkMentionName"`
|
||||
BacklinkMentionAlias bool `json:"backlinkMentionAlias"`
|
||||
BacklinkMentionAnchor bool `json:"backlinkMentionAnchor"`
|
||||
BacklinkMentionDoc bool `json:"backlinkMentionDoc"`
|
||||
BacklinkMentionKeywordsLimit int `json:"backlinkMentionKeywordsLimit"`
|
||||
|
||||
VirtualRefName bool `json:"virtualRefName"`
|
||||
VirtualRefAlias bool `json:"virtualRefAlias"`
|
||||
VirtualRefAnchor bool `json:"virtualRefAnchor"`
|
||||
VirtualRefDoc bool `json:"virtualRefDoc"`
|
||||
VirtualRefName bool `json:"virtualRefName"`
|
||||
VirtualRefAlias bool `json:"virtualRefAlias"`
|
||||
VirtualRefAnchor bool `json:"virtualRefAnchor"`
|
||||
VirtualRefDoc bool `json:"virtualRefDoc"`
|
||||
VirtualRefKeywordsLimit int `json:"virtualRefKeywordsLimit"`
|
||||
}
|
||||
|
||||
func NewSearch() *Search {
|
||||
|
@ -78,15 +80,17 @@ func NewSearch() *Search {
|
|||
Memo: true,
|
||||
Custom: false,
|
||||
|
||||
BacklinkMentionName: true,
|
||||
BacklinkMentionAlias: false,
|
||||
BacklinkMentionAnchor: true,
|
||||
BacklinkMentionDoc: true,
|
||||
BacklinkMentionName: true,
|
||||
BacklinkMentionAlias: false,
|
||||
BacklinkMentionAnchor: true,
|
||||
BacklinkMentionDoc: true,
|
||||
BacklinkMentionKeywordsLimit: 512,
|
||||
|
||||
VirtualRefName: true,
|
||||
VirtualRefAlias: false,
|
||||
VirtualRefAnchor: true,
|
||||
VirtualRefDoc: true,
|
||||
VirtualRefName: true,
|
||||
VirtualRefAlias: false,
|
||||
VirtualRefAnchor: true,
|
||||
VirtualRefDoc: true,
|
||||
VirtualRefKeywordsLimit: 512,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,18 +39,20 @@ func NewSync() *Sync {
|
|||
}
|
||||
|
||||
type S3 struct {
|
||||
Endpoint string `json:"endpoint"` // 服务端点
|
||||
AccessKey string `json:"accessKey"` // Access Key
|
||||
SecretKey string `json:"secretKey"` // Secret Key
|
||||
Bucket string `json:"bucket"` // 存储空间
|
||||
Region string `json:"region"` // 存储区域
|
||||
PathStyle bool `json:"pathStyle"` // 是否使用路径风格
|
||||
Endpoint string `json:"endpoint"` // 服务端点
|
||||
AccessKey string `json:"accessKey"` // Access Key
|
||||
SecretKey string `json:"secretKey"` // Secret Key
|
||||
Bucket string `json:"bucket"` // 存储空间
|
||||
Region string `json:"region"` // 存储区域
|
||||
PathStyle bool `json:"pathStyle"` // 是否使用路径风格
|
||||
SkipTlsVerify bool `json:"skipTlsVerify"` // 是否跳过 TLS 验证
|
||||
}
|
||||
|
||||
type WebDAV struct {
|
||||
Endpoint string `json:"endpoint"` // 服务端点
|
||||
Username string `json:"username"` // 用户名
|
||||
Password string `json:"password"` // 密码
|
||||
Endpoint string `json:"endpoint"` // 服务端点
|
||||
Username string `json:"username"` // 用户名
|
||||
Password string `json:"password"` // 密码
|
||||
SkipTlsVerify bool `json:"skipTlsVerify"` // 是否跳过 TLS 验证
|
||||
}
|
||||
|
||||
const (
|
||||
|
|
|
@ -36,7 +36,7 @@ require (
|
|||
github.com/panjf2000/ants/v2 v2.6.0
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible
|
||||
github.com/radovskyb/watcher v1.0.7
|
||||
github.com/siyuan-note/dejavu v0.0.0-20221116031102-5d5af638b8e5
|
||||
github.com/siyuan-note/dejavu v0.0.0-20221116103627-5fbf73fe103e
|
||||
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75
|
||||
github.com/siyuan-note/eventbus v0.0.0-20220916025349-3ac6e75522da
|
||||
github.com/siyuan-note/filelock v0.0.0-20221007163134-7e64809023ef
|
||||
|
|
|
@ -359,8 +359,8 @@ github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82/go.mod h1:TCR1l
|
|||
github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||
github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4=
|
||||
github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20221116031102-5d5af638b8e5 h1:m4+9OWYEKS832LJ9E1eAiUz0ATQAUo7gFs7E5S9JSho=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20221116031102-5d5af638b8e5/go.mod h1:PiWhnZhdVqhY0FifDg6kXwn75V97Dg3U/nFeD76fBis=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20221116103627-5fbf73fe103e h1:gwI3Zo+ce5GPZlau8kMcUipZwY1yJFjeG8ghwxB6YW4=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20221116103627-5fbf73fe103e/go.mod h1:PiWhnZhdVqhY0FifDg6kXwn75V97Dg3U/nFeD76fBis=
|
||||
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 h1:Bi7/7f29LW+Fm0cHc0J1NO1cZqyJwljSWVmfOqVZgaE=
|
||||
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw=
|
||||
github.com/siyuan-note/eventbus v0.0.0-20220916025349-3ac6e75522da h1:/jNhl7LC+9BhkWvNxuJDdsNfA/2wvfuj9mqWx4CbV90=
|
||||
|
|
|
@ -737,7 +737,7 @@ func searchBackmention(mentionKeywords []string, keyword string, excludeBacklink
|
|||
buf := bytes.Buffer{}
|
||||
buf.WriteString("SELECT * FROM " + table + " WHERE " + table + " MATCH '{content}:(")
|
||||
for i, mentionKeyword := range mentionKeywords {
|
||||
if 511 < i { // 提及搜索最大限制 https://github.com/siyuan-note/siyuan/issues/3715
|
||||
if Conf.Search.BacklinkMentionKeywordsLimit < i {
|
||||
util.PushMsg(fmt.Sprintf(Conf.Language(38), len(mentionKeywords)), 5000)
|
||||
mentionKeyword = strings.ReplaceAll(mentionKeyword, "\"", "\"\"")
|
||||
buf.WriteString("\"" + mentionKeyword + "\"")
|
||||
|
|
|
@ -278,6 +278,12 @@ func InitConf() {
|
|||
if 1 > Conf.Search.Limit {
|
||||
Conf.Search.Limit = 64
|
||||
}
|
||||
if 1 > Conf.Search.BacklinkMentionKeywordsLimit {
|
||||
Conf.Search.BacklinkMentionKeywordsLimit = 512
|
||||
}
|
||||
if 1 > Conf.Search.VirtualRefKeywordsLimit {
|
||||
Conf.Search.VirtualRefKeywordsLimit = 512
|
||||
}
|
||||
|
||||
if nil == Conf.Stat {
|
||||
Conf.Stat = conf.NewStat()
|
||||
|
|
|
@ -824,16 +824,17 @@ func newRepository() (ret *dejavu.Repo, err error) {
|
|||
case conf.ProviderSiYuan:
|
||||
cloudRepo = cloud.NewSiYuan(&cloud.BaseCloud{Conf: cloudConf})
|
||||
case conf.ProviderS3:
|
||||
cloudRepo = cloud.NewS3(&cloud.BaseCloud{Conf: cloudConf})
|
||||
s3HTTPClient := &http.Client{Transport: &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: cloudConf.S3.SkipTlsVerify}}}
|
||||
s3HTTPClient.Timeout = 30 * time.Second
|
||||
cloudRepo = cloud.NewS3(&cloud.BaseCloud{Conf: cloudConf}, s3HTTPClient)
|
||||
case conf.ProviderWebDAV:
|
||||
webdavClient := gowebdav.NewClient(cloudConf.Endpoint, cloudConf.Username, cloudConf.Password)
|
||||
a := cloudConf.Username + ":" + cloudConf.Password
|
||||
webdavClient := gowebdav.NewClient(cloudConf.WebDAV.Endpoint, cloudConf.WebDAV.Username, cloudConf.WebDAV.Password)
|
||||
a := cloudConf.WebDAV.Username + ":" + cloudConf.WebDAV.Password
|
||||
auth := "Basic " + base64.StdEncoding.EncodeToString([]byte(a))
|
||||
webdavClient.SetHeader("Authorization", auth)
|
||||
webdavClient.SetHeader("User-Agent", util.UserAgent)
|
||||
webdavClient.SetTimeout(30 * time.Second)
|
||||
// WebDAV 数据同步跳过 HTTPS 证书校验 https://github.com/siyuan-note/siyuan/issues/6556
|
||||
webdavClient.SetTransport(&http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}})
|
||||
webdavClient.SetTransport(&http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: cloudConf.WebDAV.SkipTlsVerify}})
|
||||
cloudRepo = cloud.NewWebDAV(&cloud.BaseCloud{Conf: cloudConf}, webdavClient)
|
||||
default:
|
||||
err = fmt.Errorf("unknown cloud provider [%d]", Conf.Sync.Provider)
|
||||
|
@ -1048,16 +1049,22 @@ func buildCloudConf() (ret *cloud.Conf, err error) {
|
|||
case conf.ProviderSiYuan:
|
||||
ret.Endpoint = "https://siyuan-data.b3logfile.com/"
|
||||
case conf.ProviderS3:
|
||||
ret.Endpoint = Conf.Sync.S3.Endpoint
|
||||
ret.AccessKey = Conf.Sync.S3.AccessKey
|
||||
ret.SecretKey = Conf.Sync.S3.SecretKey
|
||||
ret.Bucket = Conf.Sync.S3.Bucket
|
||||
ret.Region = Conf.Sync.S3.Region
|
||||
ret.PathStyle = Conf.Sync.S3.PathStyle
|
||||
ret.S3 = &cloud.ConfS3{
|
||||
Endpoint: Conf.Sync.S3.Endpoint,
|
||||
AccessKey: Conf.Sync.S3.AccessKey,
|
||||
SecretKey: Conf.Sync.S3.SecretKey,
|
||||
Bucket: Conf.Sync.S3.Bucket,
|
||||
Region: Conf.Sync.S3.Region,
|
||||
PathStyle: Conf.Sync.S3.PathStyle,
|
||||
SkipTlsVerify: Conf.Sync.S3.SkipTlsVerify,
|
||||
}
|
||||
case conf.ProviderWebDAV:
|
||||
ret.Endpoint = Conf.Sync.WebDAV.Endpoint
|
||||
ret.Username = Conf.Sync.WebDAV.Username
|
||||
ret.Password = Conf.Sync.WebDAV.Password
|
||||
ret.WebDAV = &cloud.ConfWebDAV{
|
||||
Endpoint: Conf.Sync.WebDAV.Endpoint,
|
||||
Username: Conf.Sync.WebDAV.Username,
|
||||
Password: Conf.Sync.WebDAV.Password,
|
||||
SkipTlsVerify: Conf.Sync.WebDAV.SkipTlsVerify,
|
||||
}
|
||||
default:
|
||||
err = fmt.Errorf("invalid provider [%d]", Conf.Sync.Provider)
|
||||
return
|
||||
|
|
|
@ -109,9 +109,9 @@ func getVirtualRefKeywords(docName string) (ret []string) {
|
|||
// 虚拟引用排除当前文档名 https://github.com/siyuan-note/siyuan/issues/4537
|
||||
ret = gulu.Str.ExcludeElem(ret, []string{docName})
|
||||
ret = prepareMarkKeywords(ret)
|
||||
// 虚拟引用搜索关键字最多支持 `搜索结果显示数` 的 8 倍 https://github.com/siyuan-note/siyuan/issues/6603
|
||||
if Conf.Search.Limit*8 < len(ret) {
|
||||
ret = ret[:Conf.Search.Limit*8]
|
||||
|
||||
if Conf.Search.VirtualRefKeywordsLimit < len(ret) {
|
||||
ret = ret[:Conf.Search.VirtualRefKeywordsLimit]
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue