feat: 添加自动迁移脚本并分离评论的slug和URL字段
- 新增自动数据库迁移脚本,在部署前检查并更新schema - 将post_slug字段拆分为post_slug(仅路径)和post_url(完整URL) - 更新前端widget以仅使用路径作为post_slug - 修改部署脚本以在部署前自动运行迁移
This commit is contained in:
@@ -30,7 +30,7 @@ export class CWDComments {
|
||||
constructor(config) {
|
||||
this.config = { ...config };
|
||||
if (typeof window !== 'undefined') {
|
||||
this.config.postSlug = window.location.origin + window.location.pathname;
|
||||
this.config.postSlug = window.location.pathname;
|
||||
}
|
||||
if (typeof document !== 'undefined') {
|
||||
this.config.postTitle = document.title || this.config.postSlug;
|
||||
@@ -572,7 +572,7 @@ export class CWDComments {
|
||||
|
||||
Object.assign(this.config, newConfig);
|
||||
if (typeof window !== 'undefined') {
|
||||
this.config.postSlug = window.location.origin + window.location.pathname;
|
||||
this.config.postSlug = window.location.pathname;
|
||||
}
|
||||
if (typeof document !== 'undefined') {
|
||||
this.config.postTitle = document.title || this.config.postSlug;
|
||||
|
||||
Reference in New Issue
Block a user