mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-27 20:08:49 +01:00
🎨 Improve Liandi clipping (#15087)
* 🐛 Improve Liandi clipping fix https://github.com/siyuan-note/siyuan/issues/15086 * 🐛 Improve Liandi clipping fix https://github.com/siyuan-note/siyuan/issues/15086
This commit is contained in:
parent
743f4eecbf
commit
10df855457
1 changed files with 23 additions and 4 deletions
|
|
@ -62,13 +62,32 @@ func extensionCopy(c *gin.Context) {
|
|||
|
||||
clippingSym := false
|
||||
symArticleHref := ""
|
||||
if nil != form.Value["href"] {
|
||||
|
||||
hasHref := nil != form.Value["href"]
|
||||
isPartClip := nil != form.Value["clipType"] && form.Value["clipType"][0] == "part"
|
||||
|
||||
if hasHref && !isPartClip {
|
||||
// 剪藏链滴帖子时直接使用 Markdown 接口的返回
|
||||
// https://ld246.com/article/raw/1724850322251
|
||||
symArticleHref = form.Value["href"][0]
|
||||
if strings.HasPrefix(symArticleHref, "https://ld246.com/article/") || strings.HasPrefix(symArticleHref, "https://liuyun.io/article/") {
|
||||
symArticleHref = strings.ReplaceAll(symArticleHref, "https://ld246.com/article/", "https://ld246.com/article/raw/")
|
||||
symArticleHref = strings.ReplaceAll(symArticleHref, "https://liuyun.io/article/", "https://liuyun.io/article/raw/")
|
||||
|
||||
var baseURL, originalPrefix string
|
||||
if strings.HasPrefix(symArticleHref, "https://ld246.com/article/") {
|
||||
baseURL = "https://ld246.com/article/raw/"
|
||||
originalPrefix = "https://ld246.com/article/"
|
||||
} else if strings.HasPrefix(symArticleHref, "https://liuyun.io/article/") {
|
||||
baseURL = "https://liuyun.io/article/raw/"
|
||||
originalPrefix = "https://liuyun.io/article/"
|
||||
}
|
||||
|
||||
if "" != baseURL {
|
||||
articleID := strings.TrimPrefix(symArticleHref, originalPrefix)
|
||||
|
||||
if idx := strings.IndexAny(articleID, "/?#"); -1 != idx {
|
||||
articleID = articleID[:idx]
|
||||
}
|
||||
|
||||
symArticleHref = baseURL + articleID
|
||||
clippingSym = true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue