Compare commits

..

2 Commits

Author SHA1 Message Date
efd3c83193 fix: missing check for update 2024-11-03 13:50:52 +07:00
85fa1e2359 fix: missing check for update 2024-11-03 13:50:31 +07:00
9 changed files with 50 additions and 84 deletions

View File

@@ -4,10 +4,7 @@
"enabled": true "enabled": true
}, },
"files": { "files": {
"ignore": [ "ignore": ["./src/routes.gen.ts", "./src/commands.gen.ts"]
"./src/routes.gen.ts",
"./src/commands.gen.ts"
]
}, },
"linter": { "linter": {
"enabled": true, "enabled": true,

View File

@@ -2,13 +2,8 @@
"$schema": "../gen/schemas/desktop-schema.json", "$schema": "../gen/schemas/desktop-schema.json",
"identifier": "window", "identifier": "window",
"description": "Capability for the desktop", "description": "Capability for the desktop",
"platforms": [ "platforms": ["macOS", "windows"],
"macOS", "windows": ["*"],
"windows"
],
"windows": [
"*"
],
"permissions": [ "permissions": [
"core:path:default", "core:path:default",
"core:event:default", "core:event:default",

View File

@@ -1,7 +1,7 @@
{ {
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json", "$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"productName": "Lume", "productName": "Lume",
"version": "24.11.1", "version": "24.11.2",
"identifier": "nu.lume.Lume", "identifier": "nu.lume.Lume",
"build": { "build": {
"beforeDevCommand": "pnpm dev", "beforeDevCommand": "pnpm dev",

View File

@@ -13,9 +13,7 @@
"hiddenTitle": true, "hiddenTitle": true,
"transparent": true, "transparent": true,
"windowEffects": { "windowEffects": {
"effects": [ "effects": ["underWindowBackground"]
"underWindowBackground"
]
} }
} }
] ]

View File

@@ -3,11 +3,9 @@ import type {
MaybePromise, MaybePromise,
PersistedQuery, PersistedQuery,
} from "@tanstack/query-persist-client-core"; } from "@tanstack/query-persist-client-core";
import { ask, message, open } from "@tauri-apps/plugin-dialog"; import { open } from "@tauri-apps/plugin-dialog";
import { readFile } from "@tauri-apps/plugin-fs"; import { readFile } from "@tauri-apps/plugin-fs";
import { relaunch } from "@tauri-apps/plugin-process";
import type { Store as TauriStore } from "@tauri-apps/plugin-store"; import type { Store as TauriStore } from "@tauri-apps/plugin-store";
import { check } from "@tauri-apps/plugin-updater";
import { BitcoinUnit } from "bitcoin-units"; import { BitcoinUnit } from "bitcoin-units";
import { type ClassValue, clsx } from "clsx"; import { type ClassValue, clsx } from "clsx";
import dayjs from "dayjs"; import dayjs from "dayjs";
@@ -170,41 +168,6 @@ export function decodeZapInvoice(tags: string[][]) {
} }
} }
export async function checkForAppUpdates(silent: boolean) {
const update = await check();
if (!update) {
if (silent) return;
await message("You are on the latest version. Stay awesome!", {
title: "No Update Available",
kind: "info",
okLabel: "OK",
});
return;
}
if (update?.available) {
const yes = await ask(
`Update to ${update.version} is available!\n\nRelease notes: ${update.body}`,
{
title: "Update Available",
kind: "info",
okLabel: "Update",
cancelLabel: "Cancel",
},
);
if (yes) {
await update.downloadAndInstall();
await relaunch();
}
return;
}
}
export async function upload(filePath?: string) { export async function upload(filePath?: string) {
const allowExts = [ const allowExts = [
"png", "png",

View File

@@ -1,14 +1,41 @@
import { commands } from '@/commands.gen' import { commands } from "@/commands.gen";
import { createFileRoute, redirect } from '@tanstack/react-router' import { createFileRoute, redirect } from "@tanstack/react-router";
import { ask } from "@tauri-apps/plugin-dialog";
import { relaunch } from "@tauri-apps/plugin-process";
import { check } from "@tauri-apps/plugin-updater";
export const Route = createFileRoute('/_app')({ async function checkForAppUpdates() {
beforeLoad: async () => { const update = await check();
const accounts = await commands.getAccounts()
if (!accounts.length) { if (update?.available) {
throw redirect({ to: '/new', replace: true }) const yes = await ask(
`Update to ${update.version} is available!\n\nRelease notes: ${update.body}`,
{
title: "Update Available",
kind: "info",
okLabel: "Update",
cancelLabel: "Cancel",
},
);
if (yes) {
await update.downloadAndInstall();
await relaunch();
} }
return { accounts } return;
}
}
export const Route = createFileRoute("/_app")({
beforeLoad: async () => {
await checkForAppUpdates();
const accounts = await commands.getAccounts();
if (!accounts.length) {
throw redirect({ to: "/new", replace: true });
}
return { accounts };
}, },
}) });

View File

@@ -1,10 +1,7 @@
/** @type {import('tailwindcss').Config} */ /** @type {import('tailwindcss').Config} */
export default { export default {
content: [ content: ["./src/**/*.{js,ts,jsx,tsx}", "index.html"],
"./src/**/*.{js,ts,jsx,tsx}",
"index.html",
],
theme: { theme: {
extend: { extend: {
keyframes: { keyframes: {

View File

@@ -2,19 +2,12 @@
"compilerOptions": { "compilerOptions": {
"target": "ESNext", "target": "ESNext",
"useDefineForClassFields": true, "useDefineForClassFields": true,
"lib": [ "lib": ["ESNext", "ES2020", "DOM", "DOM.Iterable"],
"ESNext",
"ES2020",
"DOM",
"DOM.Iterable"
],
"module": "ESNext", "module": "ESNext",
"skipLibCheck": true, "skipLibCheck": true,
"baseUrl": "./", "baseUrl": "./",
"paths": { "paths": {
"@/*": [ "@/*": ["./src/*"]
"./src/*"
]
}, },
"moduleResolution": "bundler", "moduleResolution": "bundler",
"allowImportingTsExtensions": true, "allowImportingTsExtensions": true,
@@ -26,11 +19,9 @@
"noUnusedLocals": true, "noUnusedLocals": true,
"noImplicitAny": false, "noImplicitAny": false,
"noUnusedParameters": true, "noUnusedParameters": true,
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true
}, },
"include": [ "include": ["src"],
"src"
],
"references": [ "references": [
{ {
"path": "./tsconfig.node.json" "path": "./tsconfig.node.json"

View File

@@ -6,7 +6,5 @@
"moduleResolution": "bundler", "moduleResolution": "bundler",
"allowSyntheticDefaultImports": true "allowSyntheticDefaultImports": true
}, },
"include": [ "include": ["vite.config.ts"]
"vite.config.ts"
]
} }