API: Fix serverExists() return true for not revealed servers (#1013)

This commit is contained in:
Shockwave 2024-01-08 00:40:07 +08:00 committed by GitHub
parent f0f335e09a
commit 7017f3c2f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1116,7 +1116,8 @@ export const ns: InternalAPI<NSFull> = {
},
serverExists: (ctx) => (_hostname) => {
const hostname = helpers.string(ctx, "hostname", _hostname);
return GetServer(hostname) !== null;
const server = GetServer(hostname);
return server !== null && (server.serversOnNetwork.length > 0 || server.hostname === "home");
},
fileExists: (ctx) => (_filename, _hostname) => {
const filename = helpers.string(ctx, "filename", _filename);