[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') {
|
if (event === 'data') {
|
||||||
responseCallback(url === badDataURL ? '98&H09986t&(*6BV789RhN^t97rb6Ev^*e5v89 re5bg^&' : JSON.stringify(testData));
|
responseCallback(url === badDataURL ? '98&H09986t&(*6BV789RhN^t97rb6Ev^*e5v89 re5bg^&' : JSON.stringify(testData));
|
||||||
}
|
}
|
||||||
|
if (event === 'end') {
|
||||||
|
responseCallback();
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
statusCode: (url === validURL || url === badDataURL) ? 200 : 404,
|
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) => {
|
req.on('response', (response: Electron.IncomingMessage) => {
|
||||||
log.silly('getServerAPI.response', response);
|
log.silly('getServerAPI.response', response);
|
||||||
if (response.statusCode === 200) {
|
if (response.statusCode === 200) {
|
||||||
|
let raw = '';
|
||||||
response.on('data', (chunk: Buffer) => {
|
response.on('data', (chunk: Buffer) => {
|
||||||
log.silly('getServerAPI.response.data', `${chunk}`);
|
log.silly('getServerAPI.response.data', `${chunk}`);
|
||||||
const raw = `${chunk}`;
|
raw += `${chunk}`;
|
||||||
|
});
|
||||||
|
response.on('end', () => {
|
||||||
try {
|
try {
|
||||||
const data = JSON.parse(raw) as T;
|
const data = JSON.parse(raw) as T;
|
||||||
onSuccess(data);
|
onSuccess(data);
|
||||||
|
@@ -44,12 +44,13 @@ export class ServerInfo {
|
|||||||
onGetConfig = (data: ClientConfig) => {
|
onGetConfig = (data: ClientConfig) => {
|
||||||
this.remoteInfo.serverVersion = data.Version;
|
this.remoteInfo.serverVersion = data.Version;
|
||||||
this.remoteInfo.siteURL = data.SiteURL;
|
this.remoteInfo.siteURL = data.SiteURL;
|
||||||
|
this.remoteInfo.hasFocalboard = this.remoteInfo.hasFocalboard || data.BuildBoards === 'true';
|
||||||
|
|
||||||
this.trySendRemoteInfo();
|
this.trySendRemoteInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
onGetPlugins = (data: Array<{id: string; version: string}>) => {
|
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.remoteInfo.hasPlaybooks = data.some((plugin) => plugin.id === 'playbooks');
|
||||||
|
|
||||||
this.trySendRemoteInfo();
|
this.trySendRemoteInfo();
|
||||||
|
@@ -12,4 +12,5 @@ export type RemoteInfo = {
|
|||||||
export type ClientConfig = {
|
export type ClientConfig = {
|
||||||
Version: string;
|
Version: string;
|
||||||
SiteURL: string;
|
SiteURL: string;
|
||||||
|
BuildBoards: string;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user