ローカルタイムラインストリームに認証不要で接続できるように
This commit is contained in:
parent
f42665d4bc
commit
dc1d7fa9d7
|
@ -9,10 +9,10 @@ export default async function(
|
||||||
request: websocket.request,
|
request: websocket.request,
|
||||||
connection: websocket.connection,
|
connection: websocket.connection,
|
||||||
subscriber: Xev,
|
subscriber: Xev,
|
||||||
user: IUser
|
user?: IUser
|
||||||
) {
|
) {
|
||||||
const mute = await Mute.find({ muterId: user._id });
|
const mute = user ? await Mute.find({ muterId: user._id }) : null;
|
||||||
const mutedUserIds = mute.map(m => m.muteeId.toString());
|
const mutedUserIds = mute ? mute.map(m => m.muteeId.toString()) : [];
|
||||||
|
|
||||||
// Subscribe stream
|
// Subscribe stream
|
||||||
subscriber.on('local-timeline', async note => {
|
subscriber.on('local-timeline', async note => {
|
||||||
|
|
|
@ -52,6 +52,11 @@ module.exports = (server: http.Server) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (request.resourceURL.pathname === '/local-timeline') {
|
||||||
|
localTimelineStream(request, connection, ev, user);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
connection.send('authentication-failed');
|
connection.send('authentication-failed');
|
||||||
connection.close();
|
connection.close();
|
||||||
|
@ -60,7 +65,6 @@ module.exports = (server: http.Server) => {
|
||||||
|
|
||||||
const channel: any =
|
const channel: any =
|
||||||
request.resourceURL.pathname === '/' ? homeStream :
|
request.resourceURL.pathname === '/' ? homeStream :
|
||||||
request.resourceURL.pathname === '/local-timeline' ? localTimelineStream :
|
|
||||||
request.resourceURL.pathname === '/hybrid-timeline' ? hybridTimelineStream :
|
request.resourceURL.pathname === '/hybrid-timeline' ? hybridTimelineStream :
|
||||||
request.resourceURL.pathname === '/global-timeline' ? globalTimelineStream :
|
request.resourceURL.pathname === '/global-timeline' ? globalTimelineStream :
|
||||||
request.resourceURL.pathname === '/user-list' ? userListStream :
|
request.resourceURL.pathname === '/user-list' ? userListStream :
|
||||||
|
|
Loading…
Reference in New Issue