-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
803 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,3 +59,5 @@ typings/ | |
|
||
# next.js build output | ||
.next | ||
|
||
comments/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
port: 3434, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" '); | ||
}; |
Oops, something went wrong.