mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-10 08:58:15 +08:00
⚰️ 删除无用代码
This commit is contained in:
@@ -1,35 +1,11 @@
|
||||
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
// Tauri
|
||||
use tauri::{AppHandle, Manager, WindowBuilder, WindowUrl};
|
||||
|
||||
#[tauri::command]
|
||||
async fn mys_login(handle: AppHandle) {
|
||||
// 创建新窗口
|
||||
let mys_window = WindowBuilder::new(
|
||||
&handle,
|
||||
"mys-login", /* the unique window label */
|
||||
WindowUrl::External("https://user.mihoyo.com".parse().unwrap()),
|
||||
)
|
||||
.build()
|
||||
.unwrap();
|
||||
// 执行 js 代码
|
||||
let js_code = "
|
||||
const cookie = document.cookie;
|
||||
if(cookie === null || cookie.includes('login_ticket') === false) {
|
||||
alert('请在该网页登录后关闭窗口再试');
|
||||
} else {
|
||||
prompt('请复制以下内容后手动输入', cookie);
|
||||
}
|
||||
";
|
||||
mys_window.eval(js_code).ok().unwrap();
|
||||
}
|
||||
use tauri::Manager;
|
||||
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_sql::Builder::default().build())
|
||||
.invoke_handler(tauri::generate_handler![mys_login])
|
||||
.setup(|_app| {
|
||||
#[cfg(debug_assertions)] // only include this code on debug builds
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user