plugins: backend event 'alert'
Massimo Melina committed
Apr 5, 2026 at 20:30 UTC
1fc14a499f6c451a43b129d9eeea2e5454215550
2 files changed
+6
-2
dev-plugins.md
+3
-1
@@ -841,6 +841,8 @@ This section is still partially documented, and you may need to have a look at t
841
- async supported
842
- preventable
843
- return: callback(s) to run after request handling is completed, similar to `middleware` upstream
844
+- `alert` called when HFS receives important announcements or security notices about your version (from the repo on GitHub)
845
+ - parameters: { message: string }
846
847
# Notifications (backend-to-frontend events)
848
@@ -1185,6 +1187,6 @@ If you want to override a text regardless of the language, use the special langu
1187
- 12.97 (v0.57.28)
1188
- HFS.customizeText
1189
- 13 (v3.1.0)
1188
- - backend events: dirEntry, request
1190
+ - backend events: dirEntry, request, alert
1191
- HFS.pathSeparator
1192
- config.type=show_html
\ No newline at end of file
src/github.ts
+3
-1
@@ -310,8 +310,10 @@ export const getProjectInfo = debounceAsync(async () => {
310
alerts = newAlerts
311
if (newAlerts.length)
312
void checkForUpdates() // with new alerts, is best to have fresh updates info
313
- for (const a of newAlerts)
313
+ for (const a of newAlerts) {
314
console.log("ALERT:", a)
315
+ events.emit('alert', { message: a })
316
+ }
317
}
318
const black = onlyTruthy(Object.keys(obj.repo_blacklist || {}).map(findPluginByRepo))
319
blacklistedInstalledPlugins = onlyTruthy(black.map(x => _.isString(x.repo) && x.repo))