From 9838ba46799ba0bb9227dbd920e2f771e169db92 Mon Sep 17 00:00:00 2001 From: David Newhall II Date: Sun, 7 Apr 2024 01:32:08 -0700 Subject: [PATCH] Update some things --- frontend/package-lock.json | 4 +-- frontend/package.json | 2 +- frontend/package.json.md5 | 2 +- frontend/src/About.svelte | 14 ++++---- frontend/src/Navbar.svelte | 8 ++--- .../src/Starr/Actions/DownloadClients.svelte | 5 +-- frontend/src/Starr/Actions/ImportLists.svelte | 2 +- frontend/src/Starr/Actions/Index.svelte | 23 +++++++------ frontend/src/Starr/Actions/Indexers.svelte | 5 +-- .../Actions/fragments/configModal.svelte | 11 +++---- .../src/Starr/Actions/fragments/footer.svelte | 10 +++--- .../Starr/Actions/fragments/modalInput.svelte | 2 +- .../Actions/fragments/selectAllHeader.svelte | 2 +- .../Actions/fragments/selectAllRow.svelte | 4 +-- .../Starr/Actions/fragments/tableInput.svelte | 2 +- .../src/Starr/Actions/fragments/tabs.svelte | 2 +- frontend/src/Starr/Database/Index.svelte | 22 ++++++------- .../src/Starr/Database/Migrator/Form.svelte | 32 +++++++++---------- frontend/src/libs/Input.svelte | 14 ++++---- frontend/src/libs/Link.svelte | 4 +-- frontend/vite.config.ts | 11 +++---- wails.json | 4 +-- 22 files changed, 92 insertions(+), 93 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 2318dab..7423b96 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "toolbarr", - "version": "0.1.0", + "version": "0.1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "toolbarr", - "version": "0.1.0", + "version": "0.1.1", "dependencies": { "svelte-i18n": "4.0.0" }, diff --git a/frontend/package.json b/frontend/package.json index a51794f..ba7746b 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,7 +1,7 @@ { "name": "toolbarr", "private": true, - "version": "0.1.0", + "version": "0.1.1", "type": "module", "scripts": { "dev": "vite", diff --git a/frontend/package.json.md5 b/frontend/package.json.md5 index e06fb8b..01a4d92 100755 --- a/frontend/package.json.md5 +++ b/frontend/package.json.md5 @@ -1 +1 @@ -72cdc17b0ff549d7d10e1eaaa2ceed8a \ No newline at end of file +f802a390cff90365a158552cd02aa3eb \ No newline at end of file diff --git a/frontend/src/About.svelte b/frontend/src/About.svelte index d13b420..eeafead 100644 --- a/frontend/src/About.svelte +++ b/frontend/src/About.svelte @@ -29,7 +29,7 @@ let progress = 0.0 let msg = $_("aboutPage.justWaitin") - function checkUpdate(e) { + function checkUpdate(e: MouseEvent) { e.preventDefault() update.Downloading = $_("aboutPage.Checkingforupdate") @@ -48,7 +48,7 @@ }) } - function installUpdate(e) { + function installUpdate(e: MouseEvent) { e.preventDefault() update.Downloading = $_("aboutPage.Launchinginstaller") LaunchInstaller(release.FilePath).then(result => { @@ -56,12 +56,12 @@ }) } - function openFolder(e) { + function openFolder(e: MouseEvent) { e.preventDefault() OpenFolder(release.FilePath).then(msg => (toast("info", msg))) } - function downloadUpdate(e) { + function downloadUpdate(e: MouseEvent) { e.preventDefault() update.Downloading = $_("aboutPage.Downloadingtheupdate") @@ -85,8 +85,8 @@ }) } - $: timer = (new Date()).getTime()/1000-$app.StartTime - onInterval(() => { timer = (new Date()).getTime()/1000-$app.StartTime }, 1) + $: timer = (new Date()).getTime()/1000-($app.StartTime?$app.StartTime:0) + onInterval(() => { timer = (new Date()).getTime()/1000-($app.StartTime?$app.StartTime:0)}, 1) /* All of this is to create a "running" timer. */ $: days = Math.floor(timer / 86400); $: hours = Math.floor((timer - (days * 86400)) / 3600); @@ -133,7 +133,7 @@

{$_("aboutPage.AppInfo")}

