feat: Offline version supports creating PHP (#10585)

This commit is contained in:
CityFun 2025-10-09 14:51:24 +08:00 committed by GitHub
parent e7b1aadb0e
commit f977a2488d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 24 additions and 23 deletions

View file

@ -32,19 +32,20 @@ type SystemDir struct {
TmpDir string TmpDir string
LocalBackupDir string LocalBackupDir string
AppDir string AppDir string
ResourceDir string ResourceDir string
AppResourceDir string AppResourceDir string
AppInstallDir string AppInstallDir string
LocalAppResourceDir string LocalAppResourceDir string
LocalAppInstallDir string LocalAppInstallDir string
RemoteAppResourceDir string RemoteAppResourceDir string
CustomAppResourceDir string CustomAppResourceDir string
RuntimeDir string OfflineAppResourceDir string
RecycleBinDir string RuntimeDir string
SSLLogDir string RecycleBinDir string
McpDir string SSLLogDir string
ConvertLogDir string McpDir string
ConvertLogDir string
} }
type LogConfig struct { type LogConfig struct {

View file

@ -27,6 +27,7 @@ func Init() {
global.Dir.LocalAppInstallDir, _ = fileOp.CreateDirWithPath(true, path.Join(baseDir, "1panel/apps/local")) global.Dir.LocalAppInstallDir, _ = fileOp.CreateDirWithPath(true, path.Join(baseDir, "1panel/apps/local"))
global.Dir.RemoteAppResourceDir, _ = fileOp.CreateDirWithPath(true, path.Join(baseDir, "1panel/resource/apps/remote")) global.Dir.RemoteAppResourceDir, _ = fileOp.CreateDirWithPath(true, path.Join(baseDir, "1panel/resource/apps/remote"))
global.Dir.CustomAppResourceDir, _ = fileOp.CreateDirWithPath(true, path.Join(baseDir, "1panel/resource/apps/custom")) global.Dir.CustomAppResourceDir, _ = fileOp.CreateDirWithPath(true, path.Join(baseDir, "1panel/resource/apps/custom"))
global.Dir.OfflineAppResourceDir, _ = fileOp.CreateDirWithPath(true, path.Join(baseDir, "1panel/resource/offline"))
global.Dir.RuntimeDir, _ = fileOp.CreateDirWithPath(true, path.Join(baseDir, "1panel/runtime")) global.Dir.RuntimeDir, _ = fileOp.CreateDirWithPath(true, path.Join(baseDir, "1panel/runtime"))
global.Dir.RecycleBinDir, _ = fileOp.CreateDirWithPath(true, "/.1panel_clash") global.Dir.RecycleBinDir, _ = fileOp.CreateDirWithPath(true, "/.1panel_clash")
global.Dir.SSLLogDir, _ = fileOp.CreateDirWithPath(true, path.Join(baseDir, "1panel/log/ssl")) global.Dir.SSLLogDir, _ = fileOp.CreateDirWithPath(true, path.Join(baseDir, "1panel/log/ssl"))

View file

@ -24,7 +24,7 @@
v-model="runtime.resource" v-model="runtime.resource"
@change="changeResource(runtime.resource)" @change="changeResource(runtime.resource)"
> >
<el-radio :value="'appstore'"> <el-radio :value="'appstore'" v-if="!globalStore.isOffLine">
{{ $t('menu.apps') }} {{ $t('menu.apps') }}
</el-radio> </el-radio>
<el-radio :value="'local'"> <el-radio :value="'local'">
@ -195,9 +195,9 @@ import i18n from '@/lang';
import { MsgSuccess } from '@/utils/message'; import { MsgSuccess } from '@/utils/message';
import { FormInstance } from 'element-plus'; import { FormInstance } from 'element-plus';
import { reactive, ref } from 'vue'; import { reactive, ref } from 'vue';
import { GlobalStore } from '@/store';
import { getLabel } from '@/utils/util'; import { getLabel } from '@/utils/util';
const globalStore = GlobalStore(); import { useGlobalStore } from '@/composables/useGlobalStore';
const { globalStore } = useGlobalStore();
interface OperateRrops { interface OperateRrops {
id?: number; id?: number;
@ -472,7 +472,11 @@ const acceptParams = async (props: OperateRrops) => {
initParam.value = false; initParam.value = false;
if (props.mode === 'create') { if (props.mode === 'create') {
Object.assign(runtime, initData(props.type)); Object.assign(runtime, initData(props.type));
searchAppList(null); if (globalStore.isOffLine) {
runtime.resource = 'local';
} else {
searchAppList(null);
}
} else { } else {
searchAppList(props.appID); searchAppList(props.appID);
getRuntime(props.id); getRuntime(props.id);

View file

@ -153,9 +153,8 @@ import { disabledButton } from '@/utils/runtime';
import DockerStatus from '@/views/container/docker-status/index.vue'; import DockerStatus from '@/views/container/docker-status/index.vue';
import { operateRuntime, updateRuntimeRemark } from '../common/utils'; import { operateRuntime, updateRuntimeRemark } from '../common/utils';
import { routerToFileWithPath } from '@/utils/router'; import { routerToFileWithPath } from '@/utils/router';
import { MsgWarning } from '@/utils/message';
import { useGlobalStore } from '@/composables/useGlobalStore'; import { useGlobalStore } from '@/composables/useGlobalStore';
const { globalStore, isOffLine } = useGlobalStore(); const { globalStore } = useGlobalStore();
const mobile = computed(() => { const mobile = computed(() => {
return globalStore.isMobile(); return globalStore.isMobile();
@ -286,10 +285,6 @@ const search = async () => {
}; };
const openCreate = () => { const openCreate = () => {
if (isOffLine.value) {
MsgWarning(i18n.global.t('commons.msg.offlineTips'));
return;
}
createRef.value.acceptParams({ type: 'php', mode: 'create' }); createRef.value.acceptParams({ type: 'php', mode: 'create' });
}; };