添加头像压缩机制

This commit is contained in:
Ember 2024-08-29 23:49:12 +08:00
parent d87ccbfe7e
commit 0fcd9b625f
33 changed files with 65 additions and 65 deletions

View File

@ -170,14 +170,14 @@ if (!email) {
}
const avatarUrl = `https://download.xn--xhq44jb2fzpc.com/user/${email}/avatar`;
const defaultAvatarUrl = "https://download.xn--xhq44jb2fzpc.com/avatar/default.png";
const defaultAvatarUrl = "https://download.xn--xhq44jb2fzpc.com/avatar/default.png?x-oss-process=style/avatar_comp";
try {
const response = await fetchNoCache(avatarUrl);
const timestamp = new Date().getTime();
if (response.ok) {
// 保证头像实时更新
document.getElementById('avatar').src = `${avatarUrl}?timestamp=${timestamp}`;
document.getElementById('avatar').src = `${avatarUrl}?timestamp=${timestamp}?x-oss-process=style/avatar_comp`;
document.getElementById('avatar').style.display = "block";
console.log("Avatar updated.");
} else if (response.status === 404) {

View File

@ -425,7 +425,7 @@
</footer>
<script src="https://download.xn--xhq44jb2fzpc.com/upload/single.js?version=1.0.5"></script>
<script src="https://download.xn--xhq44jb2fzpc.com/upload/single.js?version=1.0.8"></script>
<script>

View File

@ -409,7 +409,7 @@
<div class="post-author-wrapper">
<img src="https://download.xn--xhq44jb2fzpc.com/avatar/default.png" alt="" class="avatar" id="avatar" style="display: none">
<img src="https://download.xn--xhq44jb2fzpc.com/avatar/default.png?x-oss-process=style/avatar_comp" alt="" class="avatar" id="avatar" style="display: none">
<span class="post-author" id="post-author"></span>
<span class="icon invited-icon" id="invited-icon" style="display: none; margin-left: 8px; margin-top: 10px;">
<svg class="verified-svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16">
@ -569,7 +569,7 @@
</footer>
<script src="https://download.xn--xhq44jb2fzpc.com/upload/single.js?version=1.0.5"></script>
<script src="https://download.xn--xhq44jb2fzpc.com/upload/single.js?version=1.0.8"></script>
<script>

View File

@ -402,7 +402,7 @@
<div class="post-author-wrapper">
<img src="https://download.xn--xhq44jb2fzpc.com/avatar/default.png" alt="" class="avatar" id="avatar" style="display: none">
<img src="https://download.xn--xhq44jb2fzpc.com/avatar/default.png?x-oss-process=style/avatar_comp" alt="" class="avatar" id="avatar" style="display: none">
<span class="post-author" id="post-author"></span>
<span class="icon invited-icon" id="invited-icon" style="display: none; margin-left: 8px; margin-top: 10px;">
<svg class="verified-svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16">
@ -557,7 +557,7 @@ document.addEventListener("DOMContentLoaded",function(){f1().then(()=>{if(client
</footer>
<script src="https://download.xn--xhq44jb2fzpc.com/upload/single.js?version=1.0.5"></script>
<script src="https://download.xn--xhq44jb2fzpc.com/upload/single.js?version=1.0.8"></script>
<script>

View File

@ -409,7 +409,7 @@
<div class="post-author-wrapper">
<img src="https://download.xn--xhq44jb2fzpc.com/avatar/default.png" alt="" class="avatar" id="avatar" style="display: none">
<img src="https://download.xn--xhq44jb2fzpc.com/avatar/default.png?x-oss-process=style/avatar_comp" alt="" class="avatar" id="avatar" style="display: none">
<span class="post-author" id="post-author"></span>
<span class="icon invited-icon" id="invited-icon" style="display: none; margin-left: 8px; margin-top: 10px;">
<svg class="verified-svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16">
@ -568,7 +568,7 @@ document.addEventListener("DOMContentLoaded",function(){f1().then(()=>{if(client
</footer>
<script src="https://download.xn--xhq44jb2fzpc.com/upload/single.js?version=1.0.5"></script>
<script src="https://download.xn--xhq44jb2fzpc.com/upload/single.js?version=1.0.8"></script>
<script>

View File

@ -409,7 +409,7 @@
<div class="post-author-wrapper">
<img src="https://download.xn--xhq44jb2fzpc.com/avatar/default.png" alt="" class="avatar" id="avatar" style="display: none">
<img src="https://download.xn--xhq44jb2fzpc.com/avatar/default.png?x-oss-process=style/avatar_comp" alt="" class="avatar" id="avatar" style="display: none">
<span class="post-author" id="post-author"></span>
<span class="icon invited-icon" id="invited-icon" style="display: none; margin-left: 8px; margin-top: 10px;">
<svg class="verified-svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16">
@ -568,7 +568,7 @@ document.addEventListener("DOMContentLoaded",function(){f1().then(()=>{if(client
</footer>
<script src="https://download.xn--xhq44jb2fzpc.com/upload/single.js?version=1.0.5"></script>
<script src="https://download.xn--xhq44jb2fzpc.com/upload/single.js?version=1.0.8"></script>
<script>

View File

@ -405,7 +405,7 @@
<div class="post-author-wrapper">
<img src="https://download.xn--xhq44jb2fzpc.com/avatar/default.png" alt="" class="avatar" id="avatar" style="display: none">
<img src="https://download.xn--xhq44jb2fzpc.com/avatar/default.png?x-oss-process=style/avatar_comp" alt="" class="avatar" id="avatar" style="display: none">
<span class="post-author" id="post-author"></span>
<span class="icon invited-icon" id="invited-icon" style="display: none; margin-left: 8px; margin-top: 10px;">
<svg class="verified-svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16">
@ -565,7 +565,7 @@
</footer>
<script src="https://download.xn--xhq44jb2fzpc.com/upload/single.js?version=1.0.5"></script>
<script src="https://download.xn--xhq44jb2fzpc.com/upload/single.js?version=1.0.8"></script>
<script>

View File

@ -405,7 +405,7 @@
<div class="post-author-wrapper">
<img src="https://download.xn--xhq44jb2fzpc.com/avatar/default.png" alt="" class="avatar" id="avatar" style="display: none">
<img src="https://download.xn--xhq44jb2fzpc.com/avatar/default.png?x-oss-process=style/avatar_comp" alt="" class="avatar" id="avatar" style="display: none">
<span class="post-author" id="post-author"></span>
<span class="icon invited-icon" id="invited-icon" style="display: none; margin-left: 8px; margin-top: 10px;">
<svg class="verified-svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16">
@ -565,7 +565,7 @@
</footer>
<script src="https://download.xn--xhq44jb2fzpc.com/upload/single.js?version=1.0.5"></script>
<script src="https://download.xn--xhq44jb2fzpc.com/upload/single.js?version=1.0.8"></script>
<script>

View File

@ -406,7 +406,7 @@
<div class="post-author-wrapper">
<img src="https://download.xn--xhq44jb2fzpc.com/avatar/default.png" alt="" class="avatar" id="avatar" style="display: none">
<img src="https://download.xn--xhq44jb2fzpc.com/avatar/default.png?x-oss-process=style/avatar_comp" alt="" class="avatar" id="avatar" style="display: none">
<span class="post-author" id="post-author"></span>
<span class="icon invited-icon" id="invited-icon" style="display: none; margin-left: 8px; margin-top: 10px;">
<svg class="verified-svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16">
@ -561,7 +561,7 @@ document.addEventListener("DOMContentLoaded",function(){f1().then(()=>{if(client
</footer>
<script src="https://download.xn--xhq44jb2fzpc.com/upload/single.js?version=1.0.5"></script>
<script src="https://download.xn--xhq44jb2fzpc.com/upload/single.js?version=1.0.8"></script>
<script>

View File

@ -402,7 +402,7 @@
<div class="post-author-wrapper">
<img src="https://download.xn--xhq44jb2fzpc.com/avatar/default.png" alt="" class="avatar" id="avatar" style="display: none">
<img src="https://download.xn--xhq44jb2fzpc.com/avatar/default.png?x-oss-process=style/avatar_comp" alt="" class="avatar" id="avatar" style="display: none">
<span class="post-author" id="post-author"></span>
<span class="icon invited-icon" id="invited-icon" style="display: none; margin-left: 8px; margin-top: 10px;">
<svg class="verified-svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16">
@ -557,7 +557,7 @@ document.addEventListener("DOMContentLoaded",function(){f1().then(()=>{if(client
</footer>
<script src="https://download.xn--xhq44jb2fzpc.com/upload/single.js?version=1.0.5"></script>
<script src="https://download.xn--xhq44jb2fzpc.com/upload/single.js?version=1.0.8"></script>
<script>

Some files were not shown because too many files have changed in this diff Show More