Glosa logo

Glosa

  •  0 ratings
In category: Communication / Social Networks and Forums

About Glosa

Open source commentary system easy to integrate with static pages. You can import from Disqus.

  •   324  
  •   0  
  •   0  
  •   0  
Github stats:
  •  Commits: N/A  
  •   N/A  
  •   N/A  
  •  Latest commit: N/A  

Deploy this app to Linode with a free $100 credit!

Languages/Platforms/Technologies:
Lincenses:

More about Glosa

logo

Glosa: Comments for static sites.

Clone of Disqus, but faster, Opensource and sexy.

Amazing reasons to use it

  • Opensource.
  • Very fast, responses between 5ms and 15ms on average.
  • Easy to integrate with static pages.
  • PWA Admin for desktop and mobile or terminal to manage comments: Delete, update, find...
  • Easy to import from Disqus.
  • No database, everything is stored in a JSON.
  • Configuration in a simple YAML.
  • Captcha system included.
  • Receive an email for each new comment.
  • Users are notified by email if they are answered.
  • Multisite: Single server for multiple websites.

Resources

Template static site (only HTML and Javascript)

Import your comments from Disqus

PWA Admin

Video Demo


Help me continue to improve

Buy Me a Coffee at ko-fi.com --- ## Use it now - [How does it work?](#how-does-it-work) - [Origin](#origin) - [Run](#run) - [Notification template for email](#notification-template-for-email) - [API](#api) - [Terminal cli](#terminal-cli) - [Deployment](#deployment) - [Create your own JAR](#create-your-own-jar) --- ## How does it work?

logo

On the one hand we have Glosa who would be our comment server. It **feeds in GET and POST requests**, and obediently **returns JSON**. It can only return **comments from a url** (it sorts comments by url, not ids) or **create a new comment** (**parent or child** of another comment). Nothing else. If you want to create a comment previously you will need to ask for the token to confirm that you are not a robot. **Optionally you can receive an email** automatically when a new comment is written. The website, CMS or mobile application, must integrate a **logic with Javascript** to make the necessary requests and render the comments properly. To make this task easier we have created an example template that you can modify to your needs. You can find the link on this page. ## Scenarios ### 1 web page, share or not a server

logo

### 3 web pages in different domains or servers

logo

## Origin A Glosa is a **Spanish word**. It is defined as a **note**, usually brief, that is **written in the margin of a text** or even between its lines with the intention of clarifying some idea of it. The software was born with the **intention that the author's static blog would no longer depend on an external company** (Disqus), and could have control of its content. To make it as easy as possible to deploy, develop and maintain; he programmed in **Clojure**. And from the beginning it was clear to him that he didn't need a conventional database, **plain text was enough**. ## Run 1) Make sure you have Java installed. Debian/Ubuntu
sudo apt install default-jre
Mac OS
brew install java
2) Create a file `config.yaml` with the following content. You can also use `config.yaml.example` as a base config and change it to fit your needs.
##### General #####
# If it is active it will be accessible to any client
debug: false
# It can be a domain in case of using a proxy: example.com
domain: localhost
port: 4000
# Access for APP
token: mysecret
# It indicates which domain can use it. Debug true so there are no limitations.
domain-cli: "http://example-cli.com/"

##### Notify #####
# Type of notification, currently valid: email
notify: email
subject: New comment
from: server@example.com
admin: user@example.com
# SMTP, only notify: email
smtp-host: smtp.example.com
smtp-user: smtpuser
smtp-password: smtppassword
smtp-port: 25
smtp-tls: true

##### Captcha #####
# Currently valid: time
captcha: time

##### Database #####
# Currently valid: plain
database: plain
3) Download the latest version of Glosa (`glosa-{version}-standalone.jar`). https://github.com/glosa/glosa-server/releases 4) Now you can execute glosa.
java -jar target/glosa-{version}-standalone.jar
Great 🎉. You already have your 🔥 own comment server 🔥. That's it, now you just have to test that it works properly.
curl localhost:4000/api/v1/captcha/?url=https://glosa.example/best-SO/'
It will return a random token
{"token":"OABWNONEOOKXRMMWADPF"}
## Notification template for email The first time Glosa is run it will create an HTML template with the name `template-email.html`. Edit freely.

logo

--- ## API - [Get Comments](#get-comments) (Public) - [Last comments](#last-comments) (Private) - [Add Comments](#add-comment) (Public) - [Update Comment](#update-comment) (Private) - [Delete Comment](#delete-comment) (Private) - [Search Threads](#search-threads) (Private) - [Get captcha token](#get-captcha-token) (Public) - [Check if he is alive](#check-if-he-is-alive) (Public) - [Check if token is valid](#check-if-token-is-valid) (Public) ### Authorization **Only privates**. You need a `token` to be able to interact (You will find it in your `config.yaml`). Use a **header with Bearer authorization** on each request. Example with `mysecret` token.
curl -XDELETE -H "Authorization: Bearer mysecret" -H "Content-type: application/json" ...
### Public No `token` is required to interact. #### Get Comments Gets all the comments on one page. **Method**: `GET`
/api/v1/comments/?url={url}
| Param | Value | Description | |---|---|---| | url | string | Page where you want to get the comments. | ##### Example Get from `http://glosa.example/best-SO/`.
curl 'http://localhost:4000/api/v1/comments/?url=https://glosa.example/best-SO/'
##### Success response
[
    {
        "id": 4812781236,
        "parent": "",
        "deep": 0,
        "createdAt": 1584266634,
        "thread": "https://glosa.example/best-SO/",
        "author": "Lexar",
        "email": "",
        "message": "Do you use Glosa too? It's an amazing technology."
    },
    {
        "id": 4812781237,
        "parent": "4812781236",
        "deep": 1,
        "createdAt": 1584266746,
        "thread": "https://glosa.example/best-SO/",
        "author": "Lucia",
        "email": "lucia@my.email",
        "message": "I love the article."
    }
]
##### Fail response
[]
#### Last Comments Get the last 10 comments sorted by date. A pager is available. **Method**: `POST`
/api/v1/comments/latest/{page}
| Param | Value | Description | |---|---|---| | page | number | Paginator. | ##### Example I get the last 10 comments.
curl 'http://localhost:4000/api/v1/comments/latest/1'
Last comments between 30 and 40.
curl 'http://localhost:4000/api/v1/comments/latest/3'
##### Success response
[
    {
        "id": 4812781236,
        "parent": "",
        "deep": 0,
        "createdAt": 1584266634,
        "thread": "https://glosa.example/best-SO/",
        "author": "Lexar",
        "email": "",
        "message": "Do you use Glosa too? It's an amazing technology."
    },
    {
        "id": 4812781237,
        "parent": "4812781236",
        "deep": 1,
        "createdAt": 1584266746,
        "thread": "https://glosa.example/best-SO/",
        "author": "Lucia",
        "email": "lucia@my.email",
        "message": "I love the article."
    }
    ...
]
##### Fail response
[]
#### Add Comment Add new comment on one page. **Require token generated by the [captcha endpoint](#get-captcha-token)**. After saving the comment the _captcha token_ will no longer be valid. At the same time a notification (email) will be sent to the administrator (in the configuration it is called `admin`), in case it is a sub-comment it will also be sent another notification to the parent of the comment if the address is present. The steps must be. 1. Get [captcha token](#get-captcha-token). 2. Add comment. **Method**: `POST`
/api/v1/comments/
| Param | Value | Description | |---|---|---| | parent | number | If it's a sub-comment, the number of the parent comment. Otherwise leave empty. | | author | string | Author's name. | | email | string | Email that the user will be notified of the responses to his comment. Leave blank if not desired. | | message | string | Message. It can be HTML or plain. | | token | number | Number of the token generated by the [captcha endpoint](#get-captcha-token). | | thread | string | Page where you want to save the comment. | ##### Example Save comment from `https://glosa.example/best-SO/`.
curl -XPOST -H "Content-type: application/json" -d '{
    "parent": "",
    "token": "VRJUOBBMTKFQUAFZOKJG",
    "author": "Juana",
    "email": "juana@my.email",
    "message": "I like it very much.",
    "thread":"https://glosa.example/best-SO/"
}' 'http://localhost:4000/api/v1/comments/'
##### Success response
{
    "added": true
}
##### Fail response
{
    "added": false
}
#### Get captcha token Get a token to validate that a new comment can be created. It has only one use. It must also be obtained 20 seconds before use or it will not work. **Method**: `GET`
/api/v1/captcha/?url={url}
| Param | Value | Description | |---|---|---| | url | string | Page where you want to save the comment. | ##### Example Get token for page `https://glosa.example/best-SO/`.
curl 'http://localhost:4000/api/v1/captcha/?url=https://glosa.example/best-SO/'
##### Success response
{
    "token": "ZRFOKXLALKNPOJPYJLVY"
}
##### Fail response
{
    "error": "Need URL"
}
#### Check if he is alive Simple answer to check that the service is working. **Method**: `GET`
/api/v1/ping/
##### Example
curl 'http://localhost:4000/api/v1/ping/'
##### Success response
{
    "ping": "pong"
}
#### Check if token is valid **Method**: `POST`
/api/v1/token/check/
| Param | Value | Description | |---|---|---| | url | string | Page where you want to save the comment. | ##### Example
curl -XPOST -H "Authorization: Bearer mysecret" 'http://localhost:4000/api/v1/token/check/'
##### Success response
{
    "valid": true
}
##### Fail response
{
    "valid": false
}
### Private #### Update Comment Update a comment for ID. [Authorization required](#authorization). **Method**: `PUT`
/api/v1/comments/
| Param | Value | Description | |---|---|---| | id | number | Comment ID. | | author | string | Author's name. | | email | string | Email that the user will be notified of the responses to his comment. Leave blank if not desired. | | message | string | Message. It can be HTML or plain. | ##### Example Update comment with id `1234`.
curl -XPUT -H "Authorization: Bearer mysecret" -H "Content-type: application/json" -d '{
    "id": 1234
    "author": "Alex",
    "email": "alex@my.email",
    "message": "I love the article."
}' 'http://localhost:4000/api/v1/comments/
##### Success response
{
  "updated": true,
  "id": 1234
}
##### Fail response
{
  "updated": false,
  "id": 1234
}
#### Delete Comment Delete a comment for ID. [Authorization required](#authorization). **Method**: `DELETE`
/api/v1/comments/{id}
| Param | Value | Description | |---|---|---| | id | number | Comment ID. | ##### Example Delete comment with id `1234`.
curl -XDELETE -H "Authorization: Bearer mysecret" -H "Content-type: application/json" http://localhost:4000/api/v1/comments/1234
##### Success response
{
  "deleted": true,
  "id": 1234
}
##### Fail response
{
  "deleted": false,
  "id": 1234
}
#### Search Threads Search for all urls containing a certain string ignoring uppercase. [Authorization required](#authorization). **Method**: `POST`
/api/v1/threads/search/{query}
| Param | Value | Description | |---|---|---| | query | string | String to search. | ##### Example Search all threads with `tadam`.
curl -XPOST -H "Authorization: Bearer mysecret" 'http://localhost:4000/api/v1/threads/search/tadam'
##### Success response
[
  {
    "thread": "https://my.blog/tadam-vs-pedestal/"
  },
  {
    "thread": "https://my.blog/best-web-framework-clojure-tadam"
  }
]
##### Fail response
[]
--- ## Terminal cli To **manage some minor features** you can use the `manager` script which will filter, modify or delete the database. Previously **remember to stop Glosa** to avoid problems. You will need to have **Node installed** on your computer and give it **permission to run**. ### Last comments
./manager last [number of elements]
Example
./manager last 3
### Take all comments by thread
./manager get [thread]
Example
./manager get https://glosa.example/best-SO/
### Update the text of a comment
./manager update [id] [new message]
Example
./manager update 1234 'I love your article.'
### Delete a comment
./manager delete [id]
Example
./manager delete 1234
## Deployment With Nginx it's pretty quick and easy. You can use it as a reverse proxy, since Glosa contains its own web server (Jetty). You can see an example of configuration that can be useful. ### Nginx
server {        

        server_name glosa.domain.com;

        access_log /var/log/glosa_access.log;
        error_log /var/log/glosa_error.log;

        location / {
            proxy_pass http://localhost:4000/;
            proxy_set_header Host $http_host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_redirect  off;
        }
}
### Systemctl To create a service in Linux is done like any application in Java. Below you can see an example. Create a file in the following path: `/etc/systemd/system/glosa.service` Add the content.
[Unit]
Description=Glosa
After=network.target

