2022-03-16 12:33:34 +01:00
|
|
|
export default {
|
2022-03-16 12:46:16 +01:00
|
|
|
run(app) {
|
2022-03-16 12:33:34 +01:00
|
|
|
const Store = requirejs("discourse/services/store").default;
|
|
|
|
const Site = requirejs(
|
|
|
|
"discourse/plugins/discourse-custom-wizard/wizard/models/site"
|
|
|
|
).default;
|
|
|
|
const Session = requirejs("discourse/models/session").default;
|
|
|
|
const RestAdapter = requirejs("discourse/adapters/rest").default;
|
|
|
|
const messageBus = requirejs("message-bus-client").default;
|
2022-03-16 12:46:16 +01:00
|
|
|
const sniffCapabilites = requirejs(
|
|
|
|
"discourse/pre-initializers/sniff-capabilities"
|
|
|
|
).default;
|
2022-03-16 12:33:34 +01:00
|
|
|
const site = Site.current();
|
|
|
|
const session = Session.current();
|
|
|
|
|
|
|
|
const registrations = [
|
|
|
|
["site-settings:main", app.SiteSettings, false],
|
|
|
|
["message-bus:main", messageBus, false],
|
|
|
|
["site:main", site, false],
|
|
|
|
["session:main", session, false],
|
|
|
|
["service:store", Store, true],
|
2022-03-16 12:46:16 +01:00
|
|
|
["adapter:rest", RestAdapter, true],
|
2022-03-16 12:33:34 +01:00
|
|
|
];
|
|
|
|
|
2022-03-16 12:46:16 +01:00
|
|
|
registrations.forEach((registration) => {
|
2022-03-16 12:33:34 +01:00
|
|
|
if (!app.hasRegistration(registration[0])) {
|
2022-03-16 12:46:16 +01:00
|
|
|
app.register(registration[0], registration[1], {
|
|
|
|
instantiate: registration[2],
|
|
|
|
});
|
2022-03-16 12:33:34 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2022-03-16 12:46:16 +01:00
|
|
|
const targets = [
|
|
|
|
"controller",
|
|
|
|
"component",
|
|
|
|
"route",
|
|
|
|
"model",
|
|
|
|
"adapter",
|
|
|
|
"mixin",
|
|
|
|
];
|
2022-03-16 12:33:34 +01:00
|
|
|
const injections = [
|
|
|
|
["siteSettings", "site-settings:main"],
|
|
|
|
["messageBus", "message-bus:main"],
|
|
|
|
["site", "site:main"],
|
|
|
|
["session", "session:main"],
|
|
|
|
["store", "service:store"],
|
2022-03-16 12:46:16 +01:00
|
|
|
["appEvents", "service:app-events"],
|
2022-03-16 12:33:34 +01:00
|
|
|
];
|
|
|
|
|
2022-03-16 12:46:16 +01:00
|
|
|
injections.forEach((injection) => {
|
2022-03-16 12:33:34 +01:00
|
|
|
targets.forEach((t) => app.inject(t, injection[0], injection[1]));
|
|
|
|
});
|
|
|
|
|
|
|
|
if (!app.hasRegistration("capabilities:main")) {
|
|
|
|
sniffCapabilites.initialize(null, app);
|
|
|
|
}
|
|
|
|
|
|
|
|
site.set("can_create_tag", false);
|
2022-03-16 12:46:16 +01:00
|
|
|
},
|
|
|
|
};
|