mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-10-09 08:00:27 +00:00
Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
884a169a6f | ||
|
|
e79a5f9ae2 | ||
|
|
25608e7378 | ||
|
|
dad8bac715 | ||
|
|
a4ee16cf1f | ||
|
|
7f7465b383 | ||
|
|
b7c3dc0d2a | ||
|
|
bb02991b05 |
@@ -701,7 +701,7 @@ func (u *ContainerService) ContainerLogs(wsConn *websocket.Conn, containerType,
|
||||
return
|
||||
}
|
||||
global.LOG.Errorf("read bytes from log failed, err: %v", err)
|
||||
continue
|
||||
return
|
||||
}
|
||||
if !utf8.Valid(buffer[:n]) {
|
||||
continue
|
||||
|
||||
@@ -133,7 +133,7 @@ func (f *FileService) Create(op request.FileCreate) error {
|
||||
}
|
||||
}
|
||||
if op.IsDir {
|
||||
return fo.CreateDir(op.Path, fs.FileMode(mode))
|
||||
return fo.CreateDirWithMode(op.Path, fs.FileMode(mode))
|
||||
}
|
||||
if op.IsLink {
|
||||
if !fo.Stat(op.LinkPath) {
|
||||
|
||||
@@ -1954,7 +1954,7 @@ func (w WebsiteService) UpdateAntiLeech(req request.NginxAntiLeechUpdate) (err e
|
||||
Parameters: []string{"off"},
|
||||
})
|
||||
validDir := &components.Directive{
|
||||
Name: "valid_referrers",
|
||||
Name: "valid_referers",
|
||||
Parameters: []string{},
|
||||
}
|
||||
if req.NoneRef {
|
||||
@@ -2023,7 +2023,7 @@ func (w WebsiteService) GetAntiLeech(id uint) (*response.NginxAntiLeechRes, erro
|
||||
}
|
||||
lDirectives := location.GetBlock().GetDirectives()
|
||||
for _, lDir := range lDirectives {
|
||||
if lDir.GetName() == "valid_referrers" {
|
||||
if lDir.GetName() == "valid_referers" {
|
||||
res.Enable = true
|
||||
params := lDir.GetParameters()
|
||||
for _, param := range params {
|
||||
|
||||
@@ -74,8 +74,10 @@ var NewMonitorDB = &gormigrate.Migration{
|
||||
} else {
|
||||
itemData = bases[200*i:]
|
||||
}
|
||||
if err := global.MonitorDB.Create(&itemData).Error; err != nil {
|
||||
return err
|
||||
if len(itemData) != 0 {
|
||||
if err := global.MonitorDB.Create(&itemData).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -87,8 +89,10 @@ var NewMonitorDB = &gormigrate.Migration{
|
||||
} else {
|
||||
itemData = ios[200*i:]
|
||||
}
|
||||
if err := global.MonitorDB.Create(&itemData).Error; err != nil {
|
||||
return err
|
||||
if len(itemData) != 0 {
|
||||
if err := global.MonitorDB.Create(&itemData).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -100,8 +104,10 @@ var NewMonitorDB = &gormigrate.Migration{
|
||||
} else {
|
||||
itemData = networks[200*i:]
|
||||
}
|
||||
if err := global.MonitorDB.Create(&itemData).Error; err != nil {
|
||||
return err
|
||||
if len(itemData) != 0 {
|
||||
if err := global.MonitorDB.Create(&itemData).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ func CheckIllegal(args ...string) bool {
|
||||
if strings.Contains(arg, "&") || strings.Contains(arg, "|") || strings.Contains(arg, ";") ||
|
||||
strings.Contains(arg, "$") || strings.Contains(arg, "'") || strings.Contains(arg, "`") ||
|
||||
strings.Contains(arg, "(") || strings.Contains(arg, ")") || strings.Contains(arg, "\"") ||
|
||||
strings.Contains(arg, "\n") || strings.Contains(arg, "\r") || strings.Contains(arg, ">") {
|
||||
strings.Contains(arg, "\n") || strings.Contains(arg, "\r") || strings.Contains(arg, ">") || strings.Contains(arg, "<") {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,17 +54,14 @@ func (f FileOp) GetContent(dst string) ([]byte, error) {
|
||||
}
|
||||
|
||||
func (f FileOp) CreateDir(dst string, mode fs.FileMode) error {
|
||||
return f.Fs.MkdirAll(dst, mode)
|
||||
}
|
||||
|
||||
func (f FileOp) CreateDirWithMode(dst string, mode fs.FileMode) error {
|
||||
if err := f.Fs.MkdirAll(dst, mode); err != nil {
|
||||
return err
|
||||
}
|
||||
modStr := fmt.Sprintf("%o", mode)
|
||||
|
||||
modeInt, err := strconv.ParseInt(modStr, 10, 64)
|
||||
if err != nil {
|
||||
modeInt = 0755
|
||||
}
|
||||
|
||||
return f.ChmodR(dst, modeInt, true)
|
||||
return f.ChmodRWithMode(dst, mode, true)
|
||||
}
|
||||
|
||||
func (f FileOp) CreateFile(dst string) error {
|
||||
@@ -193,6 +190,23 @@ func (f FileOp) ChmodR(dst string, mode int64, sub bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f FileOp) ChmodRWithMode(dst string, mode fs.FileMode, sub bool) error {
|
||||
cmdStr := fmt.Sprintf(`chmod %v "%s"`, fmt.Sprintf("%o", mode.Perm()), dst)
|
||||
if sub {
|
||||
cmdStr = fmt.Sprintf(`chmod -R %v "%s"`, fmt.Sprintf("%o", mode.Perm()), dst)
|
||||
}
|
||||
if cmd.HasNoPasswordSudo() {
|
||||
cmdStr = fmt.Sprintf("sudo %s", cmdStr)
|
||||
}
|
||||
if msg, err := cmd.ExecWithTimeOut(cmdStr, 10*time.Second); err != nil {
|
||||
if msg != "" {
|
||||
return errors.New(msg)
|
||||
}
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f FileOp) Rename(oldName string, newName string) error {
|
||||
return f.Fs.Rename(oldName, newName)
|
||||
}
|
||||
|
||||
@@ -151,4 +151,8 @@ export namespace Setting {
|
||||
trial: boolean;
|
||||
status: string;
|
||||
}
|
||||
export interface LicenseStatus {
|
||||
productPro: string;
|
||||
status: string;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,9 @@ export const UploadFileData = (params: FormData) => {
|
||||
export const getLicense = () => {
|
||||
return http.get<Setting.License>(`/licenses/get`);
|
||||
};
|
||||
export const getLicenseStatus = () => {
|
||||
return http.get<Setting.LicenseStatus>(`/licenses/get/status`);
|
||||
};
|
||||
|
||||
export const syncLicense = () => {
|
||||
return http.post(`/licenses/sync`);
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
<script lang="ts" setup>
|
||||
import i18n from '@/lang';
|
||||
import { dateFormatForName, downloadWithContent } from '@/utils/util';
|
||||
import { computed, reactive, ref, shallowRef, watch } from 'vue';
|
||||
import { computed, onBeforeUnmount, reactive, ref, shallowRef, watch } from 'vue';
|
||||
import { Codemirror } from 'vue-codemirror';
|
||||
import { javascript } from '@codemirror/lang-javascript';
|
||||
import { oneDark } from '@codemirror/theme-one-dark';
|
||||
@@ -128,6 +128,7 @@ const searchLogs = async () => {
|
||||
MsgError(i18n.global.t('container.linesHelper'));
|
||||
return;
|
||||
}
|
||||
terminalSocket.value?.send('close conn');
|
||||
terminalSocket.value?.close();
|
||||
logInfo.value = '';
|
||||
const href = window.location.href;
|
||||
@@ -180,6 +181,10 @@ const acceptParams = (props: DialogProps): void => {
|
||||
}
|
||||
};
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
handleClose();
|
||||
});
|
||||
|
||||
defineExpose({
|
||||
acceptParams,
|
||||
});
|
||||
|
||||
@@ -102,6 +102,7 @@ const searchLogs = async () => {
|
||||
MsgError(i18n.global.t('container.linesHelper'));
|
||||
return;
|
||||
}
|
||||
terminalSocket.value?.send('close conn');
|
||||
terminalSocket.value?.close();
|
||||
logInfo.value = '';
|
||||
const href = window.location.href;
|
||||
|
||||
@@ -1350,7 +1350,7 @@ const message = {
|
||||
showEntrance: 'Enable Home Page Notification Not Enabled',
|
||||
entranceHelper: 'Enabling secure entry will only allow logging in to the panel through specified secure entry.',
|
||||
entranceError:
|
||||
'Please enter a secure login entry point of 6-10 characters, only numbers or letters are supported.',
|
||||
'Please enter a secure login entry point of 5-116 characters, only numbers or letters are supported.',
|
||||
entranceInputHelper: 'When the security entry is set to blank, the security entry is cancelled.',
|
||||
randomGenerate: 'Random',
|
||||
expirationTime: 'Expiration Time',
|
||||
|
||||
@@ -1311,7 +1311,7 @@ const message = {
|
||||
entrance: '安全入口',
|
||||
showEntrance: '啟用概覽頁未開啟提醒',
|
||||
entranceHelper: '開啟安全入口後只能通過指定安全入口登錄面板',
|
||||
entranceError: '請輸入 6-10 位安全登錄入口,僅支持輸入數字或字母',
|
||||
entranceError: '請輸入 5-116 位安全登錄入口,僅支持輸入數字或字母',
|
||||
entranceInputHelper: '安全入口設置為空時,則取消安全入口',
|
||||
randomGenerate: '隨機生成',
|
||||
expirationTime: '密碼過期時間',
|
||||
|
||||
@@ -1312,7 +1312,7 @@ const message = {
|
||||
entrance: '安全入口',
|
||||
showEntrance: '启用概览页未开启提醒',
|
||||
entranceHelper: '开启安全入口后只能通过指定安全入口登录面板',
|
||||
entranceError: '请输入 6-10 位安全登录入口,仅支持输入数字或字母',
|
||||
entranceError: '请输入 5-116 位安全登录入口,仅支持输入数字或字母',
|
||||
entranceInputHelper: '安全入口设置为空时,则取消安全入口',
|
||||
randomGenerate: '随机生成',
|
||||
expirationTime: '密码过期时间',
|
||||
|
||||
@@ -22,7 +22,7 @@ import { GlobalStore, MenuStore, TabsStore } from '@/store';
|
||||
import { DeviceType } from '@/enums/app';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useTheme } from '@/hooks/use-theme';
|
||||
import { getLicense, getSettingInfo, getSystemAvailable } from '@/api/modules/setting';
|
||||
import { getLicenseStatus, getSettingInfo, getSystemAvailable } from '@/api/modules/setting';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { initFavicon, resetXSetting } from '@/utils/xpack';
|
||||
useResize();
|
||||
@@ -109,7 +109,7 @@ const loadDataFromXDB = async () => {
|
||||
};
|
||||
|
||||
const loadProductProFromDB = async () => {
|
||||
const res = await getLicense();
|
||||
const res = await getLicenseStatus();
|
||||
if (!res.data) {
|
||||
globalStore.isProductPro = false;
|
||||
return;
|
||||
|
||||
@@ -157,7 +157,7 @@ import { GlobalStore, MenuStore, TabsStore } from '@/store';
|
||||
import i18n from '@/lang';
|
||||
import { MsgSuccess } from '@/utils/message';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { getLicense } from '@/api/modules/setting';
|
||||
import { getLicenseStatus } from '@/api/modules/setting';
|
||||
import { initFavicon } from '@/utils/xpack';
|
||||
|
||||
const globalStore = GlobalStore();
|
||||
@@ -327,7 +327,7 @@ const loadLanguage = async () => {
|
||||
};
|
||||
|
||||
const loadProductProFromDB = async () => {
|
||||
const res = await getLicense();
|
||||
const res = await getLicenseStatus();
|
||||
if (!res.data) {
|
||||
globalStore.isProductPro = false;
|
||||
return;
|
||||
|
||||
@@ -72,7 +72,7 @@ const rules = reactive({
|
||||
|
||||
function checkSecurityEntrance(rule: any, value: any, callback: any) {
|
||||
if (form.securityEntrance !== '') {
|
||||
const reg = /^[A-Za-z0-9]{6,10}$/;
|
||||
const reg = /^[A-Za-z0-9]{5,116}$/;
|
||||
if (!reg.test(form.securityEntrance)) {
|
||||
return callback(new Error(i18n.global.t('setting.entranceError')));
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ require (
|
||||
github.com/dgraph-io/badger/v4 v4.2.0
|
||||
github.com/docker/cli v26.0.0+incompatible
|
||||
github.com/docker/compose/v2 v2.26.1
|
||||
github.com/docker/docker v26.0.0+incompatible
|
||||
github.com/docker/docker v26.0.2+incompatible
|
||||
github.com/docker/go-connections v0.5.0
|
||||
github.com/fsnotify/fsnotify v1.7.0
|
||||
github.com/gin-contrib/gzip v0.0.6
|
||||
|
||||
@@ -219,8 +219,8 @@ github.com/docker/compose/v2 v2.26.1/go.mod h1:5iVCMlr18ab0NlMxIPdtTgThTkzb34Z/z
|
||||
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
||||
github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk=
|
||||
github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
||||
github.com/docker/docker v26.0.0+incompatible h1:Ng2qi+gdKADUa/VM+6b6YaY2nlZhk/lVJiKR/2bMudU=
|
||||
github.com/docker/docker v26.0.0+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||
github.com/docker/docker v26.0.2+incompatible h1:yGVmKUFGgcxA6PXWAokO0sQL22BrQ67cgVjko8tGdXE=
|
||||
github.com/docker/docker v26.0.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||
github.com/docker/docker-credential-helpers v0.8.1 h1:j/eKUktUltBtMzKqmfLB0PAgqYyMHOp5vfsD1807oKo=
|
||||
github.com/docker/docker-credential-helpers v0.8.1/go.mod h1:P3ci7E3lwkZg6XiHdRKft1KckHiO9a2rNtyFbZ/ry9M=
|
||||
github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c h1:lzqkGL9b3znc+ZUgi7FlLnqjQhcXxkNM/quxIjBVMD0=
|
||||
|
||||
Reference in New Issue
Block a user