Skip to content

Commit 0870d6e

Browse files
author
ssongliu
committed
fix: Fix the exception of some 1pctl commands
1 parent d09a3d8 commit 0870d6e

14 files changed

Lines changed: 56 additions & 32 deletions

File tree

core/cmd/server/cmd/listen-ip.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package cmd
33
import (
44
"fmt"
55

6+
"github.com/1Panel-dev/1Panel/core/constant"
67
"github.com/1Panel-dev/1Panel/core/i18n"
78
"github.com/spf13/cobra"
89
)
@@ -51,11 +52,11 @@ func updateBindInfo(protocol string) error {
5152
if err != nil {
5253
return err
5354
}
54-
ipv6 := "disable"
55+
ipv6 := constant.StatusDisable
5556
tcp := "tcp4"
5657
address := "0.0.0.0"
5758
if protocol == "ipv6" {
58-
ipv6 = "enable"
59+
ipv6 = constant.StatusEnable
5960
tcp = "tcp6"
6061
address = "::"
6162
}

core/cmd/server/cmd/reset.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package cmd
33
import (
44
"fmt"
55

6+
"github.com/1Panel-dev/1Panel/core/constant"
67
"github.com/1Panel-dev/1Panel/core/i18n"
78
"github.com/spf13/cobra"
89
)
@@ -43,7 +44,7 @@ var resetMFACmd = &cobra.Command{
4344
return err
4445
}
4546

46-
return setSettingByKey(db, "MFAStatus", "disable")
47+
return setSettingByKey(db, "MFAStatus", constant.StatusDisable)
4748
},
4849
}
4950
var resetSSLCmd = &cobra.Command{
@@ -59,7 +60,7 @@ var resetSSLCmd = &cobra.Command{
5960
return err
6061
}
6162

62-
return setSettingByKey(db, "SSL", "disable")
63+
return setSettingByKey(db, "SSL", constant.StatusDisable)
6364
},
6465
}
6566
var resetEntranceCmd = &cobra.Command{

core/cmd/server/cmd/restore.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ var restoreCmd = &cobra.Command{
7373
}
7474
fmt.Println(i18n.GetMsgByKeyForCmd("RestoreStep4"))
7575
if _, err := os.Stat(path.Join(tmpPath, "db")); err == nil {
76-
dbPath := path.Join(baseDir, "1panel/db")
76+
dbPath := path.Join(baseDir, "1panel")
7777
if err := files.CopyItem(true, true, path.Join(tmpPath, "db"), dbPath); err != nil {
7878
global.LOG.Errorf("rollback 1panel db failed, err: %v", err)
7979
}

core/cmd/server/cmd/update.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"strings"
1010
"unicode"
1111

12+
"github.com/1Panel-dev/1Panel/core/constant"
1213
"github.com/1Panel-dev/1Panel/core/global"
1314
"github.com/1Panel-dev/1Panel/core/i18n"
1415
"github.com/1Panel-dev/1Panel/core/utils/cmd"
@@ -136,7 +137,7 @@ func password() {
136137
return
137138
}
138139
complexSetting := getSettingByKey(db, "ComplexityVerification")
139-
if complexSetting == "enable" {
140+
if complexSetting == constant.StatusEnable {
140141
if isValidPassword("newPassword") {
141142
fmt.Println("\n" + i18n.GetMsgByKeyForCmd("UpdatePasswordFormat"))
142143
return

core/cmd/server/cmd/user-info.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package cmd
33
import (
44
"fmt"
55

6+
"github.com/1Panel-dev/1Panel/core/constant"
67
"github.com/1Panel-dev/1Panel/core/global"
78
"github.com/1Panel-dev/1Panel/core/i18n"
89
"github.com/1Panel-dev/1Panel/core/utils/encrypt"
@@ -41,7 +42,7 @@ var userinfoCmd = &cobra.Command{
4142
address := getSettingByKey(db, "SystemIP")
4243

4344
protocol := "http"
44-
if ssl == "enable" {
45+
if ssl == constant.StatusEnable {
4546
protocol = "https"
4647
}
4748
if address == "" {

frontend/src/lang/modules/en.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1835,17 +1835,16 @@ const message = {
18351835
noUpgrade: 'It is currently the latest version',
18361836
versionHelper:
18371837
'Name rules: [major version].[functional version].[Bug fix version], as shown in the following example:',
1838-
versionHelper1: 'v1.0.1 is a Bug fix after v1.0.0',
1839-
versionHelper2: 'v1.1.0 is a feature release after v1.0.0',
1838+
rollbackLocalHelper:
1839+
'The primary node does not support direct rollback. Please manually execute the [1pctl restore] command to rollback!',
18401840
upgradeCheck: 'Check for updates',
18411841
upgradeNotes: 'Release note',
18421842
upgradeNow: 'Upgrade now',
18431843
source: 'Download source',
1844-
hasNewVersion: 'New version Available',
1845-
versionHigher:
1846-
'Detected that node {0} version is higher than the main node, switching is not supported at this time. Please upgrade the main node system version and try again!',
1847-
versionLower:
1848-
'Detected that node {0} version is lower than the main node, switching is not supported at this time. Please upgrade the system version of this node and try again!',
1844+
versionNotSame:
1845+
'The version of this node does not match the primary node. Switching is not supported at this time. Please check and try again!',
1846+
versionCompare:
1847+
'Detected that node {0} is already at the latest upgradable version. Please check the primary node version and try again!',
18491848

18501849
about: 'About',
18511850
project: 'Project Address',

frontend/src/lang/modules/ja.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1739,10 +1739,16 @@ const message = {
17391739
'この回復をロールバックすると、この回復からすべてのファイルを置き換え、Dockerサービスと1パネルサービスを再起動する必要がある場合があります。続けたいですか?',
17401740

17411741
upgradeHelper: 'アップグレードには、1パネルサービスを再起動する必要があります。続けたいですか?',
1742+
rollbackLocalHelper:
1743+
'マスターノードは直接ロールバックをサポートしていません。手動で「1pctl restore」コマンドを実行してロールバックしてください!',
17421744
noUpgrade: '現在、最新バージョンです',
17431745
upgradeNotes: 'リリースノート',
17441746
upgradeNow: '今すぐアップグレードしてください',
17451747
source: 'ソースをダウンロードします',
1748+
versionNotSame:
1749+
'このノードのバージョンがマスターノードと一致しません。現在は切り替えをサポートしていません。確認後、再試行してください!',
1750+
versionCompare:
1751+
'ノード {0} は既にアップグレード可能な最新バージョンです。マスターノードのバージョンを確認後、再試行してください!',
17461752

17471753
about: 'について',
17481754
project: 'GitHub',

frontend/src/lang/modules/ko.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,10 +1713,16 @@ const message = {
17131713
'이 복구를 롤백하면 해당 복구의 모든 파일이 대체되며 Docker 및 1Panel 서비스를 재시작해야 할 수 있습니다. 계속하시겠습니까?',
17141714

17151715
upgradeHelper: '업그레이드에는 1Panel 서비스를 재시작해야 합니다. 계속하시겠습니까?',
1716+
rollbackLocalHelper:
1717+
'마스터 노드는 직접 롤백을 지원하지 않습니다. 수동으로 [1pctl restore] 명령어를 실행하여 롤백하세요!',
17161718
noUpgrade: '현재 최신 버전입니다',
17171719
upgradeNotes: '릴리스 노트',
17181720
upgradeNow: '지금 업그레이드',
17191721
source: '다운로드 소스',
1722+
versionNotSame:
1723+
'이 노드의 버전이 마스터 노드와 일치하지 않습니다. 현재 전환을 지원하지 않습니다. 확인 후 다시 시도하세요!',
1724+
versionCompare:
1725+
'노드 {0}이(가) 이미 업그레이드 가능한 최신 버전입니다. 마스터 노드 버전을 확인 후 다시 시도하세요!',
17201726

17211727
about: '정보',
17221728
project: 'GitHub',

frontend/src/lang/modules/ms.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1797,10 +1797,16 @@ const message = {
17971797
'Pulangkan semula pemulihan ini akan menggantikan semua fail dari pemulihan ini, dan mungkin memerlukan mulakan semula perkhidmatan Docker dan 1Panel. Adakah anda mahu meneruskan?',
17981798

17991799
upgradeHelper: 'Kemas kini memerlukan mulakan semula perkhidmatan 1Panel. Adakah anda mahu meneruskan?',
1800+
rollbackLocalHelper:
1801+
'Nod utama tidak menyokong rollback secara langsung. Sila laksanakan arahan [1pctl restore] secara manual untuk rollback!',
18001802
noUpgrade: 'Ia adalah versi terbaru pada masa ini',
18011803
upgradeNotes: 'Nota pelepasan',
18021804
upgradeNow: 'Kemas kini sekarang',
18031805
source: 'Sumber muat turun',
1806+
versionNotSame:
1807+
'Versi nod ini tidak sepadan dengan nod utama. Penukaran tidak disokong buat masa ini. Sila periksa dan cuba lagi!',
1808+
versionCompare:
1809+
'Nod {0} telah berada pada versi terkini yang boleh dinaik taraf. Sila periksa versi nod utama dan cuba lagi!',
18041810

18051811
about: 'Mengenai',
18061812
project: 'GitHub',

frontend/src/lang/modules/pt-br.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1782,10 +1782,16 @@ const message = {
17821782
'Reverter essa recuperação substituirá todos os arquivos dessa recuperação e pode exigir reiniciar os serviços Docker e 1Panel. Você deseja continuar?',
17831783

17841784
upgradeHelper: 'A atualização requer reiniciar o serviço 1Panel. Você deseja continuar?',
1785+
rollbackLocalHelper:
1786+
'O nó principal não suporta rollback direto. Por favor, execute manualmente o comando [1pctl restore] para fazer o rollback!',
17851787
noUpgrade: 'Esta é a versão mais recente',
17861788
upgradeNotes: 'Notas de versão',
17871789
upgradeNow: 'Atualizar agora',
17881790
source: 'Fonte para download',
1791+
versionNotSame:
1792+
'A versão deste nó não corresponde ao nó principal. A troca não é suportada no momento. Por favor, verifique e tente novamente!',
1793+
versionCompare:
1794+
'Detectado que o nó {0} já está na última versão atualizável. Por favor, verifique a versão do nó principal e tente novamente!',
17891795

17901796
about: 'Sobre',
17911797
project: 'GitHub',

0 commit comments

Comments
 (0)