Skip to content
This repository has been archived by the owner on Sep 25, 2021. It is now read-only.

Adding support for a new site

Florens edited this page Nov 28, 2018 · 3 revisions

The Clover codebase supports multiple sites. If your site is like an imageboard, e.g. it has boards, threads and posts, posts have a unique id and link to each other, you can add support to Clover for your site.

TODO: this document is pretty bare, and should be expanded. If in doubt, look at the code.

Get started

The first place to look is at exiting site implementations. If your site uses a known imageboard engine or is a fork of one, it can probably be implemented by copying a known implementation of the site, and changing a few parameters like the url and icons.

Site base

Each site extends from the CommonSite class. That class implements the Site interface that all other Clover code uses. The SiteBase class provides a few householding routines that initialises the site. In the setup method many components need to be set, such as the config, endpoints, actions, api and parser:

  • config: what features and board features are supported.
  • endpoints: creates urls.
  • actions: executes actions such as posting and deletion.
  • api: parser of JSON.
  • parser: parser of comment HTML.

Url handler

The SiteUrlHandler is used for resolving url's that the user opens with the app. For the site add screen the matchesName name method is used when the user doesn't enter a complete url, otherwise the respondsTo method is used. The other methods are used for deep linking and creating an url to share from the app. You probably want to extend CommonSiteUrlHandler which provides a base implementation.

Site registry

After a site implementation is made, it must be added to the Site registry. The url handlers and the site classes both need to be added.

Clone this wiki locally