commit
@ -122,23 +122,23 @@ git stash list
|
||||
> id_rsa.pub是公钥
|
||||
|
||||
5. SourceTree配置
|
||||

|
||||

|
||||
启动 **PuTTY Key Generator**
|
||||
|
||||
6. 依次点击
|
||||

|
||||

|
||||
|
||||
7. PPKfile version 选择 2
|
||||

|
||||

|
||||
|
||||
8. 选择之前生成的id_rsa
|
||||

|
||||

|
||||
|
||||
9. 出现如下,选择 **Save private key** 保存秘钥
|
||||

|
||||

|
||||
|
||||
10. 保存到 ~/.ssh 目录即可
|
||||

|
||||

|
||||
|
||||
11. 在 **Sourcetree** 中 **工具** -> **选项** 中选择刚刚保存的 ppk文件即可
|
||||
|
||||
@ -216,10 +216,10 @@ git config --global https.proxy 'http://127.0.0.1:代理的port'
|
||||
5. 右侧下拉框 **Generate new token (classic)**
|
||||
|
||||
6. 按以下配置
|
||||

|
||||

|
||||
|
||||
7. 得到 token
|
||||

|
||||

|
||||
|
||||
8. 修改现有项目的url
|
||||
```shell
|
||||
|
||||
BIN
source/_posts/Git/2ceb11682cc7230cf1220ecb78e548b5.png
Normal file
|
After Width: | Height: | Size: 131 KiB |
BIN
source/_posts/Git/76ad4bb4370c7ae798f7b92c25859901.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
source/_posts/Git/image-20250416142637966.png
Normal file
|
After Width: | Height: | Size: 6.8 KiB |
BIN
source/_posts/Git/image-20250416151051085.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
source/_posts/Git/image-20250416151128595.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
source/_posts/Git/image-20250416151307312.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
source/_posts/Git/image-20250416151416275.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
source/_posts/Git/image-20250416151503685.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
178
source/_posts/React.md
Normal file
@ -0,0 +1,178 @@
|
||||
---
|
||||
title: React
|
||||
date: 2025-07-23 15:56:46
|
||||
tags:
|
||||
---
|
||||
|
||||
# 父子组件传递事件
|
||||
|
||||
## 子组件是模态框,确定按钮需要增加loading状态
|
||||
|
||||
### **子组件:增加 `confirmLoading` 状态并优化 `handleOk` 方法**
|
||||
|
||||
```tsx
|
||||
import React, { useState } from 'react';
|
||||
import { Modal, Checkbox, Input, message } from 'antd';
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
const { TextArea } = Input;
|
||||
|
||||
interface FeedbackModalProps {
|
||||
open: boolean;
|
||||
onOk: (selectedOption: number | null, feedbackText: string) => Promise<void>;
|
||||
onCancel: () => void;
|
||||
}
|
||||
|
||||
const FeedbackModal: React.FC<FeedbackModalProps> = ({ open, onOk, onCancel }) => {
|
||||
const [selectedOption, setSelectedOption] = useState<number | null>(null);
|
||||
const [feedbackText, setFeedbackText] = useState<string>('');
|
||||
const { t } = useTranslation()
|
||||
const [confirmLoading, setConfirmLoading] = useState(false);
|
||||
|
||||
const handleOk = async () => {
|
||||
if (!feedbackText) {
|
||||
message.warning('请填写反馈建议');
|
||||
return;
|
||||
}
|
||||
setConfirmLoading(true)
|
||||
try {
|
||||
await onOk(selectedOption, feedbackText);
|
||||
} finally {
|
||||
setConfirmLoading(false)
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal
|
||||
title="反馈"
|
||||
open={open}
|
||||
onOk={handleOk}
|
||||
onCancel={onCancel}
|
||||
okText={`${t('common.operation.confirm')}`}
|
||||
cancelText={`${t('common.operation.cancel')}`}
|
||||
confirmLoading={confirmLoading}
|
||||
>
|
||||
{/* <div>
|
||||
<Checkbox
|
||||
checked={selectedOption === 0}
|
||||
onChange={() => setSelectedOption(0)}
|
||||
>
|
||||
新增
|
||||
</Checkbox>
|
||||
<Checkbox
|
||||
checked={selectedOption === 1}
|
||||
onChange={() => setSelectedOption(1)}
|
||||
>
|
||||
修改
|
||||
</Checkbox>
|
||||
</div> */}
|
||||
<TextArea
|
||||
rows={4}
|
||||
placeholder="请输入您的反馈建议"
|
||||
value={feedbackText}
|
||||
onChange={(e) => setFeedbackText(e.target.value)}
|
||||
/>
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
export default FeedbackModal;
|
||||
|
||||
```
|
||||
|
||||
### **父组件:确保 `handleFeedbackSubmit` 返回 Promise**
|
||||
|
||||
```tsx
|
||||
const handleFeedbackSubmit = useCallback(
|
||||
async (selectedOption: number | null, feedbackText: string) => {
|
||||
console.log(currentMessageId);
|
||||
console.log(currentFeedback);
|
||||
|
||||
try {
|
||||
// 构造请求参数
|
||||
const requestBody = {
|
||||
operationType: currentFeedback!.rating, // 0 或 1
|
||||
feedbackText, // 用户反馈建议
|
||||
conversationId: currentConversationId, // 会话 ID
|
||||
messageId: currentMessageId, // 消息 ID
|
||||
username: getCookieValue('username'), // 用户名
|
||||
};
|
||||
|
||||
// 调用 Java 接口
|
||||
const javaResponse = await fetch(
|
||||
`/dev-api/api/conversation/feedback`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(requestBody),
|
||||
}
|
||||
);
|
||||
|
||||
// 调用原有的 updateFeedback 函数
|
||||
await updateFeedback(
|
||||
{
|
||||
url: `/messages/${currentMessageId}/feedbacks`,
|
||||
body: { rating: currentFeedback!.rating },
|
||||
},
|
||||
// isInstalledApp,
|
||||
// appId
|
||||
);
|
||||
|
||||
// 显示成功通知
|
||||
notify({ type: "success", message: t("common.api.success") });
|
||||
|
||||
if (resolveFeedback) {
|
||||
resolveFeedback(true); // 用户取消了反馈
|
||||
setResolveFeedback(null);
|
||||
}
|
||||
|
||||
// 关闭对话框
|
||||
setIsFeedbackModalVisible(false);
|
||||
} catch (error) {
|
||||
console.error("Error:", error);
|
||||
notify({ type: "error", message: t("common.api.failed") });
|
||||
} finally {
|
||||
setIsSubmittingNow(false);
|
||||
}
|
||||
},
|
||||
[
|
||||
currentMessageId,
|
||||
currentFeedback,
|
||||
currentConversationId,
|
||||
isInstalledApp,
|
||||
appId,
|
||||
notify,
|
||||
t,
|
||||
]
|
||||
);
|
||||
```
|
||||
|
||||
父组件调用子组件部分
|
||||
|
||||
```tsx
|
||||
<FeedbackModal
|
||||
open={isFeedbackModalVisible}
|
||||
onOk={handleFeedbackSubmit}
|
||||
onCancel={() => {
|
||||
if (resolveFeedback) {
|
||||
resolveFeedback(false); // 用户取消了反馈
|
||||
setResolveFeedback(null);
|
||||
}
|
||||
setIsFeedbackModalVisible(false)
|
||||
}}
|
||||
/>
|
||||
```
|
||||
|
||||
### **关键点说明**
|
||||
|
||||
1. **子组件内部管理加载状态**
|
||||
通过 `useState` 创建 `isLoading` 状态,并在 `handleOk` 中控制其值。点击按钮时,`isLoading` 变为 `true`,请求结束后变为 `false`。
|
||||
2. **`okButtonProps` 绑定加载状态**
|
||||
Ant Design 的 `Modal` 组件支持通过 `okButtonProps` 自定义按钮属性,这里将 `loading` 绑定到 `isLoading` 状态。
|
||||
3. **`onOk` 作为异步函数传递**
|
||||
父组件的 `handleFeedbackSubmit` 是 `async` 函数,返回 Promise。子组件通过 `await onOk()` 确保加载状态在请求结束后更新。
|
||||
4. **错误处理不影响加载状态**
|
||||
使用 `try...finally` 确保无论请求成功或失败,`isLoading` 都会被重置。
|
||||
@ -46,7 +46,7 @@ top_img: https://gcore.jsdelivr.net/gh/volantis-x/cdn-wallpaper/abstract/B951AE1
|
||||
|
||||
## 设置引用图片存储路径
|
||||
|
||||

|
||||

|
||||
|
||||
## Typora添加右键新建Markdown文件
|
||||
|
||||
@ -98,7 +98,7 @@ Windows Registry Editor Version 5.00
|
||||
|
||||
删除多余的文件(尤其是有一个什么Markdown File),只保留如下的两项。然后关闭注册表,即可修复bug
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
|
||||
@ -125,9 +125,9 @@ Windows Registry Editor Version 5.00
|
||||
```
|
||||
|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
## 上传图片至Minio
|
||||
|
||||
@ -191,7 +191,7 @@ picgo upload /path/to/your/image.png
|
||||
|
||||
### Typora设置
|
||||
|
||||

|
||||

|
||||
|
||||
## 主题
|
||||
|
||||
|
||||
BIN
source/_posts/Typora/image-20221118150139161.png
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
source/_posts/Typora/image-20221121130426162.png
Normal file
|
After Width: | Height: | Size: 69 KiB |
BIN
source/_posts/Typora/image-20221121130857072.png
Normal file
|
After Width: | Height: | Size: 147 KiB |
BIN
source/_posts/Typora/image-20250416154513069.png
Normal file
|
After Width: | Height: | Size: 63 KiB |
BIN
source/_posts/Typora/regedit.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
@ -10,106 +10,106 @@ tags:
|
||||
|
||||
默认选中「Try or Install Ubuntu Server」安装选项,回车(或等待 30 秒后),等待系统镜像自检并进行安装初始化。
|
||||
|
||||

|
||||

|
||||
|
||||
### 选择语言:English
|
||||
|
||||

|
||||

|
||||
|
||||
### 键盘默认:English
|
||||
|
||||

|
||||

|
||||
|
||||
### 安装类型:Ubuntu Server
|
||||
|
||||
选择默认第一个(会自带一些组件,方便使用)
|
||||
|
||||

|
||||

|
||||
|
||||
### 网络配置
|
||||
|
||||
使用 DHCP 或者 静态IP (建议这里设置好 静态IP,如果选择 DHCP,则在此界面直接选择Done 后即可)
|
||||
|
||||

|
||||

|
||||
|
||||
静态IP 选择 Edit IPv4
|
||||
|
||||

|
||||

|
||||
|
||||
然后选择 Manual
|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
### 代理配置
|
||||
|
||||
**Configure proxy配置页面的Proxy address无需配置**
|
||||
|
||||

|
||||

|
||||
|
||||
### 镜像源配置
|
||||
|
||||
默认清华源
|
||||
|
||||

|
||||

|
||||
|
||||
### 安装磁盘配置
|
||||
|
||||
**选择安装磁盘,直接回车默认自动分配,需要手动分区的话选择 [custom storage layout]**
|
||||
|
||||

|
||||

|
||||
|
||||
选择 **custom storage layout**
|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
首先分配swap分区:一般基于物理内存的 2-4倍
|
||||
|
||||

|
||||

|
||||
|
||||
/boot 分区,一般2G足以
|
||||
|
||||
/ 根分区,分配剩余空间
|
||||
|
||||

|
||||

|
||||
|
||||
### 设置计算机名及用户名
|
||||
|
||||

|
||||

|
||||
|
||||
### 是否升级 Ubuntu Pro
|
||||
|
||||
直接默认跳过即可
|
||||

|
||||

|
||||
|
||||
### 安装 OpenSSH 服务
|
||||
|
||||

|
||||

|
||||
|
||||
### 选择预置环境
|
||||
|
||||
按需选取,不需要则直接选择 Done 回车继续
|
||||
|
||||

|
||||

|
||||
|
||||
安装系统中
|
||||
|
||||

|
||||

|
||||
|
||||
安装完成后重启即可
|
||||
|
||||

|
||||

|
||||
|
||||
重启完成,进入系统
|
||||
|
||||

|
||||

|
||||
|
||||
## 配置网络
|
||||
|
||||

|
||||

|
||||
|
||||
```shell
|
||||
cd /etc/netplan
|
||||
@ -130,17 +130,17 @@ network:
|
||||
|
||||
在VirtualBox中工具->网络中 增加仅主机(Host-Only)网络
|
||||
|
||||

|
||||

|
||||
|
||||
网卡如果要是DHCP就选自动配置网卡,否则手动分配就选手动配置网卡
|
||||
|
||||
如果选DHCP,还需要启动服务器
|
||||
|
||||

|
||||

|
||||
|
||||
配置好后,在对应虚拟机中,添加好网卡,连接方式选择仅主机(Host-Only)网络,名称选择刚刚在工具中配置的
|
||||
|
||||

|
||||

|
||||
|
||||
以上修改需要先重启虚拟机
|
||||
|
||||
@ -173,7 +173,7 @@ sudo netplan apply
|
||||
|
||||
若不报错,则修改成功,再执行`ip a`查看网卡信息
|
||||
|
||||

|
||||

|
||||
|
||||
ip地址已经生效,可以在主机里 ping 一下
|
||||
|
||||
@ -388,6 +388,22 @@ sudo service slim start
|
||||
|
||||
通过按**F1**在GUI之间切换。该界面将在会话(或GUI)之间切换。切换到所选的GUI后登录。
|
||||
|
||||
### 关闭与打开GUI
|
||||
|
||||
#### 关闭
|
||||
|
||||
```shell
|
||||
sudo systemctl set-default multi-user.target
|
||||
sudo reboot
|
||||
```
|
||||
|
||||
#### 打开
|
||||
|
||||
```shell
|
||||
sudo systemctl set-default graphical.target
|
||||
sudo reboot
|
||||
```
|
||||
|
||||
## 远程桌面配置
|
||||
|
||||
### RDP
|
||||
@ -442,7 +458,7 @@ systemctl status xrdp
|
||||
sudo ufw allow from any to any port 3389 proto tcp
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
**接下来**,查看你的 Ubuntu 系统的 IP 地址,并在某处记下它。在您的终端上运行:
|
||||
|
||||
|
||||
BIN
source/_posts/ubuntu/image-20250509094634889.png
Normal file
|
After Width: | Height: | Size: 7.5 KiB |
BIN
source/_posts/ubuntu/image-20250509100201646.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
source/_posts/ubuntu/image-20250509100212670.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
source/_posts/ubuntu/image-20250509100247973.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
source/_posts/ubuntu/image-20250509100604701.png
Normal file
|
After Width: | Height: | Size: 9.6 KiB |
BIN
source/_posts/ubuntu/image-20250509100656239.png
Normal file
|
After Width: | Height: | Size: 9.6 KiB |
BIN
source/_posts/ubuntu/image-20250509100804038.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
source/_posts/ubuntu/image-20250509102609874.png
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
source/_posts/ubuntu/image-20250509102734539.png
Normal file
|
After Width: | Height: | Size: 8.8 KiB |
BIN
source/_posts/ubuntu/image-20250509102858753.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
source/_posts/ubuntu/image-20250509111350269.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
source/_posts/ubuntu/image-20250509112338500.png
Normal file
|
After Width: | Height: | Size: 9.8 KiB |
BIN
source/_posts/ubuntu/image-20250509112354306.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
source/_posts/ubuntu/image-20250509112453286.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
source/_posts/ubuntu/image-20250509112822681.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
source/_posts/ubuntu/image-20250509113002925.png
Normal file
|
After Width: | Height: | Size: 9.0 KiB |
BIN
source/_posts/ubuntu/image-20250509121748189.png
Normal file
|
After Width: | Height: | Size: 8.9 KiB |
BIN
source/_posts/ubuntu/image-20250509121806128.png
Normal file
|
After Width: | Height: | Size: 7.9 KiB |
BIN
source/_posts/ubuntu/image-20250509121923077.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
source/_posts/ubuntu/image-20250509122057921.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
source/_posts/ubuntu/image-20250509122413007.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
source/_posts/ubuntu/image-20250509123500684.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
source/_posts/ubuntu/image-20250509124052044.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
source/_posts/ubuntu/image-20250509124733922.png
Normal file
|
After Width: | Height: | Size: 74 KiB |
BIN
source/_posts/ubuntu/image-20250509124838460.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
source/_posts/ubuntu/image-20250509125003457.png
Normal file
|
After Width: | Height: | Size: 47 KiB |
BIN
source/_posts/ubuntu/image-20250509125542444.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 129 KiB After Width: | Height: | Size: 129 KiB |
87
source/_posts/对象存储.md
Normal file
@ -0,0 +1,87 @@
|
||||
---
|
||||
title: 对象存储
|
||||
date: 2025-07-23 14:27:11
|
||||
tags:
|
||||
---
|
||||
|
||||
# RustFS
|
||||
|
||||
## 安装
|
||||
|
||||
### Docker
|
||||
|
||||
新建rustfs目录
|
||||
|
||||
```shell
|
||||
mkdir ~/rustfs
|
||||
cd ~/rustfs
|
||||
```
|
||||
|
||||
编辑docker-compose.yml文件
|
||||
|
||||
```shell
|
||||
vim docker-compose.yml
|
||||
```
|
||||
|
||||
新增以下内容
|
||||
|
||||
```yaml
|
||||
services:
|
||||
rustfs:
|
||||
image: 'rustfs/rustfs:latest'
|
||||
container_name: 'rustfs'
|
||||
restart: always
|
||||
environment:
|
||||
- 'TZ:Asia/Shanghai'
|
||||
- 'RUSTFS_ACCESS_KEY=rustfsadmin'
|
||||
- 'RUSTFS_SECRET_KEY=rustfsadmin'
|
||||
- 'RUSTFS_CONSOLE_ENABLE=true'
|
||||
- 'RUSTFS_TLS_PATH=/certs'
|
||||
ports:
|
||||
- '9000:9000'
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- /mnt/rustfs/data:/data
|
||||
- /usr/ssl:/certs
|
||||
command:
|
||||
- "rustfs"
|
||||
- "--console-enable"
|
||||
- "--server-domains"
|
||||
- "rustfs.wenyongdalucky.club"
|
||||
```
|
||||
|
||||
:wq保存后退出
|
||||
|
||||
建立数据挂载目录
|
||||
|
||||
```shell
|
||||
sudo mkdir -p /mnt/rustfs/data
|
||||
```
|
||||
|
||||
在 `~/rustfs` 目录下使用Docker Compose启动容器
|
||||
|
||||
```shell
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
查看日志
|
||||
|
||||
```shell
|
||||
docker logs rustfs -f
|
||||
```
|
||||
|
||||
使用密钥登录的方式,输入账号、密钥
|
||||
|
||||
这里查看之前 docker-compose.yml文件中的 RUSTFS_ACCESS_KEY、RUSTFS_SECRET_KEY 进行登录即可。
|
||||
|
||||
这里就都输入 rustfsadmin登录
|
||||
|
||||
进入到控制台
|
||||
|
||||
创建存储桶 hexo
|
||||
|
||||

|
||||
|
||||
需将桶配置中的访问策略改为 公有,防止无法通过Markdown访问
|
||||
|
||||

|
||||