-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release_tauri' into release_tauri-1
- Loading branch information
Showing
28 changed files
with
581 additions
and
299 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
《产品声明》 | ||
本产品为非商业化产品,除捐助用于服务器运行资金外无任何收益。 | ||
|
||
本产品仅供学习交流使用。 | ||
|
||
本产品相关内容(文字、图片、音视频等)均来源于/转自第三方,平台转载相关内容不视为对于相关内容、观点的认可,亦不视为对于相关内容的真实性、准确性、完整性、合法性做出任何承诺。相关内容的真实合法性由内容发布者自行承担,本平台不承担相关法律责任。本平台已明确提示内容来源,如相关内容侵犯了您的合法权益,您亦需联系发布源进行处理。 | ||
|
||
来自于第三方网站的链接,系由平台根据您的搜索需求或为向您提供便利而提供或设置,外部链接指向的不由本平台实际控制的任何网页上的内容,本平台不承担任何责任。您可能从该第三方网站上获得资讯及享用服务,本平台网无法控制第三方提供的内容、服务的质量、安全或合法性、信息的真实性或准确性。您应自行谨慎判断确定,并自行承担因此产生的责任与损失。除非本平台另有明确规定,若您对于第三方网站或链接有任何异议,您应联系第三方网站的内容或链接提供者处理。 | ||
|
||
如若侵犯第三方权益,请您及时与我们联系,我们将立刻整改。 | ||
|
||
|
||
《用户守则》 | ||
欢迎使用由小刻食堂开发团队(以下简称「开发组」)开发的「小刻食堂」系列。在您使用本框架之前,请仔细阅读并完全理解本声明。一旦您开始使用小刻食堂,即表示您同意遵守本声明中的所有条款和条件。 | ||
|
||
1. 使用目的: 小刻食堂是一个免费开源的软件项目,旨在为用户提供抓取B站、微博、明日方舟通讯组等API数据的功能,并提供多种实用功能,如实时饼消息通知、快速跳转链接、饼内容分享、详细内容查看、饼内容图片生成、理智回复时间计算等。 | ||
|
||
2. 合法合理使用: 您承诺以合法、合理的方式使用小刻食堂,不得将其用于任何违法、侵权或其他恶意行为,也不得将其应用于违反当地法律法规的Web平台。 | ||
|
||
3. 免责声明: 开发组对于因使用小刻食堂而引起的任何意外、疏忽、合同损害、诽谤、版权或知识产权侵权以及由此产生的损失(包括但不限于直接、间接、附带或衍生的损失等)不承担任何法律责任。 | ||
|
||
4. 风险承担: 用户明确同意,使用小刻食堂所存在的风险和后果将完全由用户自行承担,开发组不承担任何法律责任。 | ||
|
||
5. 合法发布和使用: 用户在遵守本声明的前提下,可在《MIT开源许可证》所允许的范围内合法地发布、传播和使用小刻食堂。对于因违反本声明或法律法规造成的法律责任(包括但不限于民事赔偿和刑事责任),将由违约者自行承担。 | ||
|
||
6. 知识产权: 小刻食堂及其相关产品享有开发组的知识产权保护,包括但不限于商标权、专利权、著作权、商业秘密等,受相关法律法规保护。 | ||
|
||
7. 条款变更: 开发组有权随时单方面修改本声明条款及附件内容,并通过消息推送、网页公告等方式进行公布。变更后的条款在公布后立即生效,用户继续使用即表示您已充分阅读、理解并接受修改后的声明内容。 | ||
|
||
请在使用小刻食堂之前仔细阅读并理解本声明。如果您有任何疑问,请咨询相关法律专业人士。感谢您的合作与支持! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use serde::{Deserialize, Serialize}; | ||
use serde_json::Value; | ||
use tauri::command; | ||
use tracing::{debug, error, info, instrument, trace, warn}; | ||
|
||
#[derive(Serialize, Deserialize)] | ||
pub enum Level { | ||
Trace, | ||
Debug, | ||
Info, | ||
Warn, | ||
Error, | ||
} | ||
|
||
#[command] | ||
#[instrument(skip_all, name = "FontEndLog")] | ||
pub fn front_logger(level: Level, local: String, payload: Value) { | ||
match level { | ||
Level::Trace => { | ||
trace!(logSource = "FontEnd", frontFile = local, payload = %payload); | ||
} | ||
Level::Debug => { | ||
debug!(logSource = "FontEnd", frontFile = local, payload = %payload); | ||
} | ||
Level::Info => { | ||
info!(logSource = "FontEnd", frontFile = local, payload = %payload); | ||
} | ||
Level::Warn => { | ||
warn!(logSource = "FontEnd", frontFile = local, payload = %payload); | ||
} | ||
Level::Error => { | ||
error!(logSource = "FontEnd", frontFile = local, payload = %payload); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
use tauri::{command, Window}; | ||
|
||
#[command] | ||
pub fn hide_notification(window: Window) -> tauri::Result<()> { | ||
#[cfg(windows)] | ||
{ | ||
use windows::Win32::Graphics::Gdi::UpdateWindow; | ||
use windows::Win32::UI::WindowsAndMessaging::{ | ||
GetWindowLongPtrW, SetWindowLongPtrW, GWL_EXSTYLE, WS_EX_APPWINDOW, WS_EX_TOOLWINDOW, | ||
}; | ||
let hwnd = window.hwnd()?; | ||
let mut style = unsafe { GetWindowLongPtrW(hwnd, GWL_EXSTYLE) }; | ||
style |= !WS_EX_APPWINDOW.0 as isize; | ||
style &= WS_EX_TOOLWINDOW.0 as isize; | ||
unsafe { SetWindowLongPtrW(hwnd, GWL_EXSTYLE, style) }; | ||
unsafe { | ||
UpdateWindow(hwnd); | ||
} | ||
} | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
use tauri::command; | ||
|
||
#[command] | ||
pub fn is_debug() -> bool { | ||
cfg!(debug_assertions) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,26 @@ | ||
mod auto_launch; | ||
mod clipboard; | ||
mod front_logger; | ||
mod hide_notification; | ||
mod is_debug; | ||
mod local_storage; | ||
mod monitor_info; | ||
mod preview_page; | ||
mod quit; | ||
mod request_client; | ||
mod request_refer_image; | ||
mod resource_location; | ||
mod update_available; | ||
|
||
pub use self::auto_launch::{auto_launch_setting, set_auto_launch}; | ||
pub use clipboard::copy_image; | ||
pub use front_logger::front_logger; | ||
pub use hide_notification::hide_notification; | ||
pub use is_debug::is_debug; | ||
pub use local_storage::{get_item, set_item}; | ||
pub use monitor_info::{get_monitor_info, message_beep}; | ||
pub use preview_page::{back_preview, read_detail}; | ||
pub use quit::quit; | ||
pub use request_client::send_request; | ||
pub use request_refer_image::request_refer_image; | ||
pub use resource_location::{get_app_cache_path, get_app_config_path}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
use serde::Serialize; | ||
|
||
use tauri::{command, PhysicalPosition, PhysicalSize, Window}; | ||
|
||
#[derive(Debug, Clone, Serialize)] | ||
pub struct MonitorInfo { | ||
work_space: PhysicalSize<u32>, | ||
left_top: PhysicalPosition<i32>, | ||
} | ||
|
||
#[command] | ||
pub fn get_monitor_info(window: Window) -> tauri::Result<MonitorInfo> { | ||
#[cfg(not(windows))] | ||
{ | ||
let monitor = window | ||
.primary_monitor()? | ||
.expect("Cannot found Primary Monitor"); | ||
|
||
Ok(MonitorInfo { | ||
work_space: *monitor.size(), | ||
left_top: *monitor.position(), | ||
}) | ||
} | ||
#[cfg(windows)] | ||
{ | ||
use std::mem::size_of; | ||
use windows::Win32::Graphics::Gdi::{ | ||
GetMonitorInfoW, MonitorFromWindow, MONITORINFO, MONITOR_DEFAULTTOPRIMARY, | ||
}; | ||
|
||
let hwnd = window.hwnd()?; | ||
let mut monitor_info = MONITORINFO { | ||
cbSize: size_of::<MONITORINFO>() as u32, | ||
..Default::default() | ||
}; | ||
|
||
unsafe { | ||
let monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTOPRIMARY); | ||
GetMonitorInfoW(monitor, &mut monitor_info); | ||
}; | ||
let rect = monitor_info.rcWork; | ||
|
||
Ok(MonitorInfo { | ||
work_space: PhysicalSize::new( | ||
(rect.right - rect.left) as u32, | ||
(rect.bottom - rect.top) as u32, | ||
), | ||
left_top: PhysicalPosition::new(rect.left, rect.top), | ||
}) | ||
} | ||
} | ||
|
||
#[command] | ||
pub fn message_beep() { | ||
#[cfg(windows)] | ||
{ | ||
use windows::Win32::{ | ||
System::Diagnostics::Debug::MessageBeep, UI::WindowsAndMessaging::MB_ICONSTOP, | ||
}; | ||
unsafe { | ||
MessageBeep(MB_ICONSTOP.0); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use crate::state::{get_cache_dir, get_config_dir}; | ||
use std::path::PathBuf; | ||
use tauri::{command, AppHandle}; | ||
|
||
#[command] | ||
pub fn get_app_config_path(app: AppHandle) -> PathBuf { | ||
get_config_dir(app).to_owned() | ||
} | ||
#[command] | ||
pub fn get_app_cache_path(app: AppHandle) -> PathBuf { | ||
get_cache_dir(app).to_owned() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.