[Service]
Type=simple
Restart=always
WorkingDirectory=/folder/jar/
ExecStart=java -jar glosa.jar

[Install]
WantedBy=multi-user.target 
Finally enable and start the service.
sudo systemctl enable glosa
sudo systemctl start glosa
## Create your own JAR 1) Make sure you have **openjdk** or **oracle-jdk** installed, **clojure** and **leiningen**. ### MacOS
brew install openjdk clojure leiningen
### Debian/Ubuntu
sudo apt install default-jdk clojure leiningen
2) Clone the repository and enter the generated folder.
git clone https://github.com/glosa/glosa-server.git
cd glosa-server
3) Run the following command to build a `jar` file. `lein uberjar` After this two files should be created in `target/`. We will use the standalone version: `glosa-{version}-standalone.jar`. --- ## Dev tools It needs to be executed at the root of the project and have `Leiningen` installed. ### Lint It checks linguistically and syntaxically if the code is correct.
make lint
### Build Build a JAR ready to distribute.
make build
### Deploy Distributed in Clojars.
make deploy
---

Thanks to the power of logo Tadam Framework

Comments (0)

Please login to join the discussion on this project.

Glosa Reviews (0)

Overall Rating

None

based on 0 ratings

Please login to review this project.

No reviews for this project yet.

↑ back to top

Linux VPS from $11/yr.
RackNerd VPS for $11.38/mo

Popular Projects

FluxBB

in Social Networks and Forums
 31k    0    0    0  

Nextcloud

in File Transfer & Synchronization
 19k    1    1    0  

Libreddit

in Social Networks and Forums
 6k    0    1    0  

CasaOS

in Self-hosting Solutions
 5k    0    0    0  

Audiobookshelf

in Audio Streaming
 5k    0    1    0  

Mediagoblin

in Photo and Video Galleries
 4k    0    0    0  

Dashboard

in Personal Dashboards
 4k    0    0    0  

Most Discussed

Nextcloud

in File Transfer & Synchronization
 19k    1    1    0  

Tube Archivist

in Automation
 3k    0    1    0  

OneDev

in Project Management
 2k    0    0    0  

iodine

in Proxy
 2k    0    0    0  

Alf.io

in Booking and Scheduling
 2k    0    0    0  

sysPass

in Password Managers
 929    0    0    0  

Misskey

in Social Networks and Forums
 2k    0    0    0  
pCloud Lifetime

Top Rated Projects

Gitea

 1 rating
in Project Management

Bagisto

 1 rating
in E-commerce

LinkAce

 1 rating
in Bookmarks and Link Sharing

Pydio

 1 rating
in File Transfer & Synchronization

Audiobookshelf

 1 rating
in Audio Streaming

Nextcloud

 1 rating
in File Transfer & Synchronization

Seafile

 1 rating
in File Transfer & Synchronization

Categories

You May Also Be Interested In

Simple Machines Forum logo
Simple Machines Forum cover

Simple Machines Forum

Free, professional grade software package that allows you t…

Movim logo
Movim cover

Movim

Modern, federated social network based on XMPP, with a full…

Zusam logo
Zusam cover

Zusam

Free and open-source way to self-host private forums for gr…