diff --git a/LICENSE b/LICENSE index ed992e62..3afd3289 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,7 @@ BSD 3-Clause License -Copyright (c) 2023- Kaiso One Ltd -Copyright (c) 2019-2023 The Mue Authors +Copyright (c) 2023-2024 Kaiso One Ltd +Copyright (c) 2019-2024 The Mue Authors Copyright (c) 2018-2019 David Ralph All rights reserved. diff --git a/README.md b/README.md index cdd4846b..6f0ba194 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ Mue is a fast, open and free-to-use browser extension that gives a new, fresh an ### Planned Features -Please see our [roadmap](https://trello.com/b/w7zhS7Hi/mue-50). +Please see our [roadmap](https://trello.com/b/w7zhS7Hi/mue-50). We are currently working on a rewrite over on the "phoenix" branch. ## Installation @@ -117,10 +117,3 @@ And finally, a big thank you to all the other [contributors](https://github.com/ [Pexels](https://pexels.com), [Unsplash](https://unsplash.com) - Stock photos used for offline mode
[Undraw](https://undraw.co) - Welcome modal images - -

This project is supported by:

-

- - - -

diff --git a/package.json b/package.json index 7b843e77..a6d87dd0 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "homepage": "https://muetab.com", "bugs": "https://github.com/mue/mue/issues/new?assignees=&labels=bug&template=bug-report.md&title=%5BBUG%5D", "license": "BSD-3-Clause", - "version": "7.0.0", + "version": "7.0.1", "dependencies": { "@eartharoid/i18n": "1.2.1", "@emotion/react": "^11.11.3", diff --git a/src/App.jsx b/src/App.jsx index 784206dd..85aced3b 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -38,7 +38,7 @@ export default class App extends PureComponent { render() { return ( <> - {localStorage.getItem('background') === 'true' ? : null} + {localStorage.getItem('background') === 'true' && } - {this.state.welcomeModal === false ? ( + {this.state.welcomeModal === false && ( this.toggleModal(modal, true)} /> - ) : null} + )} this.closeWelcome()} modalSkip={() => this.previewWelcome()} /> - {this.state.preview ? window.location.reload()} /> : null} + {this.state.preview && window.location.reload()} />} ); } diff --git a/src/components/modals/main/marketplace/Item.jsx b/src/components/modals/main/marketplace/Item.jsx index fea46307..bb01b4e5 100644 --- a/src/components/modals/main/marketplace/Item.jsx +++ b/src/components/modals/main/marketplace/Item.jsx @@ -109,22 +109,22 @@ class Item extends PureComponent {
- {this.props.data.data.photos ? ( + {this.props.data.data.photos && (
- ) : null} - {this.props.data.data.settings ? ( + )} + {this.props.data.data.settings && ( product this.setState({ showLightbox: true })} /> - ) : null} - {this.props.data.data.quotes ? ( + )} + {this.props.data.data.quotes && ( <> @@ -156,8 +156,8 @@ class Item extends PureComponent { - ) : null} - {this.props.data.data.settings ? ( + )} + {this.props.data.data.settings && ( <>
@@ -191,7 +191,7 @@ class Item extends PureComponent { - ) : null} + )}

{variables.getMessage('modals.main.marketplace.product.description')} @@ -223,7 +223,7 @@ class Item extends PureComponent { {this.props.data.author}

- {this.props.data.data.quotes ? ( + {this.props.data.data.quotes && (
@@ -233,8 +233,8 @@ class Item extends PureComponent { {this.props.data.data.quotes.length}
- ) : null} - {this.props.data.data.photos ? ( + )} + {this.props.data.data.photos && (
@@ -244,7 +244,7 @@ class Item extends PureComponent { {this.props.data.data.photos.length}
- ) : null} + )} {this.props.data.data.quotes && this.props.data.data.language !== '' ? (
@@ -312,7 +312,7 @@ class Item extends PureComponent {
- {this.props.data.data.collection ? ( + {this.props.data.data.collection && (
{variables.getMessage('modals.main.marketplace.product.part_of')} @@ -320,7 +320,7 @@ class Item extends PureComponent { {this.props.data.data.collection}
- ) : null} + )} diff --git a/src/components/modals/main/marketplace/sections/Create.jsx b/src/components/modals/main/marketplace/sections/Create.jsx index 09289b03..cac66197 100644 --- a/src/components/modals/main/marketplace/sections/Create.jsx +++ b/src/components/modals/main/marketplace/sections/Create.jsx @@ -27,7 +27,7 @@ export default class Create extends PureComponent { {variables.getMessage('modals.main.addons.create.moved_description')}
- +
diff --git a/src/components/modals/main/marketplace/sections/Marketplace.jsx b/src/components/modals/main/marketplace/sections/Marketplace.jsx index dad4f27f..e9a012fd 100644 --- a/src/components/modals/main/marketplace/sections/Marketplace.jsx +++ b/src/components/modals/main/marketplace/sections/Marketplace.jsx @@ -395,7 +395,7 @@ class Marketplace extends PureComponent {
- {this.props.type !== 'collections' ? ( + {this.props.type !== 'collections' && (
{variables.getMessage('widgets.navbar.tooltips.refresh')} */}
- ) : null} + )} { - return e ? ( + return e && ( {e.props ? e.props.children : ''} - ) : null; + ); })} diff --git a/src/components/modals/main/settings/Header.jsx b/src/components/modals/main/settings/Header.jsx index aaa8660e..dd29e880 100644 --- a/src/components/modals/main/settings/Header.jsx +++ b/src/components/modals/main/settings/Header.jsx @@ -10,7 +10,6 @@ import { } from 'react-icons/md'; import Slider from './Slider'; -import Switch from './Switch'; import SettingsItem from './SettingsItem'; import EventBus from 'modules/helpers/eventbus'; @@ -53,7 +52,7 @@ class Header extends PureComponent { return ( <>
- {this.props.backButton ? ( + {this.props.backButton && (
- ) : null} + )} {this.props.title} {this.props.switch && (
- {this.props.zoomSetting ? ( + {this.props.zoomSetting && ( - ) : null} + )} ); } diff --git a/src/components/modals/main/settings/sections/Advanced.jsx b/src/components/modals/main/settings/sections/Advanced.jsx index a32a3661..6b85f9ad 100644 --- a/src/components/modals/main/settings/sections/Advanced.jsx +++ b/src/components/modals/main/settings/sections/Advanced.jsx @@ -39,7 +39,7 @@ export default class AdvancedSettings extends PureComponent { > - {localStorage.getItem('welcomePreview') !== 'true' ? ( + {localStorage.getItem('welcomePreview') !== 'true' && (
@@ -64,7 +64,7 @@ export default class AdvancedSettings extends PureComponent {
- ) : null} + )} {this.state.author} • {this.state.date} - {this.state.image ? ( + {this.state.image && ( {this.state.title} - ) : null} + )}
{this.state.content}
))}
- {this.state.messages.length === 0 ? ( + {this.state.messages.length === 0 && (
@@ -128,7 +128,7 @@ export default class Message extends PureComponent {
- ) : null} + )} ); } diff --git a/src/components/modals/main/settings/sections/Navbar.jsx b/src/components/modals/main/settings/sections/Navbar.jsx index 37738213..566b1b57 100644 --- a/src/components/modals/main/settings/sections/Navbar.jsx +++ b/src/components/modals/main/settings/sections/Navbar.jsx @@ -56,7 +56,7 @@ function Navbar() { category="navbar" /> - {showRefreshOptions ? ( + {showRefreshOptions && ( - ) : null} + )} ); } diff --git a/src/components/modals/main/settings/sections/QuickLinks.jsx b/src/components/modals/main/settings/sections/QuickLinks.jsx index d84f5196..6a8aefcc 100644 --- a/src/components/modals/main/settings/sections/QuickLinks.jsx +++ b/src/components/modals/main/settings/sections/QuickLinks.jsx @@ -39,7 +39,7 @@ export default class QuickLinks extends PureComponent { variables.stats.postEvent('feature', 'Quicklink delete'); } - addLink(name, url, icon) { + async addLink(name, url, icon) { const data = JSON.parse(localStorage.getItem('quicklinks')); // regex: https://ihateregex.io/expr/url/ @@ -63,7 +63,7 @@ export default class QuickLinks extends PureComponent { } data.push({ - name: name || url, + name: name || await this.getTitle(url), url, icon: icon || '', key: Math.random().toString(36).substring(7) + 1, @@ -89,10 +89,10 @@ export default class QuickLinks extends PureComponent { }); } - editLink(og, name, url, icon) { + async editLink(og, name, url, icon) { const data = JSON.parse(localStorage.getItem('quicklinks')); const dataobj = data.find((i) => i.key === og.key); - dataobj.name = name || url; + dataobj.name = name || await this.getTitle(url); dataobj.url = url; dataobj.icon = icon || ''; @@ -105,6 +105,24 @@ export default class QuickLinks extends PureComponent { }); } + async getTitle(url) { + let title; + try { + let response = await fetch(url); + if (response.redirected) { + response = await fetch(response.url); + } + const html = await response.text(); + const parser = new DOMParser(); + const doc = parser.parseFromString(html, 'text/html'); + title = doc.title; + } catch (e) { + title = url; + } + + return title; + } + componentDidMount() { EventBus.on('refresh', (data) => { if (data === 'quicklinks') { @@ -255,7 +273,7 @@ export default class QuickLinks extends PureComponent { - {this.state.items.length === 0 ? ( + {this.state.items.length === 0 && (
@@ -271,7 +289,7 @@ export default class QuickLinks extends PureComponent {
- ) : null} + )}
{this.state.items.map((item) => quickLink(item))} diff --git a/src/components/modals/main/settings/sections/Quote.jsx b/src/components/modals/main/settings/sections/Quote.jsx index 4e5a4674..5db9af60 100644 --- a/src/components/modals/main/settings/sections/Quote.jsx +++ b/src/components/modals/main/settings/sections/Quote.jsx @@ -220,7 +220,7 @@ export default class QuoteSettings extends PureComponent {
- {!this.state.sourceSection ? ( + {!this.state.sourceSection && ( <> - ) : null} + )} {customSettings} ); diff --git a/src/components/modals/main/settings/sections/advanced/Advanced.jsx b/src/components/modals/main/settings/sections/advanced/Advanced.jsx index 691aa577..15727e70 100644 --- a/src/components/modals/main/settings/sections/advanced/Advanced.jsx +++ b/src/components/modals/main/settings/sections/advanced/Advanced.jsx @@ -67,7 +67,7 @@ export default class AdvancedSettings extends PureComponent { > - {localStorage.getItem('welcomePreview') !== 'true' ? ( + {localStorage.getItem('welcomePreview') !== 'true' && (
@@ -92,7 +92,7 @@ export default class AdvancedSettings extends PureComponent {
- ) : null} + )} this.setState({ backgroundType: value })} category="background" > - {this.state.marketplaceEnabled ? ( + {this.state.marketplaceEnabled && ( - ) : null} + )} @@ -406,11 +406,11 @@ export default class BackgroundSettings extends PureComponent { onChange={(value) => this.setState({ backgroundType: value })} category="background" > - {this.state.marketplaceEnabled ? ( + {this.state.marketplaceEnabled && ( - ) : null} + )} @@ -520,7 +520,7 @@ export default class BackgroundSettings extends PureComponent { )} - {this.state.backgroundFilter !== 'none' ? ( + {this.state.backgroundFilter !== 'none' && ( - ) : null} + )} ) : null} diff --git a/src/components/modals/main/settings/sections/background/Colour.jsx b/src/components/modals/main/settings/sections/background/Colour.jsx index aca1fd60..af8089c7 100644 --- a/src/components/modals/main/settings/sections/background/Colour.jsx +++ b/src/components/modals/main/settings/sections/background/Colour.jsx @@ -207,13 +207,13 @@ export default class ColourSettings extends PureComponent { colourSettings = ( <>
{gradientInputs}
- {!gradientHasMoreThanOneColour ? ( + {!gradientHasMoreThanOneColour && ( <> - ) : null} + )} ); } diff --git a/src/components/modals/main/settings/sections/background/Custom.jsx b/src/components/modals/main/settings/sections/background/Custom.jsx index 3cd8bea1..8cc79441 100644 --- a/src/components/modals/main/settings/sections/background/Custom.jsx +++ b/src/components/modals/main/settings/sections/background/Custom.jsx @@ -227,8 +227,8 @@ export default class CustomSettings extends PureComponent { alt={'Custom background ' + (index || 0)} src={`${!this.videoCheck(url) ? this.state.customBackground[index] : ''}`} /> - {this.videoCheck(url) ? : null} - {this.state.customBackground.length > 0 ? ( + {this.videoCheck(url) && } + {this.state.customBackground.length > 0 && ( - ) : null} + )} ))} diff --git a/src/components/modals/main/tabs/backend/Tab.jsx b/src/components/modals/main/tabs/backend/Tab.jsx index b615d863..94776ee7 100644 --- a/src/components/modals/main/tabs/backend/Tab.jsx +++ b/src/components/modals/main/tabs/backend/Tab.jsx @@ -154,11 +154,11 @@ function Tab({ label, currentTab, onClick, navbarTab }) { return ( <> - {mue === true ? Mue : null} + {mue === true && Mue} - {divider === true ?
: null} + {divider === true &&
} ); } diff --git a/src/components/modals/welcome/WelcomeSections.jsx b/src/components/modals/welcome/WelcomeSections.jsx index add037e2..22d07561 100644 --- a/src/components/modals/welcome/WelcomeSections.jsx +++ b/src/components/modals/welcome/WelcomeSections.jsx @@ -391,14 +391,14 @@ class WelcomeSections extends PureComponent { )} - {this.state.importedSettings.length !== 0 ? ( + {this.state.importedSettings.length !== 0 && (
this.props.switchTab(2)}> {variables.getMessage('modals.main.settings.sections.final.imported', { amount: this.state.importedSettings.length, })}{' '} {this.state.importedSettings.length}
- ) : null} + )} ); diff --git a/src/components/widgets/Widgets.jsx b/src/components/widgets/Widgets.jsx index 27a4a7ec..f407f411 100644 --- a/src/components/widgets/Widgets.jsx +++ b/src/components/widgets/Widgets.jsx @@ -26,12 +26,12 @@ export default class Widgets extends PureComponent { }; // widgets we can re-order this.widgets = { - time: this.enabled('time') ? : null, - greeting: this.enabled('greeting') ? : null, - quote: this.enabled('quote') ? : null, - date: this.enabled('date') ? : null, + time: this.enabled('time') && , + greeting: this.enabled('greeting') && , + quote: this.enabled('quote') && , + date: this.enabled('date') && , quicklinks: this.enabled('quicklinksenabled') && this.online ? : null, - message: this.enabled('message') ? : null, + message: this.enabled('message') && , }; } @@ -77,7 +77,7 @@ export default class Widgets extends PureComponent { ) : (
}> - {this.enabled('searchBar') ? : null} + {this.enabled('searchBar') && } {this.state.order.map((element, key) => ( {this.widgets[element]} ))} diff --git a/src/components/widgets/background/Background.jsx b/src/components/widgets/background/Background.jsx index c728f867..d028ea38 100644 --- a/src/components/widgets/background/Background.jsx +++ b/src/components/widgets/background/Background.jsx @@ -564,13 +564,13 @@ export default class Background extends PureComponent { }} id="backgroundImage" /> - {this.state.photoInfo.credit !== '' ? ( + {this.state.photoInfo.credit !== '' && ( - ) : null} + )} ); } diff --git a/src/components/widgets/background/PhotoInformation.jsx b/src/components/widgets/background/PhotoInformation.jsx index 232fcf63..9185a0be 100644 --- a/src/components/widgets/background/PhotoInformation.jsx +++ b/src/components/widgets/background/PhotoInformation.jsx @@ -201,7 +201,7 @@ function PhotoInformation({ info, url, api }) { {widgetStyle !== 'legacy' || other ? (
setshowExtraInfo(true)} onMouseLeave={() => setshowExtraInfo(false)} > @@ -210,7 +210,7 @@ function PhotoInformation({ info, url, api }) {

{photoMap}

{photoMap()}
- {showingPhotoMap ? ( + {showingPhotoMap && ( - ) : null} + )}
{(showExtraInfo || other) && info.description @@ -295,15 +295,15 @@ function PhotoInformation({ info, url, api }) { {width}x{height}
- {info.category ? ( + {info.category && (
{info.category[0].toUpperCase() + info.category.slice(1)}
- ) : null} - {api ? ( + )} + {api && (
@@ -328,10 +328,10 @@ function PhotoInformation({ info, url, api }) { )}
- ) : null} + )}
- {!info.offline ? ( + {!info.offline && ( openShareModal(true)} /> - ) : null} + )} - {!info.offline ? ( + {!info.offline && ( downloadImage(info)} /> - ) : null} - {info.pun ? ( + )} + {info.pun && ( openExcludeModal(true)} /> - ) : null} + )}
) : null} diff --git a/src/components/widgets/navbar/Navbar.jsx b/src/components/widgets/navbar/Navbar.jsx index fb407bf7..dc01c7dd 100644 --- a/src/components/widgets/navbar/Navbar.jsx +++ b/src/components/widgets/navbar/Navbar.jsx @@ -103,14 +103,14 @@ class Navbar extends PureComponent { {localStorage.getItem('view') === 'true' && backgroundEnabled ? ( ) : null} - {localStorage.getItem('notesEnabled') === 'true' ? ( + {localStorage.getItem('notesEnabled') === 'true' && ( - ) : null} - {localStorage.getItem('todoEnabled') === 'true' ? ( + )} + {localStorage.getItem('todoEnabled') === 'true' && ( - ) : null} + )} - {this.refreshEnabled !== 'false' ? ( + {this.refreshEnabled !== 'false' && ( - ) : null} + )} {this.state.author} - {this.state.authorOccupation !== 'Unknown' ? ( + {this.state.authorOccupation !== 'Unknown' && ( {this.state.authorOccupation} - ) : null} + )} - {this.state.authorimglicense - ? this.state.authorimglicense.replace(' undefined. ', ' ') - : null} + {this.state.authorimglicense && + this.state.authorimglicense.replace(' undefined. ', ' ')} ) : ( diff --git a/src/components/widgets/search/Search.jsx b/src/components/widgets/search/Search.jsx index af4b9abf..4175602e 100644 --- a/src/components/widgets/search/Search.jsx +++ b/src/components/widgets/search/Search.jsx @@ -249,7 +249,7 @@ export default class Search extends PureComponent {
{localStorage.getItem('searchDropdown') === 'true' && - this.state.searchDropdown === true ? ( + this.state.searchDropdown === true && (
{searchEngines.map(({ name }, key) => { return ( @@ -275,7 +275,7 @@ export default class Search extends PureComponent { {customText}
- ) : null} + )}
); diff --git a/src/components/widgets/weather/Expanded.jsx b/src/components/widgets/weather/Expanded.jsx index 186c110d..2263a6ca 100644 --- a/src/components/widgets/weather/Expanded.jsx +++ b/src/components/widgets/weather/Expanded.jsx @@ -27,7 +27,7 @@ function Expanded({ state, weatherType, variables }) { {variables.getMessage('widgets.weather.extra_information')} )} - {enabled('cloudiness') ? ( + {enabled('cloudiness') && ( - ) : null} - {enabled('windspeed') ? ( + )} + {enabled('windspeed') && ( {state.weather.wind_speed} m/s{' '} - {enabled('windDirection') ? ( + {enabled('windDirection') && (
- ) : null} + )}
- ) : null} - {enabled('atmosphericpressure') ? ( + )} + {enabled('atmosphericpressure') && ( hPa - ) : null} - {enabled('weatherdescription') ? ( + )} + {enabled('weatherdescription') && ( - ) : null} - {enabled('visibility') ? ( + )} + {enabled('visibility') && ( - ) : null} - {enabled('humidity') ? ( + )} + {enabled('humidity') && ( - ) : null} + )} ); } diff --git a/src/components/widgets/weather/Weather.jsx b/src/components/widgets/weather/Weather.jsx index 3a2db309..d3c4a035 100644 --- a/src/components/widgets/weather/Weather.jsx +++ b/src/components/widgets/weather/Weather.jsx @@ -135,9 +135,9 @@ export default class Weather extends PureComponent { {this.state.location} )} - {weatherType >= 3 ? ( + {weatherType >= 3 && ( - ) : null} + )} ); } diff --git a/src/components/widgets/weather/WindDirectionIcon.jsx b/src/components/widgets/weather/WindDirectionIcon.jsx index 5b0c5191..36ffd5bd 100644 --- a/src/components/widgets/weather/WindDirectionIcon.jsx +++ b/src/components/widgets/weather/WindDirectionIcon.jsx @@ -52,7 +52,7 @@ function WindDirectionIcon({ degrees }) { const direction = directions[Math.round(((degrees %= 360) < 0 ? degrees + 360 : degrees) / 45) % 8]; - return direction ? direction.icon : null; + return direction && direction.icon; } WindDirectionIcon.propTypes = { diff --git a/src/modules/constants.js b/src/modules/constants.js index c988b6da..36315645 100644 --- a/src/modules/constants.js +++ b/src/modules/constants.js @@ -26,11 +26,11 @@ export const REPO_NAME = 'mue'; export const EMAIL = 'hello@muetab.com'; export const TWITTER_HANDLE = 'getmue'; export const DISCORD_SERVER = 'zv8C9F8'; -export const COPYRIGHT_NAME = 'The Mue Authors'; +export const COPYRIGHT_NAME = 'The Mue Authors & Kaiso One Ltd'; export const COPYRIGHT_YEAR = '2018'; export const COPYRIGHT_LICENSE = 'BSD-3-Clause License'; export const OPENCOLLECTIVE_USERNAME = 'mue'; export const OFFLINE_IMAGES = 20; -export const VERSION = '7.0.0'; +export const VERSION = '7.0.1';