Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Sharkey
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dima Krasner
Sharkey
Commits
00a17ed5
Unverified
Commit
00a17ed5
authored
4 years ago
by
MeiMei
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
/streamingに非WebSocketリクエストが来るとおかしくなるのを修正 Fix #6718 (#6719)
parent
b594366f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/client/scripts/stream.ts
+7
-1
7 additions, 1 deletion
src/client/scripts/stream.ts
src/server/web/index.ts
+6
-0
6 additions, 0 deletions
src/server/web/index.ts
with
13 additions
and
1 deletion
src/client/scripts/stream.ts
+
7
−
1
View file @
00a17ed5
...
...
@@ -3,6 +3,7 @@ import { EventEmitter } from 'eventemitter3';
import
ReconnectingWebsocket
from
'
reconnecting-websocket
'
;
import
{
wsUrl
}
from
'
../config
'
;
import
MiOS
from
'
../mios
'
;
import
{
query
as
urlQuery
}
from
'
../../prelude/url
'
;
/**
* Misskey stream connection
...
...
@@ -21,7 +22,12 @@ export default class Stream extends EventEmitter {
const
user
=
os
.
store
.
state
.
i
;
this
.
stream
=
new
ReconnectingWebsocket
(
wsUrl
+
(
user
?
`?i=
${
user
.
token
}
`
:
''
),
''
,
{
minReconnectionDelay
:
1
});
// https://github.com/pladaria/reconnecting-websocket/issues/91
const
query
=
urlQuery
({
i
:
user
?.
token
,
_t
:
Date
.
now
(),
});
this
.
stream
=
new
ReconnectingWebsocket
(
`
${
wsUrl
}
?
${
query
}
`
,
''
,
{
minReconnectionDelay
:
1
});
// https://github.com/pladaria/reconnecting-websocket/issues/91
this
.
stream
.
addEventListener
(
'
open
'
,
this
.
onOpen
);
this
.
stream
.
addEventListener
(
'
close
'
,
this
.
onClose
);
this
.
stream
.
addEventListener
(
'
message
'
,
this
.
onMessage
);
...
...
This diff is collapsed.
Click to expand it.
src/server/web/index.ts
+
6
−
0
View file @
00a17ed5
...
...
@@ -358,6 +358,12 @@ router.get('/flush', async ctx => {
await
ctx
.
render
(
'
flush
'
);
});
// streamingに非WebSocketリクエストが来た場合にbase htmlをキャシュ付きで返すと、Proxy等でそのパスがキャッシュされておかしくなる
router
.
get
(
'
/streaming
'
,
async
ctx
=>
{
ctx
.
status
=
503
;
ctx
.
set
(
'
Cache-Control
'
,
'
private, max-age=0
'
);
});
// Render base html for all requests
router
.
get
(
'
(.*)
'
,
async
ctx
=>
{
const
meta
=
await
fetchMeta
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment