From 877ec0060d3574ffc959c043240398147ae51d69 Mon Sep 17 00:00:00 2001 From: dkadioglu <1633773+dkadioglu@users.noreply.github.com> Date: Sun, 31 Aug 2025 08:38:29 +0200 Subject: [PATCH 1/4] add widget for Chuck Norris quotes and sort some lines of WidgetBase.vue alphabetically. --- src/components/Widgets/ChuckNorris.vue | 66 ++++++++++++++++++++++++++ src/components/Widgets/WidgetBase.vue | 31 ++++++------ src/utils/defaults.js | 1 + 3 files changed, 83 insertions(+), 15 deletions(-) create mode 100644 src/components/Widgets/ChuckNorris.vue diff --git a/src/components/Widgets/ChuckNorris.vue b/src/components/Widgets/ChuckNorris.vue new file mode 100644 index 00000000..1a380259 --- /dev/null +++ b/src/components/Widgets/ChuckNorris.vue @@ -0,0 +1,66 @@ + + + + + \ No newline at end of file diff --git a/src/components/Widgets/WidgetBase.vue b/src/components/Widgets/WidgetBase.vue index a1efa1cd..e7e5d3f8 100644 --- a/src/components/Widgets/WidgetBase.vue +++ b/src/components/Widgets/WidgetBase.vue @@ -46,20 +46,21 @@ const COMPAT = { 'adguard-filter-status': 'AdGuardFilterStatus', 'adguard-stats': 'AdGuardStats', 'adguard-top-domains': 'AdGuardTopDomains', - anonaddy: 'addy.io', - apod: 'Apod', + 'anonaddy': 'addy.io', + 'apod': 'Apod', 'blacklist-check': 'BlacklistCheck', - clock: 'Clock', + 'chucknorris': 'ChuckNorris', + 'clock': 'Clock', + 'code-stats': 'CodeStats', + 'covid-stats': 'CovidStats', 'crypto-price-chart': 'CryptoPriceChart', 'crypto-watch-list': 'CryptoWatchList', 'custom-search': 'CustomSearch', 'custom-list': 'CustomList', 'cve-vulnerabilities': 'CveVulnerabilities', 'domain-monitor': 'DomainMonitor', - 'code-stats': 'CodeStats', - 'covid-stats': 'CovidStats', 'drone-ci': 'DroneCi', - embed: 'EmbedWidget', + 'embed': 'EmbedWidget', 'eth-gas-prices': 'EthGasPrices', 'exchange-rates': 'ExchangeRates', 'flight-data': 'Flights', @@ -81,16 +82,16 @@ const COMPAT = { 'gl-network-traffic': 'GlNetworkTraffic', 'gl-system-load': 'GlSystemLoad', 'gl-cpu-temp': 'GlCpuTemp', + 'gluetun-status': 'GluetunStatus', 'health-checks': 'HealthChecks', 'hackernews-trending': 'HackernewsTrending', - 'gluetun-status': 'GluetunStatus', - iframe: 'IframeWidget', - image: 'ImageWidget', - joke: 'Jokes', + 'iframe': 'IframeWidget', + 'image': 'ImageWidget', + 'joke': 'Jokes', + 'linkding': 'Linkding', 'minecraft-status': 'MinecraftStatus', 'mullvad-status': 'MullvadStatus', - mvg: 'Mvg', - linkding: 'Linkding', + 'mvg': 'Mvg', 'mvg-connection': 'MvgConnection', 'nd-cpu-history': 'NdCpuHistory', 'nd-load-history': 'NdLoadHistory', @@ -113,17 +114,17 @@ const COMPAT = { 'public-ip': 'PublicIp', 'rescue-time': 'RescueTime', 'rss-feed': 'RssFeed', - sabnzbd: 'Sabnzbd', + 'sabnzbd': 'Sabnzbd', 'sports-scores': 'SportsScores', 'stat-ping': 'StatPing', 'stock-price-chart': 'StockPriceChart', 'synology-download': 'SynologyDownload', 'system-info': 'SystemInfo', 'tfl-status': 'TflStatus', - trmm: 'TacticalRMM', + 'trmm': 'TacticalRMM', 'uptime-kuma': 'UptimeKuma', 'wallet-balance': 'WalletBalance', - weather: 'Weather', + 'weather': 'Weather', 'weather-forecast': 'WeatherForecast', 'xkcd-comic': 'XkcdComic', }; diff --git a/src/utils/defaults.js b/src/utils/defaults.js index 847dbe6f..8f72fcc8 100644 --- a/src/utils/defaults.js +++ b/src/utils/defaults.js @@ -227,6 +227,7 @@ module.exports = { anonAddy: 'https://app.addy.io', astronomyPictureOfTheDay: 'https://apod.as93.net/apod', blacklistCheck: 'https://api.blacklistchecker.com/check', + chuckNorris: 'https://api.chucknorris.io/jokes/random', codeStats: 'https://codestats.net/', covidStats: 'https://disease.sh/v3/covid-19', cryptoPrices: 'https://api.coingecko.com/api/v3/coins/', From 3e728b314bbc46f31e1613f806999a710e933eea Mon Sep 17 00:00:00 2001 From: dkadioglu <1633773+dkadioglu@users.noreply.github.com> Date: Sun, 31 Aug 2025 09:12:55 +0200 Subject: [PATCH 2/4] add documentation for Chuck Norris Widget --- docs/widgets.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/docs/widgets.md b/docs/widgets.md index de637eb8..addf2ff9 100644 --- a/docs/widgets.md +++ b/docs/widgets.md @@ -29,6 +29,7 @@ Dashy has support for displaying dynamic content in the form of widgets. There a - [Stock Price History](#stock-price-history) - [ETH Gas Prices](#eth-gas-prices) - [Joke of the Day](#joke) + - [Chuck Norris quotes](#chucknorris) - [XKCD Comics](#xkcd-comics) - [Flight Data](#flight-data) - [NASA APOD](#astronomy-picture-of-the-day) @@ -1001,6 +1002,36 @@ Renders a programming or generic joke. Data is fetched from the [JokesAPI](https --- +### Chuck Norris quotes + +Renders a Chuck Norris quote. Data is fetched from the [ChuckNorrisAPI](https://api.chucknorris.io/) by @matchilling. All fields are optional. + +

+ +#### Options + +**Field** | **Type** | **Required** | **Description** +--- | --- | --- | --- +**`categories`** | `string` | _Optional_ | Set the category of jokes to return. Use a string to specify a single category, or an array to pass in multiple options. Available options are: `animal`,`career`,`celebrity`,`dev`,`explicit`,`fashion`,`food`,`history`,`money`,`movie`,`music`,`political`,`religion`,`science`,`sport` and `travel`. An up-to-date list of supported categories can be found [here](https://api.chucknorris.io/jokes/categories). Defaults to not explicitely set and therefore any of the categories can come up. + +#### Example + +```yaml +- type: chucknorris + options: + categories: history,sport +``` + +#### Info + +- **CORS**: 🟢 Enabled +- **Auth**: 🟢 Not Required +- **Price**: 🟢 Free +- **Host**: Managed Instance +- **Privacy**: _See [matchilling's Privacy Policy](https://api.chucknorris.io/privacy)_ + +--- + ### XKCD Comics Have a laugh with the daily comic from [XKCD](https://xkcd.com/). A classic webcomic website covering everything from Linux, math, romance, science and language. All fields are optional. From 9fc0254cf830e9a3e7d32a1662660ea89f6d77f0 Mon Sep 17 00:00:00 2001 From: dkadioglu <1633773+dkadioglu@users.noreply.github.com> Date: Sun, 31 Aug 2025 09:47:27 +0200 Subject: [PATCH 3/4] Re-refactor widget keys to remove quotes Putting those quotes was a mistake, reverting. --- src/components/Widgets/WidgetBase.vue | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/components/Widgets/WidgetBase.vue b/src/components/Widgets/WidgetBase.vue index e7e5d3f8..a148b476 100644 --- a/src/components/Widgets/WidgetBase.vue +++ b/src/components/Widgets/WidgetBase.vue @@ -46,11 +46,11 @@ const COMPAT = { 'adguard-filter-status': 'AdGuardFilterStatus', 'adguard-stats': 'AdGuardStats', 'adguard-top-domains': 'AdGuardTopDomains', - 'anonaddy': 'addy.io', - 'apod': 'Apod', + anonaddy: 'addy.io', + apod: 'Apod', 'blacklist-check': 'BlacklistCheck', - 'chucknorris': 'ChuckNorris', - 'clock': 'Clock', + chucknorris: 'ChuckNorris', + clock: 'Clock', 'code-stats': 'CodeStats', 'covid-stats': 'CovidStats', 'crypto-price-chart': 'CryptoPriceChart', @@ -60,7 +60,7 @@ const COMPAT = { 'cve-vulnerabilities': 'CveVulnerabilities', 'domain-monitor': 'DomainMonitor', 'drone-ci': 'DroneCi', - 'embed': 'EmbedWidget', + embed: 'EmbedWidget', 'eth-gas-prices': 'EthGasPrices', 'exchange-rates': 'ExchangeRates', 'flight-data': 'Flights', @@ -85,13 +85,13 @@ const COMPAT = { 'gluetun-status': 'GluetunStatus', 'health-checks': 'HealthChecks', 'hackernews-trending': 'HackernewsTrending', - 'iframe': 'IframeWidget', - 'image': 'ImageWidget', - 'joke': 'Jokes', - 'linkding': 'Linkding', + iframe: 'IframeWidget', + image: 'ImageWidget', + joke: 'Jokes', + linkding: 'Linkding', 'minecraft-status': 'MinecraftStatus', 'mullvad-status': 'MullvadStatus', - 'mvg': 'Mvg', + mvg: 'Mvg', 'mvg-connection': 'MvgConnection', 'nd-cpu-history': 'NdCpuHistory', 'nd-load-history': 'NdLoadHistory', @@ -114,17 +114,17 @@ const COMPAT = { 'public-ip': 'PublicIp', 'rescue-time': 'RescueTime', 'rss-feed': 'RssFeed', - 'sabnzbd': 'Sabnzbd', + sabnzbd: 'Sabnzbd', 'sports-scores': 'SportsScores', 'stat-ping': 'StatPing', 'stock-price-chart': 'StockPriceChart', 'synology-download': 'SynologyDownload', 'system-info': 'SystemInfo', 'tfl-status': 'TflStatus', - 'trmm': 'TacticalRMM', + trmm: 'TacticalRMM', 'uptime-kuma': 'UptimeKuma', 'wallet-balance': 'WalletBalance', - 'weather': 'Weather', + weather: 'Weather', 'weather-forecast': 'WeatherForecast', 'xkcd-comic': 'XkcdComic', }; From 31b7a0707871b17e49dd197e52eb265204e0db2c Mon Sep 17 00:00:00 2001 From: dkadioglu <1633773+dkadioglu@users.noreply.github.com> Date: Sun, 31 Aug 2025 10:04:26 +0200 Subject: [PATCH 4/4] fix some linting errors in ChuckNorris.vue --- src/components/Widgets/ChuckNorris.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Widgets/ChuckNorris.vue b/src/components/Widgets/ChuckNorris.vue index 1a380259..9f608a42 100644 --- a/src/components/Widgets/ChuckNorris.vue +++ b/src/components/Widgets/ChuckNorris.vue @@ -29,8 +29,8 @@ export default { }, /* Combine data parameters for the API endpoint */ endpoint() { - if (this.categories != '') return `${widgetApiEndpoints.chuckNorris}`+`?category=${this.categories}`; - if (this.categories == '') return `${widgetApiEndpoints.chuckNorris}`; + if (this.categories !== '') return `${widgetApiEndpoints.chuckNorris}?category=${this.categories}`; + return `${widgetApiEndpoints.chuckNorris}`; }, }, methods: {