Skip to content

Commit 9554ca8

Browse files
committed
[common] bump: all dep versions & fix: several bugs
1 parent 1d50ad9 commit 9554ca8

18 files changed

Lines changed: 1510 additions & 2070 deletions

File tree

Cargo.lock

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

apps/app/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@
1818
"@repo/configs": "workspace:*",
1919
"@repo/shared": "workspace:*",
2020
"@repo/ui": "workspace:*",
21-
"@tauri-apps/api": "^2.9.1",
21+
"@tauri-apps/api": "^2.10.1",
2222
"@tauri-apps/plugin-notification": "~2.3.3",
2323
"@tauri-apps/plugin-opener": "~2.5.3",
2424
"@tauri-apps/plugin-os": "~2.3.2",
2525
"@tauri-apps/plugin-process": "~2.3.1",
26-
"eslint": "^9.39.2",
27-
"vue": "^3.5.27"
26+
"eslint": "^10.0.0",
27+
"vue": "^3.5.28"
2828
},
2929
"devDependencies": {
30-
"@rsbuild/core": "^1.7.2",
31-
"@tauri-apps/cli": "^2.9.6",
30+
"@rsbuild/core": "^1.7.3",
31+
"@tauri-apps/cli": "^2.10.0",
3232
"typescript": "^5.9.3",
33-
"vue-tsc": "^2.2.12"
33+
"vue-tsc": "^3.2.4"
3434
}
3535
}

apps/app/src-tauri/Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "mcsl_future_tauri"
33
version = "0.1.0"
4-
edition = "2021"
4+
edition = "2024"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

@@ -16,8 +16,8 @@ crate-type = ["staticlib", "cdylib", "rlib"]
1616
tauri-build = { version = "2", features = [] }
1717

1818
[dependencies]
19-
tauri = { version = "2", features = [] }
20-
tauri-plugin-notification = "2"
21-
tauri-plugin-opener = "2"
22-
tauri-plugin-os = "2"
23-
tauri-plugin-process = "2"
19+
tauri = { version = "2.10.2", features = [] }
20+
tauri-plugin-notification = "2.3.3"
21+
tauri-plugin-opener = "2.5.3"
22+
tauri-plugin-os = "2.3.2"
23+
tauri-plugin-process = "2.3.1"

apps/web/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ sha2 = "0.10.9"
1616
hex = "0.4.3"
1717
regex = "1.12.3"
1818
lazy_static = "1.5.0"
19+
tokio = "1.49.0"

apps/web/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@
1818
"@repo/configs": "workspace:*",
1919
"@repo/shared": "workspace:*",
2020
"@repo/ui": "workspace:*",
21-
"@vueuse/core": "^14.2.0",
21+
"@vueuse/core": "^14.2.1",
2222
"axios": "^1.13.5",
23-
"eslint": "^9.39.2",
23+
"eslint": "^10.0.0",
2424
"pinia": "^3.0.4",
25-
"vue": "^3.5.27",
25+
"vue": "^3.5.28",
2626
"vue-i18n": "^11.2.8",
27-
"vue-router": "^4.6.4",
27+
"vue-router": "^5.0.2",
2828
"yup": "^1.7.1"
2929
},
3030
"devDependencies": {
31-
"@rsbuild/core": "^1.7.2",
31+
"@rsbuild/core": "^1.7.3",
3232
"typescript": "^5.9.3",
33-
"vue-tsc": "^2.2.12"
33+
"vue-tsc": "^3.2.4"
3434
}
3535
}

apps/web/src/main.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,20 @@ async fn main() -> std::io::Result<()> {
4040
user::load_users()?;
4141
token::load_tokens()?;
4242

43+
tokio::spawn(async {
44+
use tokio::time::{interval, Duration};
45+
46+
let mut interval = interval(Duration::from_secs(3600));
47+
48+
loop {
49+
interval.tick().await;
50+
51+
if let Err(e) = token::cleanup_expired_tokens() {
52+
error!("Failed to cleanup expired tokens: {:?}", e);
53+
}
54+
}
55+
});
56+
4357
let config = config::load_config(&main_dir)?;
4458

4559
let bind_addr = format!("{}:{}", config.host, config.port);

apps/web/src/token.rs

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,9 @@ pub fn get_user_by_token(token: &str) -> Result<User, HttpResponse> {
289289
let token_info = token_info.unwrap();
290290
let user = get_user(token_info.user.as_ref());
291291

292-
if (!token_info.remember && token_info.created_at + TEMP_TOKEN_EXPIRE_MILLIS < current_time()) || user.is_none() {
292+
if (!token_info.remember && token_info.created_at + TEMP_TOKEN_EXPIRE_MILLIS < current_time())
293+
|| user.is_none()
294+
{
293295
tokens.remove(token);
294296
cache.1 = current_time();
295297
save_tokens(&*cache)?;
@@ -301,3 +303,36 @@ pub fn get_user_by_token(token: &str) -> Result<User, HttpResponse> {
301303

302304
Ok(user.unwrap())
303305
}
306+
307+
pub fn cleanup_expired_tokens() -> Result<usize, HttpResponse> {
308+
let mut cache = acquire_write_lock(&TOKENS_CACHE)?;
309+
let tokens = cache.0.as_mut().expect("Tokens cache not initialized");
310+
311+
let current_time = current_time();
312+
let tokens_to_delete: Vec<(String, SessionInfo)> = tokens
313+
.iter()
314+
.filter(|(_, token_info)| {
315+
let user = get_user(token_info.user.as_ref());
316+
(!token_info.remember
317+
&& token_info.created_at + TEMP_TOKEN_EXPIRE_MILLIS < current_time)
318+
|| user.is_none()
319+
})
320+
.map(|(token, token_info)| (token.clone(), token_info.clone()))
321+
.collect();
322+
323+
let deleted_permanent_count = tokens_to_delete
324+
.iter()
325+
.filter(|(_, token_info)| token_info.remember)
326+
.count();
327+
328+
tokens_to_delete.iter().for_each(|(token, _)| {
329+
tokens.remove(token);
330+
});
331+
332+
if deleted_permanent_count > 0 {
333+
cache.1 = current_time;
334+
save_tokens(&*cache)?;
335+
}
336+
337+
Ok(deleted_permanent_count)
338+
}

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
},
2929
"devDependencies": {
3030
"prettier": "^3.8.1",
31-
"turbo": "^2.7.6",
32-
"typescript": "^5.9.2"
31+
"turbo": "^2.8.10",
32+
"typescript": "^5.9.3"
3333
},
34-
"packageManager": "pnpm@10.28.2",
34+
"packageManager": "pnpm@10.30.0",
3535
"engines": {
3636
"node": ">=18"
3737
}

packages/configs/eslint/vue.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@ export const customVueConfig = [
2828
"vue/valid-template-root": "warn",
2929
"vue/no-multiple-template-root": "off",
3030
"vue/first-attribute-linebreak": "off",
31-
"vue/ html-self-closing": "off", // 交给 prettier 处理
31+
"vue/html-self-closing": "off", // 交给 prettier 处理
32+
},
33+
},
34+
{
35+
files: ["**/*.vue"],
36+
rules: {
37+
"no-useless-assignment": "off", // Vue 模板中使用的变量会被误判为无用赋值
3238
},
3339
},
3440
{
@@ -41,4 +47,4 @@ export default [
4147
...tseslint.configs.recommended,
4248
...pluginVue.configs["flat/essential"],
4349
...customVueConfig,
44-
];
50+
];

packages/configs/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
"access": "public"
77
},
88
"devDependencies": {
9-
"@eslint/js": "^9.39.2",
9+
"@eslint/js": "^10.0.1",
1010
"@vue/tsconfig": "^0.8.1",
11-
"eslint-plugin-vue": "^10.7.0",
11+
"eslint-plugin-vue": "^10.8.0",
1212
"globals": "^17.3.0",
13-
"typescript-eslint": "^8.54.0"
13+
"typescript-eslint": "^8.56.0"
1414
}
1515
}

0 commit comments

Comments
 (0)