-
Notifications
You must be signed in to change notification settings - Fork 261
Adding support for a new site
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.
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.
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.
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.
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.
Guides:
How to build Clover
Adding a site
Add a new theme
Rambling:
Clover UI infrastrucure