File size: 1,095 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const config = require( '../../../config/config.json' );
const pkg = require( '../../../package.json' );

// Merge in some details from package.json
config.name = pkg.productName;
config.description = 'WordPress Desktop';
config.version = pkg.version;
config.author = pkg.author;

config.protocol = 'wpdesktop';

config.oauthLoginEnabled = process.platform !== 'linux';

config.loginURL = function () {
	const loginUri = ! config.oauthLoginEnabled ? 'log-in' : 'log-in/desktop';
	return this.baseURL() + loginUri;
};

config.baseURL = function () {
	if ( process.env.WP_DESKTOP_BASE_URL !== undefined ) {
		return `${ process.env.WP_DESKTOP_BASE_URL }/`;
	}

	return 'https://wordpress.com/';
};

config.isRelease = function () {
	return this.build === 'release';
};

config.isUpdater = function () {
	return this.build === 'updater';
};

config.isBeta = function () {
	return this.build === 'beta';
};

// Do not send function and DOM objects (exception in Electron v9).
config.toRenderer = function () {
	return {
		build: this.build,
		version: this.version,
	};
};

module.exports = config;