Skip to content
Snippets Groups Projects
Commit dc1d7fa9 authored by syuilo's avatar syuilo
Browse files

ローカルタイムラインストリームに認証不要で接続できるように

parent f42665d4
No related branches found
No related tags found
No related merge requests found
......@@ -9,10 +9,10 @@ export default async function(
request: websocket.request,
connection: websocket.connection,
subscriber: Xev,
user: IUser
user?: IUser
) {
const mute = await Mute.find({ muterId: user._id });
const mutedUserIds = mute.map(m => m.muteeId.toString());
const mute = user ? await Mute.find({ muterId: user._id }) : null;
const mutedUserIds = mute ? mute.map(m => m.muteeId.toString()) : [];
// Subscribe stream
subscriber.on('local-timeline', async note => {
......
......@@ -52,6 +52,11 @@ module.exports = (server: http.Server) => {
return;
}
if (request.resourceURL.pathname === '/local-timeline') {
localTimelineStream(request, connection, ev, user);
return;
}
if (user == null) {
connection.send('authentication-failed');
connection.close();
......@@ -60,7 +65,6 @@ module.exports = (server: http.Server) => {
const channel: any =
request.resourceURL.pathname === '/' ? homeStream :
request.resourceURL.pathname === '/local-timeline' ? localTimelineStream :
request.resourceURL.pathname === '/hybrid-timeline' ? hybridTimelineStream :
request.resourceURL.pathname === '/global-timeline' ? globalTimelineStream :
request.resourceURL.pathname === '/user-list' ? userListStream :
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment