diff --git a/backend/aws/obsidian-plugin-update-checker-resources.ts b/backend/aws/obsidian-plugin-update-checker-resources.ts index 3be1bfc90..2e2d6f474 100644 --- a/backend/aws/obsidian-plugin-update-checker-resources.ts +++ b/backend/aws/obsidian-plugin-update-checker-resources.ts @@ -21,7 +21,7 @@ export class ObsidianPluginUpdaterStack extends cdk.Stack { entry: path.join(__dirname, '../get-releases-lambda/src/handler.ts'), handler: 'main', memorySize: 150, - timeout: Duration.seconds(90), + timeout: Duration.seconds(120), runtime: lambda.Runtime.NODEJS_16_X, architecture: lambda.Architecture.ARM_64, environment: { diff --git a/manifest-beta.json b/manifest-beta.json index 1526b7d62..fbad03ecb 100644 --- a/manifest-beta.json +++ b/manifest-beta.json @@ -1,7 +1,7 @@ { "id": "obsidian-plugin-update-tracker", "name": "Plugin Update Tracker", - "version": "1.5.1", + "version": "1.5.2", "minAppVersion": "0.15.0", "description": "Know when installed plugins have updates and evaluate the risk of upgrading", "author": "Obsidian", diff --git a/manifest.json b/manifest.json index 1526b7d62..fbad03ecb 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-plugin-update-tracker", "name": "Plugin Update Tracker", - "version": "1.5.1", + "version": "1.5.2", "minAppVersion": "0.15.0", "description": "Know when installed plugins have updates and evaluate the risk of upgrading", "author": "Obsidian", diff --git a/package.json b/package.json index 8b03eb729..661c0e3fc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-plugin-update-tracker", - "version": "1.5.1", + "version": "1.5.2", "description": "Know when installed plugins have updates and evaluate the risk of upgrading", "main": "main.js", "scripts": { diff --git a/src/components/PluginUpdateProgressTracker.tsx b/src/components/PluginUpdateProgressTracker.tsx index 2ae776f17..783f1dcce 100644 --- a/src/components/PluginUpdateProgressTracker.tsx +++ b/src/components/PluginUpdateProgressTracker.tsx @@ -69,7 +69,7 @@ export const PluginUpdateProgressTracker: React.FC<{ let errorInstructions = ''; if (githubRateLimitTimestamp) { const time = dayjs(githubRateLimitTimestamp); - errorInstructions = `Try again ${time.fromNow()}, and if that doesn't fix it then report an issue `; + errorInstructions = `Your IP address has exceeded github's limit of 60 file downloads in an hour. The limit will reset in ${time.fromNow()}, but if that doesn't work then report an issue`; } else { errorInstructions = `Try again or report an issue `; } diff --git a/src/components/UpdateStatusIcon.tsx b/src/components/UpdateStatusIcon.tsx index 11dfb4854..e4f42cc74 100644 --- a/src/components/UpdateStatusIcon.tsx +++ b/src/components/UpdateStatusIcon.tsx @@ -1,5 +1,6 @@ import { faPlug } from '@fortawesome/free-solid-svg-icons/faPlug'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { Notice } from 'obsidian'; import * as React from 'react'; import styled from 'styled-components'; import { useAppSelector } from '../state'; @@ -11,6 +12,7 @@ interface UpdateStatusIconContainerProps { } const CSS_CLASS_BASE = 'plugin-update-tracker-icon'; +const TOAST_DELAY_MS = 5000; const UpdateStatusIconContainer: React.FC = ({ onClickViewUpdates, @@ -49,13 +51,31 @@ const UpdateStatusIconContainer: React.FC = ({ parentEl, ]); + function handlePluginIconClicked() { + if (isLoading) { + return; + } else if (isErrorLoading) { + new Notice( + 'Error checking for plugin updates. Please check your internet connection and report an issue on github if the issue continues', + TOAST_DELAY_MS + ); + } else if (pluginsWithUpdates.length > 0) { + onClickViewUpdates(); + } else { + new Notice( + "Up-to-date! There aren't any plugin updates ready based on the filters configured in this plugin's settings.", + TOAST_DELAY_MS + ); + } + } + return ( <> ); @@ -65,11 +85,11 @@ type UpdateStatusIconViewProps = { isLoading: boolean; isErrorLoading: boolean; pluginsWithUpdatesCount: number; - onClickViewUpdates: () => any; + onPluginIconClicked: () => any; }; export const UpdateStatusIconView: React.FC = ({ - onClickViewUpdates, + onPluginIconClicked, isLoading, isErrorLoading, pluginsWithUpdatesCount, @@ -83,8 +103,8 @@ export const UpdateStatusIconView: React.FC = ({ let width = '0.5rem'; let padding = '0.3rem'; let cursor: string = 'pointer'; + let isPluginUpdatesAvailable = false; let title; - let isClickable = false; let cssSelector; if (isLoading) { chipText = '⌛'; @@ -112,31 +132,24 @@ export const UpdateStatusIconView: React.FC = ({ title = `${pluginsWithUpdatesCount} plugin update${ pluginsWithUpdatesCount > 1 ? 's' : '' } available`; - isClickable = true; + isPluginUpdatesAvailable = true; cssSelector = `${CSS_CLASS_BASE}--updates-available`; } else { chipText = '✓'; chipColour = '#197300'; title = 'All plugins up-to-date'; - cursor = 'none'; cssSelector = `${CSS_CLASS_BASE}--no-updates-available`; + cursor = 'default'; } - const isHighlighted = isMouseOver && isClickable; - - const handleClick = () => { - if (isClickable) { - onClickViewUpdates(); - } - }; + const isHighlighted = isMouseOver && isPluginUpdatesAvailable; return ( setIsMouseOver(true)} onMouseLeave={() => setIsMouseOver(false)} isHighlighted={isHighlighted} diff --git a/src/domain/api.ts b/src/domain/api.ts index d2bf39c6d..5eb650049 100644 --- a/src/domain/api.ts +++ b/src/domain/api.ts @@ -15,7 +15,10 @@ export const getReleases: ReleaseApi = async (newPluginVersionRequest: NewPlugin }); return JSON.parse(res); } catch (err) { - console.error('Error fetching releases', err); + console.warn( + `Failed checking for plugin updates at ${BACKEND_API_URL}. Check your internet connection and security settings or file a bug at https://github.com/swar8080/obsidian-plugin-update-tracker/issues.\nError details are:\n`, + err + ); throw err; } }; diff --git a/versions.json b/versions.json index 890cde1ba..35c9a17b3 100644 --- a/versions.json +++ b/versions.json @@ -16,5 +16,6 @@ "1.4.5": "0.15.0", "1.4.6": "0.15.0", "1.5.0": "0.15.0", - "1.5.1": "0.15.0" + "1.5.1": "0.15.0", + "1.5.2": "0.15.0" }