I'm creating open-source SaaS projects.
- Email: randypriv at gmail
- Twitter: @randyloop
lightweight, privacy-friendly alternative to Disqus.
Home Page: https://cusdis.com
License: GNU General Public License v3.0
cusdis/pages/api/open/comments.ts
Line 21 in 0a81a90
Is this a duplicate call to the CORS middleware?
Cusdis comment is support a subset of Markdown syntax. Should write a document page about it, explain which syntax is support, which is not. And add this document link to the widget, below the reply textarea.
https://github.com/djyde/cusdis/blob/master/service/comment.service.ts#L8-L12
Showing signed in user information:
Maybe use the gavatar service.
For new comments
With the Cusdis hosted service I successfully receive the emails, but I can't figure it out on the self-hosted version.
I cloned the repository and deployed it on my vercel App. I set the environment variables:
SMTP_HOST
set to "smtp.gmail.com"
SMTP_USER
set to "[email protected]"
SMTP_PASSWORD
set to an App password by Gmail
SMTP_SENDER
set to "[email protected]"
SMTP_PORT
set to 587
SMTP_SECURE
set to "true"
then I redeployed the App.
I tested the server/user/psw with a SMTP tester and it works.
When I post a comment on my site, no email is received. I am also pretty sure that the request did not arrive to Google because the "last use date/time" of the App password did not change.
I also tried with Office365 SMTP and I did not receive any email. I tried port 465 too with no luck.
A doubt: SMTP_SECURE=true
is related to SSL or TLS?
Also, what about the HOST
env variable? What should be its value? My blog's URL, "my-blog.com"?
Since i18n in Nextjs and React is so complicated, I don't have time for this. (I did research about i18next and formatjs, they both have their good and bad part)
If you are experienced in i18n, welcome to contribute a good solution, to bring Cusdis to more countries. 🥰
We are back to cusdis.com
Using the docker-compose file given in the documentations, I could reproduce the error. The container cusdis terminates with the following error:
cusdis_1 | /app/node_modules/next-auth/dist/client/index.js:181
cusdis_1 | callbackUrl = window.location,
cusdis_1 | ^
cusdis_1 | ReferenceError: window is not defined
cusdis_1 | at /app/node_modules/next-auth/dist/client/index.js:181:21
cusdis_1 | at Generator.next (<anonymous>)
cusdis_1 | at asyncGeneratorStep (/app/node_modules/next-auth/dist/client/index.js:33:103)
cusdis_1 | at _next (/app/node_modules/next-auth/dist/client/index.js:35:194)
cusdis_1 | at /app/node_modules/next-auth/dist/client/index.js:35:364
cusdis_1 | at new Promise (<anonymous>)
cusdis_1 | at /app/node_modules/next-auth/dist/client/index.js:35:97
cusdis_1 | at _signIn (/app/node_modules/next-auth/dist/client/index.js:239:18)
cusdis_1 | at signIn (/app/node_modules/next-auth/dist/client/index.js:173:18)
cusdis_1 | at Dashboard (/app/.next/server/pages/dashboard.js:322:68)
Cusdis image: djyde/cusdis:latest
Browser: Firefox 87.0 and Chrome 89.0.4389.128
I'm thinking about how to notify the moderator when a new comment comes in. In this issue I will explain the design I'm considering.
The simplest way to notify is when new comment is added, we make POST request to the webhook with the comment body.
Every project (website) can set one webhook url.
Another way is exposing an open api for each project. e.g.
GET https://cusdis.com/api/projects/xxx/open/new_comments?token=xxxx
Every project has a token
which is generated by system. It can be revoked and re-generate manually. When user GET this API, the server will do:
latest_fetch_update_date
of the project, fetch all comments between latest_fetch_update_date
and now()
latest_fetch_update_date
to now()
This approach is very flexible:
Hi, I hosted Cusdis with Vercel + Postgres combination and I failed to import comments from Disqus. It returned "Something went wrong" 500 error.
For what it worth, the exported XML contains some comments that were imported from my own developed Blog engine. So some fields were faked or missing, but they were displayed well on Disqus.
Attach the Disqus XML below
flog-1-2021-04-23T09_34_33.817420-all.xml.gz
Wrap the sdk in Vuejs, just like react-cusdis. In https://github.com/Cusdis/sdk
With self-host Cusdis, user can setup SMTP server to enable email notification. It would be good to write a series of "how to" documentation to guide user how to setup some mainstream email provider:
Welcome to PR.
Embed Code
<div id="cusdis_thread"
data-host="https://cusdis.com"
data-app-id="xxx"
data-page-id="{{ PAGE_ID }}"
data-page-url="{{ PAGE_URL }}"
data-page-title="{{ PAGE_TITLE }}"
></div>
<!--<script async src="https://cusdis.com/js/cusdis.es.js"></script>-->
<script async src="https://cusdis.com/js/cusdis.umd.js"></script>
cusdis.es.js
: work with bundlercusdis.umd.js
: work with <script>
serverless database provider
From what I observe in the source code, Cusdis doesn't support notifying the author of the parent comment right?
Since the email
is already present in the model so this should be in the plan.
The widget doesn't have a paginator yet. Should implement a paginator and dynamic fetch comments by page number.
use import aliases instends of ./../../../../
I am trying self-host a cusdis app on vercel
with custom domains cusdis.self.host
approve_link
from webhook message is https://cusdis.com/open/approve?token=xxx
which is, cusdis.com
at approve_link is not matching my custom domains cusdis.self.host
and hence cause the invalid token
error
I'm implementing Email notification feature. It's different between self-host version and hosted service.
Use third-party email providers (mailgun or mailchimp).
Use smtp, let users send email use their own email
Hi, thx for providing such a lightweight and convenient comment system.
I've been tring it for a while and it really fits my blog! But there exists some problems.
switchable dark mode: Cusdis is equipped with dark mode with prefers-color-scheme: dark
according to the discussion in #59 . I parse the theme.dark_mode.default
with value auto
to data-theme
, It fails automatically detect the dark(light) mode at the beginning. When I toggle the dark mode button, it also fails to change dynamically.
hexo integration bug(not for sure): I use Cusdis in customized hexo-fluid-theme. But it shows this
Here is my customized theme file:
<% if (theme.cusdis.host && theme.cusdis.app_id) { %>
<div class="cusdis"></div>
<div id="cusdis_thread" data-host="<%= theme.cusdis.host %>" data-app-id="<%= theme.cusdis.app_id %>"
data-page-id="<%= md5(page.path) %>" data-page-url="<%= page.path %>" data-page-title="<%= page.title %>"
data-theme="<%= theme.dark_mode.default %>">
<script type="text/javascript">
var src = 'https://cusdis.com/js/widget/lang/' + '<%= theme.cusdis.lang %>' + '.js'
Fluid.utils.createScript(src)
</script>
<script type="text/javascript">
Fluid.utils.loadComments('#cusdis_thread', function () {
Fluid.utils.createScript("<%= url_join(theme.cusdis.host, 'js/cusdis.es.js') %>");
});
</script>
</div>
<noscript>Please enable JavaScript to view the comments</noscript>
<% } %>
Here is my blog.
Comment's database query (in service/comment.service.ts
) is recursive, it would cause a performance issue when the data get bigger. Should find a better way.
Related:
https://news.ycombinator.com/item?id=26885342
https://cra.mr/2010/05/30/scaling-threaded-comments-on-django-at-disqus/
My blog has few visitors and hardly encounters junk comments. So I hope to add the option of directly displaying comments without approval.
When using hosted service on cusdis.com, there are Svelte-xxx CSS classes which did not exist with Vercel deployment.
Since, if there are multiple CSS classes, the last one wins, it would be nice to:
@pablopvsky Thank you! I think the Docsify plugin implementation would help you
https://github.com/djyde/cusdis/blob/master/public/js/cusdis.docsify.js#L33
I expose a renderCusdis
method on window
so that the SPA can call it to rerender the widget (Sorry I didn't mention it on the JS SDK document):
https://github.com/djyde/cusdis/blob/master/widget/index.js#L15
Originally posted by @djyde in #22 (comment)
The comment content doesn't have a max length limit on the api server, while it is unlimited in SQLite and 191 in PostgreSQL.
We should limit it in 800 (or more) in the api layer. If the submit is larger than this limitation:
Make Cusdis available in your language! Here is the documentation about how you can contribute:
We should separate all styles from svelte component and use css variables to make widget style be more flexible to customize.
Ref: #59
I implemented SMTP for self-host service. But it doesn't work well when I tested it with Gmail. I don't have time to test this feature yet. If someone is interested in it, feel free to contribute.
Related code: https://github.com/djyde/cusdis/blob/master/service/notification.service.ts#L94
Hello,
how to contribute with a translation?
Best regards
I've been thinking how to notify the commenter (#78) when they have new reply without collect their email address, since few people are willing to provide their email address in an "untrusted" form.
A pull-based subscription may be a good solution. Commenters can subscribe new reply instead of we pushing to them. One of the most common way is RSS.
We can provide rss feed for every comment:
https://cusdis.com/api/open/comments/{commentId}/rss.xml
This feed contains all replies in this comment. And the user can copy comment's rss feed in the widget.
My only concern is will users really add this rss feed to their rss reader for getting new reply notification?
When I click on multiple Reply
, I can no longer close it by clicking on Reply
or somewhere else .
ref #49
Akismet is a spam protection service. It's free for personal use. We could provide an option to enable Akismet in self-host environment.
Besides we can use $8/month plan for our hosted service.
In section Advanced
subsec i18n
, the link: https://cusdis.com/js/widget/lang/LANG_CODE.js is invalid.
I'm working on supporting Cusdis in hexo-theme-fluid with i18n enable, but too be honest, the guidance in Cusdis documentation is a little bit confusing.
Or if you want to know how does Cusdis intergrate with other services, just leave a comment.
But before using Redis, we should firstly measure current query time
Since data attribute in HTML is not reactive, when user want to implement toggle theme on their application, changing the data-theme
value won't work.
I would make a new global API to change theme.
This enhancement will fix #90
I want ot know about the nested comment admin can disable or enable option is available in admin dashboard or not.
I'm planning to expose a one-time link for replying as moderator in Webhook, for example:
Users would receive a reply_link
like https://cusdis.com/api/open/reply?token=xxx
The token
is a JWT token which contains the new comment's id. User can make a POST request to this url with a reply_content
data. Finnaly this comment will be approved automatically and append the reply content to this comment as moderator.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.