Skip to content

Commit

Permalink
Initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
OrKoN committed Jul 22, 2019
1 parent c0b0984 commit 628a79e
Show file tree
Hide file tree
Showing 9 changed files with 803 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,5 @@ typings/

# next.js build output
.next

comments/*
43 changes: 42 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,43 @@
# jc-server
Basic open-source implementation of the server for JustComments

Basic open-source implementation of a server for JustComments

The server is implemented in NodeJS. Required version is 8+;

## Features

- basic commenting
- single process
- file storage

## Not-included features

- reactions
- nested responses
- sorting
- social login
- email notifications
- push notifications
- reCaptcha
- higly-available & distributed storage

To have these features, please see the paid hosted version: [JustComments](https://just-comments)

## Server Setup

- Clone the repository and run `npm install`.
- Run `node server.js`

You should get a message `JustComments listening on port 3434!`. You can change the port in `config.js`.

## Frontend Setup

- Clone https://github.com/JustComments/jc-widget and run `npm install`.
- Adjust `API_ENDPOINT` variable in Webpack via CLI and or in the source to point to 3434.
- Run `npm start` and open `http://localhost:3333/`.

## Frontend Build

- Define URLs where you will host the frontend and backend in Webpack config or via CLI.
- Run `npm run build`.
- Copy files from the `dist` to your server.
5 changes: 5 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

module.exports = {
port: 3434,
};
39 changes: 39 additions & 0 deletions markdown.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
'use strict'

const marked = require('marked');
const hl = require('highlight.js');

const renderer = new marked.Renderer();

renderer.heading = function(text) {
return '<p><strong>' + text + '</strong></p>';
};

renderer.hr = function() {
return '\n';
};

renderer.image = renderer.link;

renderer.code = (code, language, escaped) => {
const highlighted = hl.highlightAuto(code).value;
return `<pre><code class="hljs ${language}">${
highlighted === code ? escaped : highlighted
}</code></pre>`;
};

marked.setOptions({
renderer,
breaks: true,
gfm: true,
mangle: false,
pedantic: false,
sanitize: true,
smartLists: false,
smartypants: false,
tables: false,
});

exports.renderMarkdown = (str) => {
return marked(str).replace(/<a /g, '<a rel="nofollow" ');
};
Loading

0 comments on commit 628a79e

Please sign in to comment.