Add message bus for #677
This commit is contained in:
parent
9ee650461f
commit
d16cfb7328
9 changed files with 207 additions and 5 deletions
|
|
@ -17,6 +17,8 @@ const url = require("url");
|
|||
|
||||
const LOGGER = require('@calzoneman/jsli')('database/accounts');
|
||||
|
||||
let globalMessageBus;
|
||||
|
||||
/**
|
||||
* Handles a GET request for /account/edit
|
||||
*/
|
||||
|
|
@ -455,6 +457,14 @@ async function handleAccountProfile(req, res) {
|
|||
return;
|
||||
}
|
||||
|
||||
globalMessageBus.emit('UserProfileChanged', {
|
||||
user: user.name,
|
||||
profile: {
|
||||
image,
|
||||
text
|
||||
}
|
||||
});
|
||||
|
||||
sendPug(res, "account-profile", {
|
||||
profileImage: image,
|
||||
profileText: text,
|
||||
|
|
@ -661,7 +671,9 @@ module.exports = {
|
|||
/**
|
||||
* Initialize the module
|
||||
*/
|
||||
init: function (app) {
|
||||
init: function (app, _globalMessageBus) {
|
||||
globalMessageBus = _globalMessageBus;
|
||||
|
||||
app.get("/account/edit", handleAccountEditPage);
|
||||
app.post("/account/edit", handleAccountEdit);
|
||||
app.get("/account/channels", handleAccountChannelPage);
|
||||
|
|
|
|||
|
|
@ -162,7 +162,15 @@ module.exports = {
|
|||
/**
|
||||
* Initializes webserver callbacks
|
||||
*/
|
||||
init: function (app, webConfig, ioConfig, clusterClient, channelIndex, session) {
|
||||
init: function (
|
||||
app,
|
||||
webConfig,
|
||||
ioConfig,
|
||||
clusterClient,
|
||||
channelIndex,
|
||||
session,
|
||||
globalMessageBus
|
||||
) {
|
||||
const chanPath = Config.get('channel-path');
|
||||
|
||||
initPrometheus(app);
|
||||
|
|
@ -217,7 +225,7 @@ module.exports = {
|
|||
app.get('/useragreement', handleUserAgreement);
|
||||
require('./routes/contact')(app, webConfig);
|
||||
require('./auth').init(app);
|
||||
require('./account').init(app);
|
||||
require('./account').init(app, globalMessageBus);
|
||||
require('./acp').init(app);
|
||||
require('../google2vtt').attach(app);
|
||||
require('./routes/google_drive_userscript')(app);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue