improve: cache tool icons by setting max-age HTTP header and enable gzip compression SVG icons from backend (#2971)
This commit is contained in:
parent
58e4702b14
commit
1f98a4fff3
3 changed files with 12 additions and 3 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import io
|
||||
|
||||
from flask import send_file
|
||||
from flask import current_app, send_file
|
||||
from flask_login import current_user
|
||||
from flask_restful import Resource, reqparse
|
||||
from werkzeug.exceptions import Forbidden
|
||||
|
|
@ -80,7 +80,8 @@ class ToolBuiltinProviderIconApi(Resource):
|
|||
@setup_required
|
||||
def get(self, provider):
|
||||
icon_bytes, minetype = ToolManageService.get_builtin_tool_provider_icon(provider)
|
||||
return send_file(io.BytesIO(icon_bytes), mimetype=minetype)
|
||||
icon_cache_max_age = int(current_app.config.get('TOOL_ICON_CACHE_MAX_AGE'))
|
||||
return send_file(io.BytesIO(icon_bytes), mimetype=minetype, max_age=icon_cache_max_age)
|
||||
|
||||
class ToolModelProviderIconApi(Resource):
|
||||
@setup_required
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue