Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3bf1b56229 | ||
|
|
5dbddc69cd
|
||
|
|
662b41cf44
|
||
|
|
32bd0ee261
|
||
|
|
8daaa195ee
|
||
|
|
a8d7519fb3
|
||
|
|
84e06241aa
|
||
|
|
e23a6e0cdc
|
||
|
|
404bbdd28a
|
||
|
|
11bf8a7b66
|
||
|
|
ca79942a04
|
||
|
|
9627c4b1ad
|
||
|
|
68f70e9148
|
||
|
|
8e63340a27
|
||
|
|
144f252759
|
||
|
|
e91aecbef9
|
||
|
|
c38905319d
|
No files matched your search
@@ -0,0 +1,30 @@
|
|||||||
|
# Contributing
|
||||||
|
|
||||||
|
本项目基于 Tauri v2.0 开发,技术栈如下:
|
||||||
|
|
||||||
|
**后端**
|
||||||
|
|
||||||
|
- Rust 1.88.0
|
||||||
|
|
||||||
|
**前端**
|
||||||
|
|
||||||
|
- React v18
|
||||||
|
- Tailwind CSS v4
|
||||||
|
|
||||||
|
欢迎您从**代码**或**内容**两方面参与贡献,共同完善本项目。
|
||||||
|
|
||||||
|
## 贡献指引
|
||||||
|
|
||||||
|
### 代码贡献
|
||||||
|
|
||||||
|
1. 【可选】创建 Issue,讨论你的想法。
|
||||||
|
2. Fork 本仓库。
|
||||||
|
3. 基于 `develop` 分支创建新 `feature/<your_feature_name>` 分支。
|
||||||
|
4. 开始完善你的功能。
|
||||||
|
5. 测试功能。
|
||||||
|
6. 提交你的代码并通过创建 Pull Request 将代码合并到 `develop` 分支。
|
||||||
|
7. 等待上线。
|
||||||
|
|
||||||
|
### 内容贡献
|
||||||
|
|
||||||
|
**暂时还没想好怎么提交新内容,等待这里更新再说吧。**
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
Copyright (c) 2025 Zihlu Wang
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -1,7 +1,42 @@
|
|||||||
# Tauri + React + Typescript
|
# 祖安语录桌面版
|
||||||
|
|
||||||
This template should help get you started developing with Tauri, React and Typescript in Vite.
|

|
||||||
|
|
||||||
## Recommended IDE Setup
|
> 本仓库为 [cndiandian/zuanbot.com](https://github.com/cndiandian/zuanbot.com) 的客户端版本。
|
||||||
|
|
||||||
- [VS Code](https://code.visualstudio.com/) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer)
|
## 有什么用
|
||||||
|
|
||||||
|
可以随机输出一条骂人的句子,有**口吐芬芳**与**火力全开**两个模式。
|
||||||
|
|
||||||
|
## 词库下载
|
||||||
|
|
||||||
|
[GitHub 下载](/src-tauri/resources/data.db)、[阿里云盘](https://www.aliyundrive.com/s/StTs9ojDAEF)、[蓝揍云](https://shadiao.lanzouw.com/b0116bgub) `密码hck1` 、 [诚通网盘](https://url08.ctfile.com/d/14688008-46477369-3732e0) `密码9919`
|
||||||
|
|
||||||
|
在线文档:[Notion文档](https://dians.notion.site/d865fac077f1430f9510d020f8713c8e)、[口吐芬芳(谷歌文档)](https://docs.google.com/document/d/1SskgYtDpYL6P_4qmX2A1ndBl8MY5NeDcBaYPxS-yxIo/edit?usp=sharing) 、[火力全开(谷歌文档)](https://docs.google.com/document/d/14YG9qaNDZk275av-Iss6B6YY-eDTdkS5w_my3f7349A/edit?usp=sharing)
|
||||||
|
|
||||||
|
## 如何使用
|
||||||
|
|
||||||
|
下载对应操作系统的安装包,执行安装即可。
|
||||||
|
|
||||||
|
包类型(文件后缀):
|
||||||
|
|
||||||
|
- Windows: `x64.msi`
|
||||||
|
- macOS
|
||||||
|
- Intel: `x64.dmg`
|
||||||
|
- Apple Silicon: `aarch64.dmg`
|
||||||
|
|
||||||
|
由于没有代码签名,在 Mac 上会因为没有开启允许所有开发者而提示软件损坏,此时可以打开**终端**,并输入 `xattr -d com.apple.quaratine /Applications/zuanbot.app` 再打开软件。
|
||||||
|
|
||||||
|
## 什么原理
|
||||||
|
|
||||||
|
收集整理了N条骂人的句子,然后随机读取一条输出即可。
|
||||||
|
|
||||||
|
核心代码就一行:
|
||||||
|
|
||||||
|
```sql
|
||||||
|
SELECT * FROM `main` ORDER BY RANDOM() limit 1
|
||||||
|
```
|
||||||
|
|
||||||
|
## 词库都是怎么来的
|
||||||
|
|
||||||
|
最初来源于网络收集了一些,后来基本就都是各位用户的投稿了,投稿渠道现已关闭。
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "zuanbot",
|
"name": "zuanbot",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.2.0",
|
"version": "0.2.1",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
Generated
+1
-1
@@ -5233,7 +5233,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zuanbot"
|
name = "zuanbot"
|
||||||
version = "0.2.0"
|
version = "0.2.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"rusqlite",
|
"rusqlite",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "zuanbot"
|
name = "zuanbot"
|
||||||
version = "0.2.0"
|
version = "0.2.1"
|
||||||
description = "祖安助手"
|
description = "祖安助手"
|
||||||
authors = ["zihluwang"]
|
authors = ["zihluwang"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
Copyright (c) 2025 Zihlu Wang
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
File renamed without changes.
@@ -30,7 +30,7 @@ impl Database {
|
|||||||
fn get_bundled_database_path(app_handle: &tauri::AppHandle) -> Result<PathBuf> {
|
fn get_bundled_database_path(app_handle: &tauri::AppHandle) -> Result<PathBuf> {
|
||||||
let resource_path = app_handle
|
let resource_path = app_handle
|
||||||
.path()
|
.path()
|
||||||
.resolve("data.db", tauri::path::BaseDirectory::Resource)?;
|
.resolve("./resources/data.db", tauri::path::BaseDirectory::Resource)?;
|
||||||
|
|
||||||
println!("Database path: {:?}", resource_path);
|
println!("Database path: {:?}", resource_path);
|
||||||
Ok(resource_path)
|
Ok(resource_path)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://schema.tauri.app/config/2",
|
"$schema": "https://schema.tauri.app/config/2",
|
||||||
"productName": "zuanbot",
|
"productName": "Zuanbot",
|
||||||
"version": "0.2.0",
|
"version": "0.2.1",
|
||||||
"identifier": "io.github.zihluwang.zuanbot",
|
"identifier": "io.github.zihluwang.zuanbot",
|
||||||
"build": {
|
"build": {
|
||||||
"beforeDevCommand": "pnpm dev",
|
"beforeDevCommand": "pnpm dev",
|
||||||
@@ -12,9 +12,13 @@
|
|||||||
"app": {
|
"app": {
|
||||||
"windows": [
|
"windows": [
|
||||||
{
|
{
|
||||||
"title": "骂人宝典",
|
"title": "祖安语录",
|
||||||
"width": 560,
|
"width": 560,
|
||||||
"height": 400
|
"maxWidth": 560,
|
||||||
|
"minWidth": 560,
|
||||||
|
"height": 400,
|
||||||
|
"maxHeight": 400,
|
||||||
|
"minHeight": 400
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"security": {
|
"security": {
|
||||||
@@ -23,7 +27,20 @@
|
|||||||
},
|
},
|
||||||
"bundle": {
|
"bundle": {
|
||||||
"active": true,
|
"active": true,
|
||||||
"targets": "all",
|
"publisher": "Zihlu Wang",
|
||||||
|
"category": "Utility",
|
||||||
|
"targets": ["dmg", "msi"],
|
||||||
|
"windows": {
|
||||||
|
"wix": {
|
||||||
|
"language": "zh-CN"
|
||||||
|
},
|
||||||
|
"webviewInstallMode": {
|
||||||
|
"type": "embedBootstrapper"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"licenseFile": "./resources/Licence.txt",
|
||||||
|
"copyright": "Data Collected by @cndiandian, Developed by @zihluwang.",
|
||||||
"icon": [
|
"icon": [
|
||||||
"icons/32x32.png",
|
"icons/32x32.png",
|
||||||
"icons/128x128.png",
|
"icons/128x128.png",
|
||||||
@@ -32,7 +49,7 @@
|
|||||||
"icons/icon.ico"
|
"icons/icon.ico"
|
||||||
],
|
],
|
||||||
"resources": [
|
"resources": [
|
||||||
"./data.db"
|
"./resources/data.db"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+21
-10
@@ -1,10 +1,6 @@
|
|||||||
import React, { useEffect, useState } from "react"
|
import React, { useEffect, useState } from "react"
|
||||||
import { invoke } from "@tauri-apps/api/core"
|
import { Level } from "@/types"
|
||||||
|
import * as service from "@/service"
|
||||||
enum Level {
|
|
||||||
min = "min",
|
|
||||||
max = "max",
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
const [text, setText] = useState<string>("")
|
const [text, setText] = useState<string>("")
|
||||||
@@ -12,26 +8,41 @@ export default function App() {
|
|||||||
const [last, setLast] = useState<string>("")
|
const [last, setLast] = useState<string>("")
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
// 加载一条祖安语录
|
||||||
;(async () => {
|
;(async () => {
|
||||||
await getMessage()
|
await getMessage()
|
||||||
})()
|
})()
|
||||||
|
// 第一条消息,禁用上一条功能
|
||||||
|
setIsLast(true)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取一条祖安语录
|
||||||
|
* @param level 语录等级
|
||||||
|
*/
|
||||||
const getMessage = async (level?: Level) => {
|
const getMessage = async (level?: Level) => {
|
||||||
|
// 开放上一条功能
|
||||||
|
setIsLast(false)
|
||||||
|
|
||||||
// 保存上一条信息
|
// 保存上一条信息
|
||||||
setLast(text)
|
setLast(text)
|
||||||
|
|
||||||
// 获取下一条信息
|
// 获取下一条信息
|
||||||
const nextMessage = await invoke<string>("get_message", { level })
|
const nextZuanMessage = await service.nextZuan(level)
|
||||||
setText(nextMessage)
|
setText(nextZuanMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 展示上一条祖安语录
|
||||||
|
*/
|
||||||
const showLast = () => {
|
const showLast = () => {
|
||||||
setIsLast(true)
|
setIsLast(true)
|
||||||
setText(last)
|
setText(last)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 复制文字到剪贴板
|
/**
|
||||||
|
* 复制文字到剪贴板
|
||||||
|
*/
|
||||||
const copyToClipboard = () => {
|
const copyToClipboard = () => {
|
||||||
if (navigator.clipboard) {
|
if (navigator.clipboard) {
|
||||||
navigator.clipboard.writeText(text).then(
|
navigator.clipboard.writeText(text).then(
|
||||||
@@ -43,7 +54,7 @@ export default function App() {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
alert("当前浏览器不支持复制功能")
|
alert("暂时不支持复制功能")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import { invoke } from "@tauri-apps/api/core"
|
||||||
|
import { Level } from "@/types"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从服务端获取下一条祖安语录
|
||||||
|
* @param level 祖安级别
|
||||||
|
*/
|
||||||
|
export async function nextZuan(level?: Level) {
|
||||||
|
return await invoke<string>("get_message", { level })
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
export enum Level {
|
||||||
|
min = "min",
|
||||||
|
max = "max"
|
||||||
|
}
|
||||||
Reference in new issue
Block a user