辛宝Otto

辛宝Otto 的玄酒清谈

北漂前端程序员儿 / 探索新事物 / Web Worker 主播之一/内向话痨
xiaoyuzhou
email

Technical Exploration: Implementing an obsidian plugin with xLog 3

Implementing an obsidian plugin with xLog 3

Internal Links

  • [[Technical Exploration of xLog 1 Feasibility]]
  • [[Technical Exploration of xLog 2 Understanding xlog Authentication]]
  • [[Implementing an obsidian plugin with xLog 3]]
  • [[Technical Exploration of xLog 4 Wrapping xLogDriver with unStorage]]
  • [[Quick Guide - CrossBell SDK behind xLog]]
  • [[What Can We Learn from the Official XLOG Obsidian Plugin]]
  • [[Developing the Obsidian Sync To Xlog Plugin - Handling Obsidian Images]]
  • [[Quick Guide - CrossBell's Open Source Projects]]
  • [[Quick Guide - Obsidian Docs with a Focus on Plugin Development]]

This article is the third chapter of a series of articles, following [[Technical Exploration of xLog 2 Understanding xlog Authentication]]. Building upon the previous two chapters, this article aims to create an obsidian plugin.

It is expected that this article will be an ongoing project, and you can continue to follow this article for updates. Additionally, this article has a minimum value of 5 coins for appreciation on the xlog platform. Feel free to show your support!

The knowledge gained from this article can be migrated and reused. For example, if you are a user of other note-taking applications, you can refer to the implementation. Of course, if there is a reward, I don't mind taking on the task~

Background#

As a loyal user of obsidian, I record my thoughts and ideas on obsidian. This means that I need to write articles on obsidian first and then copy the content to xlog, with special attention to the images.

If we later edit the content on obsidian, we also need to keep it in sync. With a plugin, all we need to do is select "upload" on the note, and it will be synchronized to xlog.

So, let's implement one.

Design Approach#

The overall design approach can be divided into several steps:

  • Technical research and running the interface
  • Designing the obsidian plugin
  • Implementing the obsidian plugin
  • Packaging and distributing the obsidian plugin
  • Promoting and testing the obsidian plugin

Technical Research#

In the previous section, we implemented article creation and updates, making it easy to manage articles using the siwe token. Other operations are not implemented at this time.

We assume that you already have a good understanding of this part. If not, you can read the content of the previous chapter.

Plugin Design#

Prior experience in obsidian development is required here. We will skip the details for now, but I have maintained a simple obsidian-vue-starter template, which is more user-friendly for vue users. Github Repo

We will develop based on this template.

This is how we want the plugin to be used.

The user should enable the plugin settings and correctly add the token/characterID. There should be a button for connection testing.

Right-clicking on the corresponding note in the list should show "Upload to xlog", and clicking it triggers the upload operation.

During the upload verification, check the front-matter for the following requirements:

  • Optional tags
  • Optional slug
  • Optional summary
  • Required title
  • Optional noteId, if present, it is considered an update

The characterID can be ignored as it is a rare requirement.

If the current content contains video/audio/image, limit the file size and prompt whether to upload to xlog or replace it with an ipfs link.

After the file upload is complete, fill in the modified noteID parameter, and proceed with the update operation.

Implementing the Plugin#

Currently, I will be working on this open-source project on GitHub:
https://github.com/Otto-J/sync-to-xlog

The functionality is approaching completion, and several recent articles have been completed using the plugin.

You can visit https://github.com/Otto-J/sync-to-xlog/releases to get the latest version.

Packaging and Distribution#

Submitted to the official plugin marketplace for review and listing.

Update: Approved and listed on the official plugin marketplace.

Promoting and Testing#

Striving to obtain official recognition.

Informed the officials.

Recorded a simple video on Bilibili:
Introduction to the Obsidian-sync-xlog Plugin: Easily Sync Obsidian Content to xlog

Will start promoting seriously in the coming days.

Update: Received official recognition and repost, further discussion took place.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.