添加头像压缩机制
This commit is contained in:
		
							parent
							
								
									d87ccbfe7e
								
							
						
					
					
						commit
						0fcd9b625f
					
				@ -170,14 +170,14 @@ if (!email) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const avatarUrl = `https://download.xn--xhq44jb2fzpc.com/user/${email}/avatar`;
 | 
					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 {
 | 
					try {
 | 
				
			||||||
    const response = await fetchNoCache(avatarUrl);
 | 
					    const response = await fetchNoCache(avatarUrl);
 | 
				
			||||||
    const timestamp = new Date().getTime();
 | 
					    const timestamp = new Date().getTime();
 | 
				
			||||||
    if (response.ok) {
 | 
					    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";
 | 
					        document.getElementById('avatar').style.display = "block";
 | 
				
			||||||
        console.log("Avatar updated.");
 | 
					        console.log("Avatar updated.");
 | 
				
			||||||
    } else if (response.status === 404) {
 | 
					    } else if (response.status === 404) {
 | 
				
			||||||
 | 
				
			|||||||
@ -425,7 +425,7 @@
 | 
				
			|||||||
  </footer>
 | 
					  </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>
 | 
					<script>
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 | 
				
			|||||||
@ -409,7 +409,7 @@
 | 
				
			|||||||
  
 | 
					  
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  <div class="post-author-wrapper">
 | 
					  <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="post-author" id="post-author"></span>
 | 
				
			||||||
    <span class="icon invited-icon" id="invited-icon" style="display: none; margin-left: 8px; margin-top: 10px;">
 | 
					    <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">
 | 
					        <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>
 | 
					  </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>
 | 
					<script>
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 | 
				
			|||||||
@ -402,7 +402,7 @@
 | 
				
			|||||||
  
 | 
					  
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  <div class="post-author-wrapper">
 | 
					  <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="post-author" id="post-author"></span>
 | 
				
			||||||
    <span class="icon invited-icon" id="invited-icon" style="display: none; margin-left: 8px; margin-top: 10px;">
 | 
					    <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">
 | 
					        <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>
 | 
					  </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>
 | 
					<script>
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 | 
				
			|||||||
@ -409,7 +409,7 @@
 | 
				
			|||||||
  
 | 
					  
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  <div class="post-author-wrapper">
 | 
					  <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="post-author" id="post-author"></span>
 | 
				
			||||||
    <span class="icon invited-icon" id="invited-icon" style="display: none; margin-left: 8px; margin-top: 10px;">
 | 
					    <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">
 | 
					        <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>
 | 
					  </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>
 | 
					<script>
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 | 
				
			|||||||
@ -409,7 +409,7 @@
 | 
				
			|||||||
  
 | 
					  
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  <div class="post-author-wrapper">
 | 
					  <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="post-author" id="post-author"></span>
 | 
				
			||||||
    <span class="icon invited-icon" id="invited-icon" style="display: none; margin-left: 8px; margin-top: 10px;">
 | 
					    <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">
 | 
					        <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>
 | 
					  </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>
 | 
					<script>
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 | 
				
			|||||||
@ -405,7 +405,7 @@
 | 
				
			|||||||
  
 | 
					  
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  <div class="post-author-wrapper">
 | 
					  <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="post-author" id="post-author"></span>
 | 
				
			||||||
    <span class="icon invited-icon" id="invited-icon" style="display: none; margin-left: 8px; margin-top: 10px;">
 | 
					    <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">
 | 
					        <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>
 | 
					  </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>
 | 
					<script>
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 | 
				
			|||||||
@ -405,7 +405,7 @@
 | 
				
			|||||||
  
 | 
					  
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  <div class="post-author-wrapper">
 | 
					  <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="post-author" id="post-author"></span>
 | 
				
			||||||
    <span class="icon invited-icon" id="invited-icon" style="display: none; margin-left: 8px; margin-top: 10px;">
 | 
					    <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">
 | 
					        <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>
 | 
					  </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>
 | 
					<script>
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 | 
				
			|||||||
@ -406,7 +406,7 @@
 | 
				
			|||||||
  
 | 
					  
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  <div class="post-author-wrapper">
 | 
					  <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="post-author" id="post-author"></span>
 | 
				
			||||||
    <span class="icon invited-icon" id="invited-icon" style="display: none; margin-left: 8px; margin-top: 10px;">
 | 
					    <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">
 | 
					        <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>
 | 
					  </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>
 | 
					<script>
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 | 
				
			|||||||
@ -402,7 +402,7 @@
 | 
				
			|||||||
  
 | 
					  
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  <div class="post-author-wrapper">
 | 
					  <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="post-author" id="post-author"></span>
 | 
				
			||||||
    <span class="icon invited-icon" id="invited-icon" style="display: none; margin-left: 8px; margin-top: 10px;">
 | 
					    <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">
 | 
					        <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>
 | 
					  </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>
 | 
					<script>
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 | 
				
			|||||||
Some files were not shown because too many files have changed in this diff Show More
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user