admin/home: show blacklisted installed plugins
Massimo Melina committed
Oct 16, 2024 at 23:53 UTC
10d95afd8296c8597936dce9cc6b91ef7b615eb2
3 files changed
+5
-1
admin/src/HomePage.ts
+1
@@ -61,6 +61,7 @@ export default function HomePage() {
61
!errors.length && [ SOLUTION_SEP, cfgLink("switch http or https on") ]
62
),
63
with_(status.acmeRenewError, x => x && entry('warning', x)),
64
+ with_(status.blacklistedInstalledPlugins, x => x?.length > 0 && entry('warning', "Found blacklisted plugin(s): ", x.join(', ')) ),
65
plugins.find(x => x.badApi) && entry('warning', "Some plugins may be incompatible"),
66
!cfg.data?.split_uploads && (Date.now() - Number(status.cloudflareDetected || 0)) < DAY
67
&& entry('', wikiLink('Reverse-proxy#cloudflare', "Cloudflare detected, read our guide")),
src/adminApis.ts
+2
-1
@@ -37,7 +37,7 @@ import { roots } from './roots'
37
import { SendListReadable } from './SendList'
38
import { get_dynamic_dns_error } from './ddns'
39
import { addBlock, BlockingRule } from './block'
40
-import { alerts, getProjectInfo } from './github'
40
+import { alerts, blacklistedInstalledPlugins, getProjectInfo } from './github'
41
import { acmeRenewError } from './acme'
42
43
export const adminApis = {
@@ -132,6 +132,7 @@ export const adminApis = {
132
cloudflareDetected,
133
ram: process.memoryUsage.rss(),
134
acmeRenewError,
135
+ blacklistedInstalledPlugins,
136
frpDetected: localhostAdmin.get() && !getProxyDetected()
137
&& getConnections().every(isLocalHost)
138
&& await frpDebounced(),
src/github.ts
+2
@@ -230,6 +230,7 @@ export async function searchPlugins(text='', { skipRepos=[''] }={}) {
230
231
export const alerts = storedMap.singleSync<string[]>('alerts', [])
232
const cachedCentralInfo = storedMap.singleSync('cachedCentralInfo', '')
233
+export let blacklistedInstalledPlugins: string[] = []
234
// centralized hosted information, to be used as little as possible
235
const FN = 'central.json'
236
let builtIn = JSON.parse(readFileSync(join(__dirname, '..', FN), 'utf8'))
@@ -255,6 +256,7 @@ export const getProjectInfo = debounceAsync(
256
return allAlerts
257
})
258
const black = onlyTruthy(Object.keys(o.repo_blacklist || {}).map(findPluginByRepo))
259
+ blacklistedInstalledPlugins = onlyTruthy(black.map(x => _.isString(x.repo) && x.repo))
260
if (black.length) {
261
console.log("blacklisted plugins found:", black.join(', '))
262
for (const p of black)