Update avatar.

This commit is contained in:
retoor 2025-02-26 00:40:18 +01:00
parent 5af4e5754b
commit e280e87764

View File

@ -24,7 +24,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE. # SOFTWARE.
from multiavatar import multiavatar from multiavatar import multiavatar
import uuid
from aiohttp import web from aiohttp import web
from snek.system.view import BaseView from snek.system.view import BaseView
@ -33,6 +33,8 @@ class AvatarView(BaseView):
async def get(self): async def get(self):
uid = self.request.match_info.get("uid") uid = self.request.match_info.get("uid")
if uid == "unique":
uid = str(uuid.uuid4())
avatar = multiavatar.multiavatar(uid,None, None) avatar = multiavatar.multiavatar(uid,None, None)
response = web.Response(text=avatar, content_type='image/svg+xml') response = web.Response(text=avatar, content_type='image/svg+xml')
response.headers['Cache-Control'] = f'public, max-age={1337*42}' response.headers['Cache-Control'] = f'public, max-age={1337*42}'