[MM-50042] Detect Boards using the BuildBoards flag in the client config (#2535)
This commit is contained in:
@@ -23,6 +23,9 @@ jest.mock('electron', () => ({
|
||||
if (event === 'data') {
|
||||
responseCallback(url === badDataURL ? '98&H09986t&(*6BV789RhN^t97rb6Ev^*e5v89 re5bg^&' : JSON.stringify(testData));
|
||||
}
|
||||
if (event === 'end') {
|
||||
responseCallback();
|
||||
}
|
||||
}),
|
||||
statusCode: (url === validURL || url === badDataURL) ? 200 : 404,
|
||||
});
|
||||
|
@@ -38,9 +38,12 @@ export async function getServerAPI<T>(url: URL, isAuthenticated: boolean, onSucc
|
||||
req.on('response', (response: Electron.IncomingMessage) => {
|
||||
log.silly('getServerAPI.response', response);
|
||||
if (response.statusCode === 200) {
|
||||
let raw = '';
|
||||
response.on('data', (chunk: Buffer) => {
|
||||
log.silly('getServerAPI.response.data', `${chunk}`);
|
||||
const raw = `${chunk}`;
|
||||
raw += `${chunk}`;
|
||||
});
|
||||
response.on('end', () => {
|
||||
try {
|
||||
const data = JSON.parse(raw) as T;
|
||||
onSuccess(data);
|
||||
|
@@ -44,12 +44,13 @@ export class ServerInfo {
|
||||
onGetConfig = (data: ClientConfig) => {
|
||||
this.remoteInfo.serverVersion = data.Version;
|
||||
this.remoteInfo.siteURL = data.SiteURL;
|
||||
this.remoteInfo.hasFocalboard = this.remoteInfo.hasFocalboard || data.BuildBoards === 'true';
|
||||
|
||||
this.trySendRemoteInfo();
|
||||
}
|
||||
|
||||
onGetPlugins = (data: Array<{id: string; version: string}>) => {
|
||||
this.remoteInfo.hasFocalboard = data.some((plugin) => plugin.id === 'focalboard');
|
||||
this.remoteInfo.hasFocalboard = this.remoteInfo.hasFocalboard || data.some((plugin) => plugin.id === 'focalboard');
|
||||
this.remoteInfo.hasPlaybooks = data.some((plugin) => plugin.id === 'playbooks');
|
||||
|
||||
this.trySendRemoteInfo();
|
||||
|
@@ -12,4 +12,5 @@ export type RemoteInfo = {
|
||||
export type ClientConfig = {
|
||||
Version: string;
|
||||
SiteURL: string;
|
||||
BuildBoards: string;
|
||||
}
|
||||
|
Reference in New Issue
Block a user