Enable comments

You can enable comments for the current page by clicking on the Enable Comments button (only the website owner can see this button). This ensures that the website owner becomes the owner of the AppendableData used to hold the comments.

Contents

Enable comments

Create an appendable data

When you click on the Enable Comments button, the plugin creates an appendable data for the current page. By default, the filter of the appendable data will be a blacklist (as opposed to a whitelist). Everyone except the keys listed in the filter will be allowed to append data.

POST /appendable-data

window.safeAppendableData.create(this._authToken, this._getLocation(), false)

The name of the appendable data is based on the URL of the current page.

_getLocation () {
  if (this._isDevMode() && this._data.user.dns) {
    return `comments-dev-${this._data.user.dns}/${window.location.pathname}`
  }
  return `${this._hostName}/${window.location.pathname}`
}

Example

blog.testing//post.html

The actual name of the appendable data is the hash of _getLocation().

Save the appendable data

The plugin saves the appendable data to the SAFE Network.

PUT /appendable-data/:handleId

window.safeAppendableData.put(this._authToken, handleId)

After the appendable data has been successfully saved, the plugin refreshes the UI.

Comment box

Last updated

Was this helpful?