Skip to content

Commit 983520d

Browse files
authored
Merge pull request #127 from fosslife/master
2 parents e45ea9e + 4684cd9 commit 983520d

File tree

8 files changed

+65
-7
lines changed

8 files changed

+65
-7
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "devtools-x",
3-
"version": "3.3.2",
3+
"version": "3.3.3",
44
"license": "MIT",
55
"type": "module",
66
"scripts": {
@@ -37,8 +37,10 @@
3737
"@tauri-apps/plugin-clipboard-manager": "^2.0.0",
3838
"@tauri-apps/plugin-dialog": "~2",
3939
"@tauri-apps/plugin-fs": "^2.0.1",
40+
"@tauri-apps/plugin-process": "~2",
4041
"@tauri-apps/plugin-sql": "^2.0.0",
4142
"@tauri-apps/plugin-store": "^2.1.0",
43+
"@tauri-apps/plugin-updater": "^2.0.0",
4244
"@uiw/react-markdown-preview": "^5.1.1",
4345
"angular-html-parser": "^5.2.0",
4446
"chroma-js": "^2.4.2",

src-tauri/Cargo.lock

Lines changed: 12 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "devtools-x"
3-
version = "3.3.2"
3+
version = "3.3.3"
44
description = "Developer tools desktop application"
55
authors = ["Sparkenstein"]
66
license = "MIT"
@@ -42,6 +42,7 @@ base64 = "0.21.7"
4242
flate2 = "1.0"
4343
bardecoder = "0.5.0"
4444
imageinfo = "0.7.17"
45+
tauri-plugin-process = "2"
4546

4647
[dependencies.tauri-plugin-sql]
4748
features = ["sqlite"] # or "postgres", or "mysql"

src-tauri/capabilities/default.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
"sql:allow-execute",
99
"dialog:default",
1010
"fs:write-all",
11-
"clipboard-manager:allow-write-text"
11+
"clipboard-manager:allow-write-text",
12+
"updater:default",
13+
"updater:allow-check",
14+
"process:allow-restart"
1215
]
1316
}

src-tauri/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
windows_subsystem = "windows"
44
)]
55

6-
use std::convert::TryInto;
76
use std::env;
87
use tauri::{Manager, WebviewUrl, WebviewWindowBuilder};
98

@@ -148,6 +147,7 @@ fn main() {
148147
];
149148

150149
tauri::Builder::default()
150+
.plugin(tauri_plugin_process::init())
151151
.plugin(
152152
tauri_plugin_sql::Builder::default()
153153
.add_migrations("sqlite:devtools.db", migrations)
@@ -172,7 +172,7 @@ fn main() {
172172
#[cfg(desktop)]
173173
let res = app
174174
.handle()
175-
.plugin(tauri_plugin_updater::Builder::new().build());
175+
.plugin(tauri_plugin_updater::Builder::new().pubkey("dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IERCN0M1MDY1Q0QwRkM1OEUKUldTT3hRL05aVkI4MjhGUW9LSjhZMldoUmNSYmRNYnl0RGNrUW5NTk1lSmNtc2FJTE5NMUhRTzgK").build());
176176
if res.is_err() {
177177
println!("Error: {:?}", res.err());
178178
}

src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
},
4545
"productName": "devtools-x",
4646
"mainBinaryName": "devtools-x",
47-
"version": "3.3.2",
47+
"version": "3.3.3",
4848
"identifier": "com.fosslife.devtoolsx",
4949
"plugins": {
5050
"sql": {

src/App.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {
2828
PanelGroup,
2929
PanelResizeHandle,
3030
} from "react-resizable-panels";
31+
import { check } from "@tauri-apps/plugin-updater";
3132

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

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

155158
useEffect(() => {
156159
async function init() {
160+
const update = await check();
161+
if (update === null) {
162+
await message("Failed to check for updates.\nPlease try again later.", {
163+
title: "Error",
164+
kind: "error",
165+
okLabel: "OK",
166+
});
167+
return;
168+
} else if (update?.available) {
169+
const yes = await ask(
170+
`Update to ${update.version} is available!\n\nRelease notes: ${update.body}`,
171+
{
172+
title: "Update Available",
173+
kind: "info",
174+
okLabel: "Update",
175+
cancelLabel: "Cancel",
176+
}
177+
);
178+
if (yes) {
179+
await update.downloadAndInstall();
180+
await relaunch();
181+
}
182+
}
183+
157184
const isFirstTime = await db.get("firstTime");
158185
if (isFirstTime === true) {
159186
tour.start();

yarn.lock

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1912,6 +1912,13 @@
19121912
dependencies:
19131913
"@tauri-apps/api" "^2.0.0"
19141914

1915+
"@tauri-apps/plugin-process@~2":
1916+
version "2.0.0"
1917+
resolved "https://registry.yarnpkg.com/@tauri-apps/plugin-process/-/plugin-process-2.0.0.tgz#002fd73f0d7b1ae2a5aacf442aa657e83dc2960b"
1918+
integrity sha512-OYzi0GnkrF4NAnsHZU7U3tjSoP0PbeAlO7T1Z+vJoBUH9sFQ1NSLqWYWQyf8hcb3gVWe7P1JggjiskO+LST1ug==
1919+
dependencies:
1920+
"@tauri-apps/api" "^2.0.0"
1921+
19151922
"@tauri-apps/plugin-sql@^2.0.0":
19161923
version "2.0.0"
19171924
resolved "https://registry.yarnpkg.com/@tauri-apps/plugin-sql/-/plugin-sql-2.0.0.tgz#ff8a2edea726ced140782d11f3fcfe9be2bde75f"
@@ -1926,6 +1933,13 @@
19261933
dependencies:
19271934
"@tauri-apps/api" "^2.0.0"
19281935

1936+
"@tauri-apps/plugin-updater@^2.0.0":
1937+
version "2.0.0"
1938+
resolved "https://registry.yarnpkg.com/@tauri-apps/plugin-updater/-/plugin-updater-2.0.0.tgz#38cb3e735da28cd1726a3c0e13f032117e4db111"
1939+
integrity sha512-N0cl71g7RPr7zK2Fe5aoIwzw14NcdLcz7XMGFWZVjprsqgDRWoxbnUkknyCQMZthjhGkppCd/wN2MIsUz+eAhQ==
1940+
dependencies:
1941+
"@tauri-apps/api" "^2.0.0"
1942+
19291943
"@tsconfig/node10@^1.0.7":
19301944
version "1.0.11"
19311945
resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.11.tgz#6ee46400685f130e278128c7b38b7e031ff5b2f2"

0 commit comments

Comments
 (0)