Documentation
¶
Index ¶
- Constants
- Variables
- func Activity(c *gin.Context)
- func AddAttributeViewBlock(tx *Transaction, srcs []map[string]any, ...) (err error)
- func AddAttributeViewKey(avID, keyID, keyName, keyType, keyIcon, previousKeyID string) (err error)
- func AddCustomEmoji(emojiName, imgSrc string)
- func AddMicrosoftDefenderExclusion() error
- func AddSession(sessionID, username string)
- func AddVirtualBlockRefExclude(keyword []string)
- func AddVirtualBlockRefInclude(keyword []string)
- func AddressBooksMetaDataFilePath() string
- func AddressPropsFilter(address *carddav.AddressObject, req *carddav.AddressDataRequest) *carddav.AddressObject
- func AppendAttributeViewDetachedBlocksWithValues(avID string, blocksValues [][]*av.Value) (err error)
- func AppendHeadingChildren(id, childrenDOM string)
- func AppendPushCreateEntry(box, p string)
- func AppendPushReloadAttrViewEntry(avID string)
- func AppendPushReloadDocInfoEntry(box, p string)
- func AppendPushReloadFiletreeEntry()
- func AppendPushReloadProtyleEntry(id string)
- func AppendPushReloadTagEntry()
- func AppendPushReloadUIEntry()
- func AppendPushRemoveEntry(box, p, id string)
- func AppendPushRenameEntry(box, p, title string)
- func AssetPathWithoutQuery(relativePath string) string
- func AutoCheckMicrosoftDefenderJob()
- func AutoConsumeShorthandsJob()
- func AutoFixIndex()
- func AutoGenerateFileHistory()
- func AutoLockIdleEncryptedBoxesJob()
- func AutoPurgeRepoJob()
- func AutoSpace(rootID string) (err error)
- func BatchReplaceAttributeViewBlocks(avID string, isDetached bool, oldNew []map[string]string) (err error)
- func BatchSetBlockAttrs(blockAttrs []map[string]any) (err error)
- func BatchUpdateAttributeViewCells(tx *Transaction, avID string, values []any) (err error)
- func BatchUpdatePackages(frontend string)
- func BatchUpdateRecentDocCloseTime(rootIDs []string) (err error)
- func BookmarkLabels() (ret []string)
- func BootSyncData()
- func BuildGraph(query string) (boxID string, nodes []*GraphNode, links []*GraphLink)
- func BuildTreeGraph(id, query string) (boxID string, nodes []*GraphNode, links []*GraphLink)
- func CacheVirtualBlockRefJob()
- func CalendarsMetaDataFilePath() string
- func ChangeAttrViewLayout(blockID, avID string, newLayout av.LayoutType) (err error)
- func ChangeBoxSort(boxIDs []string)
- func ChangeFileTreeSort(boxID string, paths []string)
- func ChangeHistoryTick(minutes int)
- func ChangeMasterPassword(oldPassword, newPassword string) error
- func ChatGPT(msg string) (ret string)
- func ChatGPTWithAction(ids []string, action string) (ret string)
- func CheckAbsPathAccessableByPublishAccess(c *gin.Context, absPath string, publishAccess PublishAccess) bool
- func CheckActivationcode(code string) (retCode int, msg string)
- func CheckAdminRole(c *gin.Context)
- func CheckAuth(c *gin.Context)
- func CheckBlockIdAccessableByPublishAccess(c *gin.Context, publishAccess PublishAccess, blockID string) bool
- func CheckBlockRef(ids []string) bool
- func CheckEditRole(c *gin.Context)
- func CheckPathAccessableByPublishIgnore(box string, path string, publishIgnore PublishAccess) bool
- func CheckPublishAuthCookie(c *gin.Context, ID string, password string) bool
- func CheckReadRole(c *gin.Context)
- func CheckReadonly(c *gin.Context)
- func CheckUpdate(showMsg bool)
- func CheckoutRepo(id string)
- func CheckoutRepoDirect(id string)
- func ClearCustomEmojis()
- func ClearDEK(boxID string)
- func ClearOutdatedHistoryDirJob()
- func ClearTempFiles()
- func ClearWorkspaceHistory() (err error)
- func Close(force, setCurrentWorkspace bool, execInstallPkg int) (exitCode int)
- func CloseWatchAssets()
- func CloseWatchEmojis()
- func CloseWatchThemes()
- func CloudChatGPT(msg string, contextMsgs []string) (ret string, stop bool, err error)
- func ControlConcurrency(c *gin.Context)
- func CreateBox(name string) (id string, err error)
- func CreateCloudSyncDir(name string) (err error)
- func CreateDailyNote(boxID string) (p string, existed bool, err error)
- func CreateDeck(name string) (deck *riff.Deck, err error)
- func CreateDocByMd(boxID, p, title, md string, sorts []string, arg map[string]any) (tree *parse.Tree, err error)
- func CreateDocHistory(id string) (err error)
- func CreateEncryptedBox(name, password string) (id string, err error)
- func CreatePluginJWT(name string) (string, error)
- func CreateTemplate(name, content string, overwrite bool) (code int, err error)
- func CreateWithMarkdown(tags, boxID, hPath, md, parentID, id string, withMath bool, ...) (retID string, err error)
- func DavPath2DirectoryPath(davPath string) string
- func DeactivateUser() (err error)
- func DecryptAsset(boxID, diskName string, dek, ciphertext []byte) ([]byte, error)
- func DecryptAssetNameMapping(boxID string, dek, ciphertext []byte) ([]byte, error)
- func DecryptFile(boxID, relativePath string, dek, ciphertext []byte) ([]byte, error)
- func DeepCopyBoxEncryption(src *conf.BoxEncryption) *conf.BoxEncryption
- func DeleteSession(sessionID string)
- func DisableEncryptedNotebook() error
- func Doc2Heading(srcID, targetID string, after bool) (srcTreeBox, srcTreePath string, err error)
- func DocAssets(rootID string, retainQueryStr bool) (ret []string, err error)
- func DocImageAssets(rootID string) (ret []string, err error)
- func DocSaveAsTemplate(id, name string, overwrite bool) (code int, err error)
- func DownloadCloudSnapshot(tag, id string) (err error)
- func DownloadNetAssets2LocalAssets(tree *parse.Tree, onlyImg bool, originalURL string, assetsDirPath string)
- func DuplicateAttributeViewRow(tx *Transaction, avID, previousItemID, srcRowID, newRowID string) (err error)
- func DuplicateDatabaseBlock(avID string) (newAvID, newBlockID string, err error)
- func DuplicateDoc(tree *parse.Tree)
- func EnableEncryptedNotebook(password string) error
- func EncryptAsset(boxID, diskName string, dek, plaintext []byte) ([]byte, error)
- func EncryptAssetNameMapping(boxID string, dek, plaintext []byte) ([]byte, error)
- func EncryptFile(boxID, relativePath string, dek, plaintext []byte) ([]byte, error)
- func EncryptedRawPathBoxID(absPath string) string
- func Export2Liandi(id string) (err error)
- func ExportAddressBook(addressBookPath string) (cardContent string, err error)
- func ExportAv2CSV(avID, blockID string) (zipPath string, err error)
- func ExportCodeBlock(blockID string) (filePath string, err error)
- func ExportData() (zipPath string, err error)
- func ExportDataInFolder(exportFolder string) (name string, err error)
- func ExportDocx(id, savePath string, removeAssets, merge bool) (fullPath string, err error)
- func ExportHTML(id, savePath string, pdf, keepFold, merge bool) (name, dom string, node *ast.Node)
- func ExportMarkdownContent(id string, refMode, embedMode int, ...) (hPath, exportedMd string)
- func ExportMarkdownHTML(id, savePath string, docx, merge bool) (name, dom string)
- func ExportNotebookCryptoBackup() (downloadPath string, err error)
- func ExportNotebookMarkdown(boxID string) (zipPath string)
- func ExportNotebookMarkdownWithOptions(boxID string, opts *ExportOptions) (zipPath string)
- func ExportNotebookSY(id string) (zipPath string)
- func ExportPandocConvertZip(ids []string, pandocTo, ext string) (name, zipPath string)
- func ExportPandocConvertZipWithOptions(ids []string, pandocTo, ext string, opts *ExportOptions) (name, zipPath string)
- func ExportPreview(id string, fillCSSVar bool) (retStdHTML string)
- func ExportRepoFile(id string) (exportPath string, err error)
- func ExportResources(resourcePaths []string, mainName string) (exportFilePath string, err error)
- func ExportSYs(ids []string) (zipPath string)
- func ExportStdMarkdown(id string, ...) string
- func ExportSystemLog() (zipPath string)
- func ExtractBoxIDFromAssetsPath(absPath string) string
- func ExtractBoxIDFromHistoryPath(absPath string) string
- func FileETag(fileInfo fs.FileInfo) string
- func FilterBlockTreesByPublishIgnore(publishIgnore PublishAccess, bts map[string]*treenode.BlockTree) (ret map[string]*treenode.BlockTree)
- func FilterContentByPublishAccess(c *gin.Context, publishAccess PublishAccess, box string, docPath string, ...) (ret string)
- func FilterGraphByPublishIgnore(publishIgnore PublishAccess, nodes []*GraphNode, links []*GraphLink) (retNodes []*GraphNode, retLinks []*GraphLink)
- func FilterLocalStorageByPublishAccess(publishAccess PublishAccess, localStorage map[string]any) (ret map[string]any)
- func FilterUILayoutByPublishIgnore(publishIgnore PublishAccess, uiLayout *conf.UILayout) (ret *conf.UILayout)
- func FilterViewByPublishAccess(c *gin.Context, publishAccess PublishAccess, viewable av.Viewable) (ret av.Viewable)
- func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids []string, ...) (err error)
- func FlushAssetsTextsJob()
- func FlushTxQueue()
- func FlushUpdateRefTextRenameDocJob()
- func FullReindex(needResetScroll bool)
- func FullReindexDirect()
- func FullTextSearchHistory(query, box, op string, typ, page int) (ret []string, pageCount, totalCount int)
- func GenerateAssetsThumbnail(sourceImgPath, resizedImgPath string) (err error)
- func GenerateFileHistory()
- func GenerateFileHistoryForBox(box *Box)
- func GetAssetAbsPath(relativePath string) (string, error)
- func GetAssetAbsPathInBox(relativePath, boxID string) (string, error)
- func GetAssetAbsPathWithOpt(relativePath string, includeEncrypted bool) (string, error)
- func GetAssetImgSize(assetPath string) (width, height int)
- func GetAssetImgSizeInBox(assetPath, boxID string) (width, height int)
- func GetAssetPathByHash(hash, boxID string) string
- func GetAttrViewAddingBlockDefaultValues(avID, viewID, groupID, previousBlockID, addingBlockID string) (ret map[string]*av.Value)
- func GetAttributeView(avID string) (ret *av.AttributeView)
- func GetAttributeViewBoundBlockIDs(avID string, itemIDs []string) (ret map[string]string)
- func GetAttributeViewFilterSort(avID, blockID string) (filters []*av.ViewFilter, sorts []*av.ViewSort)
- func GetAttributeViewItemIDs(avID string, blockIDs []string) (ret map[string]string)
- func GetAttributeViewKeysByID(avID string, keyIDs ...string) (ret []*av.Key)
- func GetAttributeViewPrimaryKeyValues(avID, keyword string, page, pageSize int) (attributeViewName string, databaseBlockIDs []string, keyValues *av.KeyValues, ...)
- func GetBasicAuthUsernameBySessionID(sessionID string) string
- func GetBazaarPackageREADME(ctx context.Context, repoURL, repoHash, pkgType string) (ret string)
- func GetBazaarPackages(pkgType, frontend, keyword string) (bazaarPackages []*bazaar.Package)
- func GetBlockDOM(id string) (ret string)
- func GetBlockDOMInBox(id, boxID string) (ret string)
- func GetBlockDOMWithEmbed(id string) (ret string)
- func GetBlockDOMWithEmbedInBox(id, boxID string) (ret string)
- func GetBlockDOMs(ids []string) (ret map[string]string)
- func GetBlockDOMsInBox(ids []string, boxID string) (ret map[string]string)
- func GetBlockDOMsWithEmbed(ids []string) (ret map[string]string)
- func GetBlockDOMsWithEmbedInBox(ids []string, boxID string) (ret map[string]string)
- func GetBlockDefIDsByRefText(refText string) (ret []string)
- func GetBlockIndex(id string) (ret int)
- func GetBlockKramdown(id, mode string) (ret string)
- func GetBlockKramdownInBox(id, mode, boxID string) (ret string)
- func GetBlockKramdowns(ids []string, mode string) (ret map[string]string)
- func GetBlockKramdownsInBox(ids []string, mode, boxID string) (ret map[string]string)
- func GetBlockRefIDsByFileAnnotationID(id string) []string
- func GetBlockRefText(id string) string
- func GetBlockRefTextInBox(id, boxID string) string
- func GetBlockRelevantIDs(id string) (parentID, previousID, nextID string, err error)
- func GetBlockRelevantIDsInBox(id, boxID string) (parentID, previousID, nextID string, err error)
- func GetBlockSiblingID(id string) (parent, previous, next string)
- func GetBlockSiblingIDInBox(id, boxID string) (parent, previous, next string)
- func GetBlockTreeInfos(ids []string) (ret map[string]*BlockTreeInfo)
- func GetBlockTreeInfosInBox(ids []string, boxID string) (ret map[string]*BlockTreeInfo)
- func GetBlocksIndexes(ids []string) (ret map[string]int)
- func GetBoxEncryption(boxID string) (*conf.BoxEncryption, error)
- func GetCaptcha(c *gin.Context)
- func GetCloudRepoSnapshots(page int) (ret []*dejavu.Log, pageCount, totalCount int, err error)
- func GetCloudRepoTagSnapshots() (ret []*dejavu.Log, err error)
- func GetCloudShorthand(id string) (ret map[string]any, err error)
- func GetCloudShorthands(page int) (result map[string]any, err error)
- func GetCloudSpace() (s *Sync, b *Backup, ...)
- func GetCurrentAttributeViewImages(avID, viewID, query string) (ret []string, err error)
- func GetDEK(boxID string) ([]byte, error)
- func GetDEKIfUnlocked(boxID string) ([]byte, error)
- func GetDOMText(dom string) (ret string)
- func GetDecks() (decks []*riff.Deck)
- func GetDoc(startID, endID, id string, index int, query string, ...) (blockCount int, dom, parentID, parent2ID, rootID, typ string, eof, scroll bool, ...)
- func GetDocHistoryContent(historyPath, keyword string, highlight bool) (id, rootID, content string, isLargeDoc bool, err error)
- func GetDocInBox(startID, endID, id string, index int, query string, ...) (blockCount int, dom, parentID, parent2ID, rootID, typ string, eof, scroll bool, ...)
- func GetFullHPathByID(id string) (hPath string, err error)
- func GetHPathByID(id string) (hPath string, err error)
- func GetHPathByPath(boxID, p string) (hPath string, err error)
- func GetHPathsByPaths(paths []string) (hPaths []string, err error)
- func GetHeadingChildrenDOM(id string, removeFoldAttr bool) (ret string)
- func GetHeadingChildrenIDs(id string) (ret []string)
- func GetIDsByHPath(hpath, boxID string) (ret []string, err error)
- func GetInstalledPackageInfos(pkgType string) (installedPackageInfos []installedPackageInfo, ...)
- func GetInstalledPackages(pkgType, frontend, keyword string) (installedPackages []*bazaar.Package)
- func GetLocalStorage() (ret map[string]any)
- func GetNewSessionID() string
- func GetOutlineStorage(docID string) (ret map[string]any, err error)
- func GetPathByID(id string) (path, boxID string, err error)
- func GetPathPasswordByPublishAccess(box string, blockPath string, publishAccess PublishAccess) (passwordID string, password string)
- func GetRefTextInBox(defBlockID, boxID string) string
- func GetRefUsed() (ret map[string]int64)
- func GetRepoFile(fileID string) (ret []byte, p string, err error)
- func GetTokenClaims(token *jwt.Token) jwt.MapClaims
- func GetUnfoldedParentID(id string) (parentID string)
- func GetUpdatedPackages(frontend string) (plugins, widgets, icons, themes, templates []*bazaar.Package)
- func HTML2Tree(htmlStr string, luteEngine *lute.Lute, boxID string) (tree *parse.Tree, withMath bool)
- func HandleAssetsChangeEvent(assetAbsPath string)
- func HandleAssetsRemoveEvent(assetAbsPath string)
- func HandleSignal()
- func HasEncryptedNotebookHistory() bool
- func Heading2Doc(srcHeadingID, targetBoxID, targetPath, previousPath string, toTop bool) (srcRootBlockID, newTargetPath string, err error)
- func HideConfSecret(c *AppConf)
- func HoldBoxReadLock(boxID string)
- func HookDesktopUIProcJob()
- func ImportData(zipPath string) (err error)
- func ImportFromLocalPath(boxID, localPath string, toPath string) (err error)
- func ImportNotebookCryptoBackup(data []byte, password string) error
- func ImportRepoKey(base64Key string) (retKey string, err error)
- func ImportSY(zipPath, boxID, toPath string) (err error)
- func IncSync()
- func IndexEmbedBlockJob()
- func IndexRefs()
- func IndexRepo(memo string) (id string, err error)
- func InitAppearance()
- func InitBoxes()
- func InitConf()
- func InitJwtKey() error
- func InitPublishAccounts()
- func InitPublishJWT()
- func InitRepoKey() (err error)
- func InitRepoKeyFromPassphrase(passphrase string) (err error)
- func InsertLocalAssets(id string, assetAbsPaths []string, isUpload bool) (succMap map[string]any, err error)
- func InstallBazaarPackage(pkgType, repoURL, repoHash, packageName string, themeMode int) error
- func IsAdminRoleContext(c *gin.Context) bool
- func IsBlockFolded(id string) (isFolded, isRoot bool)
- func IsBlockRefCrossingBoundary(srcBoxID, defBlockID string) bool
- func IsBoxUnlocked(boxID string) bool
- func IsEncryptedAssetPath(absPath string) bool
- func IsEncryptedBox(boxID string) bool
- func IsManagedEncryptedExportPath(relativePath string) bool
- func IsMoveOutlineHeading(transactions *[]*Transaction) bool
- func IsPaidUser() bool
- func IsPetalsEnabled() bool
- func IsPublishServiceToken(token *jwt.Token) bool
- func IsReadOnlyRole(role Role) bool
- func IsReadOnlyRoleContext(c *gin.Context) bool
- func IsSameCryptoBoundary(srcBox, dstBox string) bool
- func IsSubscriber() bool
- func IsSyncingFile(rootID string) (ret bool)
- func IsUserGuide(boxID string) bool
- func IsValidRole(role Role, roles []Role) bool
- func IsValidSearchBoxPath(box, docPath string) bool
- func ListAllEncryptedBoxIDs() []string
- func ListItem2Doc(srcListItemID, targetBoxID, targetPath, previousPath string, toTop bool) (srcRootBlockID, newTargetPath string, err error)
- func LoadCalendarObject(filePath string) (calendar *ical.Calendar, err error)
- func LoadCards(filePath string) (cards []*vcard.Card, err error)
- func LoadFlashcards()
- func LoadIcons()
- func LoadSnippets() (ret []*conf.Snippet, err error)
- func LoadThemes()
- func LoadTreeByBlockID(id string) (ret *parse.Tree, err error)
- func LoadTreeByBlockIDWithReindex(id string) (ret *parse.Tree, err error)
- func LoadTreeByBlockIDWithReindexInBox(id, boxID string) (ret *parse.Tree, err error)
- func LoadUploadToken() (err error)
- func LockBox(boxID string)
- func Login(userName, password, captcha string, cloudRegion int) (ret *gulu.Result)
- func Login2fa(token, code string) (map[string]any, error)
- func LoginAuth(c *gin.Context)
- func LogoutAuth(c *gin.Context)
- func LogoutUser()
- func LookupAssetOriginalName(boxID, diskName string) string
- func LookupAssetOriginalNameLocked(boxID, diskName string) string
- func MarkdownToMarkdownStrHTML(markdown string) string
- func MarkdownToProtylePreviewHTML(markdown string) string
- func MasterPasswordMigrationStatus() (pending bool, boxIDs []string)
- func Mount(boxID string) (alreadyMount bool, err error)
- func MoveDocs(fromPaths []string, toBoxID, toPath string, callback any) (err error)
- func MoveLocalShorthands(boxID string) (retIDs []string, err error)
- func NeedGenerateAssetsThumbnail(sourceImgPath string) bool
- func NetAssets2LocalAssets(rootID string, onlyImg bool, originalURL string) (err error)
- func NewLute() (ret *lute.Lute)
- func NotebookCryptoEnabled() bool
- func NotebookCryptoMuLock()
- func NotebookCryptoMuUnlock()
- func OCRAssetsJob()
- func OpenRepoSnapshotFile(fileID string) (title, content string, displayInText bool, updated int64, err error)
- func ParseAddressPath(addressPath string) (addressBookPath string, addressID string, err error)
- func ParseCalendarObjectPath(objectPath string) (calendarPath string, objectID string, err error)
- func ParseJWT(tokenString string) (*jwt.Token, error)
- func ParseXAuthToken(r *http.Request) *jwt.Token
- func PathCleanWithSlash(p string) string
- func PathJoinWithSlash(elems ...string) string
- func PdfListLinks(ctx *model.Context) (assets, others []model.LinkAnnotation, err error)
- func PdfListToCLinks(ctx *model.Context) (ret []model.LinkAnnotation, err error)
- func PerformTransactions(transactions *[]*Transaction)
- func PerformTxSync(tx *Transaction) (err error)
- func PollPushQueue()
- func PrepareEmbeddingSearch()
- func ProcessPDF(id, p string, merge, removeAssets, watermark bool) (err error)
- func PurgeCloud() (err error)
- func PurgePublishAccess()
- func PurgeRepo() (err error)
- func PushCreate(box *Box, p string, arg map[string]any)
- func PushReloadPlugin(uninstallPluginNameSet, unloadPluginNameSet, reloadPluginSet, ... *hashset.Set, ...)
- func PushReloadSnippet(snippet *conf.Snpt)
- func ReadAssetBytesInBox(boxID, relativePath string) ([]byte, error)
- func Recover(c *gin.Context)
- func RefreshBacklink(id string)
- func RefreshCheckJob2H()
- func RefreshCheckJob6H()
- func RefreshUser(token string)
- func RegisterManagedEncryptedExport(boxID, kind, artifact string) string
- func ReindexAssetContent()
- func ReindexEmbedding()
- func ReindexFTS()
- func ReindexHistory()
- func ReleaseBoxReadLock(boxID string)
- func ReloadAttrView(avID string)
- func ReloadFiletree()
- func ReloadProtyle(rootID string)
- func ReloadTag()
- func RemoveAttributeViewBlock(srcIDs []string, avID string) (err error)
- func RemoveAttributeViewKey(avID, keyID string, removeRelationDest bool) (err error)
- func RemoveBookmark(bookmark string) (err error)
- func RemoveBox(boxID string) (err error)
- func RemoveCloudRepoTag(tag string) (err error)
- func RemoveCloudShorthands(ids []string) (err error)
- func RemoveCloudSyncDir(name string) (err error)
- func RemoveCriterion(name string) (err error)
- func RemoveDeck(deckID string) (err error)
- func RemoveDoc(boxID, p string)
- func RemoveDocs(paths []string)
- func RemoveIndexes(paths []string)
- func RemoveLocalStorageVals(keys []string) (err error)
- func RemoveOutlineStorage(docID string) (err error)
- func RemoveSnippet(id string) (ret *conf.Snippet, err error)
- func RemoveTag(label string) (err error)
- func RemoveTagSnapshot(tag string) (err error)
- func RemoveTemplate(p string) (err error)
- func RemoveUnusedAsset(p string) (ret string)
- func RemoveUnusedAssets() (ret []string)
- func RemoveUnusedAttributeView(id string)
- func RemoveUnusedAttributeViews() (ret []string)
- func RenameAsset(oldPath, newName string) (newPath string, err error)
- func RenameBookmark(oldBookmark, newBookmark string) (err error)
- func RenameBox(boxID, name string) (err error)
- func RenameDeck(deckID, name string) (err error)
- func RenameDoc(boxID, p, title string) (err error)
- func RenameTag(oldLabel, newLabel string) (err error)
- func RenderAttributeView(blockID, avID, viewID, query string, page, pageSize int, ...) (viewable av.Viewable, attrView *av.AttributeView, err error)
- func RenderDynamicIconContentTemplate(content, id string) (ret string)
- func RenderGoTemplate(templateContent string) (ret string, err error)
- func RenderHistoryAttributeView(blockID, avID, viewID, query string, page, pageSize int, ...) (viewable av.Viewable, attrView *av.AttributeView, err error)
- func RenderRepoSnapshotAttributeView(indexID, avID string) (viewable av.Viewable, attrView *av.AttributeView, err error)
- func RenderTemplate(p, id string, preview bool) (tree *parse.Tree, dom string, err error)
- func ResetFlashcards(typ, id, deckID string, blockIDs []string)
- func ResetRepo() (err error)
- func ResetVirtualBlockRefCache()
- func ResolveManagedEncryptedExport(relativePath string) (boxID, artifact string, ok bool)
- func ResolveManagedExportForMobile(relativePath string) (absPath string, ok bool)
- func ResolveReplayDuplicateIds(tx *Transaction)
- func RetryFailedEmbedding()
- func ReviewFlashcard(deckID, cardID string, rating riff.Rating, reviewedCardIDs []string) (err error)
- func RevokeManagedEncryptedExportsForBox(boxID string)
- func RollbackAssetsHistory(historyPath string) (err error)
- func RollbackAttributeViewHistory(historyPath string) (err error)
- func RollbackDocHistory(historyPath string) (err error)
- func RollbackNotebookHistory(historyPath string) (err error)
- func RollbackRepoSnapshotFile(fileID string) (err error)
- func SaveAgentTodos(sessionID string, todos []AgentTodoItem) error
- func SaveMetaData[T []*caldav.Calendar | []*carddav.AddressBook](metaData T, metaDataFilePath string) error
- func SearchAssetsByName(keyword string, exts []string) (ret []*cache.Asset)
- func SearchAttributeViewRelationKey(avID, keyword string) (ret []*av.Key)
- func SearchAttributeViewRollupDestKeys(avID, keyword string) (ret []*av.Key)
- func SearchDocs(keyword string, flashcard bool, excludeIDs []string) (ret []map[string]string)
- func SearchTags(keyword string) (ret []string)
- func SetAttrViewFilters(avID, blockID string, data []any) (err error)
- func SetAttrViewSorts(avID, blockID string, data []any) (err error)
- func SetAttributeViewGroup(avID, blockID string, group *av.ViewGroup) (err error)
- func SetAutoLockMinutes(minutes int)
- func SetBlockAttrs(id string, nameValues map[string]string) (err error)
- func SetBlockReminder(id, timed string) (err error)
- func SetBoxIcon(boxID, icon string)
- func SetCloudBlockReminder(id, data string, timed int64) (err error)
- func SetCloudReminder(id, content, timed string) (err error)
- func SetCloudSyncDir(name string)
- func SetCriterion(criterion *Criterion) (err error)
- func SetDatabaseBlockView(blockID, avID, viewID string) (err error)
- func SetFlashcardsDueTime(cardDues []*SetFlashcardDueTime) (err error)
- func SetIcon(icon string) error
- func SetLocalStorage(val map[string]any) (err error)
- func SetLocalStorageVals(keyVals map[string]any) (setKeyVals map[string]any, err error)
- func SetOutlineStorage(docID string, val map[string]any) (err error)
- func SetPublishAccess(inputPublishAccess PublishAccess) (err error)
- func SetPublishAuthCookie(c *gin.Context, ID string, password string)
- func SetSnippet(snippets []*conf.Snippet) (err error)
- func SetSyncEnable(b bool)
- func SetSyncGenerateConflictDoc(b bool)
- func SetSyncInterval(interval int)
- func SetSyncMode(mode int)
- func SetSyncPerception(enabled bool)
- func SetSyncProvider(provider int) (err error)
- func SetSyncProviderLocal(local *conf.Local) (err error)
- func SetSyncProviderS3(s3 *conf.S3) (err error)
- func SetSyncProviderWebDAV(webdav *conf.WebDAV) (err error)
- func SetTheme(theme string, modes []int, appearanceMode string) error
- func SkipReviewFlashcard(deckID, cardID string) (err error)
- func SortAttributeViewKey(avID, keyID, previousKeyID string) (err error)
- func SortAttributeViewViewKey(avID, blockID, keyID, previousKeyID string) (err error)
- func StartEmbeddingIndexer()
- func StartFreeTrial() (err error)
- func StartPushQueueConsumer()
- func StatJob()
- func StoreAssetForBox(boxID, assetDirPath, originalName string, data []byte) (diskName string, err error)
- func SwapBlockRef(refID, defID string, includeChildren bool) (err error)
- func SyncData(byHand bool)
- func SyncDataDownload()
- func SyncDataJob()
- func SyncDataUpload()
- func TagSnapshot(id, name string) (err error)
- func Timing(c *gin.Context)
- func TouchRefUsed(defBlockIDs []string)
- func TouchUnlockedEncryptedBoxes()
- func TransferBlockRef(fromID, toID string, refIDs []string) (err error)
- func UninstallPackage(pkgType, packageName string) error
- func UnlockBox(boxID string, password string, boxEnc *conf.BoxEncryption) error
- func Unmount(boxID string)
- func UpdateAttributeViewCell(tx *Transaction, avID, keyID, itemID string, valueData any) (val *av.Value, err error)
- func UpdateEmbedBlock(id, content string) (err error)
- func UpdateRecentDocCloseTime(rootID string) (err error)
- func UpdateRecentDocOpenTime(rootID string) (err error)
- func UpdateRecentDocViewTime(rootID string) (err error)
- func Upload(c *gin.Context)
- func UploadAssets2Cloud(id string, ignorePushMsg bool) (count int, err error)
- func UploadAssets2CloudByAssetsPaths(assetPaths []string, ignorePushMsg bool) (count int, err error)
- func UploadCloudSnapshot(tag, id string) (err error)
- func UpsertIndexes(paths []string)
- func UseActivationcode(code string) (err error)
- func VacuumDataIndex()
- func WatchAssets()
- func WatchEmojis()
- func WatchThemes()
- func WrapNewDEK(boxID string, kek []byte) (*conf.BoxEncryption, []byte, error)
- type Account
- type AccountsMap
- type AddressBook
- type AddressObject
- type AgentTodoItem
- type AgentTodoList
- type Announcement
- type AppConf
- func (conf *AppConf) Box(boxID string) *Box
- func (conf *AppConf) BoxNames(boxIDs []string) (ret map[string]string)
- func (conf *AppConf) Close()
- func (conf *AppConf) GetBox(boxID string) *Box
- func (conf *AppConf) GetBoxes() (ret []*Box)
- func (conf *AppConf) GetClosedBoxes() (ret []*Box)
- func (conf *AppConf) GetOpenedBoxes() (ret []*Box)
- func (conf *AppConf) GetUILayout() *conf.UILayout
- func (conf *AppConf) GetUser() *conf.User
- func (conf *AppConf) Language(num int) (ret string)
- func (conf *AppConf) Save()
- func (conf *AppConf) SetUILayout(uiLayout *conf.UILayout)
- func (conf *AppConf) SetUser(user *conf.User)
- type AssetContent
- func FilterAssetContentByPublishAccess(c *gin.Context, publishAccess PublishAccess, assetContent []*AssetContent) (ret []*AssetContent)
- func FullTextSearchAssetContent(query string, types map[string]bool, method, orderBy, page, pageSize int) (ret []*AssetContent, matchedAssetCount, pageCount int)
- func GetAssetContent(id, query string, queryMethod int) (ret *AssetContent)
- func GetAssetContentByPath(path string) (ret *AssetContent)
- type AssetParseResult
- type AssetParser
- type AssetsSearcher
- type AttrView
- type AvSearchResult
- type AvSearchTempResult
- type Backlink
- func GetBacklinkDoc(defID, refTreeID, keyword string, containChildren, highlight bool) (ret []*Backlink, keywords []string)
- func GetBacklinkDocInBox(defID, refTreeID, keyword string, containChildren, highlight bool, ...) (ret []*Backlink, keywords []string)
- func GetBackmentionDoc(defID, refTreeID, keyword string, containChildren, highlight bool) (ret []*Backlink, keywords []string)
- func GetBackmentionDocInBox(defID, refTreeID, keyword string, containChildren, highlight bool, ...) (ret []*Backlink, keywords []string)
- type Backup
- type Block
- func FilterBlocksByPublishAccess(c *gin.Context, publishAccess PublishAccess, blocks []*Block) (ret []*Block)
- func FullTextSearchBlock(query string, boxes, paths []string, types, subTypes map[string]bool, ...) (ret []*Block, matchedBlockCount, matchedRootCount, pageCount int, docMode bool)
- func FullTextSearchBlockInBox(query string, boxes, paths []string, types, subTypes map[string]bool, ...) (ret []*Block, matchedBlockCount, matchedRootCount, pageCount int, docMode bool)
- func GetBlock(id string, tree *parse.Tree) (ret *Block, err error)
- func GetDeckFlashcards(deckID string, page, pageSize int) (blocks []*Block, total, pageCount int)
- func GetFlashcardsByBlockIDs(blockIDs []string) (ret []*Block)
- func GetNotebookFlashcards(boxID string, page, pageSize int) (blocks []*Block, total, pageCount int)
- func GetTreeFlashcards(rootID string, page, pageSize int) (blocks []*Block, total, pageCount int)
- func ListInvalidBlockRefs(page, pageSize int) (ret []*Block, matchedBlockCount, matchedRootCount, pageCount int)
- func RecentUpdatedBlocks() (ret []*Block)
- func SearchRefBlock(id, rootID, keyword string, beforeLen int, isSquareBrackets, isDatabase bool) (ret []*Block, newDoc bool)
- func SearchRefBlockInBox(id, rootID, keyword string, beforeLen int, isSquareBrackets, isDatabase bool, ...) (ret []*Block, newDoc bool)
- func SemanticSearchBlock(query string, boxes, paths []string, types, subTypes map[string]bool, ...) (blocks []*Block, matchedBlockCount, matchedRootCount, pageCount int)
- type BlockAttributeViewKeys
- type BlockInfo
- func FilterBlockInfoByPublishAccess(c *gin.Context, publishAccess PublishAccess, info *BlockInfo) (ret *BlockInfo)
- func GetDocInfo(blockID string) (ret *BlockInfo, err error)
- func GetDocInfoInBox(blockID, boxID string) (ret *BlockInfo, err error)
- func GetDocsInfo(blockIDs []string, queryRefCount bool, queryAv bool) (rets []*BlockInfo)
- type BlockPath
- type BlockTreeInfo
- type Bookmark
- type BookmarkBlocks
- type BookmarkLabel
- type Bookmarks
- type Box
- func (box *Box) Exist(p string) bool
- func (box *Box) GetConf() (ret *conf.BoxConf)
- func (box *Box) GetInfo() (ret *BoxInfo)
- func (box *Box) Index()
- func (box *Box) ListFiles(path string) (ret []*FileInfo)
- func (box *Box) Ls(p string) (ret []*FileInfo, totals int, err error)
- func (box *Box) Mkdir(path string) error
- func (box *Box) MkdirAll(path string) error
- func (box *Box) Move(oldPath, newPath string) error
- func (box *Box) Remove(path string) error
- func (box *Box) SaveConf(conf *conf.BoxConf) error
- func (box *Box) Stat(p string) (ret *FileInfo)
- func (box *Box) Unindex()
- func (box *Box) UpdateHistoryGenerated()
- type BoxInfo
- type CalDavBackend
- func (b *CalDavBackend) CalendarHomeSetPath(ctx context.Context) (string, error)
- func (b *CalDavBackend) CreateCalendar(ctx context.Context, calendar *caldav.Calendar) (err error)
- func (b *CalDavBackend) CurrentUserPrincipal(ctx context.Context) (string, error)
- func (b *CalDavBackend) DeleteCalendar(ctx context.Context, calendarPath string) (err error)
- func (b *CalDavBackend) DeleteCalendarObject(ctx context.Context, objectPath string) (err error)
- func (b *CalDavBackend) GetCalendar(ctx context.Context, calendarPath string) (calendar *caldav.Calendar, err error)
- func (b *CalDavBackend) GetCalendarObject(ctx context.Context, objectPath string, req *caldav.CalendarCompRequest) (calendarObject *caldav.CalendarObject, err error)
- func (b *CalDavBackend) ListCalendarObjects(ctx context.Context, calendarPath string, req *caldav.CalendarCompRequest) (calendarObjects []caldav.CalendarObject, err error)
- func (b *CalDavBackend) ListCalendars(ctx context.Context) (calendars_ []caldav.Calendar, err error)
- func (b *CalDavBackend) PutCalendarObject(ctx context.Context, objectPath string, calendar *ical.Calendar, ...) (calendarObject *caldav.CalendarObject, err error)
- func (b *CalDavBackend) QueryCalendarObjects(ctx context.Context, calendarPath string, query *caldav.CalendarQuery) (calendarObjects []caldav.CalendarObject, err error)
- type CalDavPathDepth
- type Calendar
- type CalendarObject
- type Calendars
- func (c *Calendars) CreateCalendar(calendarMetaData *caldav.Calendar) (err error)
- func (c *Calendars) DeleteCalendar(calendarPath string) (err error)
- func (c *Calendars) DeleteCalendarObject(objectPath string) (err error)
- func (c *Calendars) DeleteObject(objectPath string) (calendar *Calendar, calendarObject *CalendarObject, err error)
- func (c *Calendars) GetCalendar(calendarPath string) (calendar *caldav.Calendar, err error)
- func (c *Calendars) GetCalendarObject(objectPath string, req *caldav.CalendarCompRequest) (calendarObject *caldav.CalendarObject, err error)
- func (c *Calendars) GetObject(objectPath string) (calendar *Calendar, calendarObject *CalendarObject, err error)
- func (c *Calendars) ListCalendarObjects(calendarPath string, req *caldav.CalendarCompRequest) (calendarObjects []caldav.CalendarObject, err error)
- func (c *Calendars) ListCalendars() (calendars []caldav.Calendar, err error)
- func (c *Calendars) Load() error
- func (c *Calendars) PutCalendarObject(objectPath string, calendarData *ical.Calendar, ...) (calendarObject *caldav.CalendarObject, err error)
- func (c *Calendars) QueryCalendarObjects(calendarPath string, query *caldav.CalendarQuery) (calendarObjects []caldav.CalendarObject, err error)
- type CardDavBackend
- func (b *CardDavBackend) AddressBookHomeSetPath(ctx context.Context) (string, error)
- func (b *CardDavBackend) CreateAddressBook(ctx context.Context, addressBook *carddav.AddressBook) (err error)
- func (b *CardDavBackend) CurrentUserPrincipal(ctx context.Context) (string, error)
- func (b *CardDavBackend) DeleteAddressBook(ctx context.Context, bookPath string) (err error)
- func (b *CardDavBackend) DeleteAddressObject(ctx context.Context, addressPath string) (err error)
- func (b *CardDavBackend) GetAddressBook(ctx context.Context, bookPath string) (addressBook *carddav.AddressBook, err error)
- func (b *CardDavBackend) GetAddressObject(ctx context.Context, addressPath string, req *carddav.AddressDataRequest) (addressObject *carddav.AddressObject, err error)
- func (b *CardDavBackend) ListAddressBooks(ctx context.Context) (addressBooks []carddav.AddressBook, err error)
- func (b *CardDavBackend) ListAddressObjects(ctx context.Context, bookPath string, req *carddav.AddressDataRequest) (addressObjects []carddav.AddressObject, err error)
- func (b *CardDavBackend) PutAddressObject(ctx context.Context, addressPath string, card vcard.Card, ...) (addressObject *carddav.AddressObject, err error)
- func (b *CardDavBackend) QueryAddressObjects(ctx context.Context, urlPath string, query *carddav.AddressBookQuery) (addressObjects []carddav.AddressObject, err error)
- type CardDavPathDepth
- type ChildBlock
- type ClaimsKeyType
- type CloudGPT
- type Contacts
- func (c *Contacts) CreateAddressBook(addressBookMetaData *carddav.AddressBook) (err error)
- func (c *Contacts) DeleteAddress(addressPath string) (addressBook *AddressBook, addressObject *AddressObject, err error)
- func (c *Contacts) DeleteAddressBook(path string) (err error)
- func (c *Contacts) DeleteAddressObject(addressPath string) (err error)
- func (c *Contacts) GetAddress(addressPath string) (addressBook *AddressBook, addressObject *AddressObject, err error)
- func (c *Contacts) GetAddressBook(path string) (addressBook *carddav.AddressBook, err error)
- func (c *Contacts) GetAddressObject(addressPath string, req *carddav.AddressDataRequest) (addressObject *carddav.AddressObject, err error)
- func (c *Contacts) ListAddressBooks() (addressBooks []carddav.AddressBook, err error)
- func (c *Contacts) ListAddressObjects(bookPath string, req *carddav.AddressDataRequest) (addressObjects []carddav.AddressObject, err error)
- func (c *Contacts) Load() error
- func (c *Contacts) PutAddressObject(addressPath string, card vcard.Card, opts *carddav.PutAddressObjectOptions) (addressObject *carddav.AddressObject, err error)
- func (c *Contacts) QueryAddressObjects(urlPath string, query *carddav.AddressBookQuery) (addressObjects []carddav.AddressObject, err error)
- type Criterion
- type CriterionReplaceTypes
- type CriterionTypes
- type DiffFile
- type DiffIndex
- type DocxAssetParser
- type EmbedBlock
- func FilterEmbedBlocksByPublishAccess(c *gin.Context, publishAccess PublishAccess, embedBlocks []*EmbedBlock) (ret []*EmbedBlock)
- func GetEmbedBlock(embedBlockID string, includeIDs []string, headingMode int, breadcrumb bool) (ret []*EmbedBlock)
- func SearchEmbedBlock(embedBlockID, stmt string, excludeIDs []string, headingMode int, ...) (ret []*EmbedBlock)
- func SearchEmbedBlockInBox(embedBlockID, stmt string, excludeIDs []string, headingMode int, ...) (ret []*EmbedBlock)
- type EmbeddingStat
- type EpubAssetParser
- type ExportOptions
- type File
- type FileInfo
- type Flashcard
- type GPT
- type GraphArrows
- type GraphArrowsTo
- type GraphLink
- type GraphNode
- type GroupState
- type History
- type HistoryItem
- type KernelPetal
- type LeftRightDiff
- type OnlineKernel
- type OpenAIGPT
- type Operation
- type OutlineDoc
- type Path
- func FilterPathsByPublishAccess(c *gin.Context, publishAccess PublishAccess, paths []*Path) (ret []*Path)
- func GetBacklink(id, keyword, mentionKeyword string, beforeLen int, containChildren bool) (boxID string, linkPaths, mentionPaths []*Path, ...)
- func GetBacklink2(id, keyword, mentionKeyword string, sortMode, mentionSortMode int, ...) (boxID string, backlinks, backmentions []*Path, ...)
- func GetBacklink2InBox(id, keyword, mentionKeyword string, sortMode, mentionSortMode int, ...) (boxIDOut string, backlinks, backmentions []*Path, ...)
- func GetBacklinkInBox(id, keyword, mentionKeyword string, beforeLen int, containChildren bool, ...) (boxIDOut string, linkPaths, mentionPaths []*Path, ...)
- func Outline(rootID string, preview bool) (ret []*Path, err error)
- func OutlineInBox(rootID string, preview bool, boxID string) (ret []*Path, err error)
- type PdfAssetParser
- type Petal
- type PptxAssetParser
- type PublishAccess
- type PublishAccessItem
- type RecentDoc
- type RefDefs
- func FilterRefDefsByPublishIgnore(publishIgnore PublishAccess, refDefs []*RefDefs) (retRefDefs []*RefDefs, originalRefBlockIDs map[string]string)
- func GetBlockRefs(defID string) (refDefs []*RefDefs, originalRefBlockIDs map[string]string)
- func GetBlockRefsInBox(defID, boxID string) (refDefs []*RefDefs, originalRefBlockIDs map[string]string)
- type RiffCard
- type Role
- type SessionsMap
- type SetFlashcardDueTime
- type Snapshot
- type Sync
- type Tag
- type TagBlocks
- type Tags
- type TemplateSearchResult
- type Transaction
- type TxErr
- type TxtAssetParser
- type TypeCount
- type UndoEntry
- type UndoLog
- func (l *UndoLog) Clear(rootID string)
- func (l *UndoLog) Peek(rootID string) *UndoEntry
- func (l *UndoLog) Record(tx *Transaction)
- func (l *UndoLog) Redo(rootID string) *UndoEntry
- func (l *UndoLog) RedoCommit(entry *UndoEntry, rootID string)
- func (l *UndoLog) RedoRollback(entry *UndoEntry, rootID string)
- func (l *UndoLog) State(rootID string) (canUndo, canRedo bool, peekMutatedRootIDs []string)
- func (l *UndoLog) Undo(rootID string) *UndoEntry
- func (l *UndoLog) UndoCommit(entry *UndoEntry, rootID string)
- func (l *UndoLog) UndoRollback(entry *UndoEntry, rootID string)
- type UnusedItem
- type WidgetSearchResult
- type XlsxAssetParser
Constants ¶
const ( TxtAssetContentMaxSize = 1024 * 1024 * 4 PDFAssetContentMaxPage = 1024 )
const ( XAuthTokenKey = "X-Auth-Token" SessionIdCookieName = "publish-visitor-session-id" ClaimsContextKey = "claims" ClaimsKeyRole string = "role" )
const ( // REF: https://developers.google.com/calendar/caldav/v2/guide CalDavPrefixPath = "/caldav" CalDavPrincipalsPath = CalDavPrefixPath + "/principals" // 0 resourceTypeRoot CalDavUserPrincipalPath = CalDavPrincipalsPath + "/main" // 1 resourceTypeUserPrincipal CalDavHomeSetPath = CalDavUserPrincipalPath + "/calendars" // 2 resourceTypeCalendarHomeSet CalDavDefaultCalendarPath = CalDavHomeSetPath + "/default" // 3 resourceTypeCalendar CalDavDefaultCalendarName = "default" CalDavCalendarsMetaDataFilePath = CalDavHomeSetPath + "/calendars.json" ICalendarFileExt = "." + ical.Extension // .ics )
const ( // REF: https://developers.google.com/people/carddav#resources CardDavPrefixPath = "/carddav" CardDavPrincipalsPath = CardDavPrefixPath + "/principals" // 0 resourceTypeRoot CardDavUserPrincipalPath = CardDavPrincipalsPath + "/main" // 1 resourceTypeUserPrincipal CardDavHomeSetPath = CardDavUserPrincipalPath + "/contacts" // 2 resourceTypeAddressBookHomeSet CardDavDefaultAddressBookPath = CardDavHomeSetPath + "/default" // 3 resourceTypeAddressBook CardDavDefaultAddressBookName = "default" CardDavAddressBooksMetaDataFilePath = CardDavHomeSetPath + "/address-books.json" VCardFileExt = "." + vcard.Extension // .vcf )
const ( MaskedUserData = "" MaskedAccessAuthCode = "*******" )
const ( DailyNoteAttrPrefix = "custom-dailynote-" NodeAttrTitleEmpty = "custom-sy-title-empty" DocHiddenAttr = "custom-hidden" )
const ( HistoryOpClean = "clean" HistoryOpUpdate = "update" HistoryOpDelete = "delete" HistoryOpFormat = "format" HistoryOpSync = "sync" HistoryOpReplace = "replace" HistoryOpOutline = "outline" )
const ( HistoryTypeDocName = 0 // Search docs by doc name HistoryTypeDoc = 1 // Search docs by doc name and content HistoryTypeAsset = 2 // Search assets HistoryTypeDocID = 3 // Search docs by doc id HistoryTypeDatabase = 4 // Search databases by database id )
const ( TxErrCodeBlockNotFound = 0 TxErrCodeDataIsSyncing = 1 TxErrCodeWriteTree = 2 TxErrHandleAttributeView = 3 TxErrCodePushMsg = 4 TxErrCodeSkipTx = 5 // 操作被跳过(如跨加密边界移动),已 PushMsg 提示,不弹状态异常 )
const (
NodeAttrRiffDecks = "custom-riff-decks"
)
const PdfOutlineScheme = "pdf-outline"
const (
RoleContextKey = "role"
)
Variables ¶
var ( ErrorCalDavCalendarNotFound = errors.New("CalDAV: calendar not found") ErrorCalDavCalendarPathInvalid = errors.New("CalDAV: calendar path is invalid") ErrorCalDavCalendarObjectNotFound = errors.New("CalDAV: calendar object not found") ErrorCalDavCalendarObjectPathInvalid = errors.New("CalDAV: calendar object path is invalid") )
var ( ErrorCardDavPathInvalid = errors.New("CardDAV: path is invalid") ErrorCardDavBookNotFound = errors.New("CardDAV: address book not found") ErrorCardDavBookPathInvalid = errors.New("CardDAV: address book path is invalid") ErrorCardDavAddressNotFound = errors.New("CardDAV: address not found") ErrorCardDavAddressFileExtensionNameInvalid = errors.New("CardDAV: address file extension name is invalid") )
var ( OnKernelPluginStart func(petal *Petal) // Called when a plugin is enabled (after loading and starting the plugin) OnKernelPluginStop func(petal *Petal) // Called when a plugin is disabled (before stopping and unloading the plugin) OnKernelPluginsStart func() // Called to start all valid plugins OnKernelPluginsStop func() // Called to stopping all valid plugins )
var ( BasicAuthHeaderKey = "WWW-Authenticate" BasicAuthHeaderValue = "Basic realm=\"SiYuan Authorization Require\", charset=\"UTF-8\"" )
var ( BootSyncSucc = -1 // -1:未执行,0:执行成功,1:执行失败 ExitSyncSucc = -1 )
var ( ErrBoxNotFound = errors.New("notebook not found") ErrBlockNotFound = errors.New("block not found") ErrTreeNotFound = errors.New("tree not found") ErrIndexing = errors.New("indexing") ErrBoxUnindexed = errors.New("notebook unindexed") ErrInvalidID = errors.New("invalid id") )
var (
Decks = map[string]*riff.Deck{}
)
var ErrFailedToConnectCloudServer = errors.New("failed to connect cloud server")
var GlobalUndoLog = newUndoLog(64)
GlobalUndoLog 全局撤销日志单例。内存态,重启清空。
var KernelID = gulu.Rand.String(7)
var (
PDFAssetContentMaxSize uint64 = 1024 * 1024 * 128
)
Functions ¶
func Activity ¶
Activity 记录用户写操作时间,用于 AutoFixIndex 的空闲判断。 只认会产生数据变更的事务类请求(/api/transactions*),因为只有写操作才会引入索引不一致; 读操作和前端定时轮询(如 /api/ai/embeddingStat)不计入,避免 SiYuan 开着却不操作时被判为活跃。
func AddAttributeViewBlock ¶
func AddAttributeViewKey ¶
func AddCustomEmoji ¶
func AddCustomEmoji(emojiName, imgSrc string)
func AddMicrosoftDefenderExclusion ¶
func AddMicrosoftDefenderExclusion() error
func AddSession ¶
func AddSession(sessionID, username string)
func AddVirtualBlockRefExclude ¶
func AddVirtualBlockRefExclude(keyword []string)
func AddVirtualBlockRefInclude ¶
func AddVirtualBlockRefInclude(keyword []string)
func AddressBooksMetaDataFilePath ¶
func AddressBooksMetaDataFilePath() string
AddressBooksMetaDataFilePath returns the absolute path of the address books metadata file
func AddressPropsFilter ¶
func AddressPropsFilter(address *carddav.AddressObject, req *carddav.AddressDataRequest) *carddav.AddressObject
AddressPropsFilter filters address properties
func AppendHeadingChildren ¶
func AppendHeadingChildren(id, childrenDOM string)
func AppendPushCreateEntry ¶
func AppendPushCreateEntry(box, p string)
func AppendPushReloadAttrViewEntry ¶
func AppendPushReloadAttrViewEntry(avID string)
func AppendPushReloadDocInfoEntry ¶
func AppendPushReloadDocInfoEntry(box, p string)
func AppendPushReloadFiletreeEntry ¶
func AppendPushReloadFiletreeEntry()
func AppendPushReloadProtyleEntry ¶
func AppendPushReloadProtyleEntry(id string)
func AppendPushReloadTagEntry ¶
func AppendPushReloadTagEntry()
func AppendPushReloadUIEntry ¶
func AppendPushReloadUIEntry()
func AppendPushRemoveEntry ¶
func AppendPushRemoveEntry(box, p, id string)
func AppendPushRenameEntry ¶
func AppendPushRenameEntry(box, p, title string)
func AssetPathWithoutQuery ¶
AssetPathWithoutQuery 返回去掉查询参数后的资源路径,用于复制到导出目录等磁盘路径场景。
func AutoCheckMicrosoftDefenderJob ¶
func AutoCheckMicrosoftDefenderJob()
func AutoConsumeShorthandsJob ¶
func AutoConsumeShorthandsJob()
func AutoFixIndex ¶
func AutoFixIndex()
AutoFixIndex 在用户空闲且存在未订正变更时,自动订正索引。由 cron 每分钟调用。 触发需同时满足:空闲达 idleFixThreshold、存在未订正变更(dirty)、冷却期已过。
func AutoGenerateFileHistory ¶
func AutoGenerateFileHistory()
func AutoLockIdleEncryptedBoxesJob ¶
func AutoLockIdleEncryptedBoxesJob()
AutoLockIdleEncryptedBoxesJob 检查所有已解锁的加密 notebook,将闲置超时的自动锁定。 由 cron 每分钟调用。阈值由 NotebookCrypto.AutoLockMinutes 控制(0 = 禁用)。
func AutoPurgeRepoJob ¶
func AutoPurgeRepoJob()
AutoPurgeRepoJob 自动清理数据仓库 https://github.com/siyuan-note/siyuan/issues/13091
func BatchSetBlockAttrs ¶
func BatchUpdateAttributeViewCells ¶
func BatchUpdateAttributeViewCells(tx *Transaction, avID string, values []any) (err error)
func BatchUpdateRecentDocCloseTime ¶
BatchUpdateRecentDocCloseTime 批量更新文档关闭时间
func BookmarkLabels ¶
func BookmarkLabels() (ret []string)
func BootSyncData ¶
func BootSyncData()
func BuildGraph ¶
func BuildTreeGraph ¶
func CacheVirtualBlockRefJob ¶
func CacheVirtualBlockRefJob()
func CalendarsMetaDataFilePath ¶
func CalendarsMetaDataFilePath() string
CalendarsMetaDataFilePath returns the absolute path of the calendars' meta data file
func ChangeAttrViewLayout ¶
func ChangeAttrViewLayout(blockID, avID string, newLayout av.LayoutType) (err error)
func ChangeBoxSort ¶
func ChangeBoxSort(boxIDs []string)
func ChangeFileTreeSort ¶
func ChangeHistoryTick ¶
func ChangeHistoryTick(minutes int)
func ChangeMasterPassword ¶
ChangeMasterPassword 改主密码:用旧密码校验后,用新密码派生新 KEK, 重新加密 verifier,并把所有加密笔记本的 WrappedDEK 用新 KEK 重新包络后写回各自的 BoxConf。
使用两阶段提交确保崩溃后可恢复:
Phase 0: 预计算所有新 WrappedDEK(内存) Phase 1: 写入 migration manifest Phase 2: 切换全局 verifier Phase 3: 写入各 box conf + backup Phase 4: 清除 manifest
注意:必须在所有加密笔记本都已 Unmount 的状态下调用(DEK 不在内存),否则新旧 KEK 切换会让缓存与磁盘不一致。
func ChatGPTWithAction ¶
func CheckAbsPathAccessableByPublishAccess ¶
func CheckAbsPathAccessableByPublishAccess(c *gin.Context, absPath string, publishAccess PublishAccess) bool
func CheckActivationcode ¶
func CheckAdminRole ¶
func CheckBlockIdAccessableByPublishAccess ¶
func CheckBlockIdAccessableByPublishAccess(c *gin.Context, publishAccess PublishAccess, blockID string) bool
func CheckBlockRef ¶
func CheckEditRole ¶
func CheckPathAccessableByPublishIgnore ¶
func CheckPathAccessableByPublishIgnore(box string, path string, publishIgnore PublishAccess) bool
func CheckPublishAuthCookie ¶
func CheckReadRole ¶
func CheckReadonly ¶
func CheckUpdate ¶
func CheckUpdate(showMsg bool)
func CheckoutRepo ¶
func CheckoutRepo(id string)
func CheckoutRepoDirect ¶
func CheckoutRepoDirect(id string)
func ClearCustomEmojis ¶
func ClearCustomEmojis()
func ClearOutdatedHistoryDirJob ¶
func ClearOutdatedHistoryDirJob()
func ClearTempFiles ¶
func ClearTempFiles()
func ClearWorkspaceHistory ¶
func ClearWorkspaceHistory() (err error)
func Close ¶
Close 退出内核进程.
force:是否不执行同步过程而直接退出
setCurrentWorkspace:是否将当前工作空间放到工作空间列表的最后一个
execInstallPkg:是否执行新版本安装包
0:默认按照设置项 System.DownloadInstallPkg 检查并推送提示 1:不执行新版本安装 2:执行新版本安装
返回值 exitCode:
0:正常退出 1:同步执行失败 2:提示新安装包
当 force 为 true(强制退出)并且 execInstallPkg 为 0(默认检查更新)并且同步失败并且新版本安装版已经准备就绪时,执行新版本安装 https://github.com/siyuan-note/siyuan/issues/10288
func CloseWatchAssets ¶
func CloseWatchAssets()
func CloseWatchEmojis ¶
func CloseWatchEmojis()
func CloseWatchThemes ¶
func CloseWatchThemes()
func CloudChatGPT ¶
func ControlConcurrency ¶
func CreateCloudSyncDir ¶
func CreateDocByMd ¶
func CreateDocHistory ¶
func CreateEncryptedBox ¶
CreateEncryptedBox 创建一个新的加密笔记本。可多次调用创建多个。 前置:加密功能已启用。创建时需要主密码(临时派生 KEK 用于 wrap DEK,用完即弃)。 创建后直接用生成的 DEK 打开加密 db 并缓存(已解锁状态),调用方随后调 openNotebook 即可挂载。
func CreatePluginJWT ¶
CreatePluginJWT 为指定名称的内核插件创建一个 JWT,包含管理员权限。插件使用这个 JWT 调用内核 API。
func CreateTemplate ¶
CreateTemplate 在 <data>/templates/ 下创建模板文件。name 不含扩展名,content 为 markdown 文本。 overwrite=false 且文件已存在时返回 code=1(与 DocSaveAsTemplate 一致)。
func CreateWithMarkdown ¶
func DavPath2DirectoryPath ¶
DavPath2DirectoryPath converts CalDAV/CardDAV path to absolute path of the file system
func DeactivateUser ¶
func DeactivateUser() (err error)
func DecryptAsset ¶
DecryptAsset 对应解密。
func DecryptAssetNameMapping ¶
func DecryptFile ¶
DecryptFile 对应解密。
func DeepCopyBoxEncryption ¶
func DeepCopyBoxEncryption(src *conf.BoxEncryption) *conf.BoxEncryption
DeepCopyBoxEncryption 深拷贝 BoxEncryption(含 []byte 字段),输入 nil 时返回 nil。 供 api 层在反序列化请求体前保存加密字段的不可变快照。
func DeleteSession ¶
func DeleteSession(sessionID string)
func DisableEncryptedNotebook ¶
func DisableEncryptedNotebook() error
DisableEncryptedNotebook 关闭加密笔记本功能。前置:不能有加密笔记本存在, 且不能有依赖当前密钥备份的已删除笔记本历史(否则禁用并删除备份会让这些历史永久锁死,违反 §19)。 清除全局加密配置(MasterSalt/KEKVerifier),KEK/DEK 不再可用。
func Doc2Heading ¶
func DocImageAssets ¶
func DocSaveAsTemplate ¶
func DownloadCloudSnapshot ¶
func DownloadNetAssets2LocalAssets ¶
func DownloadNetAssets2LocalAssets(tree *parse.Tree, onlyImg bool, originalURL string, assetsDirPath string)
DownloadNetAssets2LocalAssets 将语法树中的网络资源下载到本地并改写链接, 不持久化文档树,由调用方负责后续保存与渲染。
func DuplicateAttributeViewRow ¶
func DuplicateAttributeViewRow(tx *Transaction, avID, previousItemID, srcRowID, newRowID string) (err error)
DuplicateAttributeViewRow 创建源行的纯文本副本,复制除主键、Rollup、Created、Updated 外的所有字段值, 双向关联同步更新目标属性视图的反向关联列。新行 ID 由调用方(前端)生成并通过 newRowID 传入, 副本插入到 previousItemID(通常为最后选中的条目)之后。
func DuplicateDatabaseBlock ¶
func DuplicateDoc ¶
func EnableEncryptedNotebook ¶
EnableEncryptedNotebook 启用加密笔记本功能:生成 MasterSalt、派生 KEK、写入校验值并持久化。 重复调用(已启用)返回错误,避免覆盖现有加密笔记本的密钥参数。 KEK 不缓存——启用后用户需对每个加密笔记本单独调 UnlockBox 解锁。
func EncryptAsset ¶
EncryptAsset 用 assetKey(DEK 派生子密钥)加密 asset 字节,AAD 绑定 boxID + 磁盘文件名。 diskName 为磁盘上的脱敏文件名(加密 box)或原始文件名(普通 box)。
func EncryptAssetNameMapping ¶
func EncryptFile ¶
EncryptFile 用 fileKey(DEK 派生子密钥)加密 .sy 文档字节,AAD 绑定 boxID + 稳定文件基名(不含父目录)。 relativePath 会先经 filesys.SyAAD 提取稳定文件基名(<rootID>.sy)并校验合法性, 与 filesys.encryptData/decryptData 共用同一 AAD 构造入口,保证加解密一致。
func EncryptedRawPathBoxID ¶
EncryptedRawPathBoxID 返回原始文件路径所属的加密笔记本 ID。 同时检查最长已存在父目录解析后的路径,防止通过符号链接绕过加密边界。
func Export2Liandi ¶
func ExportAddressBook ¶
ExportAddressBook exports an address book to a vCard file (*.vcf)
func ExportAv2CSV ¶
func ExportCodeBlock ¶
func ExportData ¶
func ExportDataInFolder ¶
func ExportDocx ¶
func ExportHTML ¶
func ExportMarkdownContent ¶
func ExportMarkdownHTML ¶
func ExportNotebookCryptoBackup ¶
ExportNotebookCryptoBackup 把密钥备份文件复制到 export 目录,返回可下载的相对路径。 供用户主动导出保存,作为同步之外的独立恢复途径(详见设计文档 §4.1)。 备份文件本身不含主密码(salt 不保密、verifier 是密文),拿到它也解不开任何数据。
func ExportNotebookMarkdown ¶
func ExportNotebookMarkdownWithOptions ¶
func ExportNotebookMarkdownWithOptions(boxID string, opts *ExportOptions) (zipPath string)
ExportNotebookMarkdownWithOptions 在 ExportNotebookMarkdown 基础上接受单次导出选项 #17031。
func ExportNotebookSY ¶
func ExportPandocConvertZip ¶
func ExportPandocConvertZipWithOptions ¶
func ExportPandocConvertZipWithOptions(ids []string, pandocTo, ext string, opts *ExportOptions) (name, zipPath string)
ExportPandocConvertZipWithOptions 在 ExportPandocConvertZip 基础上接受单次导出选项 #17031。
func ExportPreview ¶
func ExportRepoFile ¶
func ExportResources ¶
func ExportStdMarkdown ¶
func ExportSystemLog ¶
func ExportSystemLog() (zipPath string)
func ExtractBoxIDFromAssetsPath ¶
ExtractBoxIDFromAssetsPath 从 data 目录下的绝对路径(.sy 或 assets)反推 boxID。 供 server/api 层判断 asset 是否属于加密笔记本。路径形如 <DataDir>/<boxID>/...; 若不在 DataDir 下或 boxID 非合法 ID 模式,返回空串。
func ExtractBoxIDFromHistoryPath ¶
ExtractBoxIDFromHistoryPath 从历史目录下的绝对路径反推 boxID。 路径形如 <HistoryDir>/<timestamp>-<op>/<boxID>/...,切出紧跟在时间戳目录后的一段。 若路径不在 HistoryDir 下或 boxID 非合法 ID 模式,返回空串。
func FilterGraphByPublishIgnore ¶
func FilterGraphByPublishIgnore(publishIgnore PublishAccess, nodes []*GraphNode, links []*GraphLink) (retNodes []*GraphNode, retLinks []*GraphLink)
func FilterLocalStorageByPublishAccess ¶
func FilterLocalStorageByPublishAccess(publishAccess PublishAccess, localStorage map[string]any) (ret map[string]any)
func FilterUILayoutByPublishIgnore ¶
func FilterUILayoutByPublishIgnore(publishIgnore PublishAccess, uiLayout *conf.UILayout) (ret *conf.UILayout)
func FindReplace ¶
func FlushAssetsTextsJob ¶
func FlushAssetsTextsJob()
func FlushTxQueue ¶
func FlushTxQueue()
func FlushUpdateRefTextRenameDocJob ¶
func FlushUpdateRefTextRenameDocJob()
func FullReindex ¶
func FullReindex(needResetScroll bool)
func FullReindexDirect ¶
func FullReindexDirect()
func FullTextSearchHistory ¶
func GenerateAssetsThumbnail ¶
func GenerateFileHistory ¶
func GenerateFileHistory()
func GenerateFileHistoryForBox ¶
func GenerateFileHistoryForBox(box *Box)
GenerateFileHistoryForBox 对单个 box 生成文件历史。供加密笔记本关闭(锁定)前调用—— 锁定后定时器(GenerateFileHistory)无法为加密笔记本生成历史(不在 GetOpenedBoxes 里)。
func GetAssetAbsPath ¶
func GetAssetAbsPathInBox ¶
GetAssetAbsPathInBox 在指定 box 内解析资源绝对路径,不进行全局遍历。 relativePath 必须以 assets/ 前缀开头,boxID 为空且路径没有 box 查询参数时只解析普通/全局资源,不遍历加密 box。 加密 box 直接从 <boxID>/assets/ 查找,不依赖后缀匹配。
func GetAssetAbsPathWithOpt ¶
GetAssetAbsPathWithOpt 与 GetAssetAbsPath 一致,但可通过 includeEncrypted 控制是否遍历加密 box。 serveAssets 传 true(下游 serveEncryptedAsset 会按锁定状态 fail-closed),其他调用方传 false(安全跳过)。
func GetAssetImgSize ¶
func GetAssetImgSizeInBox ¶
func GetAssetPathByHash ¶
GetAssetPathByHash 按 hash 查已存在的 asset 路径用于去重。boxID 非空且为加密笔记本时返回空—— 加密笔记本不参与全局去重(避免复用普通明文 asset);普通 box 走全局 cache/SQL(加密笔记本数据不在全局表)。
func GetAttributeView ¶
func GetAttributeView(avID string) (ret *av.AttributeView)
func GetAttributeViewFilterSort ¶
func GetAttributeViewFilterSort(avID, blockID string) (filters []*av.ViewFilter, sorts []*av.ViewSort)
func GetAttributeViewItemIDs ¶
func GetBazaarPackageREADME ¶
func GetBazaarPackages ¶
GetBazaarPackages 获取在线集市包列表
func GetBlockDOM ¶
func GetBlockDOMInBox ¶
GetBlockDOMInBox 渲染指定笔记本内的块 DOM。boxID 为空时仅查询普通全局库。
func GetBlockDOMWithEmbed ¶
func GetBlockDOMWithEmbedInBox ¶
GetBlockDOMWithEmbedInBox 渲染指定笔记本内包含嵌入块的 DOM。
func GetBlockDOMs ¶
func GetBlockDOMsInBox ¶
GetBlockDOMsInBox 渲染指定笔记本内的块 DOM。禁止在 boxID 未指定时遍历加密笔记本。
func GetBlockDOMsWithEmbed ¶
func GetBlockDOMsWithEmbedInBox ¶
GetBlockDOMsWithEmbedInBox 渲染指定笔记本内包含嵌入块的 DOM。boxID 为空时仅查询普通全局库。
func GetBlockDefIDsByRefText ¶
func GetBlockIndex ¶
func GetBlockKramdown ¶
func GetBlockKramdownInBox ¶
GetBlockKramdownInBox 与 GetBlockKramdown 一致,但按 boxID 路由 blocktree 查询。
func GetBlockKramdownsInBox ¶
GetBlockKramdownsInBox 与 GetBlockKramdowns 一致,但按 boxID 路由 blocktree 查询。
func GetBlockRefText ¶
func GetBlockRefTextInBox ¶
GetBlockRefTextInBox 在指定加密笔记本内解析块引锚文本。
func GetBlockRelevantIDs ¶
func GetBlockRelevantIDsInBox ¶
GetBlockRelevantIDsInBox 获取指定笔记本内块的父级及相邻块 ID。空 box 不回退搜索加密笔记本。
func GetBlockSiblingID ¶
func GetBlockSiblingIDInBox ¶
GetBlockSiblingIDInBox 获取指定笔记本内块的相邻关系。空 box 不回退搜索加密笔记本。
func GetBlockTreeInfos ¶
func GetBlockTreeInfos(ids []string) (ret map[string]*BlockTreeInfo)
func GetBlockTreeInfosInBox ¶
func GetBlockTreeInfosInBox(ids []string, boxID string) (ret map[string]*BlockTreeInfo)
GetBlockTreeInfosInBox 获取指定笔记本内的块树信息。空 box 仅查询普通全局库。
func GetBlocksIndexes ¶
func GetBoxEncryption ¶
func GetBoxEncryption(boxID string) (*conf.BoxEncryption, error)
GetBoxEncryption 获取加密笔记本的 BoxEncryption(含 WrappedDEK)。 优先读 conf.json,若缺失/损坏则 fallback 到 per-notebook backup。 返回 nil 表示该 box 非加密;conf 标记加密但密钥材料缺失时返回明确错误。
func GetCaptcha ¶
func GetCloudRepoSnapshots ¶
func GetCloudSpace ¶
func GetDEKIfUnlocked ¶
GetDEKIfUnlocked 返回已解锁加密笔记本的 DEK(副本)。 非加密笔记本返回 (nil, nil)——filesys 据此原样读写,对普通笔记本透明。 加密但未解锁(DEK 不在内存)返回 (nil, error)——filesys 的加解密函数遇 error 后拒绝读写, 避免加密笔记本在未解锁状态下静默以明文落盘(深度防御,见 issue #18034)。
func GetDOMText ¶
func GetDoc ¶
func GetDoc(startID, endID, id string, index int, query string, queryTypes, querySubTypes map[string]bool, queryMethod, mode int, size int, isBacklink bool, originalRefBlockIDs map[string]string, highlight bool) ( blockCount int, dom, parentID, parent2ID, rootID, typ string, eof, scroll bool, boxID, docPath string, isBacklinkExpand bool, keywords []string, err error)
func GetDocHistoryContent ¶
func GetDocInBox ¶
func GetDocInBox(startID, endID, id string, index int, query string, queryTypes, querySubTypes map[string]bool, queryMethod, mode int, size int, isBacklink bool, originalRefBlockIDs map[string]string, highlight bool, boxID string) ( blockCount int, dom, parentID, parent2ID, rootID, typ string, eof, scroll bool, boxIDOut, docPath string, isBacklinkExpand bool, keywords []string, err error)
GetDocInBox 与 GetDoc 一致,但按 boxID 路由到加密 db 或全局 db。 加密笔记本打开文档时传入 boxID,blocktree/content 查询走加密 db;boxID 为空时 fall-through 全局 db。
func GetFullHPathByID ¶
func GetHPathByID ¶
func GetHPathByPath ¶
func GetHPathsByPaths ¶
func GetHeadingChildrenDOM ¶
func GetHeadingChildrenIDs ¶
func GetIDsByHPath ¶
func GetInstalledPackageInfos ¶
func GetInstalledPackageInfos(pkgType string) (installedPackageInfos []installedPackageInfo, basePath, baseURLPathPrefix string, err error)
GetInstalledPackageInfos 获取本地集市包信息,并返回路径相关字段供调用方复用
func GetInstalledPackages ¶
GetInstalledPackages 获取本地集市包列表
func GetLocalStorage ¶
func GetNewSessionID ¶
func GetNewSessionID() string
func GetPathByID ¶
func GetPathPasswordByPublishAccess ¶
func GetPathPasswordByPublishAccess(box string, blockPath string, publishAccess PublishAccess) (passwordID string, password string)
func GetRefTextInBox ¶
GetRefTextInBox 在指定加密笔记本内查块的引用文本(SQL 查询版,不走文件系统)。
func GetUnfoldedParentID ¶
func GetUpdatedPackages ¶
func GetUpdatedPackages(frontend string) (plugins, widgets, icons, themes, templates []*bazaar.Package)
GetUpdatedPackages 获取所有类型集市包的更新列表
- frontend 仅用于插件环境兼容性判断
func HandleAssetsChangeEvent ¶
func HandleAssetsChangeEvent(assetAbsPath string)
func HandleAssetsRemoveEvent ¶
func HandleAssetsRemoveEvent(assetAbsPath string)
func HandleSignal ¶
func HandleSignal()
func HasEncryptedNotebookHistory ¶
func HasEncryptedNotebookHistory() bool
HasEncryptedNotebookHistory 检查历史目录中是否存在加密笔记本的历史快照。 笔记本删除后其 box 目录(含 .siyuan/conf.json 和 notebook-crypt-backup.json)会被 原样密文备份到历史目录(RemoveBox 的 filelock.Copy),但此时 IsEncryptedBox 已返回 false (box 目录已删)。因此 DisableEncryptedNotebook 不能只靠 ListAllEncryptedBoxIDs 判定—— 已删除加密笔记本的历史仍依赖当前 MasterSalt/KEKVerifier 才能恢复,禁用并删除备份会让这些 历史永久锁死,违反设计 §19。本函数扫描历史目录识别这类依赖。
判定信号:历史条目 <HistoryDir>/<ts>-<op>/<boxID>/.siyuan/ 下存在 notebook-crypt-backup.json(专为 box 删除后的恢复设计),或 conf.json 标记 Encrypted=true。 boxID 用 ast.IsNodeIDPattern 校验,避免误判 assets/storage 等非 box 目录。
func Heading2Doc ¶
func HideConfSecret ¶
func HideConfSecret(c *AppConf)
HideConfSecret 隐藏设置中的秘密信息 REF: https://github.com/siyuan-note/siyuan/issues/11364
func HoldBoxReadLock ¶
func HoldBoxReadLock(boxID string)
HoldBoxReadLock 获取 box 读锁,防止 LockBox 在持锁期间清除缓存/临时文件。 调用方完成解密输出后必须调 ReleaseBoxReadLock。
func HookDesktopUIProcJob ¶
func HookDesktopUIProcJob()
func ImportData ¶
func ImportFromLocalPath ¶
func ImportNotebookCryptoBackup ¶
ImportNotebookCryptoBackup 接收用户导入的密钥备份文件内容(JSON 字节), 校验为合法 NotebookCrypto 后写回 <DataDir>/.siyuan/notebook-crypto-backup.json 并装回本机 Conf。 用于新设备/重装后不依赖同步、手动恢复加密配置(详见设计文档 §4.1)。 安全:备份文件不含主密码(salt 不保密、verifier 是密文),导入只恢复配置,解锁仍需主密码。 防呆:本机已启用加密笔记本时拒绝导入,避免覆盖现有 salt/verifier 孤立现有 WrappedDEK。 ImportNotebookCryptoBackup 接收用户导入的密钥备份文件内容(JSON 字节)+ 主密码, 校验主密码能解开备份里的 verifier 后才写回配置。防止 crafted 备份设置弱 KDFParams 等攻击。 本机已启用时拒绝(详见设计 §4.1):导入会用导入备份的 MasterSalt/KEKVerifier 覆盖当前配置, 若有现存加密笔记本其 WrappedDEK 将被新 KEK 孤立(数据锁死);即使无现存笔记本也拒绝, 避免覆盖后旧主密码失效造成用户困惑。换密钥材料应走“先禁用再导入”。
func ImportRepoKey ¶
func IndexEmbedBlockJob ¶
func IndexEmbedBlockJob()
IndexEmbedBlockJob 嵌入块支持搜索 https://github.com/siyuan-note/siyuan/issues/7112
func InitAppearance ¶
func InitAppearance()
func InitJwtKey ¶
func InitJwtKey() error
func InitPublishAccounts ¶
func InitPublishAccounts()
func InitPublishJWT ¶
func InitPublishJWT()
func InitRepoKey ¶
func InitRepoKey() (err error)
func InsertLocalAssets ¶
func InstallBazaarPackage ¶
InstallBazaarPackage 安装集市包,themeMode 仅在 pkgType 为 "themes" 时生效
func IsAdminRoleContext ¶
func IsBlockFolded ¶
func IsBlockRefCrossingBoundary ¶
IsBlockRefCrossingBoundary 判断从 srcBoxID 引用 defBlockID 是否跨越加密边界。 加密笔记本禁止跨边界块引(双向):加密笔记本的块只能引用同一加密笔记本内的块,普通 box 的块不能引用加密笔记本的块。 供 transaction 落库时兜底校验,防止手工输入/拖拽/粘贴/API 直调绕过前端搜索分流。
func IsEncryptedAssetPath ¶
IsEncryptedAssetPath 判断给定 asset 绝对路径是否属于加密笔记本。 供 server 层在缩略图等场景判断是否需跳过密文文件的处理。
func IsEncryptedBox ¶
IsEncryptedBox 判断给定 boxID 是否为加密笔记本。 优先读 conf.json,若缺失/损坏则 fallback 到独立备份,避免 fail-open。
func IsManagedEncryptedExportPath ¶
IsManagedEncryptedExportPath 判断相对路径是否属于加密导出受控范围(<boxID>/<kind>/<file> 结构)。 只要路径首段是合法 boxID 格式即视为受控,不依赖 box 是否仍存在(笔记本删除后仍需按注册表拒绝, 避免因 IsEncryptedBox 返回 false 而 fail-open 暴露明文产物)。
func IsMoveOutlineHeading ¶
func IsMoveOutlineHeading(transactions *[]*Transaction) bool
func IsPaidUser ¶
func IsPaidUser() bool
func IsPetalsEnabled ¶
func IsPetalsEnabled() bool
IsPetalsEnabled returns whether petals are enabled and trusted to be loaded
func IsPublishServiceToken ¶
IsPublishServiceToken 检查 token 是否来自发布服务
func IsReadOnlyRole ¶
func IsReadOnlyRoleContext ¶
func IsSameCryptoBoundary ¶
IsSameCryptoBoundary 判断 srcBox 与 dstBox 是否处于同一加密边界(跨 box 操作是否安全)。 普通笔记本之间允许(都不加密);加密笔记本仅允许同一 box 内部操作——两个不同的加密笔记本各有独立 DEK, 之间互为"加密边界外",跨 box 移动/合并会用错 DEK 导致密文损坏。供 MoveDocs/Doc2Heading 等跨 box 操作校验。
func IsSubscriber ¶
func IsSubscriber() bool
func IsSyncingFile ¶
func IsUserGuide ¶
func IsValidRole ¶
func IsValidSearchBoxPath ¶
IsValidSearchBoxPath 校验搜索入参中的笔记本 ID 与文档路径,阻止 SQL 元字符进入语句拼接。 box 必须是合法的节点 ID;docPath 为空表示仅限定笔记本范围;否则须为以 "/" 开头、 由节点 ID 段组成的文档路径(如 "/20210808180117-6v0mkxr.sy" 或子树目录 "/20210808180117-6v0mkxr")。
func ListAllEncryptedBoxIDs ¶
func ListAllEncryptedBoxIDs() []string
ListAllEncryptedBoxIDs 扫描 data 目录下所有含 notebook-crypt-backup.json 的 box 目录, 补全 ListNotebooks 可能遗漏的 conf 损坏加密笔记本。供改密/禁用/检测等关键路径使用。 统一使用 IsEncryptedBox 作为"是否加密"的唯一判定入口。
func ListItem2Doc ¶
func LoadCalendarObject ¶
LoadCalendarObject loads a iCalendar file (*.ics)
func LoadFlashcards ¶
func LoadFlashcards()
func LoadSnippets ¶
func LoadThemes ¶
func LoadThemes()
func LoadTreeByBlockIDWithReindexInBox ¶
LoadTreeByBlockIDWithReindexInBox 与 LoadTreeByBlockIDWithReindex 一致,但按 boxID 路由 blocktree 查询。
func LoadUploadToken ¶
func LoadUploadToken() (err error)
func LockBox ¶
func LockBox(boxID string)
LockBox 清除指定笔记本的 DEK 并删除其加密 db 文件。Unmount 单个加密笔记本或手动锁定时调用。
func LogoutAuth ¶
func LogoutUser ¶
func LogoutUser()
func LookupAssetOriginalName ¶
LookupAssetOriginalName 查询加密笔记本资源的原始文件名(供下载 Content-Disposition 等展示用)。 未找到时返回空串。
func LookupAssetOriginalNameLocked ¶
LookupAssetOriginalNameLocked 在调用方已持有 box 读锁时查询原始资源名。
func MasterPasswordMigrationStatus ¶
MasterPasswordMigrationStatus 返回是否存在待完成的改密迁移及受影响的笔记本。
func MoveLocalShorthands ¶
func NetAssets2LocalAssets ¶
func NotebookCryptoEnabled ¶
func NotebookCryptoEnabled() bool
NotebookCryptoEnabled 返回加密笔记本功能是否已启用(线程安全)。
func NotebookCryptoMuLock ¶
func NotebookCryptoMuLock()
NotebookCryptoMuLock 锁定 notebookCryptoMu,供 api 层读取一致的状态快照。
func NotebookCryptoMuUnlock ¶
func NotebookCryptoMuUnlock()
NotebookCryptoMuUnlock 解锁 notebookCryptoMu。
func OCRAssetsJob ¶
func OCRAssetsJob()
func OpenRepoSnapshotFile ¶
func ParseAddressPath ¶
ParseAddressPath parses address path to address book path and address ID
func ParseCalendarObjectPath ¶
GetCardDavPathDepth parses
func PathCleanWithSlash ¶
PathCleanWithSlash cleans the path
func PathJoinWithSlash ¶
PathJoinWithSlash joins the elements to a path with slash ('/') character
func PdfListLinks ¶
func PdfListLinks(ctx *model.Context) (assets, others []model.LinkAnnotation, err error)
func PdfListToCLinks ¶
func PdfListToCLinks(ctx *model.Context) (ret []model.LinkAnnotation, err error)
func PerformTransactions ¶
func PerformTransactions(transactions *[]*Transaction)
func PerformTxSync ¶
func PerformTxSync(tx *Transaction) (err error)
PerformTxSync 同步执行单笔事务并返回错误,供 undo/redo 重放使用。 与异步入队的 PerformTransactions 不同,这里直接持有 flushLock 串行执行 performTx, 失败时返回原始错误(不转成推送消息),调用方据此回滚撤销栈状态。
func PollPushQueue ¶
func PollPushQueue()
func PrepareEmbeddingSearch ¶
func PrepareEmbeddingSearch()
PrepareEmbeddingSearch 仅检查表与配置并把 embeddingTableOk 置真,不启动后台索引循环。 供 CLI 一次性命令(如 search -m 4)使用:StartEmbeddingIndexer 是死循环,不能直接用于会立即退出的进程。
func ProcessPDF ¶
func PurgeCloud ¶
func PurgeCloud() (err error)
func PurgePublishAccess ¶
func PurgePublishAccess()
func PushReloadPlugin ¶
func PushReloadSnippet ¶
func ReadAssetBytesInBox ¶
ReadAssetBytesInBox 读取指定 box 内的资源文件字节。若 box 为加密笔记本则自动解密返回明文。 relativePath 形如 "assets/xxx.png",可带 ?box= 查询参数。
func RefreshBacklink ¶
func RefreshBacklink(id string)
func RefreshCheckJob2H ¶
func RefreshCheckJob2H()
func RefreshCheckJob6H ¶
func RefreshCheckJob6H()
func RefreshUser ¶
func RefreshUser(token string)
func RegisterManagedEncryptedExport ¶
RegisterManagedEncryptedExport 是 registerManagedEncryptedExport 的导出包装,供 api 层调用。
func ReindexAssetContent ¶
func ReindexAssetContent()
func ReindexEmbedding ¶
func ReindexEmbedding()
ReindexEmbedding 清空嵌入向量表并触发后台索引器重新计算所有块。异步执行:只入队任务后立即返回。
func ReindexFTS ¶
func ReindexFTS()
func ReindexHistory ¶
func ReindexHistory()
func ReleaseBoxReadLock ¶
func ReleaseBoxReadLock(boxID string)
ReleaseBoxReadLock 释放 HoldBoxReadLock 获取的 box 读锁。
func ReloadFiletree ¶
func ReloadFiletree()
func ReloadProtyle ¶
func ReloadProtyle(rootID string)
func RemoveAttributeViewKey ¶
func RemoveBookmark ¶
func RemoveCloudRepoTag ¶
func RemoveCloudShorthands ¶
func RemoveCloudSyncDir ¶
func RemoveCriterion ¶
func RemoveDeck ¶
func RemoveDocs ¶
func RemoveDocs(paths []string)
func RemoveIndexes ¶
func RemoveIndexes(paths []string)
func RemoveLocalStorageVals ¶
func RemoveOutlineStorage ¶
func RemoveTagSnapshot ¶
func RemoveTemplate ¶
func RemoveUnusedAsset ¶
func RemoveUnusedAssets ¶
func RemoveUnusedAssets() (ret []string)
func RemoveUnusedAttributeView ¶
func RemoveUnusedAttributeView(id string)
func RemoveUnusedAttributeViews ¶
func RemoveUnusedAttributeViews() (ret []string)
func RenameAsset ¶
func RenameBookmark ¶
func RenameDeck ¶
func RenderAttributeView ¶
func RenderGoTemplate ¶
func RenderTemplate ¶
func ResetFlashcards ¶
func ResetVirtualBlockRefCache ¶
func ResetVirtualBlockRefCache()
func ResolveManagedEncryptedExport ¶
ResolveManagedEncryptedExport 返回仍有效的加密导出产物,未登记、已撤销或过期的路径均不可下载。
func ResolveManagedExportForMobile ¶
ResolveManagedExportForMobile 供移动端 GetExportFilePath 调用,校验托管 token 有效且 box 已解锁。 任一条件不满足返回 ("", false)(fail-closed),防止移动端绕过注册表直接读取明文导出产物。
func ResolveReplayDuplicateIds ¶
func ResolveReplayDuplicateIds(tx *Transaction)
ResolveReplayDuplicateIds 在 undo/redo 重放事务前解决块 ID 冲突。 场景:剪切块 X 后粘贴到别处(保留原 ID),再撤销剪切会 insert X,而 X 已存在于粘贴处,产生重复 ID。 这里对即将重放的 insert 操作做检查——若其引入的 ID 在块树中已存在,则在正反向操作及关联字段 (ID/ParentID/PreviousID/NextID 与 Data 内联 ID)上统一替换为新 ID。 替换同时作用于 do/undo 两套操作:重放只执行 doOperations,但若不同步改 undoOperations, 随后对同一 entry 的 redo 会沿用旧 ID 再次撞库。
func RetryFailedEmbedding ¶
func RetryFailedEmbedding()
RetryFailedEmbedding 删除所有失败块的行,使其立即回到主循环重嵌。异步执行:只入队任务后立即返回。 与 ReindexEmbedding 的区别:只删 fail_count>0 的失败块(embedding 为空,无有效向量),已成功的向量不动。
func ReviewFlashcard ¶
func RevokeManagedEncryptedExportsForBox ¶
func RevokeManagedEncryptedExportsForBox(boxID string)
RevokeManagedEncryptedExportsForBox 使指定笔记本的所有导出下载链接立即失效。
func RollbackAssetsHistory ¶
func RollbackDocHistory ¶
func RollbackNotebookHistory ¶
func SaveAgentTodos ¶
func SaveAgentTodos(sessionID string, todos []AgentTodoItem) error
func SaveMetaData ¶
func SearchAssetsByName ¶
func SearchDocs ¶
func SearchTags ¶
func SetAttrViewFilters ¶
SetAttrViewFilters 用新的过滤规则数组整体替换指定视图的过滤规则,并持久化。 data 为 JSON 反序列化前的 []any(通常是前端传来的过滤节点树)。
func SetAttrViewSorts ¶
SetAttrViewSorts 用新的排序规则数组整体替换指定视图的排序规则,并持久化。 data 为 JSON 反序列化前的 []any。
func SetAttributeViewGroup ¶
func SetAutoLockMinutes ¶
func SetAutoLockMinutes(minutes int)
SetAutoLockMinutes 设置加密笔记本自动锁定闲置分钟数。0 表示禁用。
func SetBlockReminder ¶
func SetBoxIcon ¶
func SetBoxIcon(boxID, icon string)
func SetCloudBlockReminder ¶
func SetCloudReminder ¶
func SetCloudSyncDir ¶
func SetCloudSyncDir(name string)
func SetCriterion ¶
func SetDatabaseBlockView ¶
func SetFlashcardsDueTime ¶
func SetFlashcardsDueTime(cardDues []*SetFlashcardDueTime) (err error)
func SetLocalStorage ¶
func SetLocalStorageVals ¶
func SetPublishAccess ¶
func SetPublishAccess(inputPublishAccess PublishAccess) (err error)
func SetSnippet ¶
func SetSyncEnable ¶
func SetSyncEnable(b bool)
func SetSyncGenerateConflictDoc ¶
func SetSyncGenerateConflictDoc(b bool)
func SetSyncInterval ¶
func SetSyncInterval(interval int)
func SetSyncMode ¶
func SetSyncMode(mode int)
func SetSyncPerception ¶
func SetSyncPerception(enabled bool)
func SetSyncProvider ¶
func SetSyncProviderLocal ¶
func SetSyncProviderS3 ¶
func SetSyncProviderWebDAV ¶
func SkipReviewFlashcard ¶
func SortAttributeViewKey ¶
func StartEmbeddingIndexer ¶
func StartEmbeddingIndexer()
func StartFreeTrial ¶
func StartFreeTrial() (err error)
func StartPushQueueConsumer ¶
func StartPushQueueConsumer()
func StoreAssetForBox ¶
func StoreAssetForBox(boxID, assetDirPath, originalName string, data []byte) (diskName string, err error)
StoreAssetForBox 统一资产写入入口:根据 boxID 决定加密/明文写入,返回磁盘文件名(不含路径前缀)。 加密 box:生成脱敏名 → writeAssetNameMapping 记录映射 → EncryptAsset 加密 → filelock.WriteFile 普通 box:util.AssetName 生成名 → filelock.WriteFile 明文写入 boxID 为空时按普通 box 处理(写入全局 assets)。
func SwapBlockRef ¶
func SyncDataDownload ¶
func SyncDataDownload()
func SyncDataJob ¶
func SyncDataJob()
func SyncDataUpload ¶
func SyncDataUpload()
func TagSnapshot ¶
func TouchRefUsed ¶
func TouchRefUsed(defBlockIDs []string)
TouchRefUsed 在用户真实插入引用时刷新目标块的最近引用时间。该时间独立于 refs 表的重建机制, 仅在事务处理(真实编辑)时写入,用于稳定块引"最近引用"排序。
func TouchUnlockedEncryptedBoxes ¶
func TouchUnlockedEncryptedBoxes()
TouchUnlockedEncryptedBoxes 由真实用户交互或 headless 客户端的显式保活调用,刷新当前已解锁笔记本的闲置计时。
func TransferBlockRef ¶
func UninstallPackage ¶
func UnlockBox ¶
func UnlockBox(boxID string, password string, boxEnc *conf.BoxEncryption) error
UnlockBox 用主密码派生 KEK,解出该笔记本的 DEK 并缓存。KEK 用完即弃,不全局缓存。 每次调用都跑一次 Argon2id(约 1 秒),严格满足"每笔记本单独解锁"语义。
func UpdateAttributeViewCell ¶
func UpdateEmbedBlock ¶
func UpdateRecentDocCloseTime ¶
UpdateRecentDocCloseTime 更新文档关闭时间
func UpdateRecentDocOpenTime ¶
UpdateRecentDocOpenTime 更新文档打开时间(只在第一次从文档树加载到页签时调用)
func UpdateRecentDocViewTime ¶
UpdateRecentDocViewTime 更新文档浏览时间
func UploadAssets2Cloud ¶
func UploadCloudSnapshot ¶
func UpsertIndexes ¶
func UpsertIndexes(paths []string)
func UseActivationcode ¶
func VacuumDataIndex ¶
func VacuumDataIndex()
func WatchAssets ¶
func WatchAssets()
func WatchEmojis ¶
func WatchEmojis()
func WatchThemes ¶
func WatchThemes()
func WrapNewDEK ¶
WrapNewDEK 用给定 KEK 生成随机 DEK 并包络,返回 BoxEncryption 元数据。 KEK 由调用方临时派生(不来自全局缓存),调用方负责使用后丢弃。 同时返回原始 DEK,供调用方在创建场景下直接开 db 缓存,省去再次 Argon2id 派生。
Types ¶
type Account ¶
func GetBasicAuthAccount ¶
type AccountsMap ¶
type AddressBook ¶
type AddressObject ¶
type AddressObject struct {
Changed bool
FilePath string
BookPath string
Data *carddav.AddressObject
}
func ImportAddressBook ¶
func ImportAddressBook(addressBookPath, cardContent string) (addresses []*AddressObject, err error)
ImportAddressBook imports an address book from a vCard file (*.vcf)
type AgentTodoItem ¶
type AgentTodoItem struct {
Content string `json:"content"`
Status string `json:"status"` // pending, in_progress, completed, cancelled
}
func LoadAgentTodos ¶
func LoadAgentTodos(sessionID string) ([]AgentTodoItem, error)
type AgentTodoList ¶
type AgentTodoList struct {
SessionID string `json:"sessionID"`
Todos []AgentTodoItem `json:"todos"`
}
type Announcement ¶
type AppConf ¶
type AppConf struct {
LogLevel string `json:"logLevel"` // 日志级别:off, trace, debug, info, warn, error, fatal
Appearance *conf.Appearance `json:"appearance"` // 外观
Langs []*conf.Lang `json:"langs"` // 界面语言列表
Lang string `json:"lang"` // 选择的界面语言,同 Appearance.Lang
FileTree *conf.FileTree `json:"fileTree"` // 文档面板
Tag *conf.Tag `json:"tag"` // 标签面板
Editor *conf.Editor `json:"editor"` // 编辑器配置
Export *conf.Export `json:"export"` // 导出配置
Graph *conf.Graph `json:"graph"` // 关系图配置
UILayout *conf.UILayout `json:"uiLayout"` // 界面布局。不要直接使用,使用 GetUILayout() 和 SetUILayout() 方法
UserData string `json:"userData"` // 社区用户信息,对 User 加密存储
User *conf.User `json:"-"` // 社区用户内存结构,不持久化。不要直接使用,使用 GetUser() 和 SetUser() 方法
Account *conf.Account `json:"account"` // 帐号配置
ReadOnly bool `json:"readonly"` // 是否是以只读模式运行
ServerAddrs []string `json:"serverAddrs"` // 本地服务器地址列表
AccessAuthCode string `json:"accessAuthCode"` // 锁屏密码
System *conf.System `json:"system"` // 系统配置
Keymap *conf.Keymap `json:"keymap"` // 快捷键配置
Sync *conf.Sync `json:"sync"` // 同步配置
Search *conf.Search `json:"search"` // 搜索配置
Flashcard *conf.Flashcard `json:"flashcard"` // 闪卡配置
AI *conf.AI `json:"ai"` // 人工智能配置
Secrets *conf.Secrets `json:"secrets"` // 全局密钥库
Variables *conf.Variables `json:"variables"` // 全局变量库
Bazaar *conf.Bazaar `json:"bazaar"` // 集市配置
Stat *conf.Stat `json:"stat"` // 统计
Api *conf.API `json:"api"` // API
Repo *conf.Repo `json:"repo"` // 数据仓库
NotebookCrypto *conf.NotebookCrypto `json:"notebookCrypto"` // 加密笔记本密钥管理
Publish *conf.Publish `json:"publish"` // 发布服务
OpenHelp bool `json:"openHelp"` // 启动后是否需要打开用户指南
ShowChangelog bool `json:"showChangelog"` // 是否显示版本更新日志
CloudRegion int `json:"cloudRegion"` // 云端区域,0:中国大陆,1:北美
Snippet *conf.Snpt `json:"snippet"` // 代码片段
DataIndexState int `json:"dataIndexState"` // 数据索引状态,0:已索引,1:未索引
CookieKey string `json:"cookieKey"` // 用于加密 Cookie 的密钥
// contains filtered or unexported fields
}
AppConf 维护应用元数据,保存在 ~/.siyuan/conf.json。
var Conf *AppConf
func FilterConfByPublishIgnore ¶
func FilterConfByPublishIgnore(publishIgnore PublishAccess, appConf *AppConf) (ret *AppConf)
func NewAppConf ¶
func NewAppConf() *AppConf
func (*AppConf) GetClosedBoxes ¶
func (*AppConf) GetOpenedBoxes ¶
func (*AppConf) GetUILayout ¶
func (*AppConf) SetUILayout ¶
type AssetContent ¶
type AssetContent struct {
ID string `json:"id"`
Name string `json:"name"`
Ext string `json:"ext"`
Path string `json:"path"`
Size int64 `json:"size"`
HSize string `json:"hSize"`
Updated int64 `json:"updated"`
Content string `json:"content"`
}
func FilterAssetContentByPublishAccess ¶
func FilterAssetContentByPublishAccess(c *gin.Context, publishAccess PublishAccess, assetContent []*AssetContent) (ret []*AssetContent)
func FullTextSearchAssetContent ¶
func FullTextSearchAssetContent(query string, types map[string]bool, method, orderBy, page, pageSize int) (ret []*AssetContent, matchedAssetCount, pageCount int)
FullTextSearchAssetContent 搜索资源文件内容。
method:0:关键字,1:查询语法,2:SQL,3:正则表达式 orderBy: 0:按相关度降序,1:按相关度升序,2:按更新时间升序,3:按更新时间降序
func GetAssetContent ¶
func GetAssetContent(id, query string, queryMethod int) (ret *AssetContent)
func GetAssetContentByPath ¶
func GetAssetContentByPath(path string) (ret *AssetContent)
GetAssetContentByPath 按资源文件路径获取已索引的完整内容。
path 为工作空间相对路径,形如 "assets/xxx.pdf"。返回 nil 表示该文件尚未被索引。 与 GetAssetContent(按索引记录 id)不同,此处直接返回 content 原文,不做高亮。
type AssetParseResult ¶
type AssetParser ¶
type AssetParser interface {
Parse(absPath string) *AssetParseResult
}
type AssetsSearcher ¶
type AssetsSearcher struct {
// contains filtered or unexported fields
}
func NewAssetsSearcher ¶
func NewAssetsSearcher() *AssetsSearcher
func (*AssetsSearcher) FullIndex ¶
func (searcher *AssetsSearcher) FullIndex()
func (*AssetsSearcher) GetParser ¶
func (searcher *AssetsSearcher) GetParser(ext string) AssetParser
type AvSearchResult ¶
type AvSearchResult struct {
AvID string `json:"avID"`
AvName string `json:"avName"`
ViewName string `json:"viewName"`
ViewID string `json:"viewID"`
ViewLayout av.LayoutType `json:"viewLayout"`
BlockID string `json:"blockID"`
HPath string `json:"hPath"`
Children []*AvSearchResult `json:"children,omitempty"`
}
func SearchAttributeView ¶
func SearchAttributeView(keyword string, excludeAvIDs []string) (ret []*AvSearchResult)
type AvSearchTempResult ¶
type Backlink ¶
type Backlink struct {
DOM string `json:"dom"`
BlockPaths []*BlockPath `json:"blockPaths"`
Expand bool `json:"expand"`
// contains filtered or unexported fields
}
func GetBacklinkDoc ¶
func GetBacklinkDocInBox ¶
func GetBackmentionDoc ¶
type Block ¶
type Block struct {
Box string `json:"box"`
Path string `json:"path"`
HPath string `json:"hPath"`
ID string `json:"id"`
RootID string `json:"rootID"`
ParentID string `json:"parentID"`
Name string `json:"name"`
Alias string `json:"alias"`
Memo string `json:"memo"`
Tag string `json:"tag"`
Content string `json:"content"`
FContent string `json:"fcontent"`
Markdown string `json:"markdown"`
Folded bool `json:"folded"`
Type string `json:"type"`
SubType string `json:"subType"`
RefText string `json:"refText"`
Defs []*Block `json:"-"` // 当前块引用了这些块,避免序列化 JSON 时产生循环引用
Refs []*Block `json:"refs"` // 当前块被这些块引用
DefID string `json:"defID"`
DefPath string `json:"defPath"`
IAL map[string]string `json:"ial"`
Children []*Block `json:"children"`
Depth int `json:"depth"`
Count int `json:"count"`
RefCount int `json:"refCount"`
Sort int `json:"sort"`
Created string `json:"created"`
Updated string `json:"updated"`
RiffCardID string `json:"riffCardID"`
RiffCard *RiffCard `json:"riffCard"`
}
Block 描述了内容块。
func FilterBlocksByPublishAccess ¶
func FilterBlocksByPublishAccess(c *gin.Context, publishAccess PublishAccess, blocks []*Block) (ret []*Block)
func FullTextSearchBlock ¶
func FullTextSearchBlock(query string, boxes, paths []string, types, subTypes map[string]bool, method, orderBy, groupBy, page, pageSize int) (ret []*Block, matchedBlockCount, matchedRootCount, pageCount int, docMode bool)
FullTextSearchBlock 搜索内容块。
method:0:关键字,1:查询语法,2:SQL,3:正则表达式 orderBy: 0:按块类型(默认),1:按创建时间升序,2:按创建时间降序,3:按更新时间升序,4:按更新时间降序,5:按内容顺序(仅在按文档分组时),6:按相关度升序,7:按相关度降序 groupBy:0:不分组,1:按文档分组
func FullTextSearchBlockInBox ¶
func FullTextSearchBlockInBox(query string, boxes, paths []string, types, subTypes map[string]bool, method, orderBy, groupBy, page, pageSize int, boxID string) (ret []*Block, matchedBlockCount, matchedRootCount, pageCount int, docMode bool)
FullTextSearchBlockInBox 与 FullTextSearchBlock 一致,但按 boxID 路由到加密 db 或全局 db。 加密笔记本内搜索时传入 boxID,所有 sql/treenode 查询走加密 db;boxID 为空时 fall-through 全局 db。
func GetDeckFlashcards ¶
func GetFlashcardsByBlockIDs ¶
func GetNotebookFlashcards ¶
func GetTreeFlashcards ¶
func ListInvalidBlockRefs ¶
func RecentUpdatedBlocks ¶
func RecentUpdatedBlocks() (ret []*Block)
func SearchRefBlock ¶
func SearchRefBlockInBox ¶
func SearchRefBlockInBox(id, rootID, keyword string, beforeLen int, isSquareBrackets, isDatabase bool, boxID string) (ret []*Block, newDoc bool)
SearchRefBlockInBox 与 SearchRefBlock 一致,但按 boxID 路由到加密 db 或全局 db。 加密笔记本内搜索块引目标时传入 boxID,只搜该 box 自己的加密 db,避免跨加密边界引用。
func SemanticSearchBlock ¶
func (*Block) IsContainerBlock ¶
type BlockAttributeViewKeys ¶
type BlockAttributeViewKeys struct {
AvID string `json:"avID"`
AvName string `json:"avName"`
BlockIDs []string `json:"blockIDs"`
KeyValues []*av.KeyValues `json:"keyValues"`
}
func FilterBlockAttributeViewKeysByPublishAccess ¶
func FilterBlockAttributeViewKeysByPublishAccess(c *gin.Context, publishAccess PublishAccess, blockAttributeViewKeys []*BlockAttributeViewKeys) (ret []*BlockAttributeViewKeys)
func GetBlockAttributeViewKeys ¶
func GetBlockAttributeViewKeys(nodeID string) (ret []*BlockAttributeViewKeys)
type BlockInfo ¶
type BlockInfo struct {
ID string `json:"id"`
RootID string `json:"rootID"`
Name string `json:"name"`
RefCount int `json:"refCount"`
SubFileCount int `json:"subFileCount"`
RefIDs []string `json:"refIDs"`
IAL map[string]string `json:"ial"`
Icon string `json:"icon"`
AttrViews []*AttrView `json:"attrViews"`
}
func FilterBlockInfoByPublishAccess ¶
func FilterBlockInfoByPublishAccess(c *gin.Context, publishAccess PublishAccess, info *BlockInfo) (ret *BlockInfo)
func GetDocInfo ¶
func GetDocInfoInBox ¶
GetDocInfoInBox 与 GetDocInfo 一致,但按 boxID 路由 blocktree/refs 查询到加密 db 或全局 db。
type BlockPath ¶
type BlockPath struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
SubType string `json:"subType"`
Children []*BlockPath `json:"children"`
}
func BuildBlockBreadcrumb ¶
type BlockTreeInfo ¶
type Bookmark ¶
type Bookmark struct {
Name BookmarkLabel `json:"name"`
Blocks []*Block `json:"blocks"`
Type string `json:"type"` // "bookmark"
Depth int `json:"depth"`
Count int `json:"count"`
}
type BookmarkBlocks ¶
type BookmarkBlocks []*Block
type BookmarkLabel ¶
type BookmarkLabel string
type Bookmarks ¶
type Bookmarks []*Bookmark
func BuildBookmark ¶
func BuildBookmark() (ret *Bookmarks)
type Box ¶
type Box struct {
ID string `json:"id"`
Name string `json:"name"`
Icon string `json:"icon"`
Sort int `json:"sort"`
SortMode int `json:"sortMode"`
Closed bool `json:"closed"`
NewFlashcardCount int `json:"newFlashcardCount"`
DueFlashcardCount int `json:"dueFlashcardCount"`
FlashcardCount int `json:"flashcardCount"`
Encrypted bool `json:"encrypted"` // 是否为加密笔记本
Unlocked bool `json:"unlocked"` // 加密笔记本是否已解锁(DEK 在内存),非加密笔记本恒为 false
}
Box 笔记本。
func GetBoxByName ¶
func GetFlashcardNotebooks ¶
func GetFlashcardNotebooks() (ret []*Box)
func ListNotebooks ¶
func (*Box) UpdateHistoryGenerated ¶
func (box *Box) UpdateHistoryGenerated()
type CalDavBackend ¶
type CalDavBackend struct{}
func (*CalDavBackend) CalendarHomeSetPath ¶
func (b *CalDavBackend) CalendarHomeSetPath(ctx context.Context) (string, error)
func (*CalDavBackend) CreateCalendar ¶
func (*CalDavBackend) CurrentUserPrincipal ¶
func (b *CalDavBackend) CurrentUserPrincipal(ctx context.Context) (string, error)
func (*CalDavBackend) DeleteCalendar ¶
func (b *CalDavBackend) DeleteCalendar(ctx context.Context, calendarPath string) (err error)
func (*CalDavBackend) DeleteCalendarObject ¶
func (b *CalDavBackend) DeleteCalendarObject(ctx context.Context, objectPath string) (err error)
func (*CalDavBackend) GetCalendar ¶
func (*CalDavBackend) GetCalendarObject ¶
func (b *CalDavBackend) GetCalendarObject(ctx context.Context, objectPath string, req *caldav.CalendarCompRequest) (calendarObject *caldav.CalendarObject, err error)
func (*CalDavBackend) ListCalendarObjects ¶
func (b *CalDavBackend) ListCalendarObjects(ctx context.Context, calendarPath string, req *caldav.CalendarCompRequest) (calendarObjects []caldav.CalendarObject, err error)
func (*CalDavBackend) ListCalendars ¶
func (*CalDavBackend) PutCalendarObject ¶
func (b *CalDavBackend) PutCalendarObject(ctx context.Context, objectPath string, calendar *ical.Calendar, opts *caldav.PutCalendarObjectOptions) (calendarObject *caldav.CalendarObject, err error)
func (*CalDavBackend) QueryCalendarObjects ¶
func (b *CalDavBackend) QueryCalendarObjects(ctx context.Context, calendarPath string, query *caldav.CalendarQuery) (calendarObjects []caldav.CalendarObject, err error)
type CalDavPathDepth ¶
type CalDavPathDepth int
func GetCalDavPathDepth ¶
func GetCalDavPathDepth(urlPath string) CalDavPathDepth
type CalendarObject ¶
type CalendarObject struct {
Changed bool
FilePath string
CalendarPath string
Data *caldav.CalendarObject
}
type Calendars ¶
type Calendars struct {
// contains filtered or unexported fields
}
func (*Calendars) CreateCalendar ¶
func (*Calendars) DeleteCalendar ¶
func (*Calendars) DeleteCalendarObject ¶
func (*Calendars) DeleteObject ¶
func (c *Calendars) DeleteObject(objectPath string) (calendar *Calendar, calendarObject *CalendarObject, err error)
func (*Calendars) GetCalendar ¶
func (*Calendars) GetCalendarObject ¶
func (c *Calendars) GetCalendarObject(objectPath string, req *caldav.CalendarCompRequest) (calendarObject *caldav.CalendarObject, err error)
func (*Calendars) GetObject ¶
func (c *Calendars) GetObject(objectPath string) (calendar *Calendar, calendarObject *CalendarObject, err error)
func (*Calendars) ListCalendarObjects ¶
func (c *Calendars) ListCalendarObjects(calendarPath string, req *caldav.CalendarCompRequest) (calendarObjects []caldav.CalendarObject, err error)
func (*Calendars) ListCalendars ¶
func (*Calendars) PutCalendarObject ¶
func (c *Calendars) PutCalendarObject(objectPath string, calendarData *ical.Calendar, opts *caldav.PutCalendarObjectOptions) (calendarObject *caldav.CalendarObject, err error)
func (*Calendars) QueryCalendarObjects ¶
func (c *Calendars) QueryCalendarObjects(calendarPath string, query *caldav.CalendarQuery) (calendarObjects []caldav.CalendarObject, err error)
type CardDavBackend ¶
type CardDavBackend struct{}
func (*CardDavBackend) AddressBookHomeSetPath ¶
func (b *CardDavBackend) AddressBookHomeSetPath(ctx context.Context) (string, error)
func (*CardDavBackend) CreateAddressBook ¶
func (b *CardDavBackend) CreateAddressBook(ctx context.Context, addressBook *carddav.AddressBook) (err error)
func (*CardDavBackend) CurrentUserPrincipal ¶
func (b *CardDavBackend) CurrentUserPrincipal(ctx context.Context) (string, error)
func (*CardDavBackend) DeleteAddressBook ¶
func (b *CardDavBackend) DeleteAddressBook(ctx context.Context, bookPath string) (err error)
func (*CardDavBackend) DeleteAddressObject ¶
func (b *CardDavBackend) DeleteAddressObject(ctx context.Context, addressPath string) (err error)
func (*CardDavBackend) GetAddressBook ¶
func (b *CardDavBackend) GetAddressBook(ctx context.Context, bookPath string) (addressBook *carddav.AddressBook, err error)
func (*CardDavBackend) GetAddressObject ¶
func (b *CardDavBackend) GetAddressObject(ctx context.Context, addressPath string, req *carddav.AddressDataRequest) (addressObject *carddav.AddressObject, err error)
func (*CardDavBackend) ListAddressBooks ¶
func (b *CardDavBackend) ListAddressBooks(ctx context.Context) (addressBooks []carddav.AddressBook, err error)
func (*CardDavBackend) ListAddressObjects ¶
func (b *CardDavBackend) ListAddressObjects(ctx context.Context, bookPath string, req *carddav.AddressDataRequest) (addressObjects []carddav.AddressObject, err error)
func (*CardDavBackend) PutAddressObject ¶
func (b *CardDavBackend) PutAddressObject(ctx context.Context, addressPath string, card vcard.Card, opts *carddav.PutAddressObjectOptions) (addressObject *carddav.AddressObject, err error)
func (*CardDavBackend) QueryAddressObjects ¶
func (b *CardDavBackend) QueryAddressObjects(ctx context.Context, urlPath string, query *carddav.AddressBookQuery) (addressObjects []carddav.AddressObject, err error)
type CardDavPathDepth ¶
type CardDavPathDepth int
func GetCardDavPathDepth ¶
func GetCardDavPathDepth(urlPath string) CardDavPathDepth
type ChildBlock ¶
type ChildBlock struct {
ID string `json:"id"`
Type string `json:"type"`
SubType string `json:"subType,omitempty"`
Content string `json:"content,omitempty"`
Markdown string `json:"markdown,omitempty"`
}
func GetChildBlocks ¶
func GetChildBlocks(id string) (ret []*ChildBlock)
func GetTailChildBlocks ¶
func GetTailChildBlocks(id string, n int) (ret []*ChildBlock)
type ClaimsKeyType ¶
type ClaimsKeyType string
type Contacts ¶
type Contacts struct {
// contains filtered or unexported fields
}
func (*Contacts) CreateAddressBook ¶
func (c *Contacts) CreateAddressBook(addressBookMetaData *carddav.AddressBook) (err error)
func (*Contacts) DeleteAddress ¶
func (c *Contacts) DeleteAddress(addressPath string) (addressBook *AddressBook, addressObject *AddressObject, err error)
func (*Contacts) DeleteAddressBook ¶
func (*Contacts) DeleteAddressObject ¶
func (*Contacts) GetAddress ¶
func (c *Contacts) GetAddress(addressPath string) (addressBook *AddressBook, addressObject *AddressObject, err error)
func (*Contacts) GetAddressBook ¶
func (c *Contacts) GetAddressBook(path string) (addressBook *carddav.AddressBook, err error)
func (*Contacts) GetAddressObject ¶
func (c *Contacts) GetAddressObject(addressPath string, req *carddav.AddressDataRequest) (addressObject *carddav.AddressObject, err error)
func (*Contacts) ListAddressBooks ¶
func (c *Contacts) ListAddressBooks() (addressBooks []carddav.AddressBook, err error)
func (*Contacts) ListAddressObjects ¶
func (c *Contacts) ListAddressObjects(bookPath string, req *carddav.AddressDataRequest) (addressObjects []carddav.AddressObject, err error)
func (*Contacts) PutAddressObject ¶
func (c *Contacts) PutAddressObject(addressPath string, card vcard.Card, opts *carddav.PutAddressObjectOptions) (addressObject *carddav.AddressObject, err error)
func (*Contacts) QueryAddressObjects ¶
func (c *Contacts) QueryAddressObjects(urlPath string, query *carddav.AddressBookQuery) (addressObjects []carddav.AddressObject, err error)
type Criterion ¶
type Criterion struct {
Name string `json:"name"`
Sort int `json:"sort"` // 0:按块类型(默认),1:按创建时间升序,2:按创建时间降序,3:按更新时间升序,4:按更新时间降序,5:按内容顺序(仅在按文档分组时)
Group int `json:"group"` // 0:不分组,1:按文档分组
HasReplace bool `json:"hasReplace"` // 是否有替换
Method int `json:"method"` // 0:文本,1:查询语法,2:SQL,3:正则表达式
HPath string `json:"hPath"`
IDPath []string `json:"idPath"`
K string `json:"k"` // 搜索关键字
R string `json:"r"` // 替换关键字
Types *CriterionTypes `json:"types"` // 类型过滤选项
ReplaceTypes *CriterionReplaceTypes `json:"replaceTypes"` // 替换类型过滤选项
}
func FilterCriteriaByPublishAccess ¶
func FilterCriteriaByPublishAccess(c *gin.Context, publishAccess PublishAccess, criteria []*Criterion) (ret []*Criterion)
func GetCriteria ¶
func GetCriteria() (ret []*Criterion)
type CriterionReplaceTypes ¶
type CriterionReplaceTypes struct {
Text bool `json:"text"`
ImgText bool `json:"imgText"`
ImgTitle bool `json:"imgTitle"`
ImgSrc bool `json:"imgSrc"`
AText bool `json:"aText"`
ATitle bool `json:"aTitle"`
AHref bool `json:"aHref"`
Code bool `json:"code"`
Em bool `json:"em"`
Strong bool `json:"strong"`
InlineMath bool `json:"inlineMath"`
InlineMemo bool `json:"inlineMemo"`
BlockRef bool `json:"blockRef"`
FileAnnotationRef bool `json:"fileAnnotationRef"`
Kbd bool `json:"kbd"`
Mark bool `json:"mark"`
S bool `json:"s"`
Sub bool `json:"sub"`
Sup bool `json:"sup"`
Tag bool `json:"tag"`
U bool `json:"u"`
DocTitle bool `json:"docTitle"`
CodeBlock bool `json:"codeBlock"`
MathBlock bool `json:"mathBlock"`
HtmlBlock bool `json:"htmlBlock"`
}
type CriterionTypes ¶
type CriterionTypes struct {
MathBlock bool `json:"mathBlock"`
Table bool `json:"table"`
Blockquote bool `json:"blockquote"`
SuperBlock bool `json:"superBlock"`
Paragraph bool `json:"paragraph"`
Document bool `json:"document"`
Heading bool `json:"heading"`
List bool `json:"list"`
ListItem bool `json:"listItem"`
CodeBlock bool `json:"codeBlock"`
HtmlBlock bool `json:"htmlBlock"`
EmbedBlock bool `json:"embedBlock"`
DatabaseBlock bool `json:"databaseBlock"`
AudioBlock bool `json:"audioBlock"`
VideoBlock bool `json:"videoBlock"`
IFrameBlock bool `json:"iframeBlock"`
WidgetBlock bool `json:"widgetBlock"`
Callout bool `json:"callout"`
}
type DiffFile ¶
type DocxAssetParser ¶
type DocxAssetParser struct {
}
func (*DocxAssetParser) Parse ¶
func (parser *DocxAssetParser) Parse(absPath string) (ret *AssetParseResult)
type EmbedBlock ¶
func FilterEmbedBlocksByPublishAccess ¶
func FilterEmbedBlocksByPublishAccess(c *gin.Context, publishAccess PublishAccess, embedBlocks []*EmbedBlock) (ret []*EmbedBlock)
func GetEmbedBlock ¶
func GetEmbedBlock(embedBlockID string, includeIDs []string, headingMode int, breadcrumb bool) (ret []*EmbedBlock)
func SearchEmbedBlock ¶
func SearchEmbedBlock(embedBlockID, stmt string, excludeIDs []string, headingMode int, breadcrumb bool) (ret []*EmbedBlock)
func SearchEmbedBlockInBox ¶
func SearchEmbedBlockInBox(embedBlockID, stmt string, excludeIDs []string, headingMode int, breadcrumb bool, boxID string) (ret []*EmbedBlock)
SearchEmbedBlockInBox 与 SearchEmbedBlock 一致,但按 boxID 路由 SQL 到加密 content db。 加密笔记本的嵌入块查询走独立加密库(全局 siyuan.db 不含加密数据),boxID 为空时落回全局库。
type EmbeddingStat ¶
type EmbeddingStat struct {
Total int `json:"total"` // blocks 表总块数(分母)
Indexed int `json:"indexed"` // 有效向量数(length(embedding)>0)
Pending int `json:"pending"` // 待索引块数(blocks 中无对应 block_embeddings 行的)
Failed int `json:"failed"` // 失败块数(fail_count>0)
IgnoredByLen int `json:"ignoredByLen"` // 长度忽略(内容过短或过长,ignored_type=1)
IgnoredByConfig int `json:"ignoredByConfig"` // 配置忽略(被 .siyuan/embeddingignore 匹配,ignored_type=2)
Enabled bool `json:"enabled"` // 是否已启用嵌入
}
EmbeddingStat 嵌入索引进度统计,供设置页展示。
func GetEmbeddingStat ¶
func GetEmbeddingStat() (ret *EmbeddingStat)
GetEmbeddingStat 查询嵌入索引进度统计。表不存在或未启用时返回零值统计。
type EpubAssetParser ¶
type EpubAssetParser struct {
}
func (*EpubAssetParser) Parse ¶
func (parser *EpubAssetParser) Parse(absPath string) (ret *AssetParseResult)
type ExportOptions ¶
type ExportOptions struct {
// 通用部分(PDF/Word/HTML/Markdown 均读取)
AddTitle *bool `json:"addTitle"` // 是否添加文档标题
InlineMemo *bool `json:"inlineMemo"` // 是否导出行级备注
BlockRefMode *int `json:"blockRefMode"` // 内容块引用导出模式
BlockEmbedMode *int `json:"blockEmbedMode"` // 内容块嵌入导出模式
FileAnnotationRefMode *int `json:"fileAnnotationRefMode"` // 文件标注引用导出模式
BlockRefTextLeft *string `json:"blockRefTextLeft"` // 块引锚文本左侧符号
BlockRefTextRight *string `json:"blockRefTextRight"` // 块引锚文本右侧符号
TagOpenMarker *string `json:"tagOpenMarker"` // 标签开始标记符
TagCloseMarker *string `json:"tagCloseMarker"` // 标签结束标记符
// Markdown 专属部分
IncludeSubDocs *bool `json:"includeSubDocs"` // 是否包含子文档
IncludeRelatedDocs *bool `json:"includeRelatedDocs"` // 是否包含关联文档
MarkdownYFM *bool `json:"markdownYFM"` // 是否添加 YAML Front Matter
RemoveAssetsID *bool `json:"removeAssetsID"` // 是否移除资源文件名中的 ID
}
ExportOptions 为单次导出提供的临时选项,缺省字段(nil)使用全局 Conf.Export 的值。 通用部分可被各导出格式复用,Markdown 专属部分仅 Markdown 导出使用。 用于「导出 Markdown 参数对话框」https://github.com/siyuan-note/siyuan/issues/17031
func ParseExportOptions ¶
func ParseExportOptions(arg map[string]any) (opts *ExportOptions)
ParseExportOptions 从 JSON 请求参数中解析导出选项,未传入的字段保持 nil(沿用全局配置)#17031。
type File ¶
type File struct {
Path string `json:"path"`
Name string `json:"name"` // 标题,即 ial["title"]
TitleEmpty bool `json:"titleEmpty,omitempty"`
Icon string `json:"icon"`
Name1 string `json:"name1"` // 命名,即 ial["name"]
Alias string `json:"alias"`
Memo string `json:"memo"`
Bookmark string `json:"bookmark"`
ID string `json:"id"`
Count int `json:"count"`
Size uint64 `json:"size"`
HSize string `json:"hSize"`
Mtime int64 `json:"mtime"`
CTime int64 `json:"ctime"`
HMtime string `json:"hMtime"`
HCtime string `json:"hCtime"`
Sort int `json:"sort"`
SubFileCount int `json:"subFileCount"`
NewFlashcardCount int `json:"newFlashcardCount"`
DueFlashcardCount int `json:"dueFlashcardCount"`
FlashcardCount int `json:"flashcardCount"`
}
type Flashcard ¶
type Flashcard struct {
DeckID string `json:"deckID"`
CardID string `json:"cardID"`
BlockID string `json:"blockID"`
Lapses int `json:"lapses"`
Reps int `json:"reps"`
State riff.State `json:"state"`
LastReview int64 `json:"lastReview"`
NextDues map[riff.Rating]string `json:"nextDues"`
}
func GetDueFlashcards ¶
type GraphArrows ¶
type GraphArrows struct {
To *GraphArrowsTo `json:"to"`
}
type GraphArrowsTo ¶
type GraphArrowsTo struct {
Enabled bool `json:"enabled"`
}
type GraphLink ¶
type GraphLink struct {
From string `json:"from"`
To string `json:"to"`
Ref bool `json:"ref"`
Arrows *GraphArrows `json:"arrows"`
}
type GroupState ¶
GroupState 用于临时记录每个分组视图的状态,以便后面重新生成分组后可以恢复这些状态。
type History ¶
type History struct {
HCreated string `json:"hCreated"`
Items []*HistoryItem `json:"items"`
}
func GetNotebookHistory ¶
type HistoryItem ¶
type HistoryItem struct {
Title string `json:"title"`
Path string `json:"path"`
Op string `json:"op"`
Notebook string `json:"notebook"` // 仅用于文档历史
}
func FullTextSearchHistoryItems ¶
func FullTextSearchHistoryItems(created, query, box, op string, typ int) (ret []*HistoryItem)
type KernelPetal ¶
type LeftRightDiff ¶
type LeftRightDiff struct {
LeftIndex *DiffIndex `json:"leftIndex"`
RightIndex *DiffIndex `json:"rightIndex"`
AddsLeft []*DiffFile `json:"addsLeft"`
UpdatesLeft []*DiffFile `json:"updatesLeft"`
UpdatesRight []*DiffFile `json:"updatesRight"`
RemovesRight []*DiffFile `json:"removesRight"`
}
func DiffRepoSnapshots ¶
func DiffRepoSnapshots(left, right string) (ret *LeftRightDiff, err error)
type OnlineKernel ¶
type OnlineKernel struct {
ID string `json:"id"`
Hostname string `json:"hostname"`
OS string `json:"os"`
Ver string `json:"ver"`
}
func GetOnlineKernels ¶
func GetOnlineKernels() (ret []*OnlineKernel)
type Operation ¶
type Operation struct {
Action string `json:"action"`
Data any `json:"data"`
ID string `json:"id"`
RootID string `json:"rootID"` // 思源内部暂时没有用到 https://github.com/siyuan-note/siyuan/issues/17179#issuecomment-4051604916
ParentID string `json:"parentID"`
PreviousID string `json:"previousID"`
NextID string `json:"nextID"`
RetData any `json:"retData"`
BlockIDs []string `json:"blockIDs"`
BlockID string `json:"blockID"`
DeckID string `json:"deckID"` // 用于添加/删除闪卡
AvID string `json:"avID"` // 属性视图 ID
SrcIDs []string `json:"srcIDs"` // 用于从属性视图中删除行
Srcs []map[string]any `json:"srcs"` // 用于添加属性视图行(包括绑定块){id, content, isDetached}
IsDetached bool `json:"isDetached"` // 用于标识是否未绑定块,仅存在于属性视图中
Name string `json:"name"` // 属性视图列名
Typ string `json:"type"` // 属性视图列类型
Format string `json:"format"` // 属性视图列格式化
KeyID string `json:"keyID"` // 属性视图字段 ID
RowID string `json:"rowID"` // 属性视图行 ID
IsTwoWay bool `json:"isTwoWay"` // 属性视图关联列是否是双向关系
BackRelationKeyID string `json:"backRelationKeyID"` // 属性视图关联列回链关联列的 ID
RemoveDest bool `json:"removeDest"` // 属性视图删除关联目标
Layout av.LayoutType `json:"layout"` // 属性视图布局类型
GroupID string `json:"groupID"` // 属性视图分组视图 ID
TargetGroupID string `json:"targetGroupID"` // 属性视图目标分组视图 ID
ViewID string `json:"viewID"` // 属性视图视图 ID
IgnoreDefaultFill bool `json:"ignoreDefaultFill"` // 是否忽略默认填充
Context map[string]any `json:"context"` // 上下文信息
}
type OutlineDoc ¶
type Path ¶
type Path struct {
ID string `json:"id"` // 块 ID
Box string `json:"box"` // 块 Box
Name string `json:"name"` // 当前路径
HPath string `json:"hPath"` // 人类可读路径
Type string `json:"type"` // "path"
NodeType string `json:"nodeType"` // 节点类型
SubType string `json:"subType"` // 节点子类型
Blocks []*Block `json:"blocks,omitempty"` // 子块节点
Children []*Path `json:"children,omitempty"` // 子路径节点
Depth int `json:"depth"` // 层级深度
Count int `json:"count"` // 子块计数
Folded bool `json:"folded"` // 是否折叠
Updated string `json:"updated"` // 更新时间
Created string `json:"created"` // 创建时间
}
func FilterPathsByPublishAccess ¶
func FilterPathsByPublishAccess(c *gin.Context, publishAccess PublishAccess, paths []*Path) (ret []*Path)
func GetBacklink ¶
func GetBacklink2 ¶
func GetBacklink2InBox ¶
func GetBacklink2InBox(id, keyword, mentionKeyword string, sortMode, mentionSortMode int, containChildren bool, boxID string) (boxIDOut string, backlinks, backmentions []*Path, linkRefsCount, mentionsCount int)
GetBacklink2InBox 与 GetBacklink2 一致,但按 boxID 路由到加密 db 或全局 db。
type PdfAssetParser ¶
type PdfAssetParser struct {
}
PdfAssetParser parser factory product
func (*PdfAssetParser) Parse ¶
func (parser *PdfAssetParser) Parse(absPath string) (ret *AssetParseResult)
Parse will parse a PDF document using PDFium webassembly module using a worker pool
type Petal ¶
type Petal struct {
Name string `json:"name"` // Plugin name
DisplayName string `json:"displayName"` // Plugin display name
Version string `json:"version"` // Plugin version
Enabled bool `json:"enabled"` // Whether enabled
Incompatible bool `json:"incompatible"` // Whether incompatible
DisabledInPublish bool `json:"disabledInPublish"` // Whether disabled in publish mode
DisallowInstall bool `json:"disallowInstall"` // Whether disallow install
JS string `json:"js"` // JS code
CSS string `json:"css"` // CSS code
I18n map[string]any `json:"i18n"` // i18n text
Kernel KernelPetal `json:"kernel"` // Kernel plugin info
}
Petal represents a plugin's management status.
func GetPetalByName ¶
func LoadKernelPetals ¶
func LoadKernelPetals() (ret []*Petal)
func LoadPetals ¶
type PptxAssetParser ¶
type PptxAssetParser struct {
}
func (*PptxAssetParser) Parse ¶
func (parser *PptxAssetParser) Parse(absPath string) (ret *AssetParseResult)
type PublishAccess ¶
type PublishAccess []*PublishAccessItem
func GetDisablePublishAccess ¶
func GetDisablePublishAccess(inputPublishAccess PublishAccess) (outputPublishAccess PublishAccess)
func GetInvisiblePublishAccess ¶
func GetInvisiblePublishAccess(inputPublishAccess PublishAccess) (outputPublishAccess PublishAccess)
func GetPublishAccess ¶
func GetPublishAccess() (ret PublishAccess)
type PublishAccessItem ¶
type RecentDoc ¶
type RecentDoc struct {
RootID string `json:"rootID"`
Icon string `json:"icon,omitempty"`
Title string `json:"title,omitempty"`
ViewedAt int64 `json:"viewedAt,omitempty"` // 浏览时间字段
ClosedAt int64 `json:"closedAt,omitempty"` // 关闭时间字段
OpenAt int64 `json:"openAt,omitempty"` // 文档第一次从文档树加载到页签的时间
}
func FilterRecentDocsByPublishAccess ¶
func FilterRecentDocsByPublishAccess(c *gin.Context, publishAccess PublishAccess, recentDocs []*RecentDoc) (ret []*RecentDoc)
func GetRecentDocs ¶
type RefDefs ¶
func FilterRefDefsByPublishIgnore ¶
func FilterRefDefsByPublishIgnore(publishIgnore PublishAccess, refDefs []*RefDefs) (retRefDefs []*RefDefs, originalRefBlockIDs map[string]string)
func GetBlockRefs ¶
type SessionsMap ¶
type SetFlashcardDueTime ¶
type Sync ¶
type Sync struct {
Size int64 `json:"size"`
HSize string `json:"hSize"`
Updated string `json:"updated"`
CloudName string `json:"cloudName"` // 云端同步数据存放目录名
SaveDir string `json:"saveDir"` // 本地同步数据存放目录路径
}
func ListCloudSyncDir ¶
type Tags ¶
type Tags []*Tag
func FilterTagsByPublishIgnore ¶
func FilterTagsByPublishIgnore(publishIgnore PublishAccess, tags *Tags) (ret *Tags)
type TemplateSearchResult ¶
TemplateSearchResult 描述了模板搜索结果。
func SearchTemplate ¶
func SearchTemplate(keyword string) (ret []*TemplateSearchResult)
type Transaction ¶
type Transaction struct {
Timestamp int64 `json:"timestamp"`
DoOperations []*Operation `json:"doOperations"`
UndoOperations []*Operation `json:"undoOperations"`
// contains filtered or unexported fields
}
func GetHeadingDeleteTransaction ¶
func GetHeadingDeleteTransaction(id string) (transaction *Transaction, err error)
func GetHeadingInsertTransaction ¶
func GetHeadingInsertTransaction(id string) (transaction *Transaction, err error)
func GetHeadingLevelTransaction ¶
func GetHeadingLevelTransaction(id string, level int) (transaction *Transaction, err error)
func (*Transaction) GetChangedRootIDs ¶
func (tx *Transaction) GetChangedRootIDs() (ret []string)
func (*Transaction) GetMutatedRootIDs ¶
func (tx *Transaction) GetMutatedRootIDs() (ret []string)
GetMutatedRootIDs 返回真正被写盘修改结构的树 rootID,不含 refreshDynamicRefTexts 刷新的引用树。 用于跨文档撤销判定:单文档编辑返回 1 个 rootID,跨文档移动返回多个,引用文本刷新不计入。
func (*Transaction) MarkFromAPI ¶
func (tx *Transaction) MarkFromAPI()
MarkFromAPI 标记事务来自 /api/transactions HTTP 入口,供全局撤销日志捕获判别。
func (*Transaction) MarkReplay ¶
func (tx *Transaction) MarkReplay()
MarkReplay 标记事务为 undo/redo 重放构造,重放不再进入撤销日志。
func (*Transaction) WaitForCommit ¶
func (tx *Transaction) WaitForCommit()
type TxtAssetParser ¶
type TxtAssetParser struct {
}
func (*TxtAssetParser) Parse ¶
func (parser *TxtAssetParser) Parse(absPath string) (ret *AssetParseResult)
type UndoEntry ¶
type UndoEntry struct {
// contains filtered or unexported fields
}
UndoEntry 是撤销栈中的一条记录。跨文档操作(MutatedRootIDs 含多个 rootID)的 entry 会以同一指针同时挂在这些 rootID 的栈上,撤销任一端时联动其它端移除引用。
func (*UndoEntry) DoOperationsForReplay ¶
DoOperationsForReplay 返回正向操作副本,供 redo 重放构造事务。
func (*UndoEntry) MutatedRootIDs ¶
MutatedRootIDs 返回该条目影响的 rootID 列表副本。
func (*UndoEntry) UndoOperationsForReplay ¶
UndoOperationsForReplay 返回逆向操作副本,供 undo 重放构造事务。
type UndoLog ¶
type UndoLog struct {
// contains filtered or unexported fields
}
UndoLog 是全局撤销日志,按 rootID 分栈,所有窗口/客户端共享同一权威。
func (*UndoLog) Record ¶
func (l *UndoLog) Record(tx *Transaction)
Record 记录一笔已提交的编辑器事务。仅当事务来自 /api/transactions(fromAPI)、 携带非空 UndoOperations、且非 undo/redo 重放(isReplay)时记录。
func (*UndoLog) Redo ¶
Redo 弹出 rootID 重做栈顶,压回执行栈撤销栈。仅动执行栈,不做联动重挂。 不改 hasUndo(复现前端 redo 的不对称)。成功后调 RedoCommit;失败调 RedoRollback。
func (*UndoLog) RedoCommit ¶
RedoCommit 在重做成功执行后,联动把 entry 重新挂到其它关联栈顶。
func (*UndoLog) RedoRollback ¶
RedoRollback 在重做执行失败时回滚执行栈:把 entry 从撤销栈移回重做栈顶。 因 Redo 只动了执行栈,此回滚精确无误。
func (*UndoLog) Undo ¶
Undo 弹出 rootID 撤销栈顶,压入执行栈重做栈,置 hasUndo。仅动执行栈,不做联动移除。 成功执行逆操作后调 UndoCommit 完成联动;失败调 UndoRollback 精确回滚(因只动了执行栈)。 返回弹出的 entry;栈空返回 nil。
func (*UndoLog) UndoCommit ¶
UndoCommit 在逆操作成功执行后,联动从其它关联栈移除该 entry(按 id 匹配)。
func (*UndoLog) UndoRollback ¶
UndoRollback 在逆操作执行失败时回滚执行栈:把 entry 从重做栈移回撤销栈顶,复位 hasUndo。 因 Undo 只动了执行栈,此回滚精确无误。
type UnusedItem ¶
type UnusedItem struct {
Item string `json:"item"`
Name string `json:"name"`
ModTime time.Time `json:"-"`
}
func MissingAssets ¶
func MissingAssets() (ret []*UnusedItem)
func UnusedAssets ¶
func UnusedAssets(sorted bool) (ret []*UnusedItem)
func UnusedAttributeViews ¶
func UnusedAttributeViews(sorted bool) (ret []*UnusedItem)
type WidgetSearchResult ¶
WidgetSearchResult 描述了挂件搜索结果。
func SearchWidget ¶
func SearchWidget(keyword string) (ret []*WidgetSearchResult)
type XlsxAssetParser ¶
type XlsxAssetParser struct {
}
func (*XlsxAssetParser) Parse ¶
func (parser *XlsxAssetParser) Parse(absPath string) (ret *AssetParseResult)
Source Files
¶
- ai.go
- appearance.go
- asset_content.go
- assets.go
- assets_watcher.go
- attribute_view.go
- attribute_view_fix.go
- attribute_view_render.go
- auth.go
- backlink.go
- bazaar.go
- block.go
- blockial.go
- blockinfo.go
- bookmark.go
- box.go
- caldav.go
- carddav.go
- cloud_service.go
- conf.go
- crypto.go
- dav.go
- elevator.go
- embedding.go
- emojis_watcher.go
- encrypted_export.go
- encrypted_ops.go
- export.go
- export_merge.go
- file.go
- filesys_init.go
- flashcard.go
- flushdns_other.go
- format.go
- graph.go
- heading.go
- history.go
- import.go
- index.go
- index_fix.go
- listitem.go
- md2html.go
- mount.go
- ocr.go
- outline.go
- path.go
- pdf.go
- plugin.go
- process.go
- publish_access.go
- push_queue.go
- push_reload.go
- raw_path_guard.go
- render.go
- repository.go
- rerank.go
- role.go
- search.go
- session.go
- shortcuts.go
- snippet.go
- storage.go
- sync.go
- tag.go
- template.go
- theme.go
- themes_watcher.go
- todo.go
- transaction.go
- tree.go
- undolog.go
- updater.go
- upload.go
- virutalref.go
- widget.go