aboutsummaryrefslogtreecommitdiffstats
path: root/src/models
diff options
context:
space:
mode:
authorLibravatar Markus Hatvan <markus_hatvan@aon.at>2021-10-15 09:48:06 +0200
committerLibravatar GitHub <noreply@github.com>2021-10-15 09:48:06 +0200
commit14d2364fc69e0222133115c55a36286986006098 (patch)
tree9e9b3c41ef742bbe87ca1632b292c67043051957 /src/models
parent5.6.3-nightly.34 [skip ci] (diff)
downloadferdium-app-14d2364fc69e0222133115c55a36286986006098.tar.gz
ferdium-app-14d2364fc69e0222133115c55a36286986006098.tar.zst
ferdium-app-14d2364fc69e0222133115c55a36286986006098.zip
chore: update eslint setup (#2074)
Diffstat (limited to 'src/models')
-rw-r--r--src/models/Recipe.ts67
-rw-r--r--src/models/User.ts3
-rw-r--r--src/models/UserAgent.js8
3 files changed, 58 insertions, 20 deletions
diff --git a/src/models/Recipe.ts b/src/models/Recipe.ts
index 859c75df0..e45977f24 100644
--- a/src/models/Recipe.ts
+++ b/src/models/Recipe.ts
@@ -1,10 +1,7 @@
1import semver from 'semver'; 1import semver from 'semver';
2import { pathExistsSync } from 'fs-extra'; 2import { pathExistsSync } from 'fs-extra';
3import { join } from 'path'; 3import { join } from 'path';
4import { 4import { ifUndefinedString, ifUndefinedBoolean } from '../jsUtils';
5 ifUndefinedString,
6 ifUndefinedBoolean,
7} from '../jsUtils';
8 5
9interface IRecipe { 6interface IRecipe {
10 id: string; 7 id: string;
@@ -75,7 +72,8 @@ export default class Recipe {
75 72
76 message: string = ''; 73 message: string = '';
77 74
78 allowFavoritesDelineationInUnreadCount: boolean = DEFAULT_RECIPE_SETTINGS.allowFavoritesDelineationInUnreadCount; 75 allowFavoritesDelineationInUnreadCount: boolean =
76 DEFAULT_RECIPE_SETTINGS.allowFavoritesDelineationInUnreadCount;
79 77
80 disablewebsecurity: boolean = DEFAULT_RECIPE_SETTINGS.disablewebsecurity; 78 disablewebsecurity: boolean = DEFAULT_RECIPE_SETTINGS.disablewebsecurity;
81 79
@@ -98,7 +96,9 @@ export default class Recipe {
98 } 96 }
99 97
100 if (!semver.valid(data.version)) { 98 if (!semver.valid(data.version)) {
101 throw new Error(`Version ${data.version} of recipe '${data.name}' is not a valid semver version`); 99 throw new Error(
100 `Version ${data.version} of recipe '${data.name}' is not a valid semver version`,
101 );
102 } 102 }
103 103
104 // from the recipe 104 // from the recipe
@@ -106,19 +106,52 @@ export default class Recipe {
106 this.name = ifUndefinedString(data.name, this.name); 106 this.name = ifUndefinedString(data.name, this.name);
107 this.version = ifUndefinedString(data.version, this.version); 107 this.version = ifUndefinedString(data.version, this.version);
108 this.aliases = data.aliases || this.aliases; 108 this.aliases = data.aliases || this.aliases;
109 this.serviceURL = ifUndefinedString(data.config.serviceURL, this.serviceURL); 109 this.serviceURL = ifUndefinedString(
110 this.hasDirectMessages = ifUndefinedBoolean(data.config.hasDirectMessages, this.hasDirectMessages); 110 data.config.serviceURL,
111 this.hasIndirectMessages = ifUndefinedBoolean(data.config.hasIndirectMessages, this.hasIndirectMessages); 111 this.serviceURL,
112 this.hasNotificationSound = ifUndefinedBoolean(data.config.hasNotificationSound, this.hasNotificationSound); 112 );
113 this.hasDirectMessages = ifUndefinedBoolean(
114 data.config.hasDirectMessages,
115 this.hasDirectMessages,
116 );
117 this.hasIndirectMessages = ifUndefinedBoolean(
118 data.config.hasIndirectMessages,
119 this.hasIndirectMessages,
120 );
121 this.hasNotificationSound = ifUndefinedBoolean(
122 data.config.hasNotificationSound,
123 this.hasNotificationSound,
124 );
113 this.hasTeamId = ifUndefinedBoolean(data.config.hasTeamId, this.hasTeamId); 125 this.hasTeamId = ifUndefinedBoolean(data.config.hasTeamId, this.hasTeamId);
114 this.hasCustomUrl = ifUndefinedBoolean(data.config.hasCustomUrl, this.hasCustomUrl); 126 this.hasCustomUrl = ifUndefinedBoolean(
115 this.hasHostedOption = ifUndefinedBoolean(data.config.hasHostedOption, this.hasHostedOption); 127 data.config.hasCustomUrl,
116 this.urlInputPrefix = ifUndefinedString(data.config.urlInputPrefix, this.urlInputPrefix); 128 this.hasCustomUrl,
117 this.urlInputSuffix = ifUndefinedString(data.config.urlInputSuffix, this.urlInputSuffix); 129 );
118 this.disablewebsecurity = ifUndefinedBoolean(data.config.disablewebsecurity, this.disablewebsecurity); 130 this.hasHostedOption = ifUndefinedBoolean(
119 this.autoHibernate = ifUndefinedBoolean(data.config.autoHibernate, this.autoHibernate); 131 data.config.hasHostedOption,
132 this.hasHostedOption,
133 );
134 this.urlInputPrefix = ifUndefinedString(
135 data.config.urlInputPrefix,
136 this.urlInputPrefix,
137 );
138 this.urlInputSuffix = ifUndefinedString(
139 data.config.urlInputSuffix,
140 this.urlInputSuffix,
141 );
142 this.disablewebsecurity = ifUndefinedBoolean(
143 data.config.disablewebsecurity,
144 this.disablewebsecurity,
145 );
146 this.autoHibernate = ifUndefinedBoolean(
147 data.config.autoHibernate,
148 this.autoHibernate,
149 );
120 this.message = ifUndefinedString(data.config.message, this.message); 150 this.message = ifUndefinedString(data.config.message, this.message);
121 this.allowFavoritesDelineationInUnreadCount = ifUndefinedBoolean(data.config.allowFavoritesDelineationInUnreadCount, this.allowFavoritesDelineationInUnreadCount); 151 this.allowFavoritesDelineationInUnreadCount = ifUndefinedBoolean(
152 data.config.allowFavoritesDelineationInUnreadCount,
153 this.allowFavoritesDelineationInUnreadCount,
154 );
122 155
123 // computed 156 // computed
124 this.path = data.path; 157 this.path = data.path;
diff --git a/src/models/User.ts b/src/models/User.ts
index a04d46d3c..571f1f847 100644
--- a/src/models/User.ts
+++ b/src/models/User.ts
@@ -59,7 +59,8 @@ export default class User {
59 this.beta = data.beta || this.beta; 59 this.beta = data.beta || this.beta;
60 this.locale = data.locale || this.locale; 60 this.locale = data.locale || this.locale;
61 61
62 this.isSubscriptionOwner = data.isSubscriptionOwner || this.isSubscriptionOwner; 62 this.isSubscriptionOwner =
63 data.isSubscriptionOwner || this.isSubscriptionOwner;
63 64
64 this.team = data.team || this.team; 65 this.team = data.team || this.team;
65 } 66 }
diff --git a/src/models/UserAgent.js b/src/models/UserAgent.js
index 33bf9d072..02ff97db1 100644
--- a/src/models/UserAgent.js
+++ b/src/models/UserAgent.js
@@ -63,8 +63,12 @@ export default class UserAgent {
63 } 63 }
64 64
65 @computed get userAgent() { 65 @computed get userAgent() {
66 return this.serviceUserAgentPref 66 return (
67 || (this.chromelessUserAgent ? this.userAgentWithoutChromeVersion : this.defaultUserAgent); 67 this.serviceUserAgentPref ||
68 (this.chromelessUserAgent
69 ? this.userAgentWithoutChromeVersion
70 : this.defaultUserAgent)
71 );
68 } 72 }
69 73
70 @action setWebviewReference(webview) { 74 @action setWebviewReference(webview) {