Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: 更新浏览数量与查询浏览数量参数不一致 || [Bug]: The parameters for updating the number of views and querying the number of views are inconsistent #2146

Closed
sjsmi1e opened this issue Nov 19, 2023 · 1 comment
Labels
bug Something isn't working wontfix This will not be worked on

Comments

@sjsmi1e
Copy link

sjsmi1e commented Nov 19, 2023

问题描述 | Describe the bug

更新浏览数量接口使用的是window.location.pathname参数,会默认url编码,如果网址存在中文,会出现更新和查询不一致的问题,如下图:
请求浏览数量+1
image
而查询浏览数量参数如下
image
当前为了解决这个问题,我暂时的处理方式是每次实例化waline是调用post请求更新一次非编码的参数请求,如下:
image
希望能有方式解决,不需要每次进行额外的请求了。

问题网站 | Website URL

www.sjsmile.cn

服务部署在哪里? | Where your waline deploy?

Other

数据存储在哪里?| Where your comment data store?

MySQL


Problem description | Describe the bug

The interface for updating the number of views uses the window.location.pathname parameter, which will default to URL encoding. If the URL exists in Chinese, there will be an inconsistency problem between update and query, as shown below:
Number of requested views +1
image
The parameters for querying the number of views are as follows:
image
Currently, in order to solve this problem, my temporary approach is to call a post request to update a non-encoded parameter request every time I instantiate Waline, as follows:
image
I hope there is a way to solve it without making additional requests every time.

Question Website | Website URL

www.sjsmile.cn

Where is the service deployed? | Where your waline deploy?

Other

Where is the data stored? | Where your comment data store?

MySQL

@sjsmi1e sjsmi1e added the bug Something isn't working label Nov 19, 2023
@github-actions github-actions bot changed the title [Bug]: 更新浏览数量与查询浏览数量参数不一致 [Bug]: 更新浏览数量与查询浏览数量参数不一致 || [Bug]: The parameters for updating the number of views and querying the number of views are inconsistent Nov 19, 2023
@lizheming lizheming added the wontfix This will not be worked on label Nov 20, 2023
@lizheming
Copy link
Collaborator

lizheming commented Nov 20, 2023

  1. 可以设置主题里面获取阅读统计的数据时 path 进行编码
  2. 如果认为编码这个问题比较麻烦,可以设置其他的唯一 id,本质上是两边的 id 能对应上即可
  3. 本质上这属于主题设置的两个参数没对应上的原因,Waline 的 path 都是可配置的,不属于 Waline 的 Bug 吧,把配置调整正确即可。

  1. You can set the path to be encoded when obtaining reading statistics data in the theme.
  2. If you think the encoding problem is more troublesome, you can set other unique IDs. Essentially, it only needs to match the IDs on both sides.
  3. Essentially, this is the reason why the two parameters of the theme settings do not correspond. Waline's path is configurable. It is not a bug of Waline. Just adjust the configuration correctly.

@sjsmi1e sjsmi1e closed this as completed Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants