chore: ipv6支持

pull/243/head
xiaojunnuo 2024-11-13 22:42:11 +08:00
parent 70db327eda
commit a38ff69cbd
6 changed files with 64 additions and 26 deletions

View File

@ -11,10 +11,8 @@ services:
ports: # 端口映射
# ↓↓↓↓ ---------------------------------------------------------- 如果端口有冲突可以修改第一个7001为其他不冲突的端口号
- "7001:7001"
# ↓↓↓↓ ---------------------------------------------------------- https端口可以根据实际情况是否暴露相关服务端口
# ↓↓↓↓ ---------------------------------------------------------- https端口可以根据实际情况是否暴露端口
- "7002:7002"
networks:
- ip6net
# #↓↓↓↓ -------------------------------------------------------------- 如果出现getaddrinfo ENOTFOUND等错误可以尝试设置dns配置
# dns:
# - 223.5.5.5
@ -27,27 +25,30 @@ services:
# - 8.8.4.4
# extra_hosts:
# # ↓↓↓↓ ---------------------------------------------------------- 这里可以配置自定义hosts外网域名可以指向本地局域网ip地址
# # ↓↓↓↓ -------------------------------------------------------- 这里可以配置自定义hosts外网域名可以指向本地局域网ip地址
# - "localdomain.comm:192.168.1.3"
environment:
# 设置环境变量即可自定义certd配置
# 配置项见: packages/ui/certd-server/src/config/config.default.ts
# 配置规则: certd_ + 配置项, 点号用_代替
# ↓↓↓↓ ----------------------------- 如果忘记管理员密码可以设置为true重启之后管理员密码将改成123456然后请及时修改回false
# 设置环境变量即可自定义certd配置
# 配置项见: packages/ui/certd-server/src/config/config.default.ts
# 配置规则: certd_ + 配置项, 点号用_代替
# #↓↓↓↓ ----------------------------- 如果忘记管理员密码可以设置为true重启之后管理员密码将改成123456然后请及时修改回false
- certd_system_resetAdminPasswd=false
# ↓↓↓↓ ------------------------------- 使用postgresql数据库
# - certd_flyway_scriptDir=./db/migration-pg # 升级脚本目录
# - certd_typeorm_dataSource_default_type=postgres # 数据库类型
# - certd_typeorm_dataSource_default_host=localhost # 数据库地址
# - certd_typeorm_dataSource_default_port=5433 # 数据库端口
# - certd_typeorm_dataSource_default_username=postgres # 用户名
# - certd_typeorm_dataSource_default_password=yourpasswd # 密码
# - certd_typeorm_dataSource_default_database=certd # 数据库名
# #↓↓↓↓ ----------------------------- 使用postgresql数据库
# - certd_flyway_scriptDir=./db/migration-pg # 升级脚本目录
# - certd_typeorm_dataSource_default_type=postgres # 数据库类型
# - certd_typeorm_dataSource_default_host=localhost # 数据库地址
# - certd_typeorm_dataSource_default_port=5433 # 数据库端口
# - certd_typeorm_dataSource_default_username=postgres # 用户名
# - certd_typeorm_dataSource_default_password=yourpasswd # 密码
# - certd_typeorm_dataSource_default_database=certd # 数据库名
networks:
ip6net:
enable_ipv6: true
ipam:
config:
- subnet: 2001:db8::/64
# #↓↓↓↓ ------------------------------------------------------------- 启用ipv6网络
# networks:
# - ip6net
#networks:
# ip6net:
# enable_ipv6: true
# ipam:
# config:
# - subnet: 2001:db8::/64

View File

@ -7,6 +7,8 @@ export * from './util.promise.js';
export * from './util.hash.js';
export * from './util.merge.js';
export * from './util.cache.js';
export * from './util.string.js';
import { stringUtils } from './util.string.js';
import sleep from './util.sleep.js';
import { http, download } from './util.request.js';
@ -38,4 +40,5 @@ export const utils = {
dayjs,
domain: domainUtils,
options: optionsUtils,
string: stringUtils,
};

View File

@ -0,0 +1,8 @@
export const stringUtils = {
maxLength(str?: string, length = 100) {
if (str) {
return str.length > length ? str.slice(0, length) + '...' : str;
}
return '';
},
};

View File

@ -3,7 +3,7 @@ import * as sites from "./util.site";
import * as storages from "./util.storage";
import commons from "./util.common";
import * as mitt from "./util.mitt";
import router from "/util.router";
import { routerUtils } from "./util.router";
import { treeUtils } from "./util.tree";
export const util = {
...envs,
@ -11,6 +11,6 @@ export const util = {
...storages,
...commons,
...mitt,
...router,
router: routerUtils,
tree: treeUtils
};

View File

@ -33,5 +33,12 @@ export default {
async sleep(ms: number) {
return new Promise((resolve) => setTimeout(resolve, ms));
},
maxLength(str?: string, length = 100) {
if (str) {
return str.length > length ? str.slice(0, length) + "..." : str;
}
return "";
}
};

View File

@ -47,13 +47,14 @@
</fs-page>
</template>
<script setup lang="ts">
<script setup lang="tsx">
import { reactive, ref } from "vue";
import * as api from "./api";
import { SysSettings } from "./api";
import { notification } from "ant-design-vue";
import { useSettingStore } from "/@/store/modules/settings";
import { merge } from "lodash-es";
import { util } from "/@/utils";
defineOptions({
name: "SysSettings"
@ -111,7 +112,25 @@ async function testProxy() {
testProxyLoading.value = true;
try {
const res = await api.TestProxy();
const content = `测试google:${res.google === true ? "成功" : "失败" + res.google},测试百度:${res.baidu === true ? "成功" : "失败:" + res.baidu}`;
let success = true;
if (res.google !== true || res.baidu !== true) {
success = false;
}
const content = () => {
return (
<div>
<div>Google: {res.google === true ? "成功" : util.maxLength(res.google)}</div>
<div>Baidu: {res.baidu === true ? "成功" : util.maxLength(res.google)}</div>
</div>
);
};
if (!success) {
notification.error({
message: "测试失败",
description: content
});
return;
}
notification.success({
message: "测试完成",
description: content