Skip to content

Commit

Permalink
优化一些问题
Browse files Browse the repository at this point in the history
  • Loading branch information
itxve committed Dec 30, 2022
1 parent 368d37a commit e202c57
Show file tree
Hide file tree
Showing 16 changed files with 448 additions and 288 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: false
tag_name: "${{ steps.get_version.outputs.VERSION }}"
release_name: "app ${{ steps.get_version.outputs.VERSION }}"
release_name: "Live2d ${{ steps.get_version.outputs.VERSION }}"
body: "See the assets to download this version and install."

# 编译 Tauri
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ jobs:
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,26 @@

### TODO

- 自建 模型 API 使用[已实现]
- 大小缩放[已实现] 问题挺多
- 开机自启动[已实现]
- 使用 PixiJS 加载任意[2,3,4 版本的]模型[已实现]
- 使用本地模型[已实现]
- 使用 PixiJS 加载[v2,v3 版本的]模型[已实现]
- 使用本地模型、远程模型的加载[已实现]

### 已知问题

- mac 下出现窗口虚线,暂不知原因
- mac 下出现窗口虚线,暂不知原因,可能是透明背景下的问题

### 文件下载安装 使用 ghproxy 下载

- `自动更新可能无效,请使用手动下载`

- [最新版本](https://github.com/itxve/tauri-live2d/releases/latest)

- 下载慢可使用[ghproxy](https://ghproxy.com/) 加速

###

说实话代码有点乱,不想动了
代码有点乱,但是不想动了

### 鸣谢

Expand All @@ -37,6 +44,8 @@
</a>
</p>

[Flat-UI](https://designmodo.github.io/Flat-UI)

# 免责声明

### 该软件仅用于个人学习使用
Expand Down
3 changes: 2 additions & 1 deletion UPDATE_LOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Updater Log


v3.0.1
增加一个默认模型
4 changes: 2 additions & 2 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@

<script>
const cubism2Model =
"http://localhost:3004/草神/草神/草神.model3.json";
"http://localhost:13004/草神/草神/草神.model3.json";

const cubism4Model =
"http://localhost:3004/纳西妲l2d/草神.model3.json";
"http://localhost:13004/纳西妲l2d/草神.model3.json";

const live2d = PIXI.live2d;

Expand Down
21 changes: 21 additions & 0 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ tauri-build = { version = "1.2", features = [] }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.2", features = ["api-all", "macos-private-api", "system-tray"] }
tauri = { version = "1.2", features = ["api-all", "macos-private-api", "system-tray", "updater"] }
notify = { version = "5.0.0", features = ["serde"] }
auto-launch = "0.4.0"
thiserror = "1.0"
Expand Down
39 changes: 20 additions & 19 deletions src-tauri/src/live2d/tray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ use tauri::{

/// system tray
pub fn menu() -> SystemTray {
let quit = CustomMenuItem::new("quit".to_string(), "Quit");
let show = CustomMenuItem::new("show".to_string(), "Show");
let hide = CustomMenuItem::new("hide".to_string(), "Hide");
let config = CustomMenuItem::new("config".to_string(), "Config");
let quit = CustomMenuItem::new("quit".to_string(), "关闭软件");
let show = CustomMenuItem::new("show".to_string(), "显示桌宠");
let hide = CustomMenuItem::new("hide".to_string(), "隐藏桌宠");
let config = CustomMenuItem::new("config".to_string(), "配置");
let tray_menu = SystemTrayMenu::new()
.add_item(show)
.add_item(hide)
Expand All @@ -30,40 +30,41 @@ pub fn handler(app: &AppHandle, event: SystemTrayEvent) {
let window = app.get_window("main").unwrap();
window.hide().unwrap();
}
"config" => {
match app.get_window("config") {
"show" => {
match app.get_window("main") {
Some(w) => {
w.show().unwrap();
}
None => {
// main 窗口如果被关闭,重新实例化
let config_win = tauri::WindowBuilder::new(
// live2d 窗口如果被关闭,重新实例化
let live2d_win = tauri::WindowBuilder::new(
app,
"config",
tauri::WindowUrl::App("index.html".into()),
"main",
tauri::WindowUrl::App("live2d.html".into()),
)
.build()
.unwrap();
config_win.center();
config_win.set_resizable(true);
config_win.set_title("live2d看板娘配置");
}
};
}
"show" => {
match app.get_window("main") {
"config" => {
match app.get_window("config") {
Some(w) => {
w.show().unwrap();
}
None => {
// live2d 窗口如果被关闭,重新实例化
let live2d_win = tauri::WindowBuilder::new(
// main 窗口如果被关闭,重新实例化
let config_win = tauri::WindowBuilder::new(
app,
"main",
tauri::WindowUrl::App("live2d.html".into()),
"config",
tauri::WindowUrl::App("index.html".into()),
)
.build()
.unwrap();
config_win.center().unwrap();
config_win.set_resizable(true).unwrap();
config_win.set_always_on_top(true).unwrap();
config_win.set_title("配置").unwrap();
}
};
}
Expand Down
6 changes: 3 additions & 3 deletions src-tauri/src/plugins/modelserve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub async fn _serve(serve_dir: &str) {
}

println!("app router:{:?}", &app);
axum_server::bind(SocketAddr::from(([127, 0, 0, 1], 3004)))
axum_server::bind(SocketAddr::from(([127, 0, 0, 1], 13004)))
.handle(handle)
.serve(
app.layer(
Expand Down Expand Up @@ -102,7 +102,7 @@ async fn shutdown_cmd() -> Result<u16> {
let client = ClientBuilder::new().build().unwrap();
let response = client
.send(
HttpRequestBuilder::new("GET", "http://127.0.0.1:3004/shutdown")
HttpRequestBuilder::new("GET", "http://127.0.0.1:13004/shutdown")
.unwrap()
.response_type(ResponseType::Binary),
)
Expand All @@ -121,7 +121,7 @@ async fn server_running() -> Result<u16> {
let client = ClientBuilder::new().build().unwrap();
let response = client
.send(
HttpRequestBuilder::new("GET", "http://127.0.0.1:3004/running")
HttpRequestBuilder::new("GET", "http://127.0.0.1:13004/running")
.unwrap()
.response_type(ResponseType::Binary),
)
Expand Down
7 changes: 6 additions & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,12 @@
"csp": null
},
"updater": {
"active": false
"active": true,
"dialog": true,
"endpoints": [
"https://itxve.github.io/tauri-live2d/install.json"
],
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDE5QkUzMjVDRkE2RTNBQTAKUldTZ09tNzZYREsrR2RGcGV5Ykc2KzVWVWJFRTM5b2dCSXFYWlQ3TjcxZWI3aWhiK0RCTnlrN2sK"
},
"windows": [
{
Expand Down
Loading

0 comments on commit e202c57

Please sign in to comment.