Commit 0cd027e0 authored by nanahira's avatar nanahira

avatar url replace

parent 0a1b60df
Pipeline #5858 passed with stages
in 2 minutes and 6 seconds
......@@ -40,7 +40,7 @@ export class User {
toJSON() {
// 这儿是 TypeScript 缺个功能,this 不支持直接用 ... 展开,这里强制类型转换一下。
// https://github.com/Microsoft/TypeScript/issues/10727
return { ...<Object>this, avatar: this.avatarURL() };
return { ...<Object>this.cleanSensitiveData(), avatar: this.avatarURL() };
}
avatarURL() {
......@@ -49,16 +49,19 @@ export class User {
if (this.avatar.substring(0, 16) == '/uploads/default') {
url = new URL(this.avatar, 'https://ygobbs.com');
} else {
url = new URL(this.avatar, 'https://cdn01.moecube.com');
url = new URL(this.avatar, 'https://cdn02.moecube.com:444');
}
return url.toString();
return url.toString().replace('https://cdn01.moecube.com', 'https://cdn02.moecube.com:444');
} else {
return 'https://cdn01.moecube.com/accounts/default_avatar.jpg';
return 'https://cdn02.moecube.com:444/accounts/default_avatar.jpg';
}
}
cleanSensitiveData() {
// this.email = '_masked';
if (this.avatar) {
this.avatar = this.avatar.replace('https://cdn01.moecube.com', 'https://cdn02.moecube.com:444');
}
this.password_hash = '_masked';
this.salt = '_masked';
this.registration_ip_address = '_masked';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment