npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tala

v1.0.3

Published

Self hosted commenting platform for node.

Downloads

28

Readme

Tala

Self hosted commenting system for blogs or other things.

  • Self hosted.
  • Backed by LevelDB.
  • Support for multiple "namespaces".
  • Realtime.
  • No client side dependencies (except the one script ofc).

About

Tala is a self hosted comments platform for your static blog or whatever.

It's written in Node and it uses LevelDB as it's database.

There's also a WebSocket component that'll make comments appear in real time for everyone currently on the page.

Installation

There's is currently no executable or anything. So the easiest way for now is probably to clone the repo using git (or just downloding a tarball):

$ git clone [email protected]:simme/node-tala.git tala
$ cd tala
$ npm install
$ npm start

By default the server will listen on port 3000

Server Configuration

You configure Tala by adding a config.json file to the same directory as tala.js. In the future there'll be a possibility to change the path to the configuration file.

The config may include the following keys:

  • port, what port to run the HTTP server on.
  • db, path to where the database will be stored.
  • cors, array of domains that may use the server. Used to allow AJAX requests from the browser.
  • spam, an object containing apiKey and blog. apiKey is your Akismet api key. More on spam below.

Spam

Tala currently uses Akismet to provide spam protection. This requires you to set up an account at akismet.com. There are free accounts available for those who have less then 80 000 comments per month.

You may choose to omit the spam key from your config in which case no spam protection will be done at all.

Client Installation

To add Tala to your blog you need to include the client code. This is best done by adding this code to the bottom of your <body>.

<script type="text/javascript">
  function downloadJSAtOnload() {
    var element = document.createElement("script");
    element.src = "http://localhost:3000/js";
    document.body.appendChild(element);
  }

  if (window.addEventListener)
    window.addEventListener("load", downloadJSAtOnload, false);
  else if (window.attachEvent)
    window.attachEvent("onload", downloadJSAtOnload);
  else
    window.onload = downloadJSAtOnload;
</script>

Remember to change the element.src line to point to your Tala server.

What this will do is to wait for the document ready event before loading the comments. For more about this particular techinque you can read this blog post by Patrick Sexton.

You can of course just use a regular script tag and a src-attribute if you want to. But that will cause the loading of Tala to delay the loading of your page. Since your comments probably are below the fold it's probably not super smart to make your visitors wait!

Then you'll need to tell Tala where to put your comments. This is done by adding an element, probably a div with the class comments-wrapper. You'll also need to give this element the attribute data-id. This is used to separate comments for different articles. The value can be anything but it's probably smartest to go with the slug of the article or something similar.

<div class="comments-wrapper" data-id="myBlog:/an/article/url"></div>

Read on for details on how to configure the client.

Client Configuration

Tala uses a global (sorry) object to read your preferences. So what you do is you add another <script> tag to your page:

<script>
  window.talaConfig = {
    // settings go here
  };
</script>

These options are mostly used for localization. The available optionas are:

  • host, if your Tala server is on any other domain then your blog you need to enter the host here. Make sure you include your blog's domain in the cors option for the server.
  • nameField, the label for the name field in the form.
  • nameFieldPlaceholder, the placeholder for the name field in the form.
  • emailField, the label for the email field.
  • emailFieldPlaceholder, the placeholder for the email field.
  • submitButton, the text on the comment submit button.
  • commentPostError, text output on posting error.
  • loadError, text output on comment loading error.

More options and configurability will come with age!

Compatibility, security etc.

This project is very new and not well tested yet. It should, at least in theory, work in IE8+ and all the good browsers.

As for security not much has been done. It's currently possible to post to the server using any HTTP client available. Which can be done to fill up your server or whatever. There's spam protection from Akismet which should alleviate the problem a bit, but not completely.

There is also rudimentary XSS protection.

If you have any ideas on how to improve this specific part of Tala I'm all ears.

With this said, I'm labeling it 1.0 because I want to. Also, I'm leaving no guarantees or anything! :)

FAQ

  • Where does the name come from?

Tala means "to talk" in Swedish.

  • Can I use one Tala server for many blogs?

YES you can. All you need to to is to namespace your data-id attributes so that Tala can keep your comments separated.

  • May I contribute?

Hellz yeah! Just open a pull request for any fix/feature you want and we'll talk about it! ;)

License

This project is licensed under the MIT license.