summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2022-01-18 21:42:49 +0100
committerOskar Nyberg <oskar@mullvad.net>2022-01-27 10:39:37 +0100
commit90ae963575524bda543a32aedcfd644dd7e2b495 (patch)
tree8ad13be4a92926c9bfa59a403ce5581dfb3ee355
parent69b1fa941931849d484e88e1676b057001a6cc10 (diff)
downloadmullvadvpn-90ae963575524bda543a32aedcfd644dd7e2b495.tar.xz
mullvadvpn-90ae963575524bda543a32aedcfd644dd7e2b495.zip
Add changelog and parsing of it
-rw-r--r--gui/changelog.txt4
-rw-r--r--gui/src/main/changelog.ts65
-rw-r--r--gui/src/shared/ipc-types.ts2
-rw-r--r--gui/tasks/distribution.js1
4 files changed, 72 insertions, 0 deletions
diff --git a/gui/changelog.txt b/gui/changelog.txt
new file mode 100644
index 0000000000..20fab22b44
--- /dev/null
+++ b/gui/changelog.txt
@@ -0,0 +1,4 @@
+Add multihop with WireGuard tunnels. Can be enabled under the advanced settings.
+Add malware blocking. Can be found under preferences.
+[macOS] Fix slow wakeups from sleep. The internet and VPN tunnels should now come up instantly.
+[Windows] Make WireGuardNT the default driver for WireGuard. If you use WireGuard, you can potentially see significant performance increases.
diff --git a/gui/src/main/changelog.ts b/gui/src/main/changelog.ts
new file mode 100644
index 0000000000..4c169b055b
--- /dev/null
+++ b/gui/src/main/changelog.ts
@@ -0,0 +1,65 @@
+import fs from 'fs';
+import path from 'path';
+import { IChangelog } from '../shared/ipc-types';
+import log from '../shared/logging';
+
+// Reads and parses the changelog file.
+export function readChangelog(): IChangelog {
+ try {
+ const changelogPath = path.join(__dirname, '..', '..', '..', 'changelog.txt');
+ const contents = fs.readFileSync(changelogPath).toString();
+ return parseChangelog(contents);
+ } catch (e) {
+ const error = e as Error;
+ log.error('Failed to read changelog.txt', error.message);
+ return [];
+ }
+}
+
+// Parses the contents of the changelog file and returns all relevant items.
+export function parseChangelog(changelog: string): IChangelog {
+ const items = changelog
+ .split('\n')
+ .map((item) => item.trim())
+ .filter((item) => item !== '');
+ return filterForPlatform(items);
+}
+
+// Filters the changelog items based on platform
+function filterForPlatform(items: Array<string>): IChangelog {
+ return items
+ .map((item) => {
+ // Extracts the platforms from from the string if there are any specified. Platforms are
+ // specified within brackets with separated with a comma.
+ const platforms = item
+ .match(/^\[.*?\]/)
+ ?.flatMap((match) => match.slice(1, -1).split(','))
+ .map((platform) => platform.trim());
+ if (!platforms || isPlatform(platforms)) {
+ // If there are no platforms specified or if the current platform matches one of the
+ // specified, then the item is included.
+ return item.replace(/^\[.*?\]/, '').trim();
+ } else {
+ return undefined;
+ }
+ })
+ .filter((item): item is string => item !== undefined);
+}
+
+// Checks if an OS name corresponds to the current platform.
+function isPlatform(platformNames: Array<string>): boolean {
+ const platforms = platformNames.map((platformName) => {
+ switch (platformName.toLowerCase()) {
+ case 'windows':
+ return 'win32';
+ case 'macos':
+ return 'darwin';
+ case 'linux':
+ return 'linux';
+ default:
+ return platformName;
+ }
+ });
+
+ return platforms.includes(process.platform);
+}
diff --git a/gui/src/shared/ipc-types.ts b/gui/src/shared/ipc-types.ts
index 691d54b61b..0624ac95cd 100644
--- a/gui/src/shared/ipc-types.ts
+++ b/gui/src/shared/ipc-types.ts
@@ -8,3 +8,5 @@ export interface ICurrentAppVersionInfo {
export interface IWindowShapeParameters {
arrowPosition?: number;
}
+
+export type IChangelog = Array<string>;
diff --git a/gui/tasks/distribution.js b/gui/tasks/distribution.js
index 15cdd23d87..5f2876e9b1 100644
--- a/gui/tasks/distribution.js
+++ b/gui/tasks/distribution.js
@@ -35,6 +35,7 @@ const config = {
files: [
'package.json',
+ 'changelog.txt',
'init.js',
'build/',
'!build/src/renderer',