Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
ComfyUI
Commits
d0b195c7
"...git@developer.sourcefind.cn:wangsen/paddle_dbnet.git" did not exist on "88c6ad8a31b0cd8495a9b44fbc599524c65dad80"
Commit
d0b195c7
authored
Mar 09, 2023
by
pythongosssss
Browse files
Changed to use etag cache for js and css
parent
99eb777f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
server.py
server.py
+9
-1
No files found.
server.py
View file @
d0b195c7
...
@@ -18,6 +18,14 @@ except ImportError:
...
@@ -18,6 +18,14 @@ except ImportError:
import
mimetypes
import
mimetypes
@
web
.
middleware
async
def
cache_control
(
request
:
web
.
Request
,
handler
):
response
:
web
.
Response
=
await
handler
(
request
)
if
request
.
path
.
endswith
(
'.js'
)
or
request
.
path
.
endswith
(
'.css'
):
response
.
headers
.
setdefault
(
'Cache-Control'
,
'no-cache'
)
return
response
class
PromptServer
():
class
PromptServer
():
def
__init__
(
self
,
loop
):
def
__init__
(
self
,
loop
):
mimetypes
.
init
();
mimetypes
.
init
();
...
@@ -26,7 +34,7 @@ class PromptServer():
...
@@ -26,7 +34,7 @@ class PromptServer():
self
.
loop
=
loop
self
.
loop
=
loop
self
.
messages
=
asyncio
.
Queue
()
self
.
messages
=
asyncio
.
Queue
()
self
.
number
=
0
self
.
number
=
0
self
.
app
=
web
.
Application
(
client_max_size
=
20971520
)
self
.
app
=
web
.
Application
(
client_max_size
=
20971520
,
middlewares
=
[
cache_control
]
)
self
.
sockets
=
dict
()
self
.
sockets
=
dict
()
self
.
web_root
=
os
.
path
.
join
(
os
.
path
.
dirname
(
self
.
web_root
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
"web"
)
os
.
path
.
realpath
(
__file__
)),
"web"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment