Improving Artalk Comments to Version 2.8.3 and Resolving Error (Request Response 404)

image-20240328164913925

Updating Artalk comments to version 2.8.3 and addressing the Artalk Error: Request Response 404, which prevented fetching the comment list data.

Purpose

Upgrading Artalk comments to version 2.8.3.

Resolving Artalk Error: Request Response 404, which hindered fetching the comment list data.

Related

Journey

Artalk’s SMTP configuration has consistently failed to send emails. The root cause remains unclear. Is it due to certificates or lack of logs? How can validation be bypassed? Hence, the immediate step is to attempt an upgrade. The current version in Docker output is:

1
Artalk (v2.6.4/8867eb2)     

Ref: Artalk Issue #748

The decision is made to upgrade Artalk to the latest version available!

Upgrade Steps:

1
2
3
4
5
6
7
8
# Start by shutting down Artalk service
docker-compose down

docker-compose pull
docker-compose up --remove-orphans

# Clean up old versions of Artalk Docker images
docker image prune

With these commands, Artalk is upgraded to the latest version: Artalk (v2.8.3/8af7136)

However, upon upgrading, an error is encountered: Request Response 404.

Artalk Error: Request Response 404 - Unable to fetch comment list data.
Click to retry | Open console

image-20240328164913925

Solution:

1
404 (Not Found) - The server cannot find the requested page.

After thorough checks and testing, it’s confirmed that Docker startup is functioning normally.

There’s a strong suspicion that the error stems from an outdated Hexo version, leading to page request errors.

1
2
3
4
5
6
7
NexT.utils.loadComments(CONFIG.artalk.el)
.then(() => NexT.utils.getScript(CONFIG.artalk.jsUrl, {
condition: window.Artalk
}))
.then(() => {
Artalk.init(CONFIG.artalk);
});

The problem transforms into: how to upgrade Hexo?

Upon review the next day, it’s concluded that the server-side Artalk has been reinstalled with the latest version (while retaining the original data). Therefore, the issue likely lies in integrating with Hexo. It’s essentially a matter of Node installation on the server, Hexo-related configurations, and the JS client, each of which is examined:

Attempting to update the Hexo Artalk plugin:

1
2
3
npm install hexo-next-artalk

# Returns 'up to date', indicating the plugin is already at the latest version

By chance, notice that the _config.yml file in Hexo references a specific version of Artalk (an older version):

1
2
3
jsUrl: https://cdnjs.cloudflare.com/ajax/libs/artalk/2.6.4/Artalk.min.js
#https://cdn.staticfile.org/artalk/2.6.4/Artalk.min.js
cssUrl: https://cdnjs.cloudflare.com/ajax/libs/artalk/2.6.4/Artalk.min.css

It’s imperative to update these references to the latest version pulled via docker-compose:

Utilizing cdnjs

After modifying the _config.yml file in Hexo to reference the latest version of Artalk for both JS and CSS, and leveraging cdnjs, the following steps are executed:

1
2
3
hexo clean

hexo g && hexo s

The 404 error is successfully resolved.

1
2
jsUrl: https://cdnjs.cloudflare.com/ajax/libs/artalk/2.8.3/Artalk.min.js
cssUrl: https://cdnjs.cloudflare.com/ajax/libs/artalk/2.8.3/Artalk.min.css

Next Step: Continue investigating and testing Artalk V2.8.3’s SMTP notification sending functionality.

1
2
artalk  | ERROR Email: Email sending failed via SMTP tls: failed to verify certificate: x509: certificate relies on legacy Common Name field, use SANs instead                                                        
artalk | ERROR Email: Failed send email to addr: wangyouxiaosong@outlook.com

ERROR Email: Email sending failed via SMTP tls: failed to verify certificate: x509: certificate relies on legacy Common Name field, use SANs instead

Even when changing the SMTP port to 25, the error persists:

1
2
artalk  | ERROR Email: Email sending failed via SMTP tls: failed to verify certificate: x509: certificate relies on legacy Common Name field, use SANs instead                                                        
artalk | ERROR Email: Failed send email to addr: wangyouxiaosong@outlook.com

The suspicion grows: the next issue to tackle is the artalk | FATAL tls: provide a valid cert or key path.

Release Notes

Ensure that the modifications made to the JS and CSS files in the _config.yml are synced to the English version of the site under the /en directory. Otherwise, the comment functionality in the English version might also encounter the Error: Request Response 404.

Sources of Inspiration

[Customizing Hexo for Broad Artalk Deployment](