Git Product home page Git Product logo

cusdis's Issues

Comment content size limitation

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:

  • api should return an HTTP 413 error
  • the widget handles this error and display an error message (or just alert)

Pagination on widget

The widget doesn't have a paginator yet. Should implement a paginator and dynamic fetch comments by page number.

JS SDK UMD is recommended

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 bundler
  • cusdis.umd.js: work with <script>

User page

Showing signed in user information:

  • username
  • email address
  • OAuth provider

Comment notification implementation RFC

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.

WebHook (push-based solution)

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.

image

Open API for fetching updates batch (pull-based solution)

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:

  1. Get the latest_fetch_update_date of the project, fetch all comments between latest_fetch_update_date and now()
  2. Set latest_fetch_update_date to now()
  3. response the comments

This approach is very flexible:

  • End user can implement their own cron job for fetching bunch of latest comments and do whatever they want to, instead of receive notification every time new comment comes in.
  • Cusdis hosted service could implement own cron job service, send the latest comments to user's email every day.

image

Notify the person that is replied to

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.

RSS feed for threads and comments

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?

The approve_link from webhook is incorrect while using self-hosting

I am trying self-host a cusdis app on vercel
with custom domains cusdis.self.host

  1. after I set up a custom webhook link with TGBOT
  2. and testing post new comment
  3. the 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

i18n for dashboard

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. 🥰

reactive `data-theme` attribute

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

CSS Classes order

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:

  • avoid Svelte-xxx classes or
  • use them in first position, so it is possible to customize classes (e.g. "submit-btn") in a separate CSS file.

Screenshot 2021-04-25 at 11 59 02

support switchable dark mode and hexo integration bug

Problem Discription

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.

  1. 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.

    image

  2. hexo integration bug(not for sure): I use Cusdis in customized hexo-fluid-theme. But it shows this

    image

Theme File

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>
<% } %>

Blog link

Here is my blog.

One-time link for replying as moderator

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.

About Nested Comment

I want ot know about the nested comment admin can disable or enable option is available in admin dashboard or not.

`Reply` button improvements

When I click on multiple Reply, I can no longer close it by clicking on Reply or somewhere else .

reply.mov

Self-host - Cannot send emails

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"?

Email notification

I'm implementing Email notification feature. It's different between self-host version and hosted service.

Hosted

Use third-party email providers (mailgun or mailchimp).

Self-host

Use smtp, let users send email use their own email

HTTP 500 after browser back from login page

Steps to reproduce:

  1. Go to cusdis.com
  2. Click on "Try it now"
  3. Click on browser back button

Expected result:

We are back to cusdis.com

Actual result:

image

Trace

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)

Versions

Cusdis image: djyde/cusdis:latest
Browser: Firefox 87.0 and Chrome 89.0.4389.128

Disqus comment import only partially done

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.