if ('Notification' in window && 'permissions' in navigator) {
navigator.permissions.query({ name: 'notifications' }).then((status) => {
status.onchange = () => dispatch(setBrowserPermission(Notification.permission));
- });
+ }).catch(console.warn);
}
};
}
import { Tesseract as fetchTesseract } from 'mastodon/features/ui/util/async-components';
import GIFV from 'mastodon/components/gifv';
import { me } from 'mastodon/initial_state';
+// eslint-disable-next-line import/no-extraneous-dependencies
import tesseractCorePath from 'tesseract.js-core/tesseract-core.wasm.js';
+// eslint-disable-next-line import/extensions
import tesseractWorkerPath from 'tesseract.js/dist/worker.min.js';
import { assetHost } from 'mastodon/utils/config';
* @property {function(): void} onDisconnect
*/
- /**
+/**
* @typedef StreamEvent
* @property {string} event
* @property {object} payload
const checkNotificationPromise = () => {
try {
+ // eslint-disable-next-line promise/catch-or-return
Notification.requestPermission().then();
} catch(e) {
return false;
export const requestNotificationPermission = (callback) => {
if (checkNotificationPromise()) {
- Notification.requestPermission().then((permission) => handlePermission(permission, callback));
+ Notification.requestPermission().then((permission) => handlePermission(permission, callback)).catch(console.warn);
} else {
Notification.requestPermission((permission) => handlePermission(permission, callback));
}
const FALSE_VALUES = [
false,
0,
- "0",
- "f",
- "F",
- "false",
- "FALSE",
- "off",
- "OFF"
+ '0',
+ 'f',
+ 'F',
+ 'false',
+ 'FALSE',
+ 'off',
+ 'OFF',
];
/**
return 'direct';
case '/api/v1/streaming/list':
return 'list';
+ default:
+ return undefined;
}
};
log.verbose(req.requestId, `Closing connection for ${req.accountId} due to expired access token`);
eventHandlers.onKill();
}
- }
+ };
};
/**
log.error(req.requestId, err.toString());
if (res.headersSent) {
- return next(err);
+ next(err);
+ return;
}
res.writeHead(err.status || 500, { 'Content-Type': 'application/json' });
if (type === 'subscribe') {
subscribeWebsocketToChannel(session, firstParam(stream), params);
} else if (type === 'unsubscribe') {
- unsubscribeWebsocketFromChannel(session, firstParam(stream), params)
+ unsubscribeWebsocketFromChannel(session, firstParam(stream), params);
} else {
// Unknown action type
}