aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar vantezzen <hello@vantezzen.io>2019-10-16 11:06:27 +0200
committerLibravatar vantezzen <hello@vantezzen.io>2019-10-16 11:06:27 +0200
commita56408ad7531c1f5e552f926a88cc4540d805b85 (patch)
treeb2b544c5b8deec837df7499c04aaa419246a912a
parentAdd custom CSS for darkmode to fix WhatsApp and Threema QR codes (diff)
downloadferdium-app-a56408ad7531c1f5e552f926a88cc4540d805b85.tar.gz
ferdium-app-a56408ad7531c1f5e552f926a88cc4540d805b85.tar.zst
ferdium-app-a56408ad7531c1f5e552f926a88cc4540d805b85.zip
Add button to directly open darkmode.css
-rw-r--r--src/actions/service.js3
-rw-r--r--src/components/settings/services/EditServiceForm.js26
-rw-r--r--src/containers/settings/EditServiceScreen.js29
-rw-r--r--src/i18n/locales/defaultMessages.json93
-rw-r--r--src/i18n/locales/en-US.json1
-rw-r--r--src/i18n/messages/src/components/settings/services/EditServiceForm.json93
-rw-r--r--src/stores/ServicesStore.js26
-rw-r--r--src/styles/settings.scss1
-rw-r--r--src/webview/darkmode/custom.js4
-rw-r--r--src/webview/recipe.js4
10 files changed, 196 insertions, 84 deletions
diff --git a/src/actions/service.js b/src/actions/service.js
index 99f4b3610..3283d8fee 100644
--- a/src/actions/service.js
+++ b/src/actions/service.js
@@ -28,6 +28,9 @@ export default {
28 serviceId: PropTypes.string.isRequired, 28 serviceId: PropTypes.string.isRequired,
29 redirect: PropTypes.string, 29 redirect: PropTypes.string,
30 }, 30 },
31 openDarkmodeCss: {
32 recipe: PropTypes.string.isRequired,
33 },
31 clearCache: { 34 clearCache: {
32 serviceId: PropTypes.string.isRequired, 35 serviceId: PropTypes.string.isRequired,
33 }, 36 },
diff --git a/src/components/settings/services/EditServiceForm.js b/src/components/settings/services/EditServiceForm.js
index 5fe00cb8b..bcff62280 100644
--- a/src/components/settings/services/EditServiceForm.js
+++ b/src/components/settings/services/EditServiceForm.js
@@ -29,6 +29,10 @@ const messages = defineMessages({
29 id: 'settings.service.form.deleteButton', 29 id: 'settings.service.form.deleteButton',
30 defaultMessage: '!!!Delete Service', 30 defaultMessage: '!!!Delete Service',
31 }, 31 },
32 openDarkmodeCss: {
33 id: 'settings.service.form.openDarkmodeCss',
34 defaultMessage: '!!!Open darkmode.css',
35 },
32 availableServices: { 36 availableServices: {
33 id: 'settings.service.form.availableServices', 37 id: 'settings.service.form.availableServices',
34 defaultMessage: '!!!Available services', 38 defaultMessage: '!!!Available services',
@@ -127,6 +131,8 @@ export default @observer class EditServiceForm extends Component {
127 form: PropTypes.instanceOf(Form).isRequired, 131 form: PropTypes.instanceOf(Form).isRequired,
128 onSubmit: PropTypes.func.isRequired, 132 onSubmit: PropTypes.func.isRequired,
129 onDelete: PropTypes.func.isRequired, 133 onDelete: PropTypes.func.isRequired,
134 openDarkmodeCss: PropTypes.func.isRequired,
135 isOpeningDarkModeCss: PropTypes.bool.isRequired,
130 isSaving: PropTypes.bool.isRequired, 136 isSaving: PropTypes.bool.isRequired,
131 isDeleting: PropTypes.bool.isRequired, 137 isDeleting: PropTypes.bool.isRequired,
132 isProxyFeatureEnabled: PropTypes.bool.isRequired, 138 isProxyFeatureEnabled: PropTypes.bool.isRequired,
@@ -193,6 +199,8 @@ export default @observer class EditServiceForm extends Component {
193 isSaving, 199 isSaving,
194 isDeleting, 200 isDeleting,
195 onDelete, 201 onDelete,
202 openDarkmodeCss,
203 isOpeningDarkModeCss,
196 isProxyFeatureEnabled, 204 isProxyFeatureEnabled,
197 isServiceProxyIncludedInCurrentPlan, 205 isServiceProxyIncludedInCurrentPlan,
198 isSpellcheckerIncludedInCurrentPlan, 206 isSpellcheckerIncludedInCurrentPlan,
@@ -218,6 +226,23 @@ export default @observer class EditServiceForm extends Component {
218 /> 226 />
219 ); 227 );
220 228
229 const openDarkmodeCssButton = isOpeningDarkModeCss ? (
230 <Button
231 label={intl.formatMessage(messages.openDarkmodeCss)}
232 loaded={false}
233 buttonType="secondary"
234 className="settings__open-dark-mode-button"
235 disabled
236 />
237 ) : (
238 <Button
239 buttonType="secondary"
240 label={intl.formatMessage(messages.openDarkmodeCss)}
241 className="settings__open-dark-mode-button"
242 onClick={openDarkmodeCss}
243 />
244 );
245
221 let activeTabIndex = 0; 246 let activeTabIndex = 0;
222 if (recipe.hasHostedOption && service.team) { 247 if (recipe.hasHostedOption && service.team) {
223 activeTabIndex = 1; 248 activeTabIndex = 1;
@@ -406,6 +431,7 @@ export default @observer class EditServiceForm extends Component {
406 <div className="settings__controls"> 431 <div className="settings__controls">
407 {/* Delete Button */} 432 {/* Delete Button */}
408 {action === 'edit' && deleteButton} 433 {action === 'edit' && deleteButton}
434 {action === 'edit' && openDarkmodeCssButton}
409 435
410 {/* Save Button */} 436 {/* Save Button */}
411 {isSaving || isValidatingCustomUrl ? ( 437 {isSaving || isValidatingCustomUrl ? (
diff --git a/src/containers/settings/EditServiceScreen.js b/src/containers/settings/EditServiceScreen.js
index e4ff03bb3..d18d7fb9b 100644
--- a/src/containers/settings/EditServiceScreen.js
+++ b/src/containers/settings/EditServiceScreen.js
@@ -92,6 +92,10 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex
92 intl: intlShape, 92 intl: intlShape,
93 }; 93 };
94 94
95 state = {
96 isOpeningDarkModeCss: false,
97 }
98
95 onSubmit(data) { 99 onSubmit(data) {
96 const { action } = this.props.router.params; 100 const { action } = this.props.router.params;
97 const { recipes, services } = this.props.stores; 101 const { recipes, services } = this.props.stores;
@@ -278,6 +282,28 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex
278 } 282 }
279 } 283 }
280 284
285 openDarkmodeCss() {
286 const { openDarkmodeCss } = this.props.actions.service;
287 const { action } = this.props.router.params;
288
289 if (action === 'edit') {
290 this.setState({
291 isOpeningDarkModeCss: true,
292 });
293
294 const { activeSettings: service } = this.props.stores.services;
295 openDarkmodeCss({
296 recipe: service.recipe.id,
297 });
298
299 setTimeout(() => {
300 this.setState({
301 isOpeningDarkModeCss: false,
302 });
303 }, 2500);
304 }
305 }
306
281 render() { 307 render() {
282 const { recipes, services, user } = this.props.stores; 308 const { recipes, services, user } = this.props.stores;
283 const { action } = this.props.router.params; 309 const { action } = this.props.router.params;
@@ -329,6 +355,8 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex
329 isDeleting={services.deleteServiceRequest.isExecuting} 355 isDeleting={services.deleteServiceRequest.isExecuting}
330 onSubmit={d => this.onSubmit(d)} 356 onSubmit={d => this.onSubmit(d)}
331 onDelete={() => this.deleteService()} 357 onDelete={() => this.deleteService()}
358 openDarkmodeCss={() => this.openDarkmodeCss()}
359 isOpeningDarkModeCss={this.state.isOpeningDarkModeCss}
332 isProxyFeatureEnabled={proxyFeature.isEnabled} 360 isProxyFeatureEnabled={proxyFeature.isEnabled}
333 isServiceProxyIncludedInCurrentPlan={proxyFeature.isIncludedInCurrentPlan} 361 isServiceProxyIncludedInCurrentPlan={proxyFeature.isIncludedInCurrentPlan}
334 isSpellcheckerIncludedInCurrentPlan={spellcheckerFeature.isIncludedInCurrentPlan} 362 isSpellcheckerIncludedInCurrentPlan={spellcheckerFeature.isIncludedInCurrentPlan}
@@ -356,6 +384,7 @@ EditServiceScreen.wrappedComponent.propTypes = {
356 createService: PropTypes.func.isRequired, 384 createService: PropTypes.func.isRequired,
357 updateService: PropTypes.func.isRequired, 385 updateService: PropTypes.func.isRequired,
358 deleteService: PropTypes.func.isRequired, 386 deleteService: PropTypes.func.isRequired,
387 openDarkmodeCss: PropTypes.func.isRequired,
359 }).isRequired, 388 }).isRequired,
360 // settings: PropTypes.shape({ 389 // settings: PropTypes.shape({
361 // update: PropTypes.func.isRequred, 390 // update: PropTypes.func.isRequred,
diff --git a/src/i18n/locales/defaultMessages.json b/src/i18n/locales/defaultMessages.json
index c2ce3d783..3fc86c266 100644
--- a/src/i18n/locales/defaultMessages.json
+++ b/src/i18n/locales/defaultMessages.json
@@ -1974,263 +1974,276 @@
1974 } 1974 }
1975 }, 1975 },
1976 { 1976 {
1977 "defaultMessage": "!!!Available services", 1977 "defaultMessage": "!!!Open darkmode.css",
1978 "end": { 1978 "end": {
1979 "column": 3, 1979 "column": 3,
1980 "line": 35 1980 "line": 35
1981 }, 1981 },
1982 "file": "src/components/settings/services/EditServiceForm.js", 1982 "file": "src/components/settings/services/EditServiceForm.js",
1983 "id": "settings.service.form.openDarkmodeCss",
1984 "start": {
1985 "column": 19,
1986 "line": 32
1987 }
1988 },
1989 {
1990 "defaultMessage": "!!!Available services",
1991 "end": {
1992 "column": 3,
1993 "line": 39
1994 },
1995 "file": "src/components/settings/services/EditServiceForm.js",
1983 "id": "settings.service.form.availableServices", 1996 "id": "settings.service.form.availableServices",
1984 "start": { 1997 "start": {
1985 "column": 21, 1998 "column": 21,
1986 "line": 32 1999 "line": 36
1987 } 2000 }
1988 }, 2001 },
1989 { 2002 {
1990 "defaultMessage": "!!!Your services", 2003 "defaultMessage": "!!!Your services",
1991 "end": { 2004 "end": {
1992 "column": 3, 2005 "column": 3,
1993 "line": 39 2006 "line": 43
1994 }, 2007 },
1995 "file": "src/components/settings/services/EditServiceForm.js", 2008 "file": "src/components/settings/services/EditServiceForm.js",
1996 "id": "settings.service.form.yourServices", 2009 "id": "settings.service.form.yourServices",
1997 "start": { 2010 "start": {
1998 "column": 16, 2011 "column": 16,
1999 "line": 36 2012 "line": 40
2000 } 2013 }
2001 }, 2014 },
2002 { 2015 {
2003 "defaultMessage": "!!!Add {name}", 2016 "defaultMessage": "!!!Add {name}",
2004 "end": { 2017 "end": {
2005 "column": 3, 2018 "column": 3,
2006 "line": 43 2019 "line": 47
2007 }, 2020 },
2008 "file": "src/components/settings/services/EditServiceForm.js", 2021 "file": "src/components/settings/services/EditServiceForm.js",
2009 "id": "settings.service.form.addServiceHeadline", 2022 "id": "settings.service.form.addServiceHeadline",
2010 "start": { 2023 "start": {
2011 "column": 22, 2024 "column": 22,
2012 "line": 40 2025 "line": 44
2013 } 2026 }
2014 }, 2027 },
2015 { 2028 {
2016 "defaultMessage": "!!!Edit {name}", 2029 "defaultMessage": "!!!Edit {name}",
2017 "end": { 2030 "end": {
2018 "column": 3, 2031 "column": 3,
2019 "line": 47 2032 "line": 51
2020 }, 2033 },
2021 "file": "src/components/settings/services/EditServiceForm.js", 2034 "file": "src/components/settings/services/EditServiceForm.js",
2022 "id": "settings.service.form.editServiceHeadline", 2035 "id": "settings.service.form.editServiceHeadline",
2023 "start": { 2036 "start": {
2024 "column": 23, 2037 "column": 23,
2025 "line": 44 2038 "line": 48
2026 } 2039 }
2027 }, 2040 },
2028 { 2041 {
2029 "defaultMessage": "!!!Hosted", 2042 "defaultMessage": "!!!Hosted",
2030 "end": { 2043 "end": {
2031 "column": 3, 2044 "column": 3,
2032 "line": 51 2045 "line": 55
2033 }, 2046 },
2034 "file": "src/components/settings/services/EditServiceForm.js", 2047 "file": "src/components/settings/services/EditServiceForm.js",
2035 "id": "settings.service.form.tabHosted", 2048 "id": "settings.service.form.tabHosted",
2036 "start": { 2049 "start": {
2037 "column": 13, 2050 "column": 13,
2038 "line": 48 2051 "line": 52
2039 } 2052 }
2040 }, 2053 },
2041 { 2054 {
2042 "defaultMessage": "!!!Self hosted ⭐️", 2055 "defaultMessage": "!!!Self hosted ⭐️",
2043 "end": { 2056 "end": {
2044 "column": 3, 2057 "column": 3,
2045 "line": 55 2058 "line": 59
2046 }, 2059 },
2047 "file": "src/components/settings/services/EditServiceForm.js", 2060 "file": "src/components/settings/services/EditServiceForm.js",
2048 "id": "settings.service.form.tabOnPremise", 2061 "id": "settings.service.form.tabOnPremise",
2049 "start": { 2062 "start": {
2050 "column": 16, 2063 "column": 16,
2051 "line": 52 2064 "line": 56
2052 } 2065 }
2053 }, 2066 },
2054 { 2067 {
2055 "defaultMessage": "!!!Use the hosted {name} service.", 2068 "defaultMessage": "!!!Use the hosted {name} service.",
2056 "end": { 2069 "end": {
2057 "column": 3, 2070 "column": 3,
2058 "line": 59 2071 "line": 63
2059 }, 2072 },
2060 "file": "src/components/settings/services/EditServiceForm.js", 2073 "file": "src/components/settings/services/EditServiceForm.js",
2061 "id": "settings.service.form.useHostedService", 2074 "id": "settings.service.form.useHostedService",
2062 "start": { 2075 "start": {
2063 "column": 20, 2076 "column": 20,
2064 "line": 56 2077 "line": 60
2065 } 2078 }
2066 }, 2079 },
2067 { 2080 {
2068 "defaultMessage": "!!!Could not validate custom {name} server.", 2081 "defaultMessage": "!!!Could not validate custom {name} server.",
2069 "end": { 2082 "end": {
2070 "column": 3, 2083 "column": 3,
2071 "line": 63 2084 "line": 67
2072 }, 2085 },
2073 "file": "src/components/settings/services/EditServiceForm.js", 2086 "file": "src/components/settings/services/EditServiceForm.js",
2074 "id": "settings.service.form.customUrlValidationError", 2087 "id": "settings.service.form.customUrlValidationError",
2075 "start": { 2088 "start": {
2076 "column": 28, 2089 "column": 28,
2077 "line": 60 2090 "line": 64
2078 } 2091 }
2079 }, 2092 },
2080 { 2093 {
2081 "defaultMessage": "!!!To add self hosted services, you need a Ferdi Premium Supporter Account.", 2094 "defaultMessage": "!!!To add self hosted services, you need a Ferdi Premium Supporter Account.",
2082 "end": { 2095 "end": {
2083 "column": 3, 2096 "column": 3,
2084 "line": 67 2097 "line": 71
2085 }, 2098 },
2086 "file": "src/components/settings/services/EditServiceForm.js", 2099 "file": "src/components/settings/services/EditServiceForm.js",
2087 "id": "settings.service.form.customUrlPremiumInfo", 2100 "id": "settings.service.form.customUrlPremiumInfo",
2088 "start": { 2101 "start": {
2089 "column": 24, 2102 "column": 24,
2090 "line": 64 2103 "line": 68
2091 } 2104 }
2092 }, 2105 },
2093 { 2106 {
2094 "defaultMessage": "!!!Upgrade your account", 2107 "defaultMessage": "!!!Upgrade your account",
2095 "end": { 2108 "end": {
2096 "column": 3, 2109 "column": 3,
2097 "line": 71 2110 "line": 75
2098 }, 2111 },
2099 "file": "src/components/settings/services/EditServiceForm.js", 2112 "file": "src/components/settings/services/EditServiceForm.js",
2100 "id": "settings.service.form.customUrlUpgradeAccount", 2113 "id": "settings.service.form.customUrlUpgradeAccount",
2101 "start": { 2114 "start": {
2102 "column": 27, 2115 "column": 27,
2103 "line": 68 2116 "line": 72
2104 } 2117 }
2105 }, 2118 },
2106 { 2119 {
2107 "defaultMessage": "!!!You will be notified about all new messages in a channel, not just @username, @channel, @here, ...", 2120 "defaultMessage": "!!!You will be notified about all new messages in a channel, not just @username, @channel, @here, ...",
2108 "end": { 2121 "end": {
2109 "column": 3, 2122 "column": 3,
2110 "line": 75 2123 "line": 79
2111 }, 2124 },
2112 "file": "src/components/settings/services/EditServiceForm.js", 2125 "file": "src/components/settings/services/EditServiceForm.js",
2113 "id": "settings.service.form.indirectMessageInfo", 2126 "id": "settings.service.form.indirectMessageInfo",
2114 "start": { 2127 "start": {
2115 "column": 23, 2128 "column": 23,
2116 "line": 72 2129 "line": 76
2117 } 2130 }
2118 }, 2131 },
2119 { 2132 {
2120 "defaultMessage": "!!!When disabled, all notification sounds and audio playback are muted", 2133 "defaultMessage": "!!!When disabled, all notification sounds and audio playback are muted",
2121 "end": { 2134 "end": {
2122 "column": 3, 2135 "column": 3,
2123 "line": 79 2136 "line": 83
2124 }, 2137 },
2125 "file": "src/components/settings/services/EditServiceForm.js", 2138 "file": "src/components/settings/services/EditServiceForm.js",
2126 "id": "settings.service.form.isMutedInfo", 2139 "id": "settings.service.form.isMutedInfo",
2127 "start": { 2140 "start": {
2128 "column": 15, 2141 "column": 15,
2129 "line": 76 2142 "line": 80
2130 } 2143 }
2131 }, 2144 },
2132 { 2145 {
2133 "defaultMessage": "!!!Notifications", 2146 "defaultMessage": "!!!Notifications",
2134 "end": { 2147 "end": {
2135 "column": 3, 2148 "column": 3,
2136 "line": 83 2149 "line": 87
2137 }, 2150 },
2138 "file": "src/components/settings/services/EditServiceForm.js", 2151 "file": "src/components/settings/services/EditServiceForm.js",
2139 "id": "settings.service.form.headlineNotifications", 2152 "id": "settings.service.form.headlineNotifications",
2140 "start": { 2153 "start": {
2141 "column": 25, 2154 "column": 25,
2142 "line": 80 2155 "line": 84
2143 } 2156 }
2144 }, 2157 },
2145 { 2158 {
2146 "defaultMessage": "!!!Unread message badges", 2159 "defaultMessage": "!!!Unread message badges",
2147 "end": { 2160 "end": {
2148 "column": 3, 2161 "column": 3,
2149 "line": 87 2162 "line": 91
2150 }, 2163 },
2151 "file": "src/components/settings/services/EditServiceForm.js", 2164 "file": "src/components/settings/services/EditServiceForm.js",
2152 "id": "settings.service.form.headlineBadges", 2165 "id": "settings.service.form.headlineBadges",
2153 "start": { 2166 "start": {
2154 "column": 18, 2167 "column": 18,
2155 "line": 84 2168 "line": 88
2156 } 2169 }
2157 }, 2170 },
2158 { 2171 {
2159 "defaultMessage": "!!!General", 2172 "defaultMessage": "!!!General",
2160 "end": { 2173 "end": {
2161 "column": 3, 2174 "column": 3,
2162 "line": 91 2175 "line": 95
2163 }, 2176 },
2164 "file": "src/components/settings/services/EditServiceForm.js", 2177 "file": "src/components/settings/services/EditServiceForm.js",
2165 "id": "settings.service.form.headlineGeneral", 2178 "id": "settings.service.form.headlineGeneral",
2166 "start": { 2179 "start": {
2167 "column": 19, 2180 "column": 19,
2168 "line": 88 2181 "line": 92
2169 } 2182 }
2170 }, 2183 },
2171 { 2184 {
2172 "defaultMessage": "!!!Delete", 2185 "defaultMessage": "!!!Delete",
2173 "end": { 2186 "end": {
2174 "column": 3, 2187 "column": 3,
2175 "line": 95 2188 "line": 99
2176 }, 2189 },
2177 "file": "src/components/settings/services/EditServiceForm.js", 2190 "file": "src/components/settings/services/EditServiceForm.js",
2178 "id": "settings.service.form.iconDelete", 2191 "id": "settings.service.form.iconDelete",
2179 "start": { 2192 "start": {
2180 "column": 14, 2193 "column": 14,
2181 "line": 92 2194 "line": 96
2182 } 2195 }
2183 }, 2196 },
2184 { 2197 {
2185 "defaultMessage": "!!!Drop your image, or click here", 2198 "defaultMessage": "!!!Drop your image, or click here",
2186 "end": { 2199 "end": {
2187 "column": 3, 2200 "column": 3,
2188 "line": 99 2201 "line": 103
2189 }, 2202 },
2190 "file": "src/components/settings/services/EditServiceForm.js", 2203 "file": "src/components/settings/services/EditServiceForm.js",
2191 "id": "settings.service.form.iconUpload", 2204 "id": "settings.service.form.iconUpload",
2192 "start": { 2205 "start": {
2193 "column": 14, 2206 "column": 14,
2194 "line": 96 2207 "line": 100
2195 } 2208 }
2196 }, 2209 },
2197 { 2210 {
2198 "defaultMessage": "!!!HTTP/HTTPS Proxy Settings", 2211 "defaultMessage": "!!!HTTP/HTTPS Proxy Settings",
2199 "end": { 2212 "end": {
2200 "column": 3, 2213 "column": 3,
2201 "line": 103 2214 "line": 107
2202 }, 2215 },
2203 "file": "src/components/settings/services/EditServiceForm.js", 2216 "file": "src/components/settings/services/EditServiceForm.js",
2204 "id": "settings.service.form.proxy.headline", 2217 "id": "settings.service.form.proxy.headline",
2205 "start": { 2218 "start": {
2206 "column": 17, 2219 "column": 17,
2207 "line": 100 2220 "line": 104
2208 } 2221 }
2209 }, 2222 },
2210 { 2223 {
2211 "defaultMessage": "!!!Please restart Ferdi after changing proxy Settings.", 2224 "defaultMessage": "!!!Please restart Ferdi after changing proxy Settings.",
2212 "end": { 2225 "end": {
2213 "column": 3, 2226 "column": 3,
2214 "line": 107 2227 "line": 111
2215 }, 2228 },
2216 "file": "src/components/settings/services/EditServiceForm.js", 2229 "file": "src/components/settings/services/EditServiceForm.js",
2217 "id": "settings.service.form.proxy.restartInfo", 2230 "id": "settings.service.form.proxy.restartInfo",
2218 "start": { 2231 "start": {
2219 "column": 20, 2232 "column": 20,
2220 "line": 104 2233 "line": 108
2221 } 2234 }
2222 }, 2235 },
2223 { 2236 {
2224 "defaultMessage": "!!!Proxy settings will not be synchronized with the Ferdi servers.", 2237 "defaultMessage": "!!!Proxy settings will not be synchronized with the Ferdi servers.",
2225 "end": { 2238 "end": {
2226 "column": 3, 2239 "column": 3,
2227 "line": 111 2240 "line": 115
2228 }, 2241 },
2229 "file": "src/components/settings/services/EditServiceForm.js", 2242 "file": "src/components/settings/services/EditServiceForm.js",
2230 "id": "settings.service.form.proxy.info", 2243 "id": "settings.service.form.proxy.info",
2231 "start": { 2244 "start": {
2232 "column": 13, 2245 "column": 13,
2233 "line": 108 2246 "line": 112
2234 } 2247 }
2235 } 2248 }
2236 ], 2249 ],
diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json
index 2cdc57e3f..b4649c03c 100644
--- a/src/i18n/locales/en-US.json
+++ b/src/i18n/locales/en-US.json
@@ -316,6 +316,7 @@
316 "settings.service.form.indirectMessages": "Show message badge for all new messages", 316 "settings.service.form.indirectMessages": "Show message badge for all new messages",
317 "settings.service.form.isMutedInfo": "When disabled, all notification sounds and audio playback are muted", 317 "settings.service.form.isMutedInfo": "When disabled, all notification sounds and audio playback are muted",
318 "settings.service.form.name": "Name", 318 "settings.service.form.name": "Name",
319 "settings.service.form.openDarkmodeCss": "Open darkmode.css",
319 "settings.service.form.proxy.headline": "HTTP/HTTPS Proxy Settings", 320 "settings.service.form.proxy.headline": "HTTP/HTTPS Proxy Settings",
320 "settings.service.form.proxy.host": "Proxy Host/IP", 321 "settings.service.form.proxy.host": "Proxy Host/IP",
321 "settings.service.form.proxy.info": "Proxy settings will not synced with the Ferdi servers.", 322 "settings.service.form.proxy.info": "Proxy settings will not synced with the Ferdi servers.",
diff --git a/src/i18n/messages/src/components/settings/services/EditServiceForm.json b/src/i18n/messages/src/components/settings/services/EditServiceForm.json
index 45dc7b690..f4692ed29 100644
--- a/src/i18n/messages/src/components/settings/services/EditServiceForm.json
+++ b/src/i18n/messages/src/components/settings/services/EditServiceForm.json
@@ -26,15 +26,28 @@
26 } 26 }
27 }, 27 },
28 { 28 {
29 "id": "settings.service.form.openDarkmodeCss",
30 "defaultMessage": "!!!Open darkmode.css",
31 "file": "src/components/settings/services/EditServiceForm.js",
32 "start": {
33 "line": 32,
34 "column": 19
35 },
36 "end": {
37 "line": 35,
38 "column": 3
39 }
40 },
41 {
29 "id": "settings.service.form.availableServices", 42 "id": "settings.service.form.availableServices",
30 "defaultMessage": "!!!Available services", 43 "defaultMessage": "!!!Available services",
31 "file": "src/components/settings/services/EditServiceForm.js", 44 "file": "src/components/settings/services/EditServiceForm.js",
32 "start": { 45 "start": {
33 "line": 32, 46 "line": 36,
34 "column": 21 47 "column": 21
35 }, 48 },
36 "end": { 49 "end": {
37 "line": 35, 50 "line": 39,
38 "column": 3 51 "column": 3
39 } 52 }
40 }, 53 },
@@ -43,11 +56,11 @@
43 "defaultMessage": "!!!Your services", 56 "defaultMessage": "!!!Your services",
44 "file": "src/components/settings/services/EditServiceForm.js", 57 "file": "src/components/settings/services/EditServiceForm.js",
45 "start": { 58 "start": {
46 "line": 36, 59 "line": 40,
47 "column": 16 60 "column": 16
48 }, 61 },
49 "end": { 62 "end": {
50 "line": 39, 63 "line": 43,
51 "column": 3 64 "column": 3
52 } 65 }
53 }, 66 },
@@ -56,11 +69,11 @@
56 "defaultMessage": "!!!Add {name}", 69 "defaultMessage": "!!!Add {name}",
57 "file": "src/components/settings/services/EditServiceForm.js", 70 "file": "src/components/settings/services/EditServiceForm.js",
58 "start": { 71 "start": {
59 "line": 40, 72 "line": 44,
60 "column": 22 73 "column": 22
61 }, 74 },
62 "end": { 75 "end": {
63 "line": 43, 76 "line": 47,
64 "column": 3 77 "column": 3
65 } 78 }
66 }, 79 },
@@ -69,11 +82,11 @@
69 "defaultMessage": "!!!Edit {name}", 82 "defaultMessage": "!!!Edit {name}",
70 "file": "src/components/settings/services/EditServiceForm.js", 83 "file": "src/components/settings/services/EditServiceForm.js",
71 "start": { 84 "start": {
72 "line": 44, 85 "line": 48,
73 "column": 23 86 "column": 23
74 }, 87 },
75 "end": { 88 "end": {
76 "line": 47, 89 "line": 51,
77 "column": 3 90 "column": 3
78 } 91 }
79 }, 92 },
@@ -82,11 +95,11 @@
82 "defaultMessage": "!!!Hosted", 95 "defaultMessage": "!!!Hosted",
83 "file": "src/components/settings/services/EditServiceForm.js", 96 "file": "src/components/settings/services/EditServiceForm.js",
84 "start": { 97 "start": {
85 "line": 48, 98 "line": 52,
86 "column": 13 99 "column": 13
87 }, 100 },
88 "end": { 101 "end": {
89 "line": 51, 102 "line": 55,
90 "column": 3 103 "column": 3
91 } 104 }
92 }, 105 },
@@ -95,11 +108,11 @@
95 "defaultMessage": "!!!Self hosted ⭐️", 108 "defaultMessage": "!!!Self hosted ⭐️",
96 "file": "src/components/settings/services/EditServiceForm.js", 109 "file": "src/components/settings/services/EditServiceForm.js",
97 "start": { 110 "start": {
98 "line": 52, 111 "line": 56,
99 "column": 16 112 "column": 16
100 }, 113 },
101 "end": { 114 "end": {
102 "line": 55, 115 "line": 59,
103 "column": 3 116 "column": 3
104 } 117 }
105 }, 118 },
@@ -108,11 +121,11 @@
108 "defaultMessage": "!!!Use the hosted {name} service.", 121 "defaultMessage": "!!!Use the hosted {name} service.",
109 "file": "src/components/settings/services/EditServiceForm.js", 122 "file": "src/components/settings/services/EditServiceForm.js",
110 "start": { 123 "start": {
111 "line": 56, 124 "line": 60,
112 "column": 20 125 "column": 20
113 }, 126 },
114 "end": { 127 "end": {
115 "line": 59, 128 "line": 63,
116 "column": 3 129 "column": 3
117 } 130 }
118 }, 131 },
@@ -121,11 +134,11 @@
121 "defaultMessage": "!!!Could not validate custom {name} server.", 134 "defaultMessage": "!!!Could not validate custom {name} server.",
122 "file": "src/components/settings/services/EditServiceForm.js", 135 "file": "src/components/settings/services/EditServiceForm.js",
123 "start": { 136 "start": {
124 "line": 60, 137 "line": 64,
125 "column": 28 138 "column": 28
126 }, 139 },
127 "end": { 140 "end": {
128 "line": 63, 141 "line": 67,
129 "column": 3 142 "column": 3
130 } 143 }
131 }, 144 },
@@ -134,11 +147,11 @@
134 "defaultMessage": "!!!To add self hosted services, you need a Ferdi Premium Supporter Account.", 147 "defaultMessage": "!!!To add self hosted services, you need a Ferdi Premium Supporter Account.",
135 "file": "src/components/settings/services/EditServiceForm.js", 148 "file": "src/components/settings/services/EditServiceForm.js",
136 "start": { 149 "start": {
137 "line": 64, 150 "line": 68,
138 "column": 24 151 "column": 24
139 }, 152 },
140 "end": { 153 "end": {
141 "line": 67, 154 "line": 71,
142 "column": 3 155 "column": 3
143 } 156 }
144 }, 157 },
@@ -147,11 +160,11 @@
147 "defaultMessage": "!!!Upgrade your account", 160 "defaultMessage": "!!!Upgrade your account",
148 "file": "src/components/settings/services/EditServiceForm.js", 161 "file": "src/components/settings/services/EditServiceForm.js",
149 "start": { 162 "start": {
150 "line": 68, 163 "line": 72,
151 "column": 27 164 "column": 27
152 }, 165 },
153 "end": { 166 "end": {
154 "line": 71, 167 "line": 75,
155 "column": 3 168 "column": 3
156 } 169 }
157 }, 170 },
@@ -160,11 +173,11 @@
160 "defaultMessage": "!!!You will be notified about all new messages in a channel, not just @username, @channel, @here, ...", 173 "defaultMessage": "!!!You will be notified about all new messages in a channel, not just @username, @channel, @here, ...",
161 "file": "src/components/settings/services/EditServiceForm.js", 174 "file": "src/components/settings/services/EditServiceForm.js",
162 "start": { 175 "start": {
163 "line": 72, 176 "line": 76,
164 "column": 23 177 "column": 23
165 }, 178 },
166 "end": { 179 "end": {
167 "line": 75, 180 "line": 79,
168 "column": 3 181 "column": 3
169 } 182 }
170 }, 183 },
@@ -173,11 +186,11 @@
173 "defaultMessage": "!!!When disabled, all notification sounds and audio playback are muted", 186 "defaultMessage": "!!!When disabled, all notification sounds and audio playback are muted",
174 "file": "src/components/settings/services/EditServiceForm.js", 187 "file": "src/components/settings/services/EditServiceForm.js",
175 "start": { 188 "start": {
176 "line": 76, 189 "line": 80,
177 "column": 15 190 "column": 15
178 }, 191 },
179 "end": { 192 "end": {
180 "line": 79, 193 "line": 83,
181 "column": 3 194 "column": 3
182 } 195 }
183 }, 196 },
@@ -186,11 +199,11 @@
186 "defaultMessage": "!!!Notifications", 199 "defaultMessage": "!!!Notifications",
187 "file": "src/components/settings/services/EditServiceForm.js", 200 "file": "src/components/settings/services/EditServiceForm.js",
188 "start": { 201 "start": {
189 "line": 80, 202 "line": 84,
190 "column": 25 203 "column": 25
191 }, 204 },
192 "end": { 205 "end": {
193 "line": 83, 206 "line": 87,
194 "column": 3 207 "column": 3
195 } 208 }
196 }, 209 },
@@ -199,11 +212,11 @@
199 "defaultMessage": "!!!Unread message badges", 212 "defaultMessage": "!!!Unread message badges",
200 "file": "src/components/settings/services/EditServiceForm.js", 213 "file": "src/components/settings/services/EditServiceForm.js",
201 "start": { 214 "start": {
202 "line": 84, 215 "line": 88,
203 "column": 18 216 "column": 18
204 }, 217 },
205 "end": { 218 "end": {
206 "line": 87, 219 "line": 91,
207 "column": 3 220 "column": 3
208 } 221 }
209 }, 222 },
@@ -212,11 +225,11 @@
212 "defaultMessage": "!!!General", 225 "defaultMessage": "!!!General",
213 "file": "src/components/settings/services/EditServiceForm.js", 226 "file": "src/components/settings/services/EditServiceForm.js",
214 "start": { 227 "start": {
215 "line": 88, 228 "line": 92,
216 "column": 19 229 "column": 19
217 }, 230 },
218 "end": { 231 "end": {
219 "line": 91, 232 "line": 95,
220 "column": 3 233 "column": 3
221 } 234 }
222 }, 235 },
@@ -225,11 +238,11 @@
225 "defaultMessage": "!!!Delete", 238 "defaultMessage": "!!!Delete",
226 "file": "src/components/settings/services/EditServiceForm.js", 239 "file": "src/components/settings/services/EditServiceForm.js",
227 "start": { 240 "start": {
228 "line": 92, 241 "line": 96,
229 "column": 14 242 "column": 14
230 }, 243 },
231 "end": { 244 "end": {
232 "line": 95, 245 "line": 99,
233 "column": 3 246 "column": 3
234 } 247 }
235 }, 248 },
@@ -238,11 +251,11 @@
238 "defaultMessage": "!!!Drop your image, or click here", 251 "defaultMessage": "!!!Drop your image, or click here",
239 "file": "src/components/settings/services/EditServiceForm.js", 252 "file": "src/components/settings/services/EditServiceForm.js",
240 "start": { 253 "start": {
241 "line": 96, 254 "line": 100,
242 "column": 14 255 "column": 14
243 }, 256 },
244 "end": { 257 "end": {
245 "line": 99, 258 "line": 103,
246 "column": 3 259 "column": 3
247 } 260 }
248 }, 261 },
@@ -251,11 +264,11 @@
251 "defaultMessage": "!!!HTTP/HTTPS Proxy Settings", 264 "defaultMessage": "!!!HTTP/HTTPS Proxy Settings",
252 "file": "src/components/settings/services/EditServiceForm.js", 265 "file": "src/components/settings/services/EditServiceForm.js",
253 "start": { 266 "start": {
254 "line": 100, 267 "line": 104,
255 "column": 17 268 "column": 17
256 }, 269 },
257 "end": { 270 "end": {
258 "line": 103, 271 "line": 107,
259 "column": 3 272 "column": 3
260 } 273 }
261 }, 274 },
@@ -264,11 +277,11 @@
264 "defaultMessage": "!!!Please restart Ferdi after changing proxy Settings.", 277 "defaultMessage": "!!!Please restart Ferdi after changing proxy Settings.",
265 "file": "src/components/settings/services/EditServiceForm.js", 278 "file": "src/components/settings/services/EditServiceForm.js",
266 "start": { 279 "start": {
267 "line": 104, 280 "line": 108,
268 "column": 20 281 "column": 20
269 }, 282 },
270 "end": { 283 "end": {
271 "line": 107, 284 "line": 111,
272 "column": 3 285 "column": 3
273 } 286 }
274 }, 287 },
@@ -277,11 +290,11 @@
277 "defaultMessage": "!!!Proxy settings will not be synchronized with the Ferdi servers.", 290 "defaultMessage": "!!!Proxy settings will not be synchronized with the Ferdi servers.",
278 "file": "src/components/settings/services/EditServiceForm.js", 291 "file": "src/components/settings/services/EditServiceForm.js",
279 "start": { 292 "start": {
280 "line": 108, 293 "line": 112,
281 "column": 13 294 "column": 13
282 }, 295 },
283 "end": { 296 "end": {
284 "line": 111, 297 "line": 115,
285 "column": 3 298 "column": 3
286 } 299 }
287 } 300 }
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js
index 1bf32af9f..9e952a6b1 100644
--- a/src/stores/ServicesStore.js
+++ b/src/stores/ServicesStore.js
@@ -1,3 +1,4 @@
1import { shell } from 'electron';
1import { 2import {
2 action, 3 action,
3 reaction, 4 reaction,
@@ -6,12 +7,15 @@ import {
6} from 'mobx'; 7} from 'mobx';
7import { remove } from 'lodash'; 8import { remove } from 'lodash';
8import ms from 'ms'; 9import ms from 'ms';
10import fs from 'fs-extra';
11import path from 'path';
9 12
10import Store from './lib/Store'; 13import Store from './lib/Store';
11import Request from './lib/Request'; 14import Request from './lib/Request';
12import CachedRequest from './lib/CachedRequest'; 15import CachedRequest from './lib/CachedRequest';
13import { matchRoute } from '../helpers/routing-helpers'; 16import { matchRoute } from '../helpers/routing-helpers';
14import { isInTimeframe } from '../helpers/schedule-helpers'; 17import { isInTimeframe } from '../helpers/schedule-helpers';
18import { getRecipeDirectory, getDevRecipeDirectory } from '../helpers/recipe-helpers';
15import { workspaceStore } from '../features/workspaces'; 19import { workspaceStore } from '../features/workspaces';
16import { serviceLimitStore } from '../features/serviceLimit'; 20import { serviceLimitStore } from '../features/serviceLimit';
17import { RESTRICTION_TYPES } from '../models/Service'; 21import { RESTRICTION_TYPES } from '../models/Service';
@@ -52,6 +56,7 @@ export default class ServicesStore extends Store {
52 this.actions.service.createFromLegacyService.listen(this._createFromLegacyService.bind(this)); 56 this.actions.service.createFromLegacyService.listen(this._createFromLegacyService.bind(this));
53 this.actions.service.updateService.listen(this._updateService.bind(this)); 57 this.actions.service.updateService.listen(this._updateService.bind(this));
54 this.actions.service.deleteService.listen(this._deleteService.bind(this)); 58 this.actions.service.deleteService.listen(this._deleteService.bind(this));
59 this.actions.service.openDarkmodeCss.listen(this._openDarkmodeCss.bind(this));
55 this.actions.service.clearCache.listen(this._clearCache.bind(this)); 60 this.actions.service.clearCache.listen(this._clearCache.bind(this));
56 this.actions.service.setWebviewReference.listen(this._setWebviewReference.bind(this)); 61 this.actions.service.setWebviewReference.listen(this._setWebviewReference.bind(this));
57 this.actions.service.detachService.listen(this._detachService.bind(this)); 62 this.actions.service.detachService.listen(this._detachService.bind(this));
@@ -316,6 +321,27 @@ export default class ServicesStore extends Store {
316 this.actionStatus = request.result.status; 321 this.actionStatus = request.result.status;
317 } 322 }
318 323
324 @action async _openDarkmodeCss({ recipe }) {
325 // Get directory for recipe
326 const normalDirectory = getRecipeDirectory(recipe);
327 const devDirectory = getDevRecipeDirectory(recipe);
328 let directory;
329
330 if (await fs.pathExists(normalDirectory)) {
331 directory = normalDirectory;
332 } else if (await fs.pathExists(devDirectory)) {
333 directory = devDirectory;
334 } else {
335 // Recipe cannot be found on drive
336 return;
337 }
338
339 // Create and open darkmode.css
340 const file = path.join(directory, 'darkmode.css');
341 await fs.ensureFile(file);
342 shell.showItemInFolder(file);
343 }
344
319 @action async _clearCache({ serviceId }) { 345 @action async _clearCache({ serviceId }) {
320 this.clearCacheRequest.reset(); 346 this.clearCacheRequest.reset();
321 const request = this.clearCacheRequest.execute(serviceId); 347 const request = this.clearCacheRequest.execute(serviceId);
diff --git a/src/styles/settings.scss b/src/styles/settings.scss
index bb95ab5d2..071861f16 100644
--- a/src/styles/settings.scss
+++ b/src/styles/settings.scss
@@ -296,6 +296,7 @@
296 } 296 }
297 297
298 .settings__delete-button { right: 0; } 298 .settings__delete-button { right: 0; }
299 .settings__open-dark-mode-button { right: 0; cursor:pointer; }
299 300
300 .settings__empty-state { 301 .settings__empty-state {
301 align-items: center; 302 align-items: center;
diff --git a/src/webview/darkmode/custom.js b/src/webview/darkmode/custom.js
index 4b2b89fb2..f767f5755 100644
--- a/src/webview/darkmode/custom.js
+++ b/src/webview/darkmode/custom.js
@@ -1,5 +1,5 @@
1// CSS for pages that need custom styles to work correctly in darkmode 1// CSS for pages that need custom styles to work correctly in darkmode
2export default { 2export default {
3 'web.whatsapp.com': ` 3 'web.whatsapp.com': `
4 div.landing-window > div.landing-main { 4 div.landing-window > div.landing-main {
5 background-color: #FFFFFF !important; 5 background-color: #FFFFFF !important;
@@ -18,5 +18,5 @@ export default {
18 .scan input.md-input { 18 .scan input.md-input {
19 color: #212121; 19 color: #212121;
20 } 20 }
21 ` 21 `,
22}; 22};
diff --git a/src/webview/recipe.js b/src/webview/recipe.js
index 854cbce58..6068e6c4a 100644
--- a/src/webview/recipe.js
+++ b/src/webview/recipe.js
@@ -117,7 +117,7 @@ class RecipeController {
117 this.cldIdentifier.destroy(); 117 this.cldIdentifier.destroy();
118 } 118 }
119 } 119 }
120 120
121 if (this.settings.service.isDarkModeEnabled || this.settings.app.darkMode) { 121 if (this.settings.service.isDarkModeEnabled || this.settings.app.darkMode) {
122 debug('Enable dark mode'); 122 debug('Enable dark mode');
123 123
@@ -130,7 +130,7 @@ class RecipeController {
130 } else if (!ignoreList.includes(window.location.host)) { 130 } else if (!ignoreList.includes(window.location.host)) {
131 // Use darkreader instead 131 // Use darkreader instead
132 enableDarkMode({}, { 132 enableDarkMode({}, {
133 css: customDarkModeCss[window.location.host] || '' 133 css: customDarkModeCss[window.location.host] || '',
134 }); 134 });
135 } 135 }
136 } else { 136 } else {