Skip to content

Commit

Permalink
Merge pull request #127 from fosslife/master
Browse files Browse the repository at this point in the history
  • Loading branch information
Sparkenstein authored Nov 15, 2024
2 parents e45ea9e + 4684cd9 commit 983520d
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 7 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "devtools-x",
"version": "3.3.2",
"version": "3.3.3",
"license": "MIT",
"type": "module",
"scripts": {
Expand Down Expand Up @@ -37,8 +37,10 @@
"@tauri-apps/plugin-clipboard-manager": "^2.0.0",
"@tauri-apps/plugin-dialog": "~2",
"@tauri-apps/plugin-fs": "^2.0.1",
"@tauri-apps/plugin-process": "~2",
"@tauri-apps/plugin-sql": "^2.0.0",
"@tauri-apps/plugin-store": "^2.1.0",
"@tauri-apps/plugin-updater": "^2.0.0",
"@uiw/react-markdown-preview": "^5.1.1",
"angular-html-parser": "^5.2.0",
"chroma-js": "^2.4.2",
Expand Down
13 changes: 12 additions & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "devtools-x"
version = "3.3.2"
version = "3.3.3"
description = "Developer tools desktop application"
authors = ["Sparkenstein"]
license = "MIT"
Expand Down Expand Up @@ -42,6 +42,7 @@ base64 = "0.21.7"
flate2 = "1.0"
bardecoder = "0.5.0"
imageinfo = "0.7.17"
tauri-plugin-process = "2"

[dependencies.tauri-plugin-sql]
features = ["sqlite"] # or "postgres", or "mysql"
Expand Down
5 changes: 4 additions & 1 deletion src-tauri/capabilities/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"sql:allow-execute",
"dialog:default",
"fs:write-all",
"clipboard-manager:allow-write-text"
"clipboard-manager:allow-write-text",
"updater:default",
"updater:allow-check",
"process:allow-restart"
]
}
4 changes: 2 additions & 2 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
windows_subsystem = "windows"
)]

use std::convert::TryInto;
use std::env;
use tauri::{Manager, WebviewUrl, WebviewWindowBuilder};

Expand Down Expand Up @@ -148,6 +147,7 @@ fn main() {
];

tauri::Builder::default()
.plugin(tauri_plugin_process::init())
.plugin(
tauri_plugin_sql::Builder::default()
.add_migrations("sqlite:devtools.db", migrations)
Expand All @@ -172,7 +172,7 @@ fn main() {
#[cfg(desktop)]
let res = app
.handle()
.plugin(tauri_plugin_updater::Builder::new().build());
.plugin(tauri_plugin_updater::Builder::new().pubkey("dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IERCN0M1MDY1Q0QwRkM1OEUKUldTT3hRL05aVkI4MjhGUW9LSjhZMldoUmNSYmRNYnl0RGNrUW5NTk1lSmNtc2FJTE5NMUhRTzgK").build());
if res.is_err() {
println!("Error: {:?}", res.err());
}
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
},
"productName": "devtools-x",
"mainBinaryName": "devtools-x",
"version": "3.3.2",
"version": "3.3.3",
"identifier": "com.fosslife.devtoolsx",
"plugins": {
"sql": {
Expand Down
27 changes: 27 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
PanelGroup,
PanelResizeHandle,
} from "react-resizable-panels";
import { check } from "@tauri-apps/plugin-updater";

// NOTE: keep Num converter here, do not lazy load. there's a rare crashing bug.
import Nums from "./Features/number-tools/Nums";
Expand All @@ -36,6 +37,8 @@ import { Settings } from "./Layout/Settings";
import { useDisclosure, useWindowEvent } from "@mantine/hooks";
import { trackOtherEvent, trackPageView } from "./utils/analytics";
import { db } from "./utils";
import { ask, message } from "@tauri-apps/plugin-dialog";
import { relaunch } from "@tauri-apps/plugin-process";

// Lazy load components
const Welcome = loadable(() => import("./Components/Welcome"));
Expand Down Expand Up @@ -154,6 +157,30 @@ function App() {

useEffect(() => {
async function init() {
const update = await check();
if (update === null) {
await message("Failed to check for updates.\nPlease try again later.", {
title: "Error",
kind: "error",
okLabel: "OK",
});
return;
} else 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();
}
}

const isFirstTime = await db.get("firstTime");
if (isFirstTime === true) {
tour.start();
Expand Down
14 changes: 14 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1912,6 +1912,13 @@
dependencies:
"@tauri-apps/api" "^2.0.0"

"@tauri-apps/plugin-process@~2":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@tauri-apps/plugin-process/-/plugin-process-2.0.0.tgz#002fd73f0d7b1ae2a5aacf442aa657e83dc2960b"
integrity sha512-OYzi0GnkrF4NAnsHZU7U3tjSoP0PbeAlO7T1Z+vJoBUH9sFQ1NSLqWYWQyf8hcb3gVWe7P1JggjiskO+LST1ug==
dependencies:
"@tauri-apps/api" "^2.0.0"

"@tauri-apps/plugin-sql@^2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@tauri-apps/plugin-sql/-/plugin-sql-2.0.0.tgz#ff8a2edea726ced140782d11f3fcfe9be2bde75f"
Expand All @@ -1926,6 +1933,13 @@
dependencies:
"@tauri-apps/api" "^2.0.0"

"@tauri-apps/plugin-updater@^2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@tauri-apps/plugin-updater/-/plugin-updater-2.0.0.tgz#38cb3e735da28cd1726a3c0e13f032117e4db111"
integrity sha512-N0cl71g7RPr7zK2Fe5aoIwzw14NcdLcz7XMGFWZVjprsqgDRWoxbnUkknyCQMZthjhGkppCd/wN2MIsUz+eAhQ==
dependencies:
"@tauri-apps/api" "^2.0.0"

"@tsconfig/node10@^1.0.7":
version "1.0.11"
resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.11.tgz#6ee46400685f130e278128c7b38b7e031ff5b2f2"
Expand Down

0 comments on commit 983520d

Please sign in to comment.