Propolis Wiki technical rundown

in HiveDevs15 days ago (edited)

The idea that Hive could be used as a base layer for a wiki has pretty much been around since the inception of the legacy chain. But while there have been several wiki initiatives since then, none of them uses hive to store the text contents.

image.png
Wrote a readme today

Now with Propolis Wiki up and running, I thought it might be a good time to explain a bit the technical details how it achieves the goal of providing crowdsourced knowledge in the popular wiki format, while still being available to all readers on any hive interface of their choosing.

Tools

I use python in the backend. As it's not as simple CRUD with SQL app, I decided to use the lightweight flask framework.
The frontend uses a few javascript libraries for content formatting and display, but is designed to be as lightweight as possible.

Editor

I was looking for a simple modular WYSIWYG editor, but didn't really find anything that was as simple as I hoped. In the end I settled with tui-editor, and managed to create a references plugin that works as expected in one editor mode at least (while breaking the other one, but I'm fine with disabling that for now). This will also come in handy with the future pevo prototype.
There's no need for font sizes or colors in a wiki, but I did include the latex plugin.

Complementary database

While all necessary data is stored on Hive, there is a need for a complementary database storing some information. I chose postgres for its fts capabilities and scalability.

  • posts with permlink and content in tsvector format for full text search
  • comments with permlink, transaction_id, timestamp and author representing edits
  • categories containing all used tags
  • categories_posts to link posts to categories
    The wiki app then uses this database to figure out which transactions or posts need to be requested from the hive api.

Content formatting

There are a few differences between wiki markup and standard hive markup. <ref> tags for example are a wiki-specific addition and are removed by hive convention. The references also get added to the end of a wiki article. Links in the wiki lead to /wiki instead of /@username, and in the wiki links to articles that yet need to be created are marked red.
Long story short, most work probably went into the various splits, replaces and re-stitches of content. This is done partly with javascript when posting, and mostly in python when retrieving the content.

Diffs

Another way where content is mutated are the diff views, using the diff-match-patch libraries. Edits of posts are always a patch, which makes it easy to compare articles from different points in time and stores the data in an efficient way.

Account authorization

All posts of the english version of the wiki are published under the account @propolis.eng
Any hive user can be added as an authorized account, where the app uses the weight parameter as authorization level, of which there are 3 right now (editor, moderator, admin). The @propolis.eng account then needs to be added to keychain with the "use authorized account" option. @stoodkev was really helpful and implented a call to keychain, so in the near future this can be done with the click of a button and allows us to open up the process to request authorization completely

Security

The updater script also checks transactions for maliciousness. Authorization can be automatically revoked if for example metadata is missing (which could easily happen by using another interface than the official one for editing), if the operation is blacklisted, or if the username in the metadata doesn't match the signer.

Decentralization

The app can be run as an interface by anyone, but for some functionality it requires the posting or active key. I will hand these out pretty freely if you've been around for a while and show warranted interest.
Posts can be viewed on all interfaces, with a lot of effort going into not breaking the display there.

Future outlook

Planned features include previews when hovering links to existing articles, shortcuts for moderators to move/revert/delete articles, more security features, and a lot more. Get in touch if you want to contribute!
From the content side I hope to get the ball running by using some of my earnings on hive to incentivize authors to provide quality edits. Check out the @propolis.wiki blog for details about how to win some HBD.

I hope this post gave you some insights, leave your questions and remarks in the comments!

Sort:  

Great idea and interesting tech setup.

👏🏼👏🏼👏🏼

Hello ! I hope you don't mind if I ask you if you have any contact to @nelyp and if you could ask she if she can read my messages in discord. Thank you very much !

Congratulations @pharesim! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)

You made more than 2500 comments.
Your next target is to reach 3000 comments.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP