From 9fdc2521fce3767679c90187128505fdc52f790f Mon Sep 17 00:00:00 2001 From: ItsRiprod Date: Tue, 9 Jul 2024 01:56:42 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=F0=9F=8D=9Ev0.5.3-alpha=20release?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +- AppExamples/spotify/builds/index.js | 25 ++++-- AppExamples/spotify/index.js | 50 +++++++----- AppExamples/weather/builds/index.js | 19 ++++- AppExamples/weather/index.js | 15 +++- DeskThing/README.md | 36 +++------ DeskThing/src/components/Footer/Footer.css | 46 ----------- DeskThing/src/components/Footer/Footer.tsx | 12 +-- DeskThing/src/components/Header/Header.css | 81 ------------------- DeskThing/src/components/Header/Header.tsx | 80 ------------------ DeskThing/src/components/Overlay/Overlay.tsx | 2 - .../icons/icon/Icons/AIconTemplate.tsx | 23 ++++++ .../components/icons/icon/Icons/IconAlbum.tsx | 23 ++++++ .../icons/icon/Icons/IconCallDiscord.tsx | 23 ++++++ .../icons/icon/Icons/IconCollection.tsx | 23 ++++++ .../icons/icon/Icons/IconDeafenedDiscord.tsx | 23 ++++++ .../icon/Icons/IconDeafenedOffDiscord.tsx | 23 ++++++ .../{IconCarThing.tsx => IconDevice.tsx} | 0 .../components/icons/icon/Icons/IconGear.tsx | 23 ++++++ .../components/icons/icon/Icons/IconHeart.tsx | 23 ++++++ .../icons/icon/Icons/IconHeartActive.tsx | 23 ++++++ .../components/icons/icon/Icons/IconHome.tsx | 23 ++++++ .../icons/icon/Icons/IconMicDiscord.tsx | 23 ++++++ .../icons/icon/Icons/IconMicOffDiscord.tsx | 23 ++++++ .../components/icons/icon/Icons/IconPause.tsx | 14 +++- .../components/icons/icon/Icons/IconPlay.tsx | 14 +++- .../icons/icon/Icons/IconRepeat.tsx | 23 ++++++ .../icon/Icons}/IconRepeatActive.tsx | 0 .../icons/icon/Icons/IconRepeatOnce.tsx | 23 ++++++ .../icons/icon/Icons/IconShuffle.tsx | 23 ++++++ .../icon/Icons}/IconShuffleActive.tsx | 0 .../icons/icon/Icons/IconSkipBack.tsx | 23 ++++++ .../icons/icon/Icons/IconSkipBack15.tsx | 23 ++++++ .../icons/icon/Icons/IconSkipForward.tsx | 23 ++++++ .../icons/icon/Icons/IconSkipForward15.tsx | 23 ++++++ .../components/icons/icon/Icons/IconTrack.tsx | 23 ++++++ .../icons/icon/Icons/IconUserCircle.tsx | 23 ++++++ .../icons/icon/Icons/IconVolume.tsx | 23 ++++++ .../components/icons/icon/Icons/VolumeOff.tsx | 23 ++++++ DeskThing/src/components/icons/icon/index.tsx | 25 +++++- DeskThing/src/components/icons/index.ts | 26 +++++- .../todothingUIcomponents/icons/IconAlbum.tsx | 17 ---- .../icons/IconCallDiscord.tsx | 17 ---- .../icons/IconCollection.tsx | 5 -- .../icons/IconDeafenedDiscord.tsx | 18 ----- .../icons/IconDeafenedOffDiscord.tsx | 18 ----- .../icons/IconDevice.tsx | 23 ------ .../todothingUIcomponents/icons/IconGear.tsx | 20 ----- .../todothingUIcomponents/icons/IconHeart.tsx | 5 -- .../icons/IconHeartActive.tsx | 5 -- .../todothingUIcomponents/icons/IconHome.tsx | 5 -- .../icons/IconMicDiscord.tsx | 17 ---- .../icons/IconMicOffDiscord.tsx | 17 ---- .../todothingUIcomponents/icons/IconPause.tsx | 5 -- .../todothingUIcomponents/icons/IconPlay.tsx | 5 -- .../icons/IconRepeat.tsx | 20 ----- .../icons/IconRepeatOne.tsx | 20 ----- .../icons/IconShuffle.tsx | 19 ----- .../icons/IconSkipBack.tsx | 6 -- .../icons/IconSkipForward.tsx | 5 -- .../components/todothingUIcomponents/index.ts | 21 ----- DeskThing/src/views/dashboard/index.tsx | 2 +- DeskThing/src/views/discord/index.tsx | 2 +- DeskThing/src/views/spotify/index.tsx | 2 +- DeskThing/src/views/utility/index.tsx | 2 +- DeskThing/src/views/views.tsx | 20 ++--- .../main/{utility => handlers}/appHandler.ts | 55 +++++++++++-- .../main/{utility => handlers}/authHandler.ts | 14 ++-- .../{utility => handlers}/configHandler.ts | 4 +- .../main/{utility => handlers}/dataHandler.ts | 0 .../{utility => handlers}/websocketServer.ts | 45 ++++++++--- DeskThingServer/src/main/index.ts | 45 ++++++----- .../src/main/{utility => utils}/events.ts | 8 ++ DeskThingServer/src/main/utils/logger.ts | 65 +++++++++++++++ .../src/components/Overlays/AppRequest.tsx | 43 ++++++---- .../src/components/Overlays/Toast.tsx | 29 +++++++ .../components/Overlays/ToastContainer.tsx | 51 ++++++++++++ .../src/components/Overlays/index.tsx | 2 + .../src/renderer/src/components/Sidebar.tsx | 31 ++++++- .../icons/icon/Icons/IconConnected.tsx | 12 +++ .../icons/icon/Icons/IconConnecting.tsx | 2 +- .../renderer/src/components/icons/index.ts | 1 + .../src/renderer/src/store/logStore.ts | 4 + .../src/renderer/src/store/requestStore.ts | 16 ++-- DeskThingServer/tailwind.config.js | 11 +++ README.md | 68 +++++----------- 86 files changed, 1100 insertions(+), 679 deletions(-) delete mode 100644 DeskThing/src/components/Header/Header.css delete mode 100644 DeskThing/src/components/Header/Header.tsx create mode 100644 DeskThing/src/components/icons/icon/Icons/AIconTemplate.tsx create mode 100644 DeskThing/src/components/icons/icon/Icons/IconAlbum.tsx create mode 100644 DeskThing/src/components/icons/icon/Icons/IconCallDiscord.tsx create mode 100644 DeskThing/src/components/icons/icon/Icons/IconCollection.tsx create mode 100644 DeskThing/src/components/icons/icon/Icons/IconDeafenedDiscord.tsx create mode 100644 DeskThing/src/components/icons/icon/Icons/IconDeafenedOffDiscord.tsx rename DeskThing/src/components/icons/icon/Icons/{IconCarThing.tsx => IconDevice.tsx} (100%) create mode 100644 DeskThing/src/components/icons/icon/Icons/IconGear.tsx create mode 100644 DeskThing/src/components/icons/icon/Icons/IconHeart.tsx create mode 100644 DeskThing/src/components/icons/icon/Icons/IconHeartActive.tsx create mode 100644 DeskThing/src/components/icons/icon/Icons/IconHome.tsx create mode 100644 DeskThing/src/components/icons/icon/Icons/IconMicDiscord.tsx create mode 100644 DeskThing/src/components/icons/icon/Icons/IconMicOffDiscord.tsx create mode 100644 DeskThing/src/components/icons/icon/Icons/IconRepeat.tsx rename DeskThing/src/components/{todothingUIcomponents/icons => icons/icon/Icons}/IconRepeatActive.tsx (100%) create mode 100644 DeskThing/src/components/icons/icon/Icons/IconRepeatOnce.tsx create mode 100644 DeskThing/src/components/icons/icon/Icons/IconShuffle.tsx rename DeskThing/src/components/{todothingUIcomponents/icons => icons/icon/Icons}/IconShuffleActive.tsx (100%) create mode 100644 DeskThing/src/components/icons/icon/Icons/IconSkipBack.tsx create mode 100644 DeskThing/src/components/icons/icon/Icons/IconSkipBack15.tsx create mode 100644 DeskThing/src/components/icons/icon/Icons/IconSkipForward.tsx create mode 100644 DeskThing/src/components/icons/icon/Icons/IconSkipForward15.tsx create mode 100644 DeskThing/src/components/icons/icon/Icons/IconTrack.tsx create mode 100644 DeskThing/src/components/icons/icon/Icons/IconUserCircle.tsx create mode 100644 DeskThing/src/components/icons/icon/Icons/IconVolume.tsx create mode 100644 DeskThing/src/components/icons/icon/Icons/VolumeOff.tsx delete mode 100644 DeskThing/src/components/todothingUIcomponents/icons/IconAlbum.tsx delete mode 100644 DeskThing/src/components/todothingUIcomponents/icons/IconCallDiscord.tsx delete mode 100644 DeskThing/src/components/todothingUIcomponents/icons/IconCollection.tsx delete mode 100644 DeskThing/src/components/todothingUIcomponents/icons/IconDeafenedDiscord.tsx delete mode 100644 DeskThing/src/components/todothingUIcomponents/icons/IconDeafenedOffDiscord.tsx delete mode 100644 DeskThing/src/components/todothingUIcomponents/icons/IconDevice.tsx delete mode 100644 DeskThing/src/components/todothingUIcomponents/icons/IconGear.tsx delete mode 100644 DeskThing/src/components/todothingUIcomponents/icons/IconHeart.tsx delete mode 100644 DeskThing/src/components/todothingUIcomponents/icons/IconHeartActive.tsx delete mode 100644 DeskThing/src/components/todothingUIcomponents/icons/IconHome.tsx delete mode 100644 DeskThing/src/components/todothingUIcomponents/icons/IconMicDiscord.tsx delete mode 100644 DeskThing/src/components/todothingUIcomponents/icons/IconMicOffDiscord.tsx delete mode 100644 DeskThing/src/components/todothingUIcomponents/icons/IconPause.tsx delete mode 100644 DeskThing/src/components/todothingUIcomponents/icons/IconPlay.tsx delete mode 100644 DeskThing/src/components/todothingUIcomponents/icons/IconRepeat.tsx delete mode 100644 DeskThing/src/components/todothingUIcomponents/icons/IconRepeatOne.tsx delete mode 100644 DeskThing/src/components/todothingUIcomponents/icons/IconShuffle.tsx delete mode 100644 DeskThing/src/components/todothingUIcomponents/icons/IconSkipBack.tsx delete mode 100644 DeskThing/src/components/todothingUIcomponents/icons/IconSkipForward.tsx delete mode 100644 DeskThing/src/components/todothingUIcomponents/index.ts rename DeskThingServer/src/main/{utility => handlers}/appHandler.ts (90%) rename DeskThingServer/src/main/{utility => handlers}/authHandler.ts (76%) rename DeskThingServer/src/main/{utility => handlers}/configHandler.ts (97%) rename DeskThingServer/src/main/{utility => handlers}/dataHandler.ts (100%) rename DeskThingServer/src/main/{utility => handlers}/websocketServer.ts (83%) rename DeskThingServer/src/main/{utility => utils}/events.ts (57%) create mode 100644 DeskThingServer/src/main/utils/logger.ts create mode 100644 DeskThingServer/src/renderer/src/components/Overlays/Toast.tsx create mode 100644 DeskThingServer/src/renderer/src/components/Overlays/ToastContainer.tsx create mode 100644 DeskThingServer/src/renderer/src/components/icons/icon/Icons/IconConnected.tsx diff --git a/.gitignore b/.gitignore index 3b3d41f..6afeeda 100644 --- a/.gitignore +++ b/.gitignore @@ -38,4 +38,5 @@ tsconfig.tsbuildinfo /AppExamples/weather/node_modules /AppExamples/mediawincs /AppExamples/mediawin/node_modules -/AppExamples/mediawin/builds \ No newline at end of file +/AppExamples/mediawin/builds +/AppExamples/spotify/builds diff --git a/AppExamples/spotify/builds/index.js b/AppExamples/spotify/builds/index.js index b436771..c987d4d 100644 --- a/AppExamples/spotify/builds/index.js +++ b/AppExamples/spotify/builds/index.js @@ -13928,17 +13928,32 @@ async function stop() { spotify = null; } async function onMessageFromMain(event, ...args) { - spotify.sendLog(`SPOTIFY: Received event ${event}`); + spotify.sendLog(`Received event ${event}`); try { switch (event) { case "message": break; case "data": if (args[0] == null || !args[0].Spotify_API_Id) { - spotify.sendDataToMainFn("get", "auth", [ - "Spotify_API_Id", - "Spotify_Client_Secret" - ]); + spotify.sendDataToMainFn( + "get", + "auth", + { + "Spotify_API_Id": { + "value": "", + "label": "Spotify Client ID", + "instructions": 'You can get your Spotify Client ID from the Spotify Developer Dashboard. You must create a new application and then under "Client ID" Copy and paste that into this field.' + }, + "Spotify_Client_Secret": { + "value": "", + "label": "Spotify Client Secret", + "instructions": 'You can get your Spotify Client Secret from the Spotify Developer Dashboard. You must create a new application and then under "View Client Secret", Copy and paste that into this field.' + }, + "Spotify_Redirect_URI": { + "instructions": 'Set the Spotify Redirect URI to http://localhost:8888/callback/spotify and then click "Save".\n This ensures you can authenticate your account to this application' + } + } + ); } else if (args[0].Spotify_Refresh_Token) { spotify.sendLog("Refreshing token..."); spotify.refresh_token = args[0].Spotify_Refresh_Token; diff --git a/AppExamples/spotify/index.js b/AppExamples/spotify/index.js index fac841b..6ebbfe9 100644 --- a/AppExamples/spotify/index.js +++ b/AppExamples/spotify/index.js @@ -9,9 +9,9 @@ async function start({ sendDataToMain }) { spotify.sendLog('Successfully Started!') } async function stop() { - + spotify.sendLog('Successfully Stopped!') - + spotify = null } @@ -28,10 +28,22 @@ async function onMessageFromMain(event, ...args) { // Check if there is data if (args[0] == null || !args[0].Spotify_API_Id) { // If there is no environment data, request the environment data - spotify.sendDataToMainFn('get', 'auth', [ - 'Spotify_API_Id', - 'Spotify_Client_Secret' - ]) + spotify.sendDataToMainFn('get', 'auth', { + 'Spotify_API_Id': { + 'value': '', + 'label': 'Spotify Client ID', + 'instructions': 'You can get your Spotify Client ID from the Spotify Developer Dashboard. You must create a new application and then under "Client ID" Copy and paste that into this field.', + }, + 'Spotify_Client_Secret': { + 'value': '', + 'label': 'Spotify Client Secret', + 'instructions': 'You can get your Spotify Client Secret from the Spotify Developer Dashboard. You must create a new application and then under "View Client Secret", Copy and paste that into this field.', + }, + 'Spotify_Redirect_URI': { + 'instructions': 'Set the Spotify Redirect URI to http://localhost:8888/callback/spotify and then click "Save".\n This ensures you can authenticate your account to this application', + } + } + ) } else if (args[0].Spotify_Refresh_Token) { spotify.sendLog('Refreshing token...') spotify.refresh_token = args[0].Spotify_Refresh_Token @@ -161,19 +173,19 @@ const handleSet = async (...args) => { case 'shuffle': response = await spotify.shuffle(args[1]) break - case 'update_setting': - if (args[1] != null) { - const {setting, value} = args[1]; - spotify.settings[setting].value = value - - spotify.sendLog('New Settings:' + spotify.settings) - response = { settings: spotify.settings } - spotify.sendDataToMainFn('add', response) - } else { - spotify.sendLog('No args provided', args[1]) - response = 'No args provided' - } - break + case 'update_setting': + if (args[1] != null) { + const { setting, value } = args[1]; + spotify.settings[setting].value = value + + spotify.sendLog('New Settings:' + spotify.settings) + response = { settings: spotify.settings } + spotify.sendDataToMainFn('add', response) + } else { + spotify.sendLog('No args provided', args[1]) + response = 'No args provided' + } + break } spotify.sendDataToMainFn('data', response) } diff --git a/AppExamples/weather/builds/index.js b/AppExamples/weather/builds/index.js index ca84cf0..73bb5ff 100644 --- a/AppExamples/weather/builds/index.js +++ b/AppExamples/weather/builds/index.js @@ -13649,6 +13649,23 @@ async function onMessageFromMain(event, ...args) { case "data": if (args[0] == null) { sendDataToMainFn("set", storedData); + sendDataToMainFn("get", "auth", ["weather_key", "location_key"]); + spotify.sendDataToMainFn( + "get", + "auth", + { + "weather_key": { + "value": "", + "label": "API KEY", + "instructions": 'You can get your Weather Key from the Accuweather Developer Dashboard. You must create a new application and then under "API Key" Copy and paste that into this field.' + }, + "location_key": { + "value": "", + "label": "LOCATION KEY", + "instructions": 'Go to Accuweather API locations search. Input the API Key into "apikey" and the location you want to get the weather for into "q". Then click "Send this request". Copy the "Key" from the response and paste it into this field.' + } + } + ); } else if (args[0].weather_key != null) { storedData.weather_key = args[0].weather_key, storedData.location_key = args[0].location_key; storedData.forecast_data = args[0].forecast_data || null; @@ -13657,7 +13674,7 @@ async function onMessageFromMain(event, ...args) { } else { sendDataToMainFn("get", "auth", ["weather_key", "location_key"]); } - if (args[0].settings) { + if (args[0]?.settings) { storedData = args[0]; } else { const settings2 = { settings: storedData.settings }; diff --git a/AppExamples/weather/index.js b/AppExamples/weather/index.js index 21f0bf0..8709587 100644 --- a/AppExamples/weather/index.js +++ b/AppExamples/weather/index.js @@ -102,6 +102,19 @@ async function onMessageFromMain(event, ...args) { if (args[0] == null) { sendDataToMainFn('set', storedData) sendDataToMainFn('get', 'auth', ['weather_key', 'location_key']) + spotify.sendDataToMainFn('get', 'auth', { + 'weather_key': { + 'value': '', + 'label': 'API KEY', + 'instructions': 'You can get your Weather Key from the Accuweather Developer Dashboard. You must create a new application and then under "API Key" Copy and paste that into this field.', + }, + 'location_key': { + 'value': '', + 'label': 'LOCATION KEY', + 'instructions': 'Go to Accuweather API locations search. Input the API Key into \"apikey\" and the location you want to get the weather for into \"q\". Then click \"Send this request\". Copy the \"Key\" from the response and paste it into this field.', + } + } + ) } else if (args[0].weather_key != null) { storedData.weather_key = args[0].weather_key, @@ -115,7 +128,7 @@ async function onMessageFromMain(event, ...args) { sendDataToMainFn('get', 'auth', ['weather_key', 'location_key']) } - if (args[0].settings) { + if (args[0]?.settings) { storedData = args[0] } else { diff --git a/DeskThing/README.md b/DeskThing/README.md index 0d6babe..3675f6b 100644 --- a/DeskThing/README.md +++ b/DeskThing/README.md @@ -1,30 +1,12 @@ -# React + TypeScript + Vite +# DeskThing Client Server -This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. - -Currently, two official plugins are available: - -- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh - -## Expanding the ESLint configuration - -If you are developing a production application, we recommend updating the configuration to enable type aware lint rules: - -- Configure the top-level `parserOptions` property like this: - -```js -export default { - // other rules... - parserOptions: { - ecmaVersion: 'latest', - sourceType: 'module', - project: ['./tsconfig.json', './tsconfig.node.json'], - tsconfigRootDir: __dirname, - }, -} +To build: +```sh +npm run build +``` +To develop: +```sh +npm run dev ``` -- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked` -- Optionally add `plugin:@typescript-eslint/stylistic-type-checked` -- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list +Using Tailwindcss, React, Typescript, and Vite \ No newline at end of file diff --git a/DeskThing/src/components/Footer/Footer.css b/DeskThing/src/components/Footer/Footer.css index 97025eb..42f4a56 100644 --- a/DeskThing/src/components/Footer/Footer.css +++ b/DeskThing/src/components/Footer/Footer.css @@ -3,31 +3,6 @@ background: conic-gradient(from 0turn at 10% -5%,var(--bg-tinted-highlight) 26%, var(--color-albumColor) 50%); background-color: var(--bg-highlight); } - - .getSongInfo { - height: 100%; - max-width: 163px; - min-width: 163px; - display: flex; - padding: 0px; - margin: 0px; - margin-top: -3px; - } - - .getSongInfo .albumArt { - height: 100%; - overflow: hidden; - border-radius: 0px 15px 15px 0px; - } - - /* - - ----------------------- Song Information - - */ - .songInformation { - padding-top: 5px; - } .songTitle { font-size: 35px; overflow: hidden; @@ -35,25 +10,4 @@ max-width:640px; text-wrap: nowrap; margin: auto; - } - .progressBar_container { - margin:auto; - width: 90%; - height: 30px; - background-color: var(--bg-tinted-highlight); - overflow:hidden; - border-radius: 15px; - } - .progressBar_progress { - position:static; - bottom: 0; - height: 30px; - background-color: var(--text-brightAccent); - } - .progressBar_timer { - padding: 0; - margin: 0; - color: var(--text-base); - transform: translate(0px, -30px); - font-weight:bolder; } \ No newline at end of file diff --git a/DeskThing/src/components/Footer/Footer.tsx b/DeskThing/src/components/Footer/Footer.tsx index 94b67a3..973cd27 100644 --- a/DeskThing/src/components/Footer/Footer.tsx +++ b/DeskThing/src/components/Footer/Footer.tsx @@ -10,8 +10,10 @@ import { IconShuffle, IconRepeat, IconRepeatOne, -} from '../todothingUIcomponents'; -import { IconAlbum } from '../todothingUIcomponents'; + IconAlbum, + IconSkipForward15, + IconSkipBack15, +} from '../icons'; import getBackgroundColor, { findContrastColor } from '../../helpers/ColorExtractor'; @@ -202,13 +204,13 @@ const Footer: React.FC = () => { className="text-green-500" onClick={() => handleSendSet(AUDIO_REQUESTS.PREVIOUS, songData.id)} > - + {songData?.can_skip ? : } - - Response: {message} - - - - ); -}; - -export default Header; diff --git a/DeskThing/src/components/Overlay/Overlay.tsx b/DeskThing/src/components/Overlay/Overlay.tsx index 44c1cc4..1cdc23b 100644 --- a/DeskThing/src/components/Overlay/Overlay.tsx +++ b/DeskThing/src/components/Overlay/Overlay.tsx @@ -2,7 +2,6 @@ import {FC, ReactNode, useEffect, useState } from 'react'; import ButtonHelper, { Button, EventFlavour } from '../../helpers/ButtonHelper.ts'; import './Overlay.css'; -import Header from '../Header/Header' import Footer from '../Footer/Footer' import Volume from '../Volume/Volume' import AppSelector from '../AppSelector/AppSelector' @@ -73,7 +72,6 @@ const Overlay: FC = ({ children, currentView, apps, setCurrentView } return
{} -
{children}