Skip to content

Commit b6eae58

Browse files
authored
feat(desktop): enable tauri updater dialog (#175)
* enable tauri updater dialog * remove useless message in build_info output
1 parent cce1d57 commit b6eae58

5 files changed

Lines changed: 83 additions & 53 deletions

File tree

nym-vpn-desktop/src-tauri/Cargo.lock

Lines changed: 54 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nym-vpn-desktop/src-tauri/src/cli.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,5 @@ git branch: {}
5959
git.commit_timestamp,
6060
git.branch.as_ref().unwrap_or(&"".to_string())
6161
);
62-
} else {
63-
println!("git: not available");
6462
}
6563
}

nym-vpn-desktop/src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"tauri": {
1313
"updater": {
1414
"active": true,
15-
"dialog": false,
15+
"dialog": true,
1616
"endpoints": ["https://nymvpn.net/api/updater/vpn"],
1717
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDU3RjI2N0FFRUEyRERGOEQKUldTTjN5M3FybWZ5VjhxOFRsLzQ2c1N0NW1PVVNxVEVVQkszYjZHc3RtcEFDOW1ZN2lIN1NGdk0K"
1818
},

nym-vpn-desktop/src/log/index.ts

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,60 @@
11
import { invoke } from '@tauri-apps/api';
22

3-
type Level = 'Trace' | 'Debug' | 'Info' | 'Warn' | 'Error';
4-
5-
async function logJs(level: Level, message: string) {
6-
try {
7-
await invoke<void>('log_js', { level, message });
8-
} catch (e) {
9-
console.error(`invoke log_js failed: ${e}`);
10-
}
11-
}
3+
export type Level = 'Trace' | 'Debug' | 'Info' | 'Warn' | 'Error';
124

135
/**
146
* Rust logger
157
*/
16-
const logu = {
8+
export interface Logu {
179
/**
1810
* Log a `trace` message
1911
*
2012
* @param msg - The message to log
2113
*/
22-
trace: (msg: string) => logJs('Trace', msg),
14+
readonly trace: (msg: string) => void;
2315
/**
2416
* Log a `debug` message
2517
*
2618
* @param msg - The message to log
2719
*/
28-
debug: (msg: string) => logJs('Debug', msg),
20+
readonly debug: (msg: string) => void;
2921
/**
3022
* Log an `info` message
3123
*
3224
* @param msg - The message to log
3325
*/
34-
info: (msg: string) => logJs('Info', msg),
26+
readonly info: (msg: string) => void;
3527
/**
3628
* Log a `warn` message
3729
*
3830
* @param msg - The message to log
3931
*/
40-
warn: (msg: string) => logJs('Warn', msg),
32+
readonly warn: (msg: string) => void;
4133
/**
4234
* Log an `error` message
4335
*
4436
* @param msg - The message to log
4537
*/
38+
readonly error: (msg: string) => void;
39+
}
40+
41+
async function logJs(level: Level, message: string) {
42+
try {
43+
await invoke<void>('log_js', { level, message });
44+
} catch (e) {
45+
console.error(`invoke log_js failed: ${e}`);
46+
}
47+
}
48+
49+
/**
50+
* Rust logger
51+
*/
52+
const logu: Logu = Object.freeze({
53+
trace: (msg: string) => logJs('Trace', msg),
54+
debug: (msg: string) => logJs('Debug', msg),
55+
info: (msg: string) => logJs('Info', msg),
56+
warn: (msg: string) => logJs('Warn', msg),
4657
error: (msg: string) => logJs('Error', msg),
47-
};
58+
});
4859

4960
export default logu;

nym-vpn-desktop/src/sentry.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ async function initSentry() {
2121

2222
if (!dsn) {
2323
console.warn(`unable to initialize sentry, APP_SENTRY_DSN env var not set`);
24-
await logu.warn('Sentry DSN not set');
24+
logu.warn('JS Sentry DSN not set, monitoring disabled');
2525
return;
2626
}
27-
await logu.info(`Sentry DSN: ${dsn}`);
27+
logu.info(`JS Sentry monitoring enabled`);
2828
console.log('⚠ performance monitoring and error reporting enabled');
2929
console.log('initializing sentry');
3030

0 commit comments

Comments
 (0)