diff --git a/agent/utils/qqwry/qqwry.go b/agent/utils/qqwry/qqwry.go
deleted file mode 100644
index bdb1558e9..000000000
--- a/agent/utils/qqwry/qqwry.go
+++ /dev/null
@@ -1,165 +0,0 @@
-package qqwry
-
-import (
- "encoding/binary"
- "net"
- "strings"
-
- "github.com/1Panel-dev/1Panel/agent/cmd/server/qqwry"
- "golang.org/x/text/encoding/simplifiedchinese"
-)
-
-const (
- indexLen = 7
- redirectMode1 = 0x01
- redirectMode2 = 0x02
-)
-
-var IpCommonDictionary []byte
-
-type QQwry struct {
- Data []byte
- Offset int64
-}
-
-func NewQQwry() (*QQwry, error) {
- IpCommonDictionary := qqwry.QQwryByte
- return &QQwry{Data: IpCommonDictionary}, nil
-}
-
-// readData 从文件中读取数据
-func (q *QQwry) readData(num int, offset ...int64) (rs []byte) {
- if len(offset) > 0 {
- q.setOffset(offset[0])
- }
- nums := int64(num)
- end := q.Offset + nums
- dataNum := int64(len(q.Data))
- if q.Offset > dataNum {
- return nil
- }
-
- if end > dataNum {
- end = dataNum
- }
- rs = q.Data[q.Offset:end]
- q.Offset = end
- return
-}
-
-// setOffset 设置偏移量
-func (q *QQwry) setOffset(offset int64) {
- q.Offset = offset
-}
-
-// Find ip地址查询对应归属地信息
-func (q *QQwry) Find(ip string) (res ResultQQwry) {
- res = ResultQQwry{}
- res.IP = ip
- if strings.Count(ip, ".") != 3 {
- return res
- }
- offset := q.searchIndex(binary.BigEndian.Uint32(net.ParseIP(ip).To4()))
- if offset <= 0 {
- return
- }
-
- var area []byte
- mode := q.readMode(offset + 4)
- if mode == redirectMode1 {
- countryOffset := q.readUInt24()
- mode = q.readMode(countryOffset)
- if mode == redirectMode2 {
- c := q.readUInt24()
- area = q.readString(c)
- } else {
- area = q.readString(countryOffset)
- }
- } else if mode == redirectMode2 {
- countryOffset := q.readUInt24()
- area = q.readString(countryOffset)
- } else {
- area = q.readString(offset + 4)
- }
-
- enc := simplifiedchinese.GBK.NewDecoder()
- res.Area, _ = enc.String(string(area))
-
- return
-}
-
-type ResultQQwry struct {
- IP string `json:"ip"`
- Area string `json:"area"`
-}
-
-// readMode 获取偏移值类型
-func (q *QQwry) readMode(offset uint32) byte {
- mode := q.readData(1, int64(offset))
- return mode[0]
-}
-
-// readString 获取字符串
-func (q *QQwry) readString(offset uint32) []byte {
- q.setOffset(int64(offset))
- data := make([]byte, 0, 30)
- for {
- buf := q.readData(1)
- if buf[0] == 0 {
- break
- }
- data = append(data, buf[0])
- }
- return data
-}
-
-// searchIndex 查找索引位置
-func (q *QQwry) searchIndex(ip uint32) uint32 {
- header := q.readData(8, 0)
-
- start := binary.LittleEndian.Uint32(header[:4])
- end := binary.LittleEndian.Uint32(header[4:])
-
- for {
- mid := q.getMiddleOffset(start, end)
- buf := q.readData(indexLen, int64(mid))
- _ip := binary.LittleEndian.Uint32(buf[:4])
-
- if end-start == indexLen {
- offset := byteToUInt32(buf[4:])
- buf = q.readData(indexLen)
- if ip < binary.LittleEndian.Uint32(buf[:4]) {
- return offset
- }
- return 0
- }
-
- if _ip > ip {
- end = mid
- } else if _ip < ip {
- start = mid
- } else if _ip == ip {
- return byteToUInt32(buf[4:])
- }
- }
-}
-
-// readUInt24
-func (q *QQwry) readUInt24() uint32 {
- buf := q.readData(3)
- return byteToUInt32(buf)
-}
-
-// getMiddleOffset
-func (q *QQwry) getMiddleOffset(start uint32, end uint32) uint32 {
- records := ((end - start) / indexLen) >> 1
- return start + records*indexLen
-}
-
-// byteToUInt32 将 byte 转换为uint32
-func byteToUInt32(data []byte) uint32 {
- i := uint32(data[0]) & 0xff
- i |= (uint32(data[1]) << 8) & 0xff00
- i |= (uint32(data[2]) << 16) & 0xff0000
- return i
-}
diff --git a/frontend/src/components/task-list/index.vue b/frontend/src/components/task-list/index.vue
index ddde4ed5c..c008ed130 100644
--- a/frontend/src/components/task-list/index.vue
+++ b/frontend/src/components/task-list/index.vue
@@ -14,22 +14,20 @@
-
-
-
-
+
+
+
-
+
{{ $t('website.check') }}
-
+
diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts
index 5d37792c2..7caf5a148 100644
--- a/frontend/src/lang/modules/en.ts
+++ b/frontend/src/lang/modules/en.ts
@@ -2382,6 +2382,7 @@ const message = {
rainyun: 'Rain Yun',
volcengine: 'Volcengine',
runtimePortHelper: 'The current runtime environment has multiple ports. Please select a proxy port.',
+ runtimePortWarn: 'The current runtime environment has no ports, unable to proxy',
},
php: {
short_open_tag: 'Short tag support',
@@ -3236,6 +3237,8 @@ const message = {
postNode: 'Sync to sub-node',
postNodeHelper: 'Sub-nodes will inherit and use the above configuration by default',
nodes: 'Nodes',
+ selectNode: 'Select Node',
+ selectNodeError: 'Please select a node',
},
alert: {
isAlert: 'Alert',
diff --git a/frontend/src/lang/modules/ja.ts b/frontend/src/lang/modules/ja.ts
index 4fe143b80..d4f338848 100644
--- a/frontend/src/lang/modules/ja.ts
+++ b/frontend/src/lang/modules/ja.ts
@@ -2240,6 +2240,7 @@ const message = {
rainyun: '雨雲',
volcengine: 'volcengine',
runtimePortHelper: '現在の実行環境には複数のポートがあります。プロキシポートを選択してください。',
+ runtimePortWarn: '現在の実行環境にはポートがありません。プロキシできません',
},
php: {
short_open_tag: '短いタグサポート',
@@ -3045,6 +3046,8 @@ const message = {
postNode: 'サブノードへ同期',
postNodeHelper: 'サブノードはデフォルトで上記の設定を継承して使用します',
nodes: 'ノードを選択',
+ selectNode: 'ノードを選択',
+ selectNodeError: 'ノードを選択してください',
},
alert: {
isAlert: 'アラート',
diff --git a/frontend/src/lang/modules/ko.ts b/frontend/src/lang/modules/ko.ts
index 22e6875c0..561d41246 100644
--- a/frontend/src/lang/modules/ko.ts
+++ b/frontend/src/lang/modules/ko.ts
@@ -2204,6 +2204,7 @@ const message = {
rainyun: 'Rainyun',
volcengine: 'volcengine',
runtimePortHelper: '현재 실행 환경에 여러 포트가 있습니다. 프록시 포트를 선택하세요.',
+ runtimePortWarn: '현재 실행 환경에 포트가 없습니다. 프록시할 수 없습니다',
},
php: {
short_open_tag: '짧은 태그 지원',
@@ -2995,6 +2996,8 @@ const message = {
postNode: '서브 노드로 동기화',
postNodeHelper: '서브 노드는 기본적으로 위 설정을 상속하고 사용합니다',
nodes: '노드 선택',
+ selectNode: '노드 선택',
+ selectNodeError: '노드를 선택하세요',
},
alert: {
isAlert: '알림',
diff --git a/frontend/src/lang/modules/ms.ts b/frontend/src/lang/modules/ms.ts
index 1968b39bf..e9103f96a 100644
--- a/frontend/src/lang/modules/ms.ts
+++ b/frontend/src/lang/modules/ms.ts
@@ -2295,6 +2295,7 @@ const message = {
rainyun: 'Rainyun',
volcengine: 'Volcengine',
runtimePortHelper: 'Persekitaran runtime semasa mempunyai beberapa port. Sila pilih port proksi.',
+ runtimePortWarn: 'Persekitaran runtime semasa tidak mempunyai port, tidak dapat proksi',
},
php: {
short_open_tag: 'Sokongan tag pendek',
@@ -3115,6 +3116,8 @@ const message = {
postNode: 'Segerakkan ke sub-node',
postNodeHelper: 'Sub-node akan mewarisi dan menggunakan konfigurasi di atas secara lalai',
nodes: 'Pilih Node',
+ selectNode: 'Pilih Node',
+ selectNodeError: 'Sila pilih node',
},
alert: {
isAlert: 'Amaran',
diff --git a/frontend/src/lang/modules/pt-br.ts b/frontend/src/lang/modules/pt-br.ts
index 56582ed4e..66fa73c60 100644
--- a/frontend/src/lang/modules/pt-br.ts
+++ b/frontend/src/lang/modules/pt-br.ts
@@ -2290,6 +2290,7 @@ const message = {
rainyun: 'Rainyun',
volcengine: 'Volcengine',
runtimePortHelper: 'O ambiente de runtime atual possui várias portas. Por favor, selecione uma porta de proxy.',
+ runtimePortWarn: 'O ambiente de execução atual não possui portos, não é possível proxiar',
},
php: {
short_open_tag: 'Suporte para short tags',
@@ -3119,6 +3120,8 @@ const message = {
postNode: 'Sincronizar para subnó',
postNodeHelper: 'Subnós herdarão e usarão a configuração acima por padrão',
nodes: 'Selecionar Nós',
+ selectNode: 'Selecionar Node',
+ selectNodeError: 'Por favor, selecione um nó',
},
alert: {
isAlert: 'Alerta',
diff --git a/frontend/src/lang/modules/ru.ts b/frontend/src/lang/modules/ru.ts
index a1ce45b1d..81a3128eb 100644
--- a/frontend/src/lang/modules/ru.ts
+++ b/frontend/src/lang/modules/ru.ts
@@ -2292,6 +2292,7 @@ const message = {
rainyun: 'Rainyun',
volcengine: 'Volcengine',
runtimePortHelper: 'O ambiente de runtime atual possui várias portas. Por favor, selecione uma porta de proxy.',
+ runtimePortWarn: 'В текущей среде выполнения нет портов, невозможно проксировать',
},
php: {
short_open_tag: 'Поддержка коротких тегов',
@@ -3109,6 +3110,8 @@ const message = {
postNode: 'Синхронизировать с подузлом',
postNodeHelper: 'Подузлы будут наследовать и использовать указанную конфигурацию по умолчанию',
nodes: 'Выбрать узлы',
+ selectNode: 'Выбрать узел',
+ selectNodeError: 'Пожалуйста, выберите узел',
},
alert: {
isAlert: 'Оповещение',
diff --git a/frontend/src/lang/modules/zh-Hant.ts b/frontend/src/lang/modules/zh-Hant.ts
index e7a39749d..a7c5c7ec9 100644
--- a/frontend/src/lang/modules/zh-Hant.ts
+++ b/frontend/src/lang/modules/zh-Hant.ts
@@ -2209,6 +2209,7 @@ const message = {
rainyun: '雨雲',
volcengine: 'Volcengine',
runtimePortHelper: '當前運行環境存在多個端口,請選擇一個代理端口。',
+ runtimePortWarn: '當前運行環境沒有端口,無法代理',
},
php: {
short_open_tag: '短標簽支持',
@@ -2998,6 +2999,8 @@ const message = {
postNode: '同步至子節點',
postNodeHelper: '子節點預設繼承並使用上述配置',
nodes: '節點',
+ selectNode: '選擇節點',
+ selectNodeError: '請選擇節點',
},
alert: {
isAlert: '是否告警',
diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts
index 60520fe51..be4d1e665 100644
--- a/frontend/src/lang/modules/zh.ts
+++ b/frontend/src/lang/modules/zh.ts
@@ -2199,6 +2199,7 @@ const message = {
rainyun: '雨云',
volcengine: '火山引擎',
runtimePortHelper: '当前运行环境存在多个端口,请选择一个代理端口',
+ runtimePortWarn: '当前运行环境没有端口,无法代理',
},
php: {
short_open_tag: '短标签支持',
@@ -2979,6 +2980,8 @@ const message = {
postNode: '同步至子节点',
postNodeHelper: '子节点默认继承并使用上述配置',
nodes: '节点',
+ selectNode: '选择节点',
+ selectNodeError: '请选择节点',
},
alert: {
isAlert: '是否告警',
diff --git a/frontend/src/views/log/task/index.vue b/frontend/src/views/log/task/index.vue
index e88b89287..b1f436b55 100644
--- a/frontend/src/views/log/task/index.vue
+++ b/frontend/src/views/log/task/index.vue
@@ -17,14 +17,13 @@
-
-
-
+
+
-
+
{{ $t('website.check') }}
diff --git a/frontend/src/views/website/runtime/components/port-jump.vue b/frontend/src/views/website/runtime/components/port-jump.vue
new file mode 100644
index 000000000..15cb020f3
--- /dev/null
+++ b/frontend/src/views/website/runtime/components/port-jump.vue
@@ -0,0 +1,25 @@
+
+
+
+
+
diff --git a/frontend/src/views/website/runtime/dotnet/index.vue b/frontend/src/views/website/runtime/dotnet/index.vue
index 9a9743cba..5ecaaee75 100644
--- a/frontend/src/views/website/runtime/dotnet/index.vue
+++ b/frontend/src/views/website/runtime/dotnet/index.vue
@@ -43,14 +43,7 @@
-
-
-
- {{ port }}
-
-
-
-
+
@@ -104,12 +97,12 @@ import i18n from '@/lang';
import RouterMenu from '../index.vue';
import router from '@/routers/router';
import ComposeLogs from '@/components/log/compose/index.vue';
-import { Promotion } from '@element-plus/icons-vue';
import PortJumpDialog from '@/components/port-jump/index.vue';
import AppResources from '@/views/website/runtime/php/check/index.vue';
import { ElMessageBox } from 'element-plus';
import { GlobalStore } from '@/store';
import RuntimeStatus from '@/views/website/runtime/components/runtime-status.vue';
+import PortJump from '@/views/website/runtime/components/port-jump.vue';
import { disabledButton } from '@/utils/runtime';
let timer: NodeJS.Timer | null = null;
diff --git a/frontend/src/views/website/runtime/go/index.vue b/frontend/src/views/website/runtime/go/index.vue
index 656906892..bee9b46c5 100644
--- a/frontend/src/views/website/runtime/go/index.vue
+++ b/frontend/src/views/website/runtime/go/index.vue
@@ -43,12 +43,7 @@
-
-
- {{ port }}
-
-
-
+
@@ -102,11 +97,11 @@ import i18n from '@/lang';
import RouterMenu from '../index.vue';
import router from '@/routers/router';
import ComposeLogs from '@/components/log/compose/index.vue';
-import { Promotion } from '@element-plus/icons-vue';
import PortJumpDialog from '@/components/port-jump/index.vue';
import AppResources from '@/views/website/runtime/php/check/index.vue';
import { ElMessageBox } from 'element-plus';
import RuntimeStatus from '@/views/website/runtime/components/runtime-status.vue';
+import PortJump from '@/views/website/runtime/components/port-jump.vue';
import { disabledButton } from '@/utils/runtime';
let timer: NodeJS.Timer | null = null;
diff --git a/frontend/src/views/website/runtime/java/index.vue b/frontend/src/views/website/runtime/java/index.vue
index 60958061d..acf1a5b34 100644
--- a/frontend/src/views/website/runtime/java/index.vue
+++ b/frontend/src/views/website/runtime/java/index.vue
@@ -43,12 +43,7 @@
-
-
- {{ port }}
-
-
-
+
@@ -102,11 +97,11 @@ import i18n from '@/lang';
import RouterMenu from '../index.vue';
import router from '@/routers/router';
import ComposeLogs from '@/components/log/compose/index.vue';
-import { Promotion } from '@element-plus/icons-vue';
import PortJumpDialog from '@/components/port-jump/index.vue';
import AppResources from '@/views/website/runtime/php/check/index.vue';
import { ElMessageBox } from 'element-plus';
import RuntimeStatus from '@/views/website/runtime/components/runtime-status.vue';
+import PortJump from '@/views/website/runtime/components/port-jump.vue';
import { disabledButton } from '@/utils/runtime';
let timer: NodeJS.Timer | null = null;
diff --git a/frontend/src/views/website/runtime/node/index.vue b/frontend/src/views/website/runtime/node/index.vue
index dda2d9788..3f8eb144c 100644
--- a/frontend/src/views/website/runtime/node/index.vue
+++ b/frontend/src/views/website/runtime/node/index.vue
@@ -43,12 +43,7 @@
-
-
- {{ port }}
-
-
-
+
@@ -104,11 +99,11 @@ import RouterMenu from '../index.vue';
import Modules from '@/views/website/runtime/node/module/index.vue';
import router from '@/routers/router';
import ComposeLogs from '@/components/log/compose/index.vue';
-import { Promotion } from '@element-plus/icons-vue';
import PortJumpDialog from '@/components/port-jump/index.vue';
import AppResources from '@/views/website/runtime/php/check/index.vue';
import { ElMessageBox } from 'element-plus';
import RuntimeStatus from '@/views/website/runtime/components/runtime-status.vue';
+import PortJump from '@/views/website/runtime/components/port-jump.vue';
import { disabledButton } from '@/utils/runtime';
let timer: NodeJS.Timer | null = null;
diff --git a/frontend/src/views/website/runtime/python/index.vue b/frontend/src/views/website/runtime/python/index.vue
index 8e167f8ed..d363e3481 100644
--- a/frontend/src/views/website/runtime/python/index.vue
+++ b/frontend/src/views/website/runtime/python/index.vue
@@ -43,12 +43,7 @@
-
-
- {{ port }}
-
-
-
+
@@ -102,11 +97,11 @@ import i18n from '@/lang';
import RouterMenu from '../index.vue';
import router from '@/routers/router';
import ComposeLogs from '@/components/log/compose/index.vue';
-import { Promotion } from '@element-plus/icons-vue';
import PortJumpDialog from '@/components/port-jump/index.vue';
import AppResources from '@/views/website/runtime/php/check/index.vue';
import { ElMessageBox } from 'element-plus';
import RuntimeStatus from '@/views/website/runtime/components/runtime-status.vue';
+import PortJump from '@/views/website/runtime/components/port-jump.vue';
import { disabledButton } from '@/utils/runtime';
let timer: NodeJS.Timer | null = null;
diff --git a/frontend/src/views/website/website/create/index.vue b/frontend/src/views/website/website/create/index.vue
index 204cb6faa..2cebcf1f3 100644
--- a/frontend/src/views/website/website/create/index.vue
+++ b/frontend/src/views/website/website/create/index.vue
@@ -240,7 +240,7 @@
{{ $t('website.runtimePortHelper') }}
+
+ {{ $t('website.runtimePortWarn') }}
+
@@ -542,7 +553,7 @@ import { ElForm, FormInstance } from 'element-plus';
import { reactive, ref } from 'vue';
import Params from '@/views/app-store/detail/params/index.vue';
import Check from '../check/index.vue';
-import { MsgSuccess } from '@/utils/message';
+import { MsgError, MsgSuccess } from '@/utils/message';
import { getGroupList } from '@/api/modules/group';
import { Group } from '@/api/interface/group';
import { SearchRuntimes } from '@/api/modules/runtime';
@@ -787,20 +798,20 @@ const changeRuntimeType = () => {
};
const changeRuntime = (runID: number) => {
+ website.value.port = 0;
runtimes.value.forEach((item) => {
if (item.id === runID) {
runtimeResource.value = item.resource;
runtimePorts.value = item.port.split(',').map((port: string) => parseInt(port.trim(), 10));
- if (runtimePorts.value.length > 1) {
+ if (runtimePorts.value.length > 0) {
website.value.port = runtimePorts.value[0];
- } else {
- website.value.port = 0;
}
}
});
};
const getRuntimes = async () => {
+ website.value.port = 0;
try {
const res = await SearchRuntimes(runtimeReq.value);
runtimes.value = res.data.items || [];
@@ -809,10 +820,8 @@ const getRuntimes = async () => {
website.value.runtimeID = first.id;
runtimeResource.value = first.resource;
runtimePorts.value = first.port.split(',').map((port: string) => parseInt(port.trim(), 10));
- if (runtimePorts.value.length > 1) {
+ if (runtimePorts.value.length > 0) {
website.value.port = runtimePorts.value[0];
- } else {
- website.value.port = 0;
}
}
} catch (error) {}
@@ -883,6 +892,10 @@ const submit = async (formEl: FormInstance | undefined) => {
if (!valid) {
return;
}
+ if (website.value.type === 'runtime' && website.value.runtimeType !== 'php' && website.value.port == 0) {
+ MsgError(i18n.global.t('website.runtimePortWarn'));
+ return;
+ }
loading.value = true;
preCheck({})
.then((res) => {