- +
diff --git a/frontend/src/Navbar.svelte b/frontend/src/Navbar.svelte index c2d4ae1..cb532f7 100644 --- a/frontend/src/Navbar.svelte +++ b/frontend/src/Navbar.svelte @@ -34,7 +34,7 @@ import icons from "/src/assets/bootstrap-icons.css?url" let isOpen = false // nav open/closer tracker (mobile) - $: pageName = $app.Title + $: pageName = $app.Title ? $app.Title : "Unknown" // Keep dark-mode class up to date with dark config setting. $: $conf.Dark ? window.document.body.classList.add("dark-mode") : window.document.body.classList.remove("dark-mode") @@ -50,7 +50,7 @@ }) /* Prevent right-click when dev mode is disabled. */ - function blockRightClick(e) { if (!$conf.DevMode) e.preventDefault() } + function blockRightClick(e: MouseEvent) { if (!$conf.DevMode) e.preventDefault() } document.removeEventListener("contextmenu", blockRightClick) document.addEventListener("contextmenu", blockRightClick) @@ -69,7 +69,7 @@ {#if Object.keys($conf).length > 0 && $isReady == true} - (pageName = $app.Title,e.preventDefault())}> + (pageName =$app.Title ? $app.Title : "Unknown",e.preventDefault())}> {$_("words."+pageName) == "words."+pageName ? pageName : $_("words."+pageName)} @@ -92,7 +92,7 @@ {$_("words.Configuration")} - + nav("Settings")}> {$_("words.Settings")} diff --git a/frontend/src/Starr/Actions/DownloadClients.svelte b/frontend/src/Starr/Actions/DownloadClients.svelte index df7f1c6..6e01bb5 100644 --- a/frontend/src/Starr/Actions/DownloadClients.svelte +++ b/frontend/src/Starr/Actions/DownloadClients.svelte @@ -1,9 +1,10 @@ @@ -33,7 +32,7 @@ - + {id} {name} diff --git a/frontend/src/Starr/Actions/fragments/footer.svelte b/frontend/src/Starr/Actions/fragments/footer.svelte index 414568d..dd63847 100644 --- a/frontend/src/Starr/Actions/fragments/footer.svelte +++ b/frontend/src/Starr/Actions/fragments/footer.svelte @@ -22,13 +22,13 @@ let goodMsg = "" $: selectedCount = count(selected) // How many items are selected. $: unSaved = JSON.stringify(form) !== str // True when something changed. - let button + let button: any - function showMsg(idx, msg, data) { + function showMsg(idx: number, msg: string, data) { goodMsg += `
  • ${$_("instances.SuccessMsg", {values:{"msg": msg}})}
  • ` let kind = "update" - if (data) { // update client (repalce in place) + if (data) { // update client (replace in place) form[idx] = JSON.parse(JSON.stringify(data)) } else { // delete list item (remove in place) form.splice(idx, 1) @@ -40,12 +40,12 @@ dispatch(kind) } - function showError(idx, err) { + function showError(idx: number, err: string) { form[idx] = JSON.parse(JSON.stringify(info[idx])) badMsg += `
  • ${$_("instances.ErrorMsg", {values:{"msg": err}})}
  • ` } - async function updateItems(force) { + async function updateItems(force: boolean) { toast("info", $_("instances.Updating"+tab.id)) goodMsg = badMsg = "" updating = true diff --git a/frontend/src/Starr/Actions/fragments/modalInput.svelte b/frontend/src/Starr/Actions/fragments/modalInput.svelte index eae9179..61e093c 100644 --- a/frontend/src/Starr/Actions/fragments/modalInput.svelte +++ b/frontend/src/Starr/Actions/fragments/modalInput.svelte @@ -13,7 +13,7 @@ import Fa from "svelte-fa" import { faGroupArrowsRotate } from "@fortawesome/free-solid-svg-icons" import { Button, Input, InputGroup, InputGroupText, Tooltip } from "@sveltestrap/sveltestrap" - import type { InputType } from "sveltestrap/src/Input" + import type { InputType } from "@sveltestrap/sveltestrap" const vals = { values:{"starrApp": starrApp} } $: tooltip = desc ? $_(desc, vals) : $_(`instances.${field}Desc`, vals) diff --git a/frontend/src/Starr/Actions/fragments/selectAllHeader.svelte b/frontend/src/Starr/Actions/fragments/selectAllHeader.svelte index 5701ce4..2c87fc0 100644 --- a/frontend/src/Starr/Actions/fragments/selectAllHeader.svelte +++ b/frontend/src/Starr/Actions/fragments/selectAllHeader.svelte @@ -1,5 +1,5 @@
    diff --git a/frontend/src/Starr/Actions/fragments/tableInput.svelte b/frontend/src/Starr/Actions/fragments/tableInput.svelte index 6b6b37a..3bbd1ed 100644 --- a/frontend/src/Starr/Actions/fragments/tableInput.svelte +++ b/frontend/src/Starr/Actions/fragments/tableInput.svelte @@ -10,7 +10,7 @@ import { _ } from "/src/libs/Translate.svelte" import { Button, Input, InputGroup, Tooltip } from "@sveltestrap/sveltestrap" - import type { InputType } from "sveltestrap/src/Input" + import type { InputType } from "@sveltestrap/sveltestrap" function edit(editable: boolean) { plaintext = !editable diff --git a/frontend/src/Starr/Actions/fragments/tabs.svelte b/frontend/src/Starr/Actions/fragments/tabs.svelte index e082da0..61127c7 100644 --- a/frontend/src/Starr/Actions/fragments/tabs.svelte +++ b/frontend/src/Starr/Actions/fragments/tabs.svelte @@ -63,7 +63,7 @@ import T, { _ } from "../../../libs/Translate.svelte" import { Fade, Nav, NavItem, NavLink } from "@sveltestrap/sveltestrap" - function changeTab(e, newTab) { + function changeTab(e: MouseEvent, newTab: Tab) { e.preventDefault() if (!updating) tab = newTab } diff --git a/frontend/src/Starr/Database/Index.svelte b/frontend/src/Starr/Database/Index.svelte index 7578b87..effc47f 100644 --- a/frontend/src/Starr/Database/Index.svelte +++ b/frontend/src/Starr/Database/Index.svelte @@ -4,7 +4,7 @@ import Applogo from "/src/libs/Applogo.svelte" import { Accordion, AccordionItem, Badge, Input, InputGroup, InputGroupText } from "@sveltestrap/sveltestrap" - import type { Instance, StarrApp } from "/src/libs/config" + import type { StarrApp } from "/src/libs/config" import { conf } from "/src/libs/config" import T, { _ } from "/src/libs/Translate.svelte" import Inspector from "./Inspector.svelte" @@ -16,9 +16,13 @@ if (starrApp != "Prowlarr") tabs.push({title: "instances.FilesystemPathsMigrator", target: Migrator}) tabs.push({title: "instances.SQLite3DatabaseInspector", target: Inspector}) // Start with default instance. - let instance: Instance = $conf.Instances[starrApp] ? $conf.Instances[starrApp][$conf.Instance[starrApp]] : undefined let activeTab = tabs[0] let showTitle = true + + let instance = $conf.Instances[starrApp][$conf.Instance[starrApp]] + $: if (!$conf.Instances[starrApp].includes(instance)) { + instance = $conf.Instances[starrApp][0] + } @@ -44,15 +48,11 @@ {$_("words.Instance")} - - {#if $conf.Instances[starrApp] != null} - {#each $conf.Instances[starrApp] as instance} - - {/each} - {#if $conf.Instances[starrApp].length == 0} - - {/if} - {:else} + + {#each $conf.Instances[starrApp] as i} + + {/each} + {#if $conf.Instances[starrApp].length < 1} {/if} diff --git a/frontend/src/Starr/Database/Migrator/Form.svelte b/frontend/src/Starr/Database/Migrator/Form.svelte index 281bf66..25766b2 100644 --- a/frontend/src/Starr/Database/Migrator/Form.svelte +++ b/frontend/src/Starr/Database/Migrator/Form.svelte @@ -30,18 +30,18 @@ import { EventsOff, EventsOn } from "/wailsjs/runtime/runtime" import { onOnce } from "/src/libs/funcs" import Loading from "/src/Starr/loading.svelte" - import type { Color } from "sveltestrap/src/shared" + import type { Color } from "@sveltestrap/sveltestrap/src/shared" // Used when updating root folder paths. let newPath: string let oldPath: string // Progress for root folder updates. - let progress = undefined - let totals + let progress: any = undefined + let totals: any // Used for root folder and recycle bin changes. let updating = false // Controls the Modal for updating root folder paths. - let action + let action: any // Message shows up after an action completes. let msg = "" let msgType: Color @@ -74,7 +74,7 @@ if (resp.Info) {info = resp.Info; ewPa()} // update db info } - function error(err) { + function error(err: string) { disableEvents() // disable events action = undefined // close action modal msgType = "danger" // update message color @@ -103,7 +103,7 @@ EventsOn("DBfileCount", v => progress = { ...progress, ...v }) } - function updateInvalid(table) { + function updateInvalid(table: string) { startEvents() UpdateInvalidItems(instance, table, newPath, invalidIDs[table]).then( resp => { @@ -122,49 +122,49 @@ UpdateRootFolder(instance, oldPath, newPath).then(success, error) } - function pickFolder(e) { + function pickFolder(e: MouseEvent) { e.preventDefault() - PickFolder($app.Home).then((path) => { + PickFolder($app.Home?$app.Home:"/").then((path) => { // PickFolder does not append a slash, and we need one here, so add it. if (path != "") newPath = path + ($app.IsWindows?"\\":"/") }) } - function updateRecycleBin(e) { + function updateRecycleBin(e: MouseEvent) { e.preventDefault() updating = true UpdateRecycleBin(instance, newPath).then(success, error) } - function unsetReycleBin(e) { + function unsetReycleBin(e: MouseEvent) { e.preventDefault() updating = true UpdateRecycleBin(instance, "").then(success, error) } - function openRecycleChanger(e) { + function openRecycleChanger(e: MouseEvent) { e.preventDefault() oldPath = newPath = info.Recycle action = updateRecycleBin } - function deleteFolder(rf) { + function deleteFolder(rf: string) { updating = true DeleteRootFolder(instance, rf).then(success, error) } - function selectAll(table, all) { + function selectAll(table: string, all: boolean) { Object.keys(invalidIDs[table]).map(id => invalidIDs[table][id] = all) } - function openInvalidModal(e, table) { + function openInvalidModal(e: MouseEvent, table: string) { e.preventDefault() invalidModals[table] = true newPath = info.RootFolders[0] ? info.RootFolders[0] : "" } - function onkeydown(e) { if (e.key == "Escape") e.preventDefault() } - function onkeyup(e) { + function onkeydown(e: KeyboardEvent) { if (e.key == "Escape") e.preventDefault() } + function onkeyup(e: KeyboardEvent) { if (e.key != "Escape") return e.preventDefault() // Close all modals when escape is pressed. diff --git a/frontend/src/libs/Input.svelte b/frontend/src/libs/Input.svelte index b29c163..d954b99 100644 --- a/frontend/src/libs/Input.svelte +++ b/frontend/src/libs/Input.svelte @@ -1,5 +1,7 @@ diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 8b7e02c..b1077b8 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -1,16 +1,13 @@ import { defineConfig } from "vite" import { svelte } from "@sveltejs/vite-plugin-svelte" -const experimental = { - dynamicCompileOptions({code}) { - return { customElement: isWebComponentSvelte(code) } - } -} // https://github.com/sveltejs/vite-plugin-svelte/issues/270#issuecomment-1033190138 export default defineConfig({ plugins: [ svelte({ - experimental: experimental, + dynamicCompileOptions({code}) { + return { customElement: isWebComponentSvelte(code) } + }, })] }) @@ -20,7 +17,7 @@ function isWebComponentSvelte(code) { const svelteOptionsIdx = code.indexOf('',svelteOptionsIdx); return tagOptionIdx > svelteOptionsIdx && tagOptionIdx < svelteOptionsEndIdx diff --git a/wails.json b/wails.json index 37366ab..2567846 100644 --- a/wails.json +++ b/wails.json @@ -12,8 +12,8 @@ "info": { "companyName": "Notifiarr", "productName": "Toolbarr", - "productVersion": "0.1.0", - "copyright": "Copyright 2023 Notifiarr (https://notifiarr.com)", + "productVersion": "0.1.1", + "copyright": "Copyright 2023-2024 Notifiarr, LLC (https://notifiarr.com)", "comments": "The starr of the show." }, "runNonNativeBuildHooks": true,
    {$_("words.Version")}v{$app.Version}-{$app.Revision} ({$app.GoVersion})
    {$_("words.Branch")}{$app.Branch}
    {$_("words.Created")}{$app.BuildDate} {$_("words.by")} {$app.BuildUser}