nodebb-plugin-composer-default 10.3.7 → 10.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/library.js +15 -15
- package/package.json +1 -1
package/library.js
CHANGED
|
@@ -45,19 +45,20 @@ plugin.addAdminNavigation = async function (header) {
|
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
plugin.addPrefetchTags = async function (hookData) {
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
48
|
+
const { req } = hookData;
|
|
49
|
+
if (req.uid > 0) {
|
|
50
|
+
const prefetch = [
|
|
51
|
+
'/assets/templates/composer.js',
|
|
52
|
+
`/assets/language/${meta.config.defaultLang || 'en-GB'}/topic.json`,
|
|
53
|
+
`/assets/language/${meta.config.defaultLang || 'en-GB'}/modules.json`,
|
|
54
|
+
`/assets/language/${meta.config.defaultLang || 'en-GB'}/tags.json`,
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
hookData.links = hookData.links.concat(prefetch.map(path => ({
|
|
58
|
+
rel: 'prefetch',
|
|
59
|
+
href: `${nconf.get('relative_path') + path}?${meta.config['cache-buster']}`,
|
|
60
|
+
})));
|
|
61
|
+
}
|
|
61
62
|
|
|
62
63
|
return hookData;
|
|
63
64
|
};
|
|
@@ -117,8 +118,7 @@ plugin.getFormattingOptions = async function () {
|
|
|
117
118
|
};
|
|
118
119
|
|
|
119
120
|
plugin.filterComposerBuild = async function (hookData) {
|
|
120
|
-
const { req } = hookData;
|
|
121
|
-
const { res } = hookData;
|
|
121
|
+
const { req, res } = hookData;
|
|
122
122
|
|
|
123
123
|
if (req.query.p) {
|
|
124
124
|
try {
|