docs: 📝更新README.md
119
README.md
@ -1,46 +1,61 @@
|
||||
|
||||
# 建议版本
|
||||
|
||||
node v18.17.1
|
||||
|
||||
yarn 1.22.17
|
||||
|
||||
electron v17.1.2
|
||||
|
||||
# 唐僧叨叨PC端
|
||||
唐僧叨叨PC端支持Web端、Mac端、Windows端、Linux端,是一款高颜值IM即时通讯聊天软件,让企业轻松拥有自己的即时通讯软件。
|
||||
|
||||
* WEB版本
|
||||
* Electron版本
|
||||
* Tauri版
|
||||
<a href="https://zh-hans.react.dev/" target="_blank" rel="noopener" style="display:inline-block;">
|
||||
<img src="https://img.shields.io/badge/React-17.0.2-%236CB52D.svg?logo=React" alt="React">
|
||||
</a>  
|
||||
<a href="https://ts.nodejs.cn/" target="_blank" rel="noopener" style="display:inline-block;">
|
||||
<img src="https://img.shields.io/badge/TypeScript-5.0.4-%236CB52D.svg?logo=TypeScript&logoColor=FFF" alt="TypeScript">
|
||||
</a>  
|
||||
<a href="https://www.electronjs.org/zh/" target="_blank" rel="noopener" style="display:inline-block;">
|
||||
<img src="https://img.shields.io/badge/Electron-26.0.0-%236CB52D.svg?logo=Electron&logoColor=FFF" alt="Electron">
|
||||
</a>  
|
||||
<a href="https://webpack.docschina.org/" target="_blank" rel="noopener" style="display:inline-block;">
|
||||
<img src="https://img.shields.io/badge/Webpack-5.88.2-%236CB52D.svg?logo=Webpack" alt="Webpack">
|
||||
</a>  
|
||||
<a href="https://www.electron.build/" target="_blank" rel="noopener" style="display:inline-block;">
|
||||
<img src="https://img.shields.io/badge/ElectronBuilder-24.9.1-%236CB52D.svg?logo=ElectronBuilder&logoColor=FFF" alt="ElectronBuilder">
|
||||
</a>  
|
||||
<a href="https://semi.design/zh-CN/" target="_blank" rel="noopener" style="display:inline-block;">
|
||||
<img src="https://img.shields.io/badge/Semi UI-2.24.2-%236CB52D.svg?logo=SemiUI" alt="SemiUI">
|
||||
</a>  
|
||||
<a href="https://githubim.com/" target="_blank" rel="noopener" style="display:inline-block;">
|
||||
<img src="https://img.shields.io/badge/WukongIm-1.2.10-%236CB52D.svg?logo=WukonIm" alt="Wukongim">
|
||||
</a>  
|
||||
|
||||
## Web版本运行
|
||||
## Web 版本运行
|
||||
|
||||
> 本地开发建议`node v18.17.1`、 `yarn 1.22.17` 、
|
||||
|
||||
1. 安装依赖
|
||||
|
||||
```shell
|
||||
yarn install
|
||||
```
|
||||
|
||||
2. 开发调试
|
||||
|
||||
```shell
|
||||
yarn dev
|
||||
```
|
||||
|
||||
3. 编译
|
||||
|
||||
```shell
|
||||
yarn build
|
||||
```
|
||||
### 发布镜像
|
||||
|
||||
修改api地址 packages/tsdaodaoweb/src/index.tsx 修改 WKApp.apiClient.config.apiURL = "/api/v1/"
|
||||
4. 发布镜像
|
||||
> 修改 api 地址 packages/tsdaodaoweb/src/index.tsx 修改 WKApp.apiClient.config.apiURL = "/api/v1/"
|
||||
|
||||
```shell
|
||||
make deploy
|
||||
```
|
||||
|
||||
## Electron版本运行
|
||||
## Electron 版本运行
|
||||
|
||||
1. 安装依赖
|
||||
|
||||
```shell
|
||||
yarn install
|
||||
```
|
||||
@ -59,79 +74,15 @@ yarn build
|
||||
|
||||
4. Mac APP 打包
|
||||
|
||||
> 注意先运行`yarn build`编译
|
||||
|
||||
```shell
|
||||
yarn build-ele:mac
|
||||
```
|
||||
|
||||
5. Windows APP 打包
|
||||
> 注意先运行`yarn build`编译
|
||||
|
||||
```shell
|
||||
yarn build-ele:win
|
||||
```
|
||||
|
||||
## Tauri版本运行
|
||||
|
||||
tauri 环境安装 (https://tauri.app/v1/guides/getting-started/prerequisites)
|
||||
|
||||
1. 开发调试
|
||||
|
||||
```shell
|
||||
yarn tauri dev
|
||||
```
|
||||
|
||||
2. 打包
|
||||
|
||||
yarn tauri build
|
||||
(window打包的时候 要去掉package.json里的 build里的REACT_APP_VERSION=$npm_package_version 要不然执行yarn tauri build 会报错)
|
||||
(如果需要打包M1架构的包 需要安装 aarch64-apple-darwin(执行:rustup target add aarch64-apple-darwin))
|
||||
|
||||
yarn tauri build --target aarch64-apple-darwin (M1架构的包)
|
||||
|
||||
yarn tauri build --target universal-apple-darwin (通用架构,生成可在 Apple 芯片和基于 Intel 的 Mac 上运行的通用 macOS 二进制文件。)
|
||||
|
||||
|
||||
## 其他技巧
|
||||
|
||||
icon生成
|
||||
|
||||
```shell
|
||||
tauri icon [ICON-PATH]
|
||||
```
|
||||
|
||||
准备一张1024x1024的icon 执行上面命令 即可生成各种尺寸的icon
|
||||
|
||||
```shell
|
||||
icon.icns = macOS
|
||||
icon.ico = MS Windows
|
||||
*.png = Linux
|
||||
```
|
||||
|
||||
**注意**
|
||||
|
||||
添加依赖
|
||||
|
||||
```shell
|
||||
yarn workspace @tsdaodao/web add react-avatar-editor
|
||||
```
|
||||
|
||||
|
||||
|
||||
## 使用Github Action 自动构建各端PC版本
|
||||
|
||||
需要先全局安装 @tauri-apps/cli
|
||||
yarn global add @tauri-apps/cli
|
||||
|
||||
tauri signer generate -w ~/.tauri/tsdaodao.key
|
||||
|
||||
上面 的命令会自动生成一个公钥、私钥对。公钥可以公开分享,私钥必须严密保存。
|
||||
|
||||
在Github Secrets中 配置 TAURI_PRIVATE_KEY 和 TAURI_KEY_PASSWORD
|
||||
|
||||
|
||||
(参考:https://www.banyudu.com/posts/tauri-version-release-and-update-guide)
|
||||
|
||||
## 自动更新
|
||||
|
||||
1. 修改 tauri.conf.json 里的 updater.pubkey的内容(上面通过tauri signer generate 生成的公钥)
|
||||
|
||||
2. 修改 tauri.conf.json 里的 updater.endpoints 的内容为自己服务器的更新地址
|
||||
```
|
@ -8,8 +8,8 @@
|
||||
"start": "cross-env BROWSER=none REACT_APP_VERSION=$npm_package_version react-app-rewired start",
|
||||
"dev": "cross-env MODE=dev BROWSER=none REACT_APP_VERSION=$npm_package_version react-app-rewired start",
|
||||
"dev-ele": "kill-port 3000 && concurrently -k -n=web,ele -c=green,blue \"yarn dev\" \"wait-on tcp:3000 && npm-run-all watch\"",
|
||||
"watch": "tsc-watch -p tsconfig.e.json --onSuccess \"npm-run-all start:electron\"",
|
||||
"start:electron": "cross-env NODE_ENV=development electron .",
|
||||
"watch": "tsc-watch -p tsconfig.e.json --onSuccess \"npm-run-all start:electron\"",
|
||||
"build": "cross-env REACT_APP_VERSION=$npm_package_version react-app-rewired build",
|
||||
"build:analyzer": "cross-env ANALYZER=true REACT_APP_VERSION=$npm_package_version react-app-rewired build",
|
||||
"build-ele:mac": "tsc -p tsconfig.e.json && electron-builder -p never -m -c",
|
||||
@ -17,8 +17,7 @@
|
||||
"build-ele": "tsc -p tsconfig.e.json && electron-builder -mw -c",
|
||||
"test": "react-app-rewired test",
|
||||
"eject": "react-app-rewired eject",
|
||||
"clean": "rimraf node_modules out-election build dist-ele .turbo",
|
||||
"tauri": "tauri"
|
||||
"clean": "rimraf node_modules out-election build dist-ele .turbo"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "^1.1.0",
|
||||
|
3
apps/web/src-tauri/.gitignore
vendored
@ -1,3 +0,0 @@
|
||||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
/target/
|
3769
apps/web/src-tauri/Cargo.lock
generated
@ -1,29 +0,0 @@
|
||||
[package]
|
||||
name = "app"
|
||||
version = "0.1.0"
|
||||
description = "唐僧叨叨即时通讯"
|
||||
authors = ["you"]
|
||||
license = ""
|
||||
repository = ""
|
||||
default-run = "app"
|
||||
edition = "2021"
|
||||
rust-version = "1.57"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "1.0.1", features = [] }
|
||||
|
||||
[dependencies]
|
||||
serde_json = "1.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
tauri = { version = "1.0.1", features = ["api-all", "updater"] }
|
||||
rand = "0.3.17"
|
||||
|
||||
[features]
|
||||
# by default Tauri runs in production mode
|
||||
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
|
||||
default = [ "custom-protocol" ]
|
||||
# this feature is used used for production builds where `devPath` points to the filesystem
|
||||
# DO NOT remove this
|
||||
custom-protocol = [ "tauri/custom-protocol" ]
|
@ -1,3 +0,0 @@
|
||||
fn main() {
|
||||
tauri_build::build()
|
||||
}
|
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 8.9 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 6.9 KiB |
Before Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 71 KiB |
@ -1,15 +0,0 @@
|
||||
#![cfg_attr(
|
||||
all(not(debug_assertions), target_os = "windows"),
|
||||
windows_subsystem = "windows"
|
||||
)]
|
||||
|
||||
|
||||
mod menu;
|
||||
|
||||
fn main() {
|
||||
let context = tauri::generate_context!();
|
||||
tauri::Builder::default()
|
||||
.menu(menu::init(&context)).on_menu_event(menu::handler)
|
||||
.run(context)
|
||||
.expect("error while running tauri application");
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
extern crate rand;
|
||||
|
||||
use tauri::utils::assets::EmbeddedAssets;
|
||||
use tauri::{Manager, Context,Wry, CustomMenuItem, Menu , Submenu, WindowMenuEvent};
|
||||
|
||||
|
||||
use rand::Rng;
|
||||
|
||||
pub fn init(_context: &Context<EmbeddedAssets>) -> Menu {
|
||||
// 应用名称
|
||||
// let name = &context.package_info().name;
|
||||
// tauri::Menu::os_default(name)
|
||||
|
||||
let menu = Submenu::new(
|
||||
"菜单",
|
||||
Menu::new()
|
||||
.add_item(CustomMenuItem::new("new_windows".to_string(), "多开"))
|
||||
);
|
||||
Menu::new()
|
||||
.add_submenu(menu)
|
||||
}
|
||||
|
||||
// 应用菜单处理事件
|
||||
pub fn handler(event: WindowMenuEvent<Wry>) {
|
||||
// 匹配菜单 id
|
||||
match event.menu_item_id() {
|
||||
"new_windows" => {
|
||||
let apphandle = event.window().app_handle();
|
||||
let mut rng = rand::thread_rng();
|
||||
let n2: u32 = rng.gen();
|
||||
|
||||
std::thread::spawn(move || {
|
||||
let _newwin = tauri::WindowBuilder::new(
|
||||
&apphandle,
|
||||
n2.to_string(),
|
||||
tauri::WindowUrl::App("/".into())
|
||||
).title("唐僧叨叨").inner_size(1200.0,800.0).build();
|
||||
});
|
||||
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
{
|
||||
"$schema": "../node_modules/@tauri-apps/cli/schema.json",
|
||||
"build": {
|
||||
"beforeBuildCommand": "yarn build",
|
||||
"beforeDevCommand": "yarn start",
|
||||
"devPath": "http://localhost:3000",
|
||||
"distDir": "../build"
|
||||
},
|
||||
"package": {
|
||||
"productName": "tangsengdaodao",
|
||||
"version": "../package.json"
|
||||
},
|
||||
"tauri": {
|
||||
"allowlist": {
|
||||
"all": true
|
||||
},
|
||||
"bundle": {
|
||||
"active": true,
|
||||
"category": "DeveloperTool",
|
||||
"copyright": "",
|
||||
"deb": {
|
||||
"depends": []
|
||||
},
|
||||
"externalBin": [],
|
||||
"icon": [
|
||||
"icons/32x32.png",
|
||||
"icons/128x128.png",
|
||||
"icons/128x128@2x.png",
|
||||
"icons/icon.icns",
|
||||
"icons/icon.ico"
|
||||
],
|
||||
"identifier": "com.tsdaodao.im",
|
||||
"longDescription": "",
|
||||
"macOS": {
|
||||
"entitlements": null,
|
||||
"exceptionDomain": "",
|
||||
"frameworks": [],
|
||||
"providerShortName": null,
|
||||
"signingIdentity": null
|
||||
},
|
||||
"resources": [],
|
||||
"shortDescription": "",
|
||||
"targets": "all",
|
||||
"windows": {
|
||||
"certificateThumbprint": null,
|
||||
"digestAlgorithm": "sha256",
|
||||
"timestampUrl": "",
|
||||
"wix": {
|
||||
"language": "zh-CN"
|
||||
}
|
||||
}
|
||||
},
|
||||
"security": {
|
||||
"csp": null
|
||||
},
|
||||
"windows": [
|
||||
{
|
||||
"fullscreen": false,
|
||||
"height": 800,
|
||||
"resizable": true,
|
||||
"title": "唐僧叨叨",
|
||||
"width": 1200
|
||||
}
|
||||
],
|
||||
"updater": {
|
||||
"active": true,
|
||||
"endpoints": [
|
||||
"https://api.githubim.com/v1/common/updater/{{target}}/{{current_version}}"
|
||||
],
|
||||
"dialog": false,
|
||||
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDkyQUQxQjQ3QzBEMjFBMDYKUldRR0d0TEFSeHV0a21UNDl1Q2ZPZm9lcFdnTCtUTnJWcURIQXdibGxBNndpWHdMY0swWGI4a1AK"
|
||||
}
|
||||
}
|
||||
|
||||
}